UNPKG

igniteui-react-core

Version:
231 lines (230 loc) 7.69 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 { 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 */ export let GridBridge = /*@__PURE__*/ (() => { class GridBridge extends PanelBridge { constructor() { super(); this.aa = null; this.z = null; this.ad = null; this.ab = new List$1(GridBridgeColumnDefinition.$, 0); this.ac = new List$1(GridBridgeRowDefinition.$, 0); } addColumnDefinition(a, b, c, d) { let e = new GridBridgeColumnDefinition(); e.a = c; e.d = d; this.ab.add(e); this.af(a); } addColumnDefinitionWithMin(a, b, c, d, e) { let f = new GridBridgeColumnDefinition(); f.a = c; f.d = d; f.c = e; this.ab.add(f); this.af(a); } insertColumnDefinition(a, b, c, d) { let e = new GridBridgeColumnDefinition(); e.a = c; e.d = d; this.ab.insert(b, e); this.af(a); } insertColumnDefinitionWithMin(a, b, c, d, e) { let f = new GridBridgeColumnDefinition(); f.a = c; f.d = d; f.c = e; this.ab.insert(b, f); this.af(a); } af(a) { let b = ""; for (let c = 0; c < this.ab.count; c++) { if (c > 0) { b += " "; } b += this.ab._inner[c].e(); } a.setStyleProperty("grid-template-columns", b); } ag(a) { let b = ""; for (let c = 0; c < this.ac.count; c++) { if (c > 0) { b += " "; } b += this.ac._inner[c].d(); } a.setStyleProperty("grid-template-rows", b); } addHandler(a, b, c, d) { switch (c) { case 1: { let e = a; this.aa = e.listen("click", runOn(this, this.ae)); this.z = d; this.ad = b; } break; } } removeHandler(a, b, c, d) { switch (c) { case 1: if (this.aa != null) { this.aa(); } this.z = null; this.ad = null; break; } } ae(a) { if (this.z != null) { let b = new NativeUIClickedEventArgs(); this.z(this.ad, b); } } addRowDefinition(a, b, c, d) { let e = new GridBridgeRowDefinition(); e.a = c; e.b = d; this.ac.add(e); this.ag(a); } addRowDefinitionWithMin(a, b, c, d, e) { let f = new GridBridgeRowDefinition(); f.a = c; f.b = d; f.c = e; this.ac.add(f); this.ag(a); } getColumn(a, b) { let c = b.an.getStyleProperty("grid-column-start"); let d = parseInt(c); if (c == "") { d = 1; } return d - 1; } getColumnSpan(a, b) { let c = b.an.getStyleProperty("grid-column-end"); let d = parseInt(c); if (c == "") { d = 1; } return (d - 1) - this.getColumn(a, b); } getColumnDefinitionsCount(a) { return this.ab.count; } getRow(a, b) { let c = b.an.getStyleProperty("grid-row"); let d = parseInt(c); if (c == "") { d = 1; } return d - 1; } getRowDefinitionsCount(a) { return this.ac.count; } getValue(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.getValue(a, b); } removeColumnDefinition(a, b) { this.ab.removeAt(b); this.af(a); } removeRowDefinition(a, b) { this.ac.removeAt(b); this.ag(a); } setColumn(a, b, c) { b.an.setStyleProperty("grid-column", (c + 1).toString()); } setColumnSpan(a, b, c) { let d = this.getColumn(a, b); b.an.setStyleProperty("grid-column-start", d.toString()); b.an.setStyleProperty("grid-column-end", (d + (c + 1)).toString()); } setRow(a, b, c) { b.an.setStyleProperty("grid-row", (c + 1).toString()); } setValue(a, b, c) { super.setValue(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; } } updateColumnDefinition(a, b, c, d) { let e = this.ab._inner[b]; e.a = c; e.d = d; this.af(a); } updateColumnDefinitionWithMin(a, b, c, d, e) { let f = this.ab._inner[b]; f.a = c; f.d = d; f.c = e; this.af(a); } updateRowDefinition(a, b, c, d) { let e = this.ac._inner[b]; e.a = c; e.b = d; this.ag(a); } getChildAt(a, b) { return this.s.apply(this, arguments); } removeChildAt(a, b) { this.y.apply(this, arguments); } addChild(a, b) { this.v.apply(this, arguments); } insertChild(a, b, c) { this.w.apply(this, arguments); } removeChild(a, b) { this.x.apply(this, arguments); } getChildrenCount(a) { return this.u.apply(this, arguments); } } GridBridge.$t = /*@__PURE__*/ markType(GridBridge, 'GridBridge', PanelBridge.$, [INativeUIGridBridge_$type]); return GridBridge; })();