UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

376 lines (375 loc) 12.5 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, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateRemove, delegateCombine, enumGetBox, fromEnum } from "igniteui-react-core"; import { SRProvider } from "igniteui-react-core"; import { BaseControlTheme_$type } from "igniteui-react-core"; import { ControlDisplayDensity_$type } from "igniteui-react-core"; import { BrushUtil } from "igniteui-react-core"; import { ObservableCollection$1 } from "igniteui-react-core"; import { ColumnChooserInfo } from "./ColumnChooserInfo"; import { stringIsNullOrWhiteSpace } from "igniteui-react-core"; /** * @hidden */ export let ColumnChooserView = /*@__PURE__*/ (() => { class ColumnChooserView extends Base { constructor() { super(); this.d = null; this.c = null; this.e = null; this.a = null; this.b = null; } h() { } g(a) { if (a == null) { this.b = null; return; } this.b = a; this.e = this.b.rootWrapper.getChildAt(0); this.e.setStyleProperty("margin", "4px 0px 4px 0px"); this.k(); this.j(); let b = Math.round(a.rootWrapper.width()); let c = Math.round(a.rootWrapper.height()); this.b.rootWrapper.setStyleProperty("position", "relative"); this.i(); } i() { if (this.b != null) { this.b.rootWrapper.setStyleProperty("background-color", this.a.aq._fill); } } j() { if (this.b != null) { let a = this.b.rootWrapper.getChildAt(1); a.setStyleProperty("width", "100%"); if (this.a.v != null) { a.setStyleProperty("height", "calc(100% - 25px"); } else { a.setStyleProperty("height", "calc(100% - 5px"); } } } k() { if (this.e != null && this.a.v != null) { this.e.setText(this.a.v); this.e.setStyleProperty("font", "16px Verdana"); } this.l(); this.m(); this.j(); } l() { if (this.e != null && this.a.ar != null) { this.e.setStyleProperty("color", this.a.ar._fill); } } m() { if (this.e != null && this.a.j != null) { this.e.setStyleProperty("font", this.a.j.fontString); } } f() { } } ColumnChooserView.$t = /*@__PURE__*/ markType(ColumnChooserView, 'ColumnChooserView'); return ColumnChooserView; })(); /** * @hidden */ export let ColumnChooser = /*@__PURE__*/ (() => { class ColumnChooser extends Base { constructor() { super(); this.a = null; this.d = null; this.propertyChanged = null; this.m = false; this.k = null; this.b = null; this.o = null; this.i = null; this.ap = BrushUtil.h(255, 0, 153, 255); this.n = null; this.e = 1; this.g = 2; this.ao = BrushUtil.h(255, 248, 248, 248); this.m = false; let a = new ColumnChooserView(); a.a = this; this.a = a; this.a.h(); } notifySizeChanged() { this.a.f(); } destroy() { if (this.d != null) { let a = this.d; a.checkedChanged = delegateRemove(a.checkedChanged, runOn(this, this.ac)); let b = this.d; b.selectAllCheckboxChanged = delegateRemove(b.selectAllCheckboxChanged, runOn(this, this.ad)); } this.provideContainer(null, null); if (this.b != null) { let c = this.b.actualColumns; c.collectionChanged = delegateRemove(c.collectionChanged, runOn(this, this.z)); let d = this.b; d.columnHiddenChanged = delegateRemove(d.columnHiddenChanged, runOn(this, this.am)); } } provideContainer(a, b) { this.d = b; if (this.d != null) { let c = this.d; c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.ac)); let d = this.d; d.selectAllCheckboxChanged = delegateCombine(d.selectAllCheckboxChanged, runOn(this, this.ad)); } this.aa(); this.a.g(a); } get l() { if (this.k == null) { this.k = new SRProvider(this.a.b); this.k.cb("DataGrid"); } return this.k; } get c() { return this.b; } set c(a) { let b = this.b; this.b = a; if (b != this.b) { this.ag("TargetGrid", b, this.b); } } get v() { return this.o; } set v(a) { let b = this.o; this.o = a; if (b != this.o) { this.ag("Title", b, this.o); } } get j() { return this.i; } set j(a) { let b = this.i; this.i = a; if (b != this.i) { this.ag("TitleStyle", b, this.i); } } get ar() { return this.ap; } set ar(a) { let b = this.ap; this.ap = a; if (b != this.ap) { this.ag("TitleColor", b, this.ap); } } get s() { return this.n != null ? this.n : !stringIsNullOrWhiteSpace(this.l.b1("Filter_Columns_List")) ? this.l.b1("Filter_Columns_List") : "Filter columns list ..."; } set s(a) { let b = this.n; this.n = a; if (b != this.n) { this.ag("FilterPlaceholderText", b, this.n); } } get f() { return this.e; } set f(a) { let b = this.e; this.e = a; if (b != this.e) { this.ag("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.e)); } } get h() { return this.g; } set h(a) { let b = this.g; this.g = a; if (b != this.g) { this.ag("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.g)); } } get aq() { return this.ao; } set aq(a) { let b = this.ao; this.ao = a; if (b != this.ao) { this.ag("BackgroundColor", b, this.ao); } } ag(a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.ah(a, b, c); } ah(a, b, c) { switch (a) { case "TargetGrid": if (b != null) { let d = b.actualColumns; d.collectionChanged = delegateRemove(d.collectionChanged, runOn(this, this.z)); let e = b; e.columnHiddenChanged = delegateRemove(e.columnHiddenChanged, runOn(this, this.am)); } if (this.b != null) { let f = this.b.actualColumns; f.collectionChanged = delegateCombine(f.collectionChanged, runOn(this, this.z)); let g = this.b; g.columnHiddenChanged = delegateCombine(g.columnHiddenChanged, runOn(this, this.am)); } this.aa(); break; case "Title": this.a.k(); break; case "TitleStyle": this.a.m(); break; case "TitleColor": this.a.l(); break; case "FilterPlaceholderText": if (this.d != null) { this.d.bm = this.s; } break; case "BaseTheme": this.ak(); break; case "Density": this.aj(); break; case "BackgroundColor": if (this.d != null) { this.d.backgroundColor = this.aq; } this.a.i(); break; } } ak() { if (this.d != null) { this.d.baseTheme = this.f; } } aj() { if (this.d != null) { this.d.density = this.h; } } am(a, b) { if (this.m == false) { this.aa(); } this.m = false; } z(a, b) { this.aa(); } aa() { if (this.b != null && this.d != null) { this.d.baseTheme = this.f; this.d.density = this.h; this.d.backgroundColor = this.aq; let a; let b = new ObservableCollection$1(ColumnChooserInfo.$, 0); for (let c of fromEnum(this.b.actualColumns)) { a = new ColumnChooserInfo(); let d = c.lo; if (c.lv != null) { d = c.lv; } a.columnName = d; a.isNotHidden = !c.jp; b.add(a); } if (this.s != null) { this.d.bm = this.s; } this.d.itemsSource = b; let e = ""; let f = ""; e = "columnName"; f = "isNotHidden"; this.d.selectedMemberPath = f; this.d.dataMemberPath = e; this.d.showSelectAll = true; } } an(a) { if (this.d != null) { this.d.updateHrMargin(a); } } al() { this.d.dd(); if (this.b != null) { for (let a of fromEnum(this.b.actualColumns)) { this.m = true; a.jp = false; } } } ae() { this.d.ci(); if (this.b != null) { for (let a of fromEnum(this.b.actualColumns)) { this.m = true; a.jp = true; } } } ad(a, b) { this.m = true; if (b.a) { this.al(); } else { this.ae(); } } ac(a, b) { this.m = true; let c = this.d.f.actualDataSource.getItemAtIndex(b.c); let d = this.b.actualColumns.count; for (let e = 0; e < d; e++) { if (this.b.actualColumns._inner[e].lo == c.columnName || this.b.actualColumns._inner[e].mf == c.columnName || this.b.actualColumns._inner[e].lv == c.columnName) { this.b.actualColumns._inner[e].jp = !b.b; this.b.actualColumns._inner[e].mz("Hidden"); } } } } ColumnChooser.$t = /*@__PURE__*/ markType(ColumnChooser, 'ColumnChooser', Base.$, [INotifyPropertyChanged_$type]); return ColumnChooser; })();