UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

598 lines (597 loc) 18.5 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 { Base, markType, fromEnum, INotifyPropertyChanged_$type, PropertyChangedEventArgs, enumGetBox, runOn, delegateCombine, delegateRemove } from "igniteui-react-core"; import { SizeData } from "igniteui-react-core"; import { NativeUI } from "igniteui-react-core"; import { ControlDisplayDensity_$type } from "igniteui-react-core"; import { BaseControlTheme_$type } from "igniteui-react-core"; import { XButton } from "igniteui-react-inputs"; import { XIcon } from "igniteui-react-inputs"; import { XButtonGroup } from "igniteui-react-inputs"; import { stringIsNullOrEmpty } from "igniteui-react-core"; import { stringFormat } from "igniteui-react-core"; import { FontInfo } from "igniteui-react-core"; import { SRProvider } from "igniteui-react-core"; import { BrushUtil } from "igniteui-react-core"; /** * @hidden */ export let GridColumnOptionsViewBase = /*@__PURE__*/ (() => { class GridColumnOptionsViewBase extends Base { constructor() { super(...arguments); this.d = null; this.f = null; this.a = null; } get g() { return this.f; } get b() { return this.a; } get e() { return this.d; } c() { let a = this.f.outerWidth(); let b = this.f.outerHeight(); let c = new SizeData(a, b); return c; } k() { } m() { let a = this.g; if (null != a) { NativeUI.m(a, this.b.bo); NativeUI.q(a, this.b.br); } } l(a) { if (a == null) { this.d = null; this.f = null; this.k(); return; } this.d = a; let b = this.d.rootWrapper; this.h(b); } h(a) { this.f = a; this.k(); this.m(); } i(a) { this.a = a; } j() { } } GridColumnOptionsViewBase.$t = /*@__PURE__*/ markType(GridColumnOptionsViewBase, 'GridColumnOptionsViewBase'); return GridColumnOptionsViewBase; })(); /** * @hidden */ export let GridColumnOptionsUtilities = /*@__PURE__*/ (() => { class GridColumnOptionsUtilities extends Base { static d(a, b, c, d, e, f, g = false) { let h = a.createElement("label"); e = a.createElement("input"); e.setAttribute("type", "checkbox"); if (!stringIsNullOrEmpty(b)) { e.setAttribute("id", b); } if (!stringIsNullOrEmpty(d)) { e.setAttribute("AccessKey", d); } f = a.createElement("text"); f.setRawText(c); if (g) { h.append(f); h.append(e); } else { h.append(e); h.append(f); } return { ret: h, p4: e, p5: f }; } static e(a, b, c, d, e, f) { let g = a.createElement("label"); f = a.createElement("input"); f.setAttribute("name", c); f.setAttribute("type", "radio"); f.setAttribute("id", b); g.append(f); let h = a.createElement("text"); h.setRawText(d); f.setAttribute("AccessKey", e); g.append(h); return { ret: g, p5: f }; } static g(a, b, c, d, e, f, g, h, i, j = true, k = false) { let l; return { ret: ((() => { let m = GridColumnOptionsUtilities.f(a, b, c, 0, d, e, f, g, h, i, l, j, k); g = m.p7; h = m.p8; i = m.p9; l = m.p10; return m.ret; })()), p6: g, p7: h, p8: i }; } static f(a, b, c, d, e, f, g, h, i, j, k, l = true, m = false, n = true) { let o = b.createElement("div"); let p = b.getSubRenderer(o); h = new XButton(); h.provideContainer(p); let q = p.getExternal(h, p.rootWrapper, p.getExternal(a, null, null)); h.e = d; h.r = e; h.n = f; let r = null != c; k = null; if (r) { k = b.createElement("div"); k.setStyleProperty("display", "inline-block"); i = new XIcon(); let s = b.getSubRenderer(k); i.provideContainer(s); let t = s.getExternal(i, s.rootWrapper, s.getExternal(a, null, null)); i.svgPath = c; k.setStyleProperty("width", stringFormat("{0}px", g.width.toString())); k.setStyleProperty("height", stringFormat("{0}px", g.height.toString())); if (n) { if (l) { k.setStyleProperty("margin-right", "7px"); } else { k.setStyleProperty("margin-left", "7px"); } } } else { i = null; } j = p.createElement("label"); j.setStyleProperty("display", "inline-block"); j.setStyleProperty("margin", "0px"); let u = b.createElement("div"); u.setStyleProperty("display", "flex"); u.setStyleProperty("flex-direction", "row"); u.setStyleProperty("flex-wrap", "no-wrap"); u.setStyleProperty("align-items", "center"); if (l) { if (r) { u.append(k); } u.append(j); } else { u.append(j); if (r) { u.append(k); } } if (m) { u.setStyleProperty("justify-content", "space-between"); h.g6 = "1"; o.setStyleProperty("display", "flex"); o.setStyleProperty("flex-direction", "column"); o.setStyleProperty("align-items", "stretch"); h.f0 = "flex"; h.g4 = "column"; h.fb = "stretch"; } h.appendButtonContent(u); return { ret: o, p7: h, p8: i, p9: j, p10: k }; } static h(a, b, c, d, e, f, g) { let h = b.createElement("div"); let i = b.getSubRenderer(h); g = new XButtonGroup(); g.provideContainer(i); let j = i.getExternal(g, i.rootWrapper, i.getExternal(a, null, null)); g.t = e; g.p = f; g.i = 0; for (let k of fromEnum(c)) { g.buttons.add(k); } let l = h.getChildAt(0); for (let m of fromEnum(d)) { l.append(m); } return { ret: h, p6: g }; } static b(a) { let b = a.getNativeElement(); return b.checked; } static i(a, b) { let c = a.getNativeElement(); c.checked = b; } static a(a) { switch (a) { case 0: return 1; case 1: return 2; default: return 1; } } static c(a) { switch (a) { case 1: return 0; case 2: return 1; case 0: default: return 0; } } static j(a, b, c = "block") { let d = b ? c : "none"; a.setStyleProperty("display", d); } static l(a, b) { if (null != a) { a.n = b.i; a.r = b.p; a.aa = b.z; } } static k(a, b) { if (null != a) { a.p = b.i; a.t = b.p; } } } GridColumnOptionsUtilities.$t = /*@__PURE__*/ markType(GridColumnOptionsUtilities, 'GridColumnOptionsUtilities'); return GridColumnOptionsUtilities; })(); /** * @hidden */ export let GridColumnOptionsBase = /*@__PURE__*/ (() => { class GridColumnOptionsBase extends Base { constructor() { super(); this.d = null; this.propertyChanged = null; this.ac = null; this.ae = null; this.e = null; this.ah = null; this.aj = false; this.bm = GridColumnOptionsBase.bp; this.h = 0; this.g = 1; this.n = 0; this.l = 0; this.x = null; this.v = null; this.a = null; this.o = 0; this.m = 2; this.y = null; this.w = null; this.bn = GridColumnOptionsBase.bq; let a = this.f(); this.e = a; this.onViewInitialized(); a.i(this); } bc(a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.be(a, b, c); } get ad() { if (null == this.ac) { this.ac = new FontInfo(); this.ac.q = "Verdana"; this.ac.f = 12; } return this.ac; } get af() { if (null == this.ae) { this.ae = new FontInfo(); this.ae.q = "Verdana"; this.ae.f = 14; } return this.ae; } get ai() { if (this.ah == null) { this.ah = new SRProvider(this.e.e); this.ah.cb("DataGrid"); } return this.ah; } get ak() { return this.aj; } set ak(a) { let b = this.aj; this.aj = a; if (b != this.aj) { this.bc("AutoSize", b, this.aj); } } get bo() { return this.bm; } set bo(a) { let b = this.bm; this.bm = a; if (b != this.bm) { this.bc("BackgroundColor", b, a); } } get j() { return this.h; } set j(a) { let b = this.h; this.h = a; if (b != this.h) { this.bc("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } } get i() { return this.g; } set i(a) { let b = this.g; this.g = a; if (b != this.g) { this.bc("ActualBaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } } get buttonDensity() { return this.n; } set buttonDensity(a) { let b = this.n; this.n = a; if (b != this.n) { this.bc("ButtonDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } } get p() { return this.l; } set p(a) { let b = this.l; this.l = a; if (b != this.l) { this.bc("ActualButtonDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } } get ab() { return this.x; } set ab(a) { let b = this.x; this.x = a; if (b != this.x) { this.bc("ButtonTextStyle", b, this.x); } } get z() { return this.v; } set z(a) { let b = this.v; this.v = a; if (this.v != b) { this.bc("ActualButtonTextStyle", b, this.v); } } get column() { return this.a; } set column(a) { let b = this.a; if (b != a) { this.a3(false); this.a = a; this.bc("Column", b, this.a); this.a3(true); } } get density() { return this.o; } set density(a) { let b = this.o; this.o = a; if (b != this.o) { this.bc("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } } get q() { return this.m; } set q(a) { let b = this.m; this.m = a; if (b != this.m) { this.bc("ActualDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } } get ag() { return this.y; } set ag(a) { let b = this.y; this.y = a; if (b != this.y) { this.bc("LabelTextStyle", b, this.y); } } get aa() { return this.w; } set aa(a) { let b = this.w; this.w = a; if (this.w != b) { this.bc("ActualLabelTextStyle", b, this.w); } } get c() { let a = this.column; if (null == a) { return null; } return a.grid; } get br() { return this.bn; } set br(a) { let b = this.bn; this.bn = a; if (b != this.bn) { this.bc("TextColor", b, a); } } a6() { this.bk(this.d, this.c); this.e.m(); } a7(a, b) { let c = this.column; if (null == c) { return; } } a8(a, b) { } a9(a, b) { } a5(a, b) { } ba(a, b) { } bb(a, b) { } onViewInitialized() { } be(a, b, c) { switch (a) { case "Column": this.a6(); break; case "LabelTextStyle": this.bl(); break; case "ButtonTextStyle": this.bi(); break; case "BackgroundColor": case "TextColor": this.e.m(); break; case "ButtonDensity": case "Density": this.q = this.density == 0 ? 2 : this.density; this.p = this.buttonDensity == 0 ? this.q : this.buttonDensity; break; case "BaseTheme": this.i = this.j == 0 ? 1 : this.j; break; } } bi() { this.z = (null == this.ab) ? this.ad : this.ab; } bk(a, b) { if (a != b) { this.bj(a, b); } } bj(a, b) { if (null != a) { this.a4(a, false); } if (null != b) { this.a4(b, true); } this.d = b; } bl() { this.aa = (null == this.ag) ? this.af : this.ag; } a3(a) { let b = this.column; if (null == b) { return; } if (a) { b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.a7)); } else { b.propertyChanged = delegateRemove(b.propertyChanged, runOn(this, this.a7)); } } a4(a, b) { if (b) { a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.bb)); let c = a.actualColumns; c.collectionChanged = delegateCombine(c.collectionChanged, runOn(this, this.a8)); a.groupDescriptions.m(runOn(this, this.ba)); a.columnPinnedChanged = delegateCombine(a.columnPinnedChanged, runOn(this, this.a9)); a.calculateCompleted = delegateCombine(a.calculateCompleted, runOn(this, this.a5)); } else { a.propertyChanged = delegateRemove(a.propertyChanged, runOn(this, this.bb)); let d = a.actualColumns; d.collectionChanged = delegateRemove(d.collectionChanged, runOn(this, this.a8)); a.groupDescriptions.p(runOn(this, this.ba)); a.columnPinnedChanged = delegateRemove(a.columnPinnedChanged, runOn(this, this.a9)); a.calculateCompleted = delegateRemove(a.calculateCompleted, runOn(this, this.a5)); } } bh(a) { GridColumnOptionsUtilities.l(a, this); } bg(a) { GridColumnOptionsUtilities.k(a, this); } destroy() { this.provideRenderer(null); } provideRenderer(a) { this.e.l(a); } } GridColumnOptionsBase.$t = /*@__PURE__*/ markType(GridColumnOptionsBase, 'GridColumnOptionsBase', Base.$, [INotifyPropertyChanged_$type]); GridColumnOptionsBase.bp = /*@__PURE__*/ BrushUtil.h(255, 248, 248, 248); GridColumnOptionsBase.bq = /*@__PURE__*/ BrushUtil.h(255, 24, 29, 31); return GridColumnOptionsBase; })();