UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

449 lines (448 loc) 14.3 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, Type, markType, enumGetBox, runOn, delegateRemove, delegateCombine, String_$type } from "igniteui-react-core"; import { List$1 } from "igniteui-react-core"; import { SummaryChooserItem } from "./SummaryChooserItem"; import { SRProvider } from "igniteui-react-core"; import { ControlDisplayDensity_$type } from "igniteui-react-core"; import { BaseControlTheme_$type } from "igniteui-react-core"; import { BrushUtil } from "igniteui-react-core"; import { SummaryChangedEventArgs } from "./SummaryChangedEventArgs"; import { Thickness } from "igniteui-react-core"; import { stringIsNullOrWhiteSpace } from "igniteui-react-core"; /** * @hidden */ export let ISummaryChooserView_$type = /*@__PURE__*/ new Type(null, 'ISummaryChooserView'); /** * @hidden */ export let SummaryChooserView = /*@__PURE__*/ (() => { class SummaryChooserView extends Base { constructor() { super(...arguments); this.b = false; this.a = null; this.c = null; this._model = null; this.d = null; } get model() { return this._model; } set model(a) { this._model = a; } get renderer() { return this.c; } get container() { return this.d; } provideContainer(a) { if (a == null) { this.c = null; this.a = null; return; } this.c = a; if (this.a == null && !this.b) { this.b = true; this.d = this.c.createElement("div"); this.d.addClass("ig-summary-chooser"); this.d.setStyleProperty("padding", "0px 8px 4px"); this.d.setStyleProperty("margin-top", "-3px"); this.d.setStyleProperty("width", "150px"); this.d.setStyleProperty("height", "154px"); this.d.setStyleProperty("box-sizing", "border-box"); this.d.listen("mousedown", (b) => b.stopPropagation()); this.c.getPortal(this.d, "CheckboxList", (b) => { let comp_ = b.componentRef; this.a = (comp_.i); this.model.a1(this.a); this.b = false; }, false); } } onItemInserted() { this.e(); } onItemRemoved() { this.e(); } e() { if (this.model.f.a1 > -1) { let a = this.model.r.count * this.model.f.a1; a += 4; this.d.setStyleProperty("height", a + "px"); } } } SummaryChooserView.$t = /*@__PURE__*/ markType(SummaryChooserView, 'SummaryChooserView', Base.$, [ISummaryChooserView_$type]); return SummaryChooserView; })(); /** * @hidden */ export let SummaryChooser = /*@__PURE__*/ (() => { class SummaryChooser extends Base { constructor() { super(); this.c = null; this.e = null; this.q = null; this.o = null; this.s = null; this.t = null; this.v = null; this.u = null; this.w = null; this.l = 0; this.k = 0; this.a8 = BrushUtil.h(255, 24, 29, 31); this.h = 0; this.g = 1; this.a7 = BrushUtil.h(255, 248, 248, 248); this.summaryChanged = null; this.c = new SummaryChooserView(); this.c.model = this; } get r() { return this.q; } get f() { return this.e; } get p() { if (this.o == null) { this.o = new SRProvider(this.c.renderer); this.o.cb("DataGrid"); } return this.o; } get aa() { if (this.s == null) { let a = this.p.b1("Column_Options_Summary_Average"); return !stringIsNullOrWhiteSpace(a) ? a : "Average"; } else { return this.s; } } set aa(a) { let b = this.s; this.s = a; if (b != this.s) { this.a0("AverageCaption", b, this.s); } } get ag() { if (this.t == null) { let a = this.p.b1("Column_Options_Summary_Count"); return !stringIsNullOrWhiteSpace(a) ? a : "Count"; } else { return this.t; } } set ag(a) { let b = this.t; this.t = a; if (b != this.t) { this.a0("CountCaption", b, this.t); } } get ap() { if (this.v == null) { let a = this.p.b1("Column_Options_Summary_Minimum"); return !stringIsNullOrWhiteSpace(a) ? a : "Minimum"; } else { return this.v; } } set ap(a) { let b = this.v; this.v = a; if (b != this.v) { this.a0("MinimumCaption", b, this.v); } } get al() { if (this.u == null) { let a = this.p.b1("Column_Options_Summary_Maximum"); return !stringIsNullOrWhiteSpace(a) ? a : "Maximum"; } else { return this.u; } } set al(a) { let b = this.u; this.u = a; if (b != this.u) { this.a0("MaximumCaption", b, this.u); } } get at() { if (this.w == null) { let a = this.p.b1("Column_Options_Summary_Sum"); return !stringIsNullOrWhiteSpace(a) ? a : "Sum"; } else { return this.w; } } set at(a) { let b = this.w; this.w = a; if (b != this.w) { this.a0("SumCaption", b, this.w); } } get n() { return this.l; } set n(a) { let b = this.l; this.l = a; if (b != this.l) { this.a0("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.l)); } } get m() { return this.k; } set m(a) { let b = this.k; this.k = a; if (b != this.k) { this.a0("ActualDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.k)); } } get ba() { return this.a8; } set ba(a) { let b = this.a8; this.a8 = a; if (b != this.a8) { this.a0("TextColor", b, a); } } get j() { return this.h; } set j(a) { let b = this.h; this.h = a; if (b != this.h) { this.a0("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.a0("ActualBaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } } get a9() { return this.a7; } set a9(a) { let b = this.a7; this.a7 = a; if (b != this.a7) { this.a0("Background", b, a); } } a1(a) { if (this.e != null) { let b = this.e; b.checkedChanged = delegateRemove(b.checkedChanged, runOn(this, this.az)); } this.e = a; if (this.e != null) { let c = this.e; c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.az)); } this.q = new List$1(SummaryChooserItem.$, 0); this.q.add(((() => { let $ret = new SummaryChooserItem(); $ret.label = this.aa; $ret.iD = "avg"; return $ret; })())); this.q.add(((() => { let $ret = new SummaryChooserItem(); $ret.label = this.ag; $ret.iD = "count"; return $ret; })())); this.q.add(((() => { let $ret = new SummaryChooserItem(); $ret.label = this.al; $ret.iD = "max"; return $ret; })())); this.q.add(((() => { let $ret = new SummaryChooserItem(); $ret.label = this.ap; $ret.iD = "min"; return $ret; })())); this.q.add(((() => { let $ret = new SummaryChooserItem(); $ret.label = this.at; $ret.iD = "sum"; return $ret; })())); this.a6(); } az(a, b) { let c = this.q._inner[b.c]; c.isSelected = b.b; if (this.summaryChanged != null) { this.summaryChanged(this, ((() => { let $ret = new SummaryChangedEventArgs(); $ret.b = c.iD; $ret.a = b.b; return $ret; })())); } } a6() { if (this.e != null) { this.e.density = this.m; this.e.eg = this.ba; this.e.baseTheme = this.i; this.e.backgroundColor = this.a9; this.e.showSelectAll = false; this.e.au = false; this.e.ar = false; this.e.updateHrMargin(new Thickness(1, -7, 3, -7, 3)); this.e.itemsSource = this.q; this.e.dataMemberPath = "label"; this.e.selectedMemberPath = "isSelected"; this.e.primaryKey = ["label"]; } } a0(a, b, c) { switch (a) { case "AverageCaption": this.a5("sum", this.aa); break; case "CountCaption": this.a5("count", this.aa); break; case "MinimumCaption": this.a5("min", this.aa); break; case "MaximumCaption": this.a5("max", this.aa); break; case "SumCaption": this.a5("sum", this.aa); break; case "ActualDensity": case "ActualBaseTheme": case "Background": case "TextColor": this.a6(); break; case "Density": this.m = this.n == 0 ? this.m : this.n; break; case "BaseTheme": this.i = this.j == 0 ? this.i : this.j; break; } } a2(a) { this.c.provideContainer(a); } ay() { if (this.e != null) { this.e.destroy(); } this.c.provideContainer(null); } a4(a, b) { for (let c = 0; c < this.q.count; c++) { let d = this.q._inner[c]; if (d.iD == a) { d.isSelected = b; if (this.e != null) { this.e.cs(c, d, d); } break; } } } ax(a, b) { let c = new SummaryChooserItem(); c.iD = a; c.label = b; this.q.add(c); if (this.e != null) { this.e.cq(this.q.count - 1, c); } this.c.onItemInserted(); } a3(a) { for (let b = 0; b < this.q.count; b++) { let c = this.q._inner[b]; if (c.iD == a) { this.q.removeAt(b); if (this.e != null) { this.e.cr(b, c); } break; } } this.c.onItemRemoved(); } a5(a, b) { for (let c = 0; c < this.q.count; c++) { let d = this.q._inner[c]; if (d.iD == a) { d.label = b; if (this.e != null) { this.e.cs(c, d, d); } break; } } } b() { let a = new List$1(String_$type, 0); for (let b = 0; b < this.q.count; b++) { let c = this.q._inner[b]; if (c.isSelected) { a.add(c.iD); } } return a.toArray(); } a() { let a = new List$1(String_$type, 0); for (let b = 0; b < this.q.count; b++) { let c = this.q._inner[b]; if (!c.isSelected) { a.add(c.iD); } } return a.toArray(); } } SummaryChooser.$t = /*@__PURE__*/ markType(SummaryChooser, 'SummaryChooser'); return SummaryChooser; })();