igniteui-react-grids
Version:
Ignite UI React grid components.
357 lines (356 loc) • 12 kB
JavaScript
/*
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 { ColumnPinningInfo } from "./ColumnPinningInfo";
import { stringIsNullOrWhiteSpace } from "igniteui-react-core";
/**
* @hidden
*/
export let ColumnPinningView = /*@__PURE__*/ (() => {
class ColumnPinningView extends Base {
constructor() {
super();
this.c = null;
this.a = null;
this.b = null;
}
f() {
}
e(a) {
if (a == null) {
this.b = null;
return;
}
this.b = a;
let b = Math.round(a.rootWrapper.width());
let c = Math.round(a.rootWrapper.height());
this.b.rootWrapper.setStyleProperty("position", "relative");
this.g();
this.c = this.b.rootWrapper.getChildAt(0);
this.c.setStyleProperty("margin", "4px 0px 4px 0px");
this.i();
this.h();
}
g() {
if (this.b != null) {
this.b.rootWrapper.setStyleProperty("background-color", this.a.an._fill);
}
}
i() {
if (this.c != null && this.a.v != null) {
this.c.setText(this.a.v);
this.c.setStyleProperty("font", "16px Verdana");
}
this.j();
this.k();
this.h();
}
j() {
if (this.c != null && this.a.ao != null) {
this.c.setStyleProperty("color", this.a.ao._fill);
}
}
k() {
if (this.c != null && this.a.j != null) {
this.c.setStyleProperty("font", this.a.j.fontString);
}
}
h() {
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");
}
}
}
d() {
}
}
ColumnPinningView.$t = /*@__PURE__*/ markType(ColumnPinningView, 'ColumnPinningView');
return ColumnPinningView;
})();
/**
* @hidden
*/
export let ColumnPinning = /*@__PURE__*/ (() => {
class ColumnPinning 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.am = BrushUtil.h(255, 0, 153, 255);
this.n = null;
this.e = 1;
this.g = 2;
this.al = BrushUtil.h(255, 248, 248, 248);
this.m = false;
let a = new ColumnPinningView();
a.a = this;
this.a = a;
this.a.f();
}
ak(a) {
if (this.d != null) {
this.d.updateHrMargin(a);
}
}
notifySizeChanged() {
this.a.d();
}
destroy() {
if (this.d != null) {
let a = this.d;
a.checkedChanged = delegateRemove(a.checkedChanged, runOn(this, this.ae));
}
this.provideContainer(null, null);
if (this.b != null) {
let b = this.b.actualColumns;
b.collectionChanged = delegateRemove(b.collectionChanged, runOn(this, this.z));
let c = this.b;
c.columnPinnedChanged = delegateRemove(c.columnPinnedChanged, runOn(this, this.aj));
}
}
provideContainer(a, b) {
this.d = b;
if (this.d != null) {
let c = this.d;
c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.ae));
}
this.aa();
this.a.e(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.ad("TargetGrid", b, this.b);
}
}
get v() {
return this.o;
}
set v(a) {
let b = this.o;
this.o = a;
if (b != this.o) {
this.ad("Title", b, this.o);
}
}
get j() {
return this.i;
}
set j(a) {
let b = this.i;
this.i = a;
if (b != this.i) {
this.ad("TitleStyle", b, this.i);
}
}
get ao() {
return this.am;
}
set ao(a) {
let b = this.am;
this.am = a;
if (b != this.am) {
this.ad("TitleColor", b, this.am);
}
}
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.ad("FilterPlaceholderText", b, this.n);
}
}
get f() {
return this.e;
}
set f(a) {
let b = this.e;
this.e = a;
if (b != this.e) {
this.ad("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.ad("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.g));
}
}
get an() {
return this.al;
}
set an(a) {
let b = this.al;
this.al = a;
if (b != this.al) {
this.ad("BackgroundColor", b, this.al);
}
}
ad(a, b, c) {
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
this.af(a, b, c);
}
af(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.columnPinnedChanged = delegateRemove(e.columnPinnedChanged, runOn(this, this.aj));
}
if (this.b != null) {
let f = this.b.actualColumns;
f.collectionChanged = delegateCombine(f.collectionChanged, runOn(this, this.z));
let g = this.b;
g.columnPinnedChanged = delegateCombine(g.columnPinnedChanged, runOn(this, this.aj));
}
this.aa();
break;
case "Title":
this.a.i();
break;
case "TitleStyle":
this.a.k();
break;
case "TitleColor":
this.a.j();
break;
case "FilterPlaceholderText":
if (this.d != null) {
this.d.bm = this.s;
}
break;
case "BaseTheme":
this.ai();
break;
case "Density":
this.ah();
break;
case "BackgroundColor":
if (this.d != null) {
this.d.backgroundColor = this.an;
}
this.a.g();
break;
}
}
ai() {
if (this.d != null) {
this.d.baseTheme = this.f;
}
}
ah() {
if (this.d != null) {
this.d.density = this.h;
}
}
aj(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.an;
let a;
let b = new ObservableCollection$1(ColumnPinningInfo.$, 0);
for (let c of fromEnum(this.b.actualColumns)) {
a = new ColumnPinningInfo();
let d = c.lo;
if (c.lv != null) {
d = c.lv;
}
a.columnName = d;
if (c.il == 1) {
a.isPinned = true;
}
else {
a.isPinned = false;
}
b.add(a);
}
this.d.showSelectAll = false;
if (this.s != null) {
this.d.bm = this.s;
}
this.d.itemsSource = b;
let e = "";
let f = "";
e = "columnName";
f = "isPinned";
this.d.selectedMemberPath = f;
this.d.dataMemberPath = e;
}
}
ae(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) {
if (this.b.actualColumns._inner[e].il == 0) {
this.b.actualColumns._inner[e].il = 1;
}
else if (this.b.actualColumns._inner[e].il == 2) {
this.b.actualColumns._inner[e].il = 1;
}
else {
this.b.actualColumns._inner[e].il = 0;
}
this.b.actualColumns._inner[e].mz("Pinned");
break;
}
}
}
}
ColumnPinning.$t = /*@__PURE__*/ markType(ColumnPinning, 'ColumnPinning', Base.$, [INotifyPropertyChanged_$type]);
return ColumnPinning;
})();