UNPKG

igniteui-react-core

Version:
233 lines (232 loc) 8.12 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 { PanelBridge } from "./PanelBridge"; import { INativeUIGridBridge_$type } from "./INativeUIGridBridge"; import { List$1 } from "./List$1"; import { GridBridgeColumnDefinition } from "./GridBridgeColumnDefinition"; import { GridBridgeRowDefinition } from "./GridBridgeRowDefinition"; import { runOn, enumGetBox, EnumUtil, markType } from "./type"; import { NativeUIClickedEventArgs } from "./NativeUIClickedEventArgs"; import { NativeUIBoxSizing_$type } from "./NativeUIBoxSizing"; import { NativeUIPlaceContent_$type } from "./NativeUIPlaceContent"; /** * @hidden */ var GridBridge = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridBridge, _super); function GridBridge() { var _this = _super.call(this) || this; _this.aa = null; _this.z = null; _this.ad = null; _this.ab = new List$1(GridBridgeColumnDefinition.$, 0); _this.ac = new List$1(GridBridgeRowDefinition.$, 0); return _this; } GridBridge.prototype.addColumnDefinition = function (a, b, c, d) { var e = new GridBridgeColumnDefinition(); e.a = c; e.d = d; this.ab.add(e); this.af(a); }; GridBridge.prototype.addColumnDefinitionWithMin = function (a, b, c, d, e) { var f = new GridBridgeColumnDefinition(); f.a = c; f.d = d; f.c = e; this.ab.add(f); this.af(a); }; GridBridge.prototype.insertColumnDefinition = function (a, b, c, d) { var e = new GridBridgeColumnDefinition(); e.a = c; e.d = d; this.ab.insert(b, e); this.af(a); }; GridBridge.prototype.insertColumnDefinitionWithMin = function (a, b, c, d, e) { var f = new GridBridgeColumnDefinition(); f.a = c; f.d = d; f.c = e; this.ab.insert(b, f); this.af(a); }; GridBridge.prototype.af = function (a) { var b = ""; for (var c = 0; c < this.ab.count; c++) { if (c > 0) { b += " "; } b += this.ab._inner[c].e(); } a.setStyleProperty("grid-template-columns", b); }; GridBridge.prototype.ag = function (a) { var b = ""; for (var c = 0; c < this.ac.count; c++) { if (c > 0) { b += " "; } b += this.ac._inner[c].d(); } a.setStyleProperty("grid-template-rows", b); }; GridBridge.prototype.addHandler = function (a, b, c, d) { switch (c) { case 1: { var e = a; this.aa = e.listen("click", runOn(this, this.ae)); this.z = d; this.ad = b; } break; } }; GridBridge.prototype.removeHandler = function (a, b, c, d) { switch (c) { case 1: if (this.aa != null) { this.aa(); } this.z = null; this.ad = null; break; } }; GridBridge.prototype.ae = function (a) { if (this.z != null) { var b = new NativeUIClickedEventArgs(); this.z(this.ad, b); } }; GridBridge.prototype.addRowDefinition = function (a, b, c, d) { var e = new GridBridgeRowDefinition(); e.a = c; e.b = d; this.ac.add(e); this.ag(a); }; GridBridge.prototype.addRowDefinitionWithMin = function (a, b, c, d, e) { var f = new GridBridgeRowDefinition(); f.a = c; f.b = d; f.c = e; this.ac.add(f); this.ag(a); }; GridBridge.prototype.getColumn = function (a, b) { var c = b.an.getStyleProperty("grid-column-start"); var d = parseInt(c); if (c == "") { d = 1; } return d - 1; }; GridBridge.prototype.getColumnSpan = function (a, b) { var c = b.an.getStyleProperty("grid-column-end"); var d = parseInt(c); if (c == "") { d = 1; } return (d - 1) - this.getColumn(a, b); }; GridBridge.prototype.getColumnDefinitionsCount = function (a) { return this.ab.count; }; GridBridge.prototype.getRow = function (a, b) { var c = b.an.getStyleProperty("grid-row"); var d = parseInt(c); if (c == "") { d = 1; } return d - 1; }; GridBridge.prototype.getRowDefinitionsCount = function (a) { return this.ac.count; }; GridBridge.prototype.getValue = function (a, b) { switch (b) { case 38: return enumGetBox(NativeUIBoxSizing_$type, a.getStyleProperty("box-sizing") == "border-box" ? 0 : 1); case 73: return enumGetBox(NativeUIPlaceContent_$type, a.getStyleProperty("place-content") == "center" ? 1 : 0); } return _super.prototype.getValue.call(this, a, b); }; GridBridge.prototype.removeColumnDefinition = function (a, b) { this.ab.removeAt(b); this.af(a); }; GridBridge.prototype.removeRowDefinition = function (a, b) { this.ac.removeAt(b); this.ag(a); }; GridBridge.prototype.setColumn = function (a, b, c) { b.an.setStyleProperty("grid-column", (c + 1).toString()); }; GridBridge.prototype.setColumnSpan = function (a, b, c) { var d = this.getColumn(a, b); b.an.setStyleProperty("grid-column-start", d.toString()); b.an.setStyleProperty("grid-column-end", (d + (c + 1)).toString()); }; GridBridge.prototype.setRow = function (a, b, c) { b.an.setStyleProperty("grid-row", (c + 1).toString()); }; GridBridge.prototype.setValue = function (a, b, c) { _super.prototype.setValue.call(this, a, b, c); switch (b) { case 38: a.setStyleProperty("box-sizing", (EnumUtil.getEnumValue(NativeUIBoxSizing_$type, c)) == 0 ? "border-box" : "content-box"); break; case 73: a.setStyleProperty("place-content", (EnumUtil.getEnumValue(NativeUIPlaceContent_$type, c)) == 1 ? "center" : "unset"); break; } }; GridBridge.prototype.updateColumnDefinition = function (a, b, c, d) { var e = this.ab._inner[b]; e.a = c; e.d = d; this.af(a); }; GridBridge.prototype.updateColumnDefinitionWithMin = function (a, b, c, d, e) { var f = this.ab._inner[b]; f.a = c; f.d = d; f.c = e; this.af(a); }; GridBridge.prototype.updateRowDefinition = function (a, b, c, d) { var e = this.ac._inner[b]; e.a = c; e.b = d; this.ag(a); }; GridBridge.prototype.getChildAt = function (a, b) { return this.s.apply(this, arguments); }; GridBridge.prototype.removeChildAt = function (a, b) { this.y.apply(this, arguments); }; GridBridge.prototype.addChild = function (a, b) { this.v.apply(this, arguments); }; GridBridge.prototype.insertChild = function (a, b, c) { this.w.apply(this, arguments); }; GridBridge.prototype.removeChild = function (a, b) { this.x.apply(this, arguments); }; GridBridge.prototype.getChildrenCount = function (a) { return this.u.apply(this, arguments); }; GridBridge.$t = markType(GridBridge, 'GridBridge', PanelBridge.$, [INativeUIGridBridge_$type]); return GridBridge; }(PanelBridge)); export { GridBridge };