UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

912 lines (911 loc) 32.1 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { AnnotationLayerView } from "./AnnotationLayerView"; import { Base, Point_$type, markType, runOn, delegateRemove, delegateCombine, typeCast, fromEnum, markDep } from "igniteui-angular-core"; import { ImageLoader } from "igniteui-angular-core"; import { PointerTooltip } from "./PointerTooltip"; import { TextBlock } from "igniteui-angular-core"; import { Rectangle } from "igniteui-angular-core"; import { AnnotationBadge } from "./AnnotationBadge"; import { Series } from "./Series"; import { DataContext } from "igniteui-angular-core"; import { CalloutView } from "./CalloutView"; import { Size } from "igniteui-angular-core"; import { Thickness } from "igniteui-angular-core"; import { Rect } from "igniteui-angular-core"; import { AxisAnnotationManager } from "./AxisAnnotationManager"; import { PointerTooltipStyle } from "./PointerTooltipStyle"; import { PointerTooltipUtils } from "./PointerTooltipUtils"; import { BrushUtil } from "igniteui-angular-core"; import { stringIsNullOrEmpty, stringContains, stringReplace } from "igniteui-angular-core"; import { tryParseNumber, isNaN_ } from "igniteui-angular-core"; import { AnnotationLayer } from "./AnnotationLayer"; import { DependencyProperty } from "igniteui-angular-core"; import { UserAnnotationTooltipLayerFrame } from "./UserAnnotationTooltipLayerFrame"; import { UserAnnotationToolTipContentUpdatingEventArgs } from "./UserAnnotationToolTipContentUpdatingEventArgs"; import { UserAnnotationLayer } from "./UserAnnotationLayer"; import { Tuple$2 } from "igniteui-angular-core"; import { CalloutAnnotationWrapper } from "./CalloutAnnotationWrapper"; import { CalloutLayer } from "./CalloutLayer"; import { PropertyMetadata } from "igniteui-angular-core"; /** * @hidden */ export let UserAnnotationToolTipLayerView = /*@__PURE__*/ (() => { class UserAnnotationToolTipLayerView extends AnnotationLayerView { constructor(a) { super(a); this.cp = null; this.cq = null; this.co = null; this.c3 = new TextBlock(); this.c5 = new Rectangle(); this.cn = null; this.c7 = null; this.cr = false; this._htmlTest = null; this.cp = a; } a4() { super.a4(); this.cq = new ImageLoader(); this.cn = new AnnotationBadge(this.cq); this.htmlTest = /^[^<]*(<[\w\W]+>)[^>]*$/; } as() { super.as(); let a = this.co; a.content = null; this.co = null; } get htmlTest() { return this._htmlTest; } set htmlTest(a) { this._htmlTest = a; } cu(a, b, c, d, e, f) { let g = c; if (b.lb == "default") { b.lb = b.cw.getDefaultTooltipTemplate(); } let template_ = b.lb; let context_ = d; if (b.toolTip == null) { return false; } let tooltip_ = b.toolTip; if ((tooltip_.updateToolTip)) { tooltip_._inPointer = true; tooltip_.updateToolTip(context_, true); tooltip_.setStyleProperty('position', 'relative'); tooltip_.setStyleProperty('left', ''); tooltip_.setStyleProperty('top', ''); } g.content = b.toolTip; let h = b.toolTip; e.t = 0; e.j = false; h.setStyleProperty("pointer-events", "auto"); g.an.n.setStyleProperty("pointer-events", "auto"); this.c7 = new Thickness(1, 0, 0, 0, 0); let i = h.findByClass("ui-tooltip-container"); if (i.length != 0) { this.cr = true; } if (i.length == 0) { i = h.findByClass("ig-tooltip-container"); } if (i.length == 0) { i = h.findByClass("ig-tooltip-container-background"); } for (let k = 0; k < i.length; k++) { let j = i[k]; j.setStyleProperty("pointer-events", "auto"); j.setStyleProperty("border-radius", e.s + "px"); let l = window.getComputedStyle(j.getNativeElement()); this.c7.top = stringIsNullOrEmpty(l.paddingTop) ? 5 : UserAnnotationToolTipLayerView.cs(l.paddingTop); this.c7.right = stringIsNullOrEmpty(l.paddingRight) ? 5 : UserAnnotationToolTipLayerView.cs(l.paddingRight); this.c7.bottom = stringIsNullOrEmpty(l.paddingBottom) ? 5 : UserAnnotationToolTipLayerView.cs(l.paddingBottom); this.c7.left = stringIsNullOrEmpty(l.paddingLeft) ? 5 : UserAnnotationToolTipLayerView.cs(l.paddingLeft); } let m = h.findByClass("ui-chart-user-annotation-tooltip-main-content"); let n = h.findByClass("ui-chart-user-annotation-tooltip-template-content"); if (m.length > 0) { let o = m[0]; if (e != null) { o.setStyleProperty("height", e.aw().height + "px"); o.setStyleProperty("width", e.aw().width + "px"); e.u = this.c7.left; e.v = this.c7.top; let p = g.an.b; let q = this.co.an.l(); if (q > 0) { p.aa(); p.ab(q, q); } p.aa(); p.af(f); e.ae(p); p.z(); if (q > 0) { p.z(); } } } if (n.length != 1) { return null; } let r = n[0].getNativeElement(); h.setStyleProperty("background", "transparent"); return r; } ct(a, b, c, d, e, f, g, h, i, j) { let k = b; if (a.lb == "default") { a.lb = a.cw.getDefaultTooltipTemplate(); } let template_ = a.lb; let context_ = c; if (a.toolTip == null) { return false; } let tooltip_ = a.toolTip; if ((tooltip_.updateToolTip)) { tooltip_._inPointer = true; tooltip_.updateToolTip(context_, true); tooltip_.setStyleProperty('position', 'relative'); tooltip_.setStyleProperty('left', ''); tooltip_.setStyleProperty('top', ''); } k.content = a.toolTip; let l = a.toolTip; l.setStyleProperty("pointer-events", "auto"); let m = l.findByClass("ui-tooltip-container"); if (m.length != 0) { this.cr = true; } if (m.length == 0) { m = l.findByClass("ig-tooltip-container"); } if (m.length == 0) { m = l.findByClass("ig-tooltip-container-background"); } this.c7 = new Thickness(1, 0, 0, 0, 0); let n = this.cp.ab0(); let o = n.ap; for (let q = 0; q < m.length; q++) { let p = m[q]; p.setStyleProperty("pointer-events", "auto"); p.setStyleProperty("border-radius", o + "px"); let r = window.getComputedStyle(p.getNativeElement()); this.c7.top = stringIsNullOrEmpty(r.paddingTop) ? 5 : UserAnnotationToolTipLayerView.cs(r.paddingTop); this.c7.right = stringIsNullOrEmpty(r.paddingRight) ? 5 : UserAnnotationToolTipLayerView.cs(r.paddingRight); this.c7.bottom = stringIsNullOrEmpty(r.paddingBottom) ? 5 : UserAnnotationToolTipLayerView.cs(r.paddingBottom); this.c7.left = stringIsNullOrEmpty(r.paddingLeft) ? 5 : UserAnnotationToolTipLayerView.cs(r.paddingLeft); } let s = l.findByClass("ui-chart-user-annotation-tooltip-main-content"); let t = l.findByClass("ui-chart-user-annotation-tooltip-template-content"); if (s.length > 0) { let u = s[0]; let v = k.an.b; this.c5._visibility = 0; this.c5.n = 0; this.c5.o = 0; this.c3.dataContext = d.b5(); this.c3._visibility = e._visibility; AxisAnnotationManager.f(j, this.c3); let w = d.a1.ag.q(); let x = d.a1.ag.s(); let y = d.a1.ag.r(); let z = d.a1.ag.p(); this.cn._visibility = f._visibility; let aa = this.c3.al != null && this.c3.al.length > 0; AxisAnnotationManager.e(j, this.cn, aa); this.cn.n = 0; this.cn.o = 0; let ab = this.cn.a7(); let ac = d.a1.ag.ax(this.c3); let ad = Math.max(h.width, ac.width); d.a1.ag.z(this.c3, new Rect(0, ab.width, 0, ad, h.height), 0, 0, 0, 0); this.c3.ao = e.ao; AxisAnnotationManager.g(this.c5, this.c3, this.cn, 102); if (g.i == null) { g.i = new Thickness(1, 0, 0, 0, 0); } d.a1.ag.av(this.c5, this.c3, this.cn, g, new Rect(0, 0, 0, h.width, h.height), w, x, y, z); let ae = this.co.an.l(); if (ae > 0) { v.aa(); v.ab(ae, ae); } v.aa(); v.ai(this.c7.left, this.c7.top); v.w(this.c5); v.af(this.c3.dataContext); v.x(this.c3); this.cn.ag.d(v); v.z(); if (ae > 0) { v.z(); } let af = Math.max(this.c3.l, this.cn.l); u.setStyleProperty("height", af + "px"); if (j.isBadgeEnabled) { u.setStyleProperty("width", this.cn.m + this.cn.bb.right + this.c3.m + "px"); } else { u.setStyleProperty("width", this.c3.m + "px"); } } if (t.length != 1) { return null; } let ag = t[0].getNativeElement(); l.setStyleProperty("background", "transparent"); return ag; } c6(a, b, c, d) { let e = a; let f = e.content; let g = new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY); e.a5 = 0; e.a4 = 1.7976931348623157E+308; if (c != null) { let h = c.badgeSize; let i = c.badgeMargin; let j = this.c3.m; e.a5 = h + 2 * i + j + this.c7.left + this.c7.right; } else if (d != null) { let k = d.aw(); e.a5 = k.width + this.c7.left + this.c7.right; } if (this.cr) { let l = e.an.ab(g); e.a4 = l.height - 12; } let m = e.c1(new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)); return m; } c1(a, b, c, d, e, f) { let g = new PointerTooltipStyle(); if (this.f.dc != null) { let h = this.f.dc.dw.j.i(); if (d != null) { PointerTooltipUtils.a(h, g, d.am, d.ao, d.t, d.s); } else { let i = e.outline == null ? BrushUtil.j(0, 0, 0, 0) : e.outline; let j = this.cp.ab0(); PointerTooltipUtils.a(h, g, e.background, i, e.strokeThickness, j.ap); } } let k = a; k.aq = g; let l = k.content; k.cw = { $type: Point_$type, x: 0, y: 0 }; k._visibility = 0; if (e == null) { k.n = b - this.c7.left; k.o = c - this.c7.top; } else { if (e.isBadgeEnabled) { k.n = b; } else { k.n = b; } k.o = c; } } cv() { if (this.co == null) { let a = new PointerTooltip(); a.b0(this.f.j8); a.c2 = 1; this.co = a; } return this.co; } cz(a) { if (a != null) { let b = a; b._visibility = 1; } } bj(a, b) { super.bj(a, b); if (b) { return; } let c = 0; let d = 0; let e = this.f.dc; if (e != null) { let f = e.dw.j.b8(); c += f.x; d += f.y; } if (this.co == null) { return; } this.co.b2(this.co.n + c, this.co.o + d); let g = this.co.content; if (g == null) { return; } let h = g.findByClass("ui-chart-user-annotation-tooltip-main-content"); let i = g.findByClass("ui-chart-user-annotation-tooltip-template-content"); if (i.length == 1) { this.cp.abk(i[0].getNativeElement()); let j = this.cp.aa0(); let k = this.co.an.b; if (j != null) { j.u = this.c7.left; j.v = this.c7.top; let l = this.co.an.l(); if (l > 0) { k.aa(); k.ab(l, l); } k.aa(); k.af(this.cp.aa8()); j.ae(k); k.z(); if (l > 0) { k.z(); } } else { let m = this.cp.aax(); let n = this.cp.aav(); this.cn.n = 0; this.cn.o = 0; this.c5.n = 0; this.c5.o = 0; let o = this.co.an.l(); if (o > 0) { k.aa(); k.ab(o, o); } k.aa(); k.ai(this.c7.left, this.c7.top); k.w(this.c5); k.af(this.c3.dataContext); k.x(this.c3); this.cn.ag.d(k); k.z(); if (o > 0) { k.z(); } } } } c0(a) { this.a2(); this.cz(this.co); if (a) { this.co.bw(); } } c2() { if (this.f.dc == null) { this.c0(true); } } cx() { if (this.co == null) { let a = new PointerTooltip(); a.b0(this.f.j8); a.c2 = 1; this.co = a; } } cy() { if (this.co == null) { return; } this.co._visibility = 1; } c4(a) { return a; } static cs(a) { if (stringContains(a, "px")) { a = stringReplace(a, "px", ""); } let b = 0; let c = tryParseNumber(a, b); b = c.p1; return b; } } UserAnnotationToolTipLayerView.$t = markType(UserAnnotationToolTipLayerView, 'UserAnnotationToolTipLayerView', AnnotationLayerView.$); return UserAnnotationToolTipLayerView; })(); /** * @hidden */ export let UserAnnotationToolTipLayer = /*@__PURE__*/ (() => { class UserAnnotationToolTipLayer extends AnnotationLayer { constructor() { super(); this.abw = null; this.abx = null; this.aas = null; this.abu = null; this.aby = null; this.aau = null; this.aay = 0; this.aba = false; this.abq = null; this.aat = null; this.aa1 = null; this.abz = null; this.aaw = null; this.aa9 = false; this.abv = null; this.aa3 = null; this.aaz = null; this.aa7 = null; this.ab1 = null; this.abf = null; this.aa4 = null; this.abb = false; this.contentUpdating = null; let a = new UserAnnotationTooltipLayerFrame(); let b = new UserAnnotationTooltipLayerFrame(); let c = new UserAnnotationTooltipLayerFrame(); let d = this.km / 1000; this.xw = a; this.xv = b; this.xx = c; this.ab = UserAnnotationToolTipLayer.$; } bk() { return new UserAnnotationToolTipLayer(); } get_eu() { return true; } ct() { return new UserAnnotationToolTipLayerView(this); } rg(a) { super.rg(a); this.aa6 = a; } g0(a) { if (this.aa2 == null) { return true; } if (this.aa2 == a) { return true; } return false; } rp(a, b, c, d) { super.rp(a, b, c, d); switch (b) { case UserAnnotationToolTipLayer.$$p[1]: case UserAnnotationToolTipLayer.$$p[2]: this.r7(true); break; case UserAnnotationToolTipLayer.$$p[0]: this.r7(true); break; case "SeriesViewer": this.abm(c, d); this.aa6.c2(); break; } } abm(a, b) { if (a != null) { a.axisPanelMouseOver = delegateRemove(a.axisPanelMouseOver, runOn(this, this.abo)); a.axisLabelMouseOver = delegateRemove(a.axisLabelMouseOver, runOn(this, this.abp)); a.axisLabelMouseLeave = delegateRemove(a.axisLabelMouseLeave, runOn(this, this.abn)); this.contentUpdating = delegateRemove(this.contentUpdating, runOn(a, a.rv)); } if (b != null) { b.axisPanelMouseOver = delegateCombine(b.axisPanelMouseOver, runOn(this, this.abo)); b.axisLabelMouseOver = delegateCombine(b.axisLabelMouseOver, runOn(this, this.abp)); b.axisLabelMouseLeave = delegateCombine(b.axisLabelMouseLeave, runOn(this, this.abn)); this.contentUpdating = delegateCombine(this.contentUpdating, runOn(b, b.rv)); } } abo(a, b) { this.abw = b.h; } abn(a, b) { } abp(a, b) { this.aba = false; if (b.a.at.count == 0) { return; } let c = b.a.a1.bg._inner[b.a.hj]; let d = b.a.cc; let e = -1; this.abq = null; for (let f = 0; f < d.a.count; f++) { let g = d.a._inner[f]; if (g == c) { e = f; this.abq = g; this.aat = b.a.cb.item(f); this.aa1 = b.a.eq._inner[f]; this.abz = b.a.ca.item(f); } } if (e == -1) { return; } this.aaw = b.a.at._inner[e]; if (this.aaw.ag == null) { return; } for (let h of fromEnum(this.dc.b9)) { let i = typeCast(UserAnnotationLayer.$, h); if (i == null) { continue; } if (Base.equalsStatic(i.yq, this.aaw.ag)) { this.aa4 = i; break; } } if (this.aa4 == null) { return; } this.abw = b.h; this.abx = b.a.a1.bd._inner[b.a.hj]; this.aas = b.a.b9.item(b.a.hi); this.aau = b.a; this.aby = b.a.bp.bi(); this.abu = b.a.bp.bf(); this.aay = b.a.a1.ai; this.aba = true; this.r7(true); } zd(a, b) { if (this.aa2 == null || this.aa2 == a) { if (!this.a1.c) { this.r7(b); } } } x3(a) { if (a == null) { return false; } if (!a.eq) { return false; } if (a.isValueOverlay) { return false; } if (a == this) { return false; } return a.hk(a.cw.b9, a.cw.ca, a.cw); } zf(a, b) { super.zf(a, b); let c = a; let d = this.abc; c.l = 0; c.m = null; c.k = 0; c.o = null; c.n = null; c.j = 0; c.i = 0; c.p = null; let e = this.aba && isNaN_(this.aap.x); let f = 0; this.aaz = null; if (this.abb) { } else if (e) { if (this.aba) { this.aaz = null; if (this.abd(c)) { f = 1; } } else { this.aa6.cz(this.aa6.cv()); return; } } else { this.aba = false; this.aaw = null; if (this.x3(this.aa2)) { if (this.abe(this.aa2, c, d, 0)) { f++; } } else { for (let g of fromEnum(this.dc.b9)) { if (this.x3(g)) { if (this.abe(g, c, d, f)) { f++; } } } } } if (f == 1) { this.aa6.cx(); } else if (f == 0) { this.aa9 = false; this.aba = false; this.aa6.cy(); } } abd(a) { this.aa3 = null; if (this.aaw == null) { return false; } if (!this.aaw.o) { return false; } let b; let c; b = { $type: Point_$type, x: this.aas.d, y: this.aas.e }; c = this.abw; if (isNaN_(b.x) || isNaN_(b.y)) { return false; } else { this.aa9 = true; this.abv = c; } this.aa7 = this.aau.b5(); let d = this.aaw.k; let e = d.j(); let f = e; let g = this.aa6.cv(); let h = null; h = new DataContext(); h.item = f; h.series = this.aa4; let i = this.aa6.ct(this.aa4, g, h, this.aau, this.abq, this.aat, this.aa1, this.abx, null, this.aaw); this.ab1 = new Thickness(1, this.aau.a1.ag.q(), this.aau.a1.ag.s(), this.aau.a1.ag.r(), this.aau.a1.ag.p()); this.abl(i, f); let j = this.aa6.c6(g, h, this.aaw, this.aaz); let k = this.cw.b9; let l = b; let m = l.x; let n = l.y; let o = l.x; let p = l.y; let q = l.x; let r = l.y; let s = this.vs; if (s == null) { s = this.vy; } let t = this.dc.yj(this.aap); let u = new Rect(0, b.x, b.y, j.width, j.height); if (!isNaN_(t.x) && !(u.containsPoint(t))) { return false; } this.aa3 = f; a.m = g; a.n = h; a.o = i; a.k = o; a.l = p; a.j = j.width; a.i = j.height; a.p = s; return true; } abe(a, b, c, d) { this.aa3 = null; let e; let f; let g = this.y8(a); if (!g.c && !this.aa9) { return false; } f = isNaN_(g.d.x) || this.aa9 ? this.abv : g.d; e = a.wv(f, false, c); if (isNaN_(e.x) || isNaN_(e.y)) { if (!this.aa9) { return false; } f = this.abv; e = a.wv(this.abv, false, c); if (isNaN_(e.x) || isNaN_(e.y)) { return false; } } else { this.aa9 = true; this.abv = f; } let h = typeCast(Tuple$2.$.specialize(CalloutAnnotationWrapper.$, CalloutView.$), a.kw(f)); let i = null; let j = null; if (h != null) { i = h.c; j = h.d; } if (i == null) { return false; } this.abf = i.b.bn; if (this.abf == null) { this.abf = i.b.text; } let k = a.mb; if (k == null) { return false; } let l = null; for (let m of fromEnum(this.dc.b9)) { let n = typeCast(UserAnnotationLayer.$, m); if (n == null) { continue; } if (Base.equalsStatic(n.yq, k)) { l = n; break; } } if (l == null) { return false; } this.aa4 = l; let o = i.b.n.b; let p = o.j(); let q = p; let r = i.c.p; let s = i.c.o; let t = i.c.k - r; let u = i.c.l - s; let v = this.w1({ $type: Point_$type, x: t, y: u }); let w = this.aa6.cv(); let x = null; x = new DataContext(); x.item = this.aa4; x.series = this.aa4; this.aaz = j.b(null); this.aaz.x = this.abf; this.aaz.u = 0; this.aaz.v = 0; let y = typeCast(CalloutLayer.$, a); this.aa7 = y.aa3.cq(); let z = this.aa6.cu(a, l, w, x, this.aaz, this.aa7); if (z == null) { z = a.toolTip; } else { this.abl(z, q); } let aa = this.aa6.c6(w, x, this.aaw, this.aaz); let ab = this.cw.b9; let ac = e; let ad = this.xc.top; let ae = this.xc.bottom; let af = this.xc.left; let ag = this.xc.right; ac = this.aa6.c4(e); let ah = ac.x; let ai = ac.y; let aj = ac.x; let ak = ac.y; let al = ac.x; let am = ac.y; let an = this.vs; if (an == null) { an = this.vy; } if (an == null) { an = a.vs; } let ao = this.wq(this.aap); let ap = new Rect(0, al, am, aa.width, aa.height); if (!isNaN_(ao.x) && !(ap.containsPoint(ao))) { return false; } this.aa3 = q; b.m = w; b.n = x; b.o = z; b.k = aj; b.l = ak; b.j = aa.width; b.i = aa.height; b.p = an; return true; } abk(a) { this.abl(a, this.aa3); } aa0() { return this.aaz; } abl(a, b) { if (this.contentUpdating == null) { return; } if (a == null || b == null) { return; } this.contentUpdating(this, ((() => { let $ret = new UserAnnotationToolTipContentUpdatingEventArgs(); $ret.content = a; $ret.annotationInfo = b; return $ret; })())); } qk() { this.aap = { $type: Point_$type, x: NaN, y: NaN }; this.r7(false); this.aa6.c0(false); } ql() { this.aap = { $type: Point_$type, x: NaN, y: NaN }; this.r7(false); this.aa6.c0(true); } zi(a, b) { super.zi(a, b); let c = a; if (isNaN_(c.k) || isNaN_(c.l) || c.o == null || c.n == null) { this.aa6.cz(this.aa6.cv()); return; } let d = c.k; let e = c.l; let f = c.j; let g = c.i; let h = c.m; let i = d; let j = e; if (h != null) { this.aa6.c1(h, i, j, this.aaz, this.aaw, this.ab1); } } gg() { return true; } get_ga() { return true; } get_f7() { return true; } gl(a) { return false; } aa8() { return this.aa7; } aax() { return this.aaw; } aav() { return this.aau; } ab0() { return this.abz; } } UserAnnotationToolTipLayer.$t = markType(UserAnnotationToolTipLayer, 'UserAnnotationToolTipLayer', AnnotationLayer.$); UserAnnotationToolTipLayer.$$p = markDep(DependencyProperty, PropertyMetadata, UserAnnotationToolTipLayer, 'raisePropertyChanged', ['SkipUnknownValues:abc:abr', [0, true], 'TargetSeriesName:abh:abs', [2, null], 'TargetSeries:aa2:abt', [Series.$, null]]); return UserAnnotationToolTipLayer; })();