UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

742 lines (741 loc) 23.4 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, __values } from "tslib"; 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 */ var GridColumnOptionsViewBase = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridColumnOptionsViewBase, _super); function GridColumnOptionsViewBase() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.d = null; _this.f = null; _this.a = null; return _this; } Object.defineProperty(GridColumnOptionsViewBase.prototype, "g", { get: function () { return this.f; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsViewBase.prototype, "b", { get: function () { return this.a; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsViewBase.prototype, "e", { get: function () { return this.d; }, enumerable: false, configurable: true }); GridColumnOptionsViewBase.prototype.c = function () { var a = this.f.outerWidth(); var b = this.f.outerHeight(); var c = new SizeData(a, b); return c; }; GridColumnOptionsViewBase.prototype.k = function () { }; GridColumnOptionsViewBase.prototype.m = function () { var a = this.g; if (null != a) { NativeUI.m(a, this.b.bo); NativeUI.q(a, this.b.br); } }; GridColumnOptionsViewBase.prototype.l = function (a) { if (a == null) { this.d = null; this.f = null; this.k(); return; } this.d = a; var b = this.d.rootWrapper; this.h(b); }; GridColumnOptionsViewBase.prototype.h = function (a) { this.f = a; this.k(); this.m(); }; GridColumnOptionsViewBase.prototype.i = function (a) { this.a = a; }; GridColumnOptionsViewBase.prototype.j = function () { }; GridColumnOptionsViewBase.$t = markType(GridColumnOptionsViewBase, 'GridColumnOptionsViewBase'); return GridColumnOptionsViewBase; }(Base)); export { GridColumnOptionsViewBase }; /** * @hidden */ var GridColumnOptionsUtilities = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridColumnOptionsUtilities, _super); function GridColumnOptionsUtilities() { return _super !== null && _super.apply(this, arguments) || this; } GridColumnOptionsUtilities.d = function (a, b, c, d, e, f, g) { if (g === void 0) { g = false; } var 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 }; }; GridColumnOptionsUtilities.e = function (a, b, c, d, e, f) { var g = a.createElement("label"); f = a.createElement("input"); f.setAttribute("name", c); f.setAttribute("type", "radio"); f.setAttribute("id", b); g.append(f); var h = a.createElement("text"); h.setRawText(d); f.setAttribute("AccessKey", e); g.append(h); return { ret: g, p5: f }; }; GridColumnOptionsUtilities.g = function (a, b, c, d, e, f, g, h, i, j, k) { if (j === void 0) { j = true; } if (k === void 0) { k = false; } var l; return { ret: ((function () { var 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 }; }; GridColumnOptionsUtilities.f = function (a, b, c, d, e, f, g, h, i, j, k, l, m, n) { if (l === void 0) { l = true; } if (m === void 0) { m = false; } if (n === void 0) { n = true; } var o = b.createElement("div"); var p = b.getSubRenderer(o); h = new XButton(); h.provideContainer(p); var q = p.getExternal(h, p.rootWrapper, p.getExternal(a, null, null)); h.e = d; h.r = e; h.n = f; var r = null != c; k = null; if (r) { k = b.createElement("div"); k.setStyleProperty("display", "inline-block"); i = new XIcon(); var s = b.getSubRenderer(k); i.provideContainer(s); var 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"); var 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 }; }; GridColumnOptionsUtilities.h = function (a, b, c, d, e, f, g) { var e_1, _a, e_2, _b; var h = b.createElement("div"); var i = b.getSubRenderer(h); g = new XButtonGroup(); g.provideContainer(i); var j = i.getExternal(g, i.rootWrapper, i.getExternal(a, null, null)); g.t = e; g.p = f; g.i = 0; try { for (var _c = __values(fromEnum(c)), _d = _c.next(); !_d.done; _d = _c.next()) { var k = _d.value; g.buttons.add(k); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } var l = h.getChildAt(0); try { for (var _e = __values(fromEnum(d)), _f = _e.next(); !_f.done; _f = _e.next()) { var m = _f.value; l.append(m); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } return { ret: h, p6: g }; }; GridColumnOptionsUtilities.b = function (a) { var b = a.getNativeElement(); return b.checked; }; GridColumnOptionsUtilities.i = function (a, b) { var c = a.getNativeElement(); c.checked = b; }; GridColumnOptionsUtilities.a = function (a) { switch (a) { case 0: return 1; case 1: return 2; default: return 1; } }; GridColumnOptionsUtilities.c = function (a) { switch (a) { case 1: return 0; case 2: return 1; case 0: default: return 0; } }; GridColumnOptionsUtilities.j = function (a, b, c) { if (c === void 0) { c = "block"; } var d = b ? c : "none"; a.setStyleProperty("display", d); }; GridColumnOptionsUtilities.l = function (a, b) { if (null != a) { a.n = b.i; a.r = b.p; a.aa = b.z; } }; GridColumnOptionsUtilities.k = function (a, b) { if (null != a) { a.p = b.i; a.t = b.p; } }; GridColumnOptionsUtilities.$t = markType(GridColumnOptionsUtilities, 'GridColumnOptionsUtilities'); return GridColumnOptionsUtilities; }(Base)); export { GridColumnOptionsUtilities }; /** * @hidden */ var GridColumnOptionsBase = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridColumnOptionsBase, _super); function GridColumnOptionsBase() { var _this = _super.call(this) || this; _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; var a = _this.f(); _this.e = a; _this.onViewInitialized(); a.i(_this); return _this; } GridColumnOptionsBase.prototype.bc = function (a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.be(a, b, c); }; Object.defineProperty(GridColumnOptionsBase.prototype, "ad", { get: function () { if (null == this.ac) { this.ac = new FontInfo(); this.ac.q = "Verdana"; this.ac.f = 12; } return this.ac; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "af", { get: function () { if (null == this.ae) { this.ae = new FontInfo(); this.ae.q = "Verdana"; this.ae.f = 14; } return this.ae; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "ai", { get: function () { if (this.ah == null) { this.ah = new SRProvider(this.e.e); this.ah.cb("DataGrid"); } return this.ah; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "ak", { get: function () { return this.aj; }, set: function (a) { var b = this.aj; this.aj = a; if (b != this.aj) { this.bc("AutoSize", b, this.aj); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "bo", { get: function () { return this.bm; }, set: function (a) { var b = this.bm; this.bm = a; if (b != this.bm) { this.bc("BackgroundColor", b, a); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "j", { get: function () { return this.h; }, set: function (a) { var b = this.h; this.h = a; if (b != this.h) { this.bc("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "i", { get: function () { return this.g; }, set: function (a) { var b = this.g; this.g = a; if (b != this.g) { this.bc("ActualBaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "buttonDensity", { get: function () { return this.n; }, set: function (a) { var b = this.n; this.n = a; if (b != this.n) { this.bc("ButtonDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "p", { get: function () { return this.l; }, set: function (a) { var b = this.l; this.l = a; if (b != this.l) { this.bc("ActualButtonDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "ab", { get: function () { return this.x; }, set: function (a) { var b = this.x; this.x = a; if (b != this.x) { this.bc("ButtonTextStyle", b, this.x); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "z", { get: function () { return this.v; }, set: function (a) { var b = this.v; this.v = a; if (this.v != b) { this.bc("ActualButtonTextStyle", b, this.v); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "column", { get: function () { return this.a; }, set: function (a) { var b = this.a; if (b != a) { this.a3(false); this.a = a; this.bc("Column", b, this.a); this.a3(true); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "density", { get: function () { return this.o; }, set: function (a) { var b = this.o; this.o = a; if (b != this.o) { this.bc("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "q", { get: function () { return this.m; }, set: function (a) { var b = this.m; this.m = a; if (b != this.m) { this.bc("ActualDensity", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, a)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "ag", { get: function () { return this.y; }, set: function (a) { var b = this.y; this.y = a; if (b != this.y) { this.bc("LabelTextStyle", b, this.y); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "aa", { get: function () { return this.w; }, set: function (a) { var b = this.w; this.w = a; if (this.w != b) { this.bc("ActualLabelTextStyle", b, this.w); } }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "c", { get: function () { var a = this.column; if (null == a) { return null; } return a.grid; }, enumerable: false, configurable: true }); Object.defineProperty(GridColumnOptionsBase.prototype, "br", { get: function () { return this.bn; }, set: function (a) { var b = this.bn; this.bn = a; if (b != this.bn) { this.bc("TextColor", b, a); } }, enumerable: false, configurable: true }); GridColumnOptionsBase.prototype.a6 = function () { this.bk(this.d, this.c); this.e.m(); }; GridColumnOptionsBase.prototype.a7 = function (a, b) { var c = this.column; if (null == c) { return; } }; GridColumnOptionsBase.prototype.a8 = function (a, b) { }; GridColumnOptionsBase.prototype.a9 = function (a, b) { }; GridColumnOptionsBase.prototype.a5 = function (a, b) { }; GridColumnOptionsBase.prototype.ba = function (a, b) { }; GridColumnOptionsBase.prototype.bb = function (a, b) { }; GridColumnOptionsBase.prototype.onViewInitialized = function () { }; GridColumnOptionsBase.prototype.be = function (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; } }; GridColumnOptionsBase.prototype.bi = function () { this.z = (null == this.ab) ? this.ad : this.ab; }; GridColumnOptionsBase.prototype.bk = function (a, b) { if (a != b) { this.bj(a, b); } }; GridColumnOptionsBase.prototype.bj = function (a, b) { if (null != a) { this.a4(a, false); } if (null != b) { this.a4(b, true); } this.d = b; }; GridColumnOptionsBase.prototype.bl = function () { this.aa = (null == this.ag) ? this.af : this.ag; }; GridColumnOptionsBase.prototype.a3 = function (a) { var 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)); } }; GridColumnOptionsBase.prototype.a4 = function (a, b) { if (b) { a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.bb)); var 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)); var 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)); } }; GridColumnOptionsBase.prototype.bh = function (a) { GridColumnOptionsUtilities.l(a, this); }; GridColumnOptionsBase.prototype.bg = function (a) { GridColumnOptionsUtilities.k(a, this); }; GridColumnOptionsBase.prototype.destroy = function () { this.provideRenderer(null); }; GridColumnOptionsBase.prototype.provideRenderer = function (a) { this.e.l(a); }; GridColumnOptionsBase.$t = markType(GridColumnOptionsBase, 'GridColumnOptionsBase', Base.$, [INotifyPropertyChanged_$type]); GridColumnOptionsBase.bp = BrushUtil.h(255, 248, 248, 248); GridColumnOptionsBase.bq = BrushUtil.h(255, 24, 29, 31); return GridColumnOptionsBase; }(Base)); export { GridColumnOptionsBase };