UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

522 lines (521 loc) 16.7 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 { __extends } from "tslib"; 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 var ISummaryChooserView_$type = /*@__PURE__*/ new Type(null, 'ISummaryChooserView'); /** * @hidden */ var SummaryChooserView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(SummaryChooserView, _super); function SummaryChooserView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.b = false; _this.a = null; _this.c = null; _this._model = null; _this.d = null; return _this; } Object.defineProperty(SummaryChooserView.prototype, "model", { get: function () { return this._model; }, set: function (a) { this._model = a; }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooserView.prototype, "renderer", { get: function () { return this.c; }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooserView.prototype, "container", { get: function () { return this.d; }, enumerable: false, configurable: true }); SummaryChooserView.prototype.provideContainer = function (a) { var _this = this; 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", function (b) { return b.stopPropagation(); }); this.c.getPortal(this.d, "CheckboxList", function (b) { var comp_ = b.componentRef; _this.a = (comp_.i); _this.model.a1(_this.a); _this.b = false; }, false); } }; SummaryChooserView.prototype.onItemInserted = function () { this.e(); }; SummaryChooserView.prototype.onItemRemoved = function () { this.e(); }; SummaryChooserView.prototype.e = function () { if (this.model.f.bc > -1) { var a = this.model.r.count * this.model.f.bc; a += 4; this.d.setStyleProperty("height", a + "px"); } }; SummaryChooserView.$t = markType(SummaryChooserView, 'SummaryChooserView', Base.$, [ISummaryChooserView_$type]); return SummaryChooserView; }(Base)); export { SummaryChooserView }; /** * @hidden */ var SummaryChooser = /** @class */ /*@__PURE__*/ (function (_super) { __extends(SummaryChooser, _super); function SummaryChooser() { var _this = _super.call(this) || this; _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; return _this; } Object.defineProperty(SummaryChooser.prototype, "r", { get: function () { return this.q; }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "f", { get: function () { return this.e; }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "p", { get: function () { if (this.o == null) { this.o = new SRProvider(this.c.renderer); this.o.cb("DataGrid"); } return this.o; }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "aa", { get: function () { if (this.s == null) { var a = this.p.b1("Column_Options_Summary_Average"); return !stringIsNullOrWhiteSpace(a) ? a : "Average"; } else { return this.s; } }, set: function (a) { var b = this.s; this.s = a; if (b != this.s) { this.a0("AverageCaption", b, this.s); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "ag", { get: function () { if (this.t == null) { var a = this.p.b1("Column_Options_Summary_Count"); return !stringIsNullOrWhiteSpace(a) ? a : "Count"; } else { return this.t; } }, set: function (a) { var b = this.t; this.t = a; if (b != this.t) { this.a0("CountCaption", b, this.t); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "ap", { get: function () { if (this.v == null) { var a = this.p.b1("Column_Options_Summary_Minimum"); return !stringIsNullOrWhiteSpace(a) ? a : "Minimum"; } else { return this.v; } }, set: function (a) { var b = this.v; this.v = a; if (b != this.v) { this.a0("MinimumCaption", b, this.v); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "al", { get: function () { if (this.u == null) { var a = this.p.b1("Column_Options_Summary_Maximum"); return !stringIsNullOrWhiteSpace(a) ? a : "Maximum"; } else { return this.u; } }, set: function (a) { var b = this.u; this.u = a; if (b != this.u) { this.a0("MaximumCaption", b, this.u); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "at", { get: function () { if (this.w == null) { var a = this.p.b1("Column_Options_Summary_Sum"); return !stringIsNullOrWhiteSpace(a) ? a : "Sum"; } else { return this.w; } }, set: function (a) { var b = this.w; this.w = a; if (b != this.w) { this.a0("SumCaption", b, this.w); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "n", { get: function () { return this.l; }, set: function (a) { var b = this.l; this.l = a; if (b != this.l) { this.a0("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.l)); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "m", { get: function () { return this.k; }, set: function (a) { var b = this.k; this.k = a; if (b != this.k) { this.a0("ActualDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.k)); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "ba", { get: function () { return this.a8; }, set: function (a) { var b = this.a8; this.a8 = a; if (b != this.a8) { this.a0("TextColor", b, a); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "j", { get: function () { return this.h; }, set: function (a) { var b = this.h; this.h = a; if (b != this.h) { this.a0("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "i", { get: function () { return this.g; }, set: function (a) { var b = this.g; this.g = a; if (b != this.g) { this.a0("ActualBaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(SummaryChooser.prototype, "a9", { get: function () { return this.a7; }, set: function (a) { var b = this.a7; this.a7 = a; if (b != this.a7) { this.a0("Background", b, a); } }, enumerable: false, configurable: true }); SummaryChooser.prototype.a1 = function (a) { var _this = this; if (this.e != null) { var b = this.e; b.checkedChanged = delegateRemove(b.checkedChanged, runOn(this, this.az)); } this.e = a; if (this.e != null) { var c = this.e; c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.az)); } this.q = new List$1(SummaryChooserItem.$, 0); this.q.add(((function () { var $ret = new SummaryChooserItem(); $ret.label = _this.aa; $ret.iD = "avg"; return $ret; })())); this.q.add(((function () { var $ret = new SummaryChooserItem(); $ret.label = _this.ag; $ret.iD = "count"; return $ret; })())); this.q.add(((function () { var $ret = new SummaryChooserItem(); $ret.label = _this.al; $ret.iD = "max"; return $ret; })())); this.q.add(((function () { var $ret = new SummaryChooserItem(); $ret.label = _this.ap; $ret.iD = "min"; return $ret; })())); this.q.add(((function () { var $ret = new SummaryChooserItem(); $ret.label = _this.at; $ret.iD = "sum"; return $ret; })())); this.a6(); }; SummaryChooser.prototype.az = function (a, b) { var c = this.q._inner[b.c]; c.isSelected = b.b; if (this.summaryChanged != null) { this.summaryChanged(this, ((function () { var $ret = new SummaryChangedEventArgs(); $ret.b = c.iD; $ret.a = b.b; return $ret; })())); } }; SummaryChooser.prototype.a6 = function () { if (this.e != null) { this.e.density = this.m; this.e.e7 = this.ba; this.e.baseTheme = this.i; this.e.backgroundColor = this.a9; this.e.showSelectAll = false; this.e.a3 = false; this.e.az = 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"]; } }; SummaryChooser.prototype.a0 = function (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; } }; SummaryChooser.prototype.a2 = function (a) { this.c.provideContainer(a); }; SummaryChooser.prototype.ay = function () { if (this.e != null) { this.e.destroy(); } this.c.provideContainer(null); }; SummaryChooser.prototype.a4 = function (a, b) { for (var c = 0; c < this.q.count; c++) { var d = this.q._inner[c]; if (d.iD == a) { d.isSelected = b; if (this.e != null) { this.e.dg(c, d, d); } break; } } }; SummaryChooser.prototype.ax = function (a, b) { var c = new SummaryChooserItem(); c.iD = a; c.label = b; this.q.add(c); if (this.e != null) { this.e.dd(this.q.count - 1, c); } this.c.onItemInserted(); }; SummaryChooser.prototype.a3 = function (a) { for (var b = 0; b < this.q.count; b++) { var c = this.q._inner[b]; if (c.iD == a) { this.q.removeAt(b); if (this.e != null) { this.e.df(b, c); } break; } } this.c.onItemRemoved(); }; SummaryChooser.prototype.a5 = function (a, b) { for (var c = 0; c < this.q.count; c++) { var d = this.q._inner[c]; if (d.iD == a) { d.label = b; if (this.e != null) { this.e.dg(c, d, d); } break; } } }; SummaryChooser.prototype.b = function () { var a = new List$1(String_$type, 0); for (var b = 0; b < this.q.count; b++) { var c = this.q._inner[b]; if (c.isSelected) { a.add(c.iD); } } return a.toArray(); }; SummaryChooser.prototype.a = function () { var a = new List$1(String_$type, 0); for (var b = 0; b < this.q.count; b++) { var c = this.q._inner[b]; if (!c.isSelected) { a.add(c.iD); } } return a.toArray(); }; SummaryChooser.$t = markType(SummaryChooser, 'SummaryChooser'); return SummaryChooser; }(Base)); export { SummaryChooser };