igniteui-react-grids
Version:
Ignite UI React grid components.
413 lines (412 loc) • 13.9 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 { __extends, __values } from "tslib";
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
*/
var ColumnPinningView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ColumnPinningView, _super);
function ColumnPinningView() {
var _this = _super.call(this) || this;
_this.c = null;
_this.a = null;
_this.b = null;
return _this;
}
ColumnPinningView.prototype.f = function () {
};
ColumnPinningView.prototype.e = function (a) {
if (a == null) {
this.b = null;
return;
}
this.b = a;
var b = Math.round(a.rootWrapper.width());
var 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();
};
ColumnPinningView.prototype.g = function () {
if (this.b != null) {
this.b.rootWrapper.setStyleProperty("background-color", this.a.an._fill);
}
};
ColumnPinningView.prototype.i = function () {
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();
};
ColumnPinningView.prototype.j = function () {
if (this.c != null && this.a.ao != null) {
this.c.setStyleProperty("color", this.a.ao._fill);
}
};
ColumnPinningView.prototype.k = function () {
if (this.c != null && this.a.j != null) {
this.c.setStyleProperty("font", this.a.j.fontString);
}
};
ColumnPinningView.prototype.h = function () {
if (this.b != null) {
var 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");
}
}
};
ColumnPinningView.prototype.d = function () {
};
ColumnPinningView.$t = markType(ColumnPinningView, 'ColumnPinningView');
return ColumnPinningView;
}(Base));
export { ColumnPinningView };
/**
* @hidden
*/
var ColumnPinning = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(ColumnPinning, _super);
function ColumnPinning() {
var _this = _super.call(this) || this;
_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;
var a = new ColumnPinningView();
a.a = _this;
_this.a = a;
_this.a.f();
return _this;
}
ColumnPinning.prototype.ak = function (a) {
if (this.d != null) {
this.d.updateHrMargin(a);
}
};
ColumnPinning.prototype.notifySizeChanged = function () {
this.a.d();
};
ColumnPinning.prototype.destroy = function () {
if (this.d != null) {
var a = this.d;
a.checkedChanged = delegateRemove(a.checkedChanged, runOn(this, this.ae));
}
this.provideContainer(null, null);
if (this.b != null) {
var b = this.b.actualColumns;
b.collectionChanged = delegateRemove(b.collectionChanged, runOn(this, this.z));
var c = this.b;
c.columnPinnedChanged = delegateRemove(c.columnPinnedChanged, runOn(this, this.aj));
}
};
ColumnPinning.prototype.provideContainer = function (a, b) {
this.d = b;
if (this.d != null) {
var c = this.d;
c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.ae));
}
this.aa();
this.a.e(a);
};
Object.defineProperty(ColumnPinning.prototype, "l", {
get: function () {
if (this.k == null) {
this.k = new SRProvider(this.a.b);
this.k.cb("DataGrid");
}
return this.k;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "c", {
get: function () {
return this.b;
},
set: function (a) {
var b = this.b;
this.b = a;
if (b != this.b) {
this.ad("TargetGrid", b, this.b);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "v", {
get: function () {
return this.o;
},
set: function (a) {
var b = this.o;
this.o = a;
if (b != this.o) {
this.ad("Title", b, this.o);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "j", {
get: function () {
return this.i;
},
set: function (a) {
var b = this.i;
this.i = a;
if (b != this.i) {
this.ad("TitleStyle", b, this.i);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "ao", {
get: function () {
return this.am;
},
set: function (a) {
var b = this.am;
this.am = a;
if (b != this.am) {
this.ad("TitleColor", b, this.am);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "s", {
get: function () {
return this.n != null ? this.n : !stringIsNullOrWhiteSpace(this.l.b1("Filter_Columns_List")) ? this.l.b1("Filter_Columns_List") : "Filter columns list ...";
},
set: function (a) {
var b = this.n;
this.n = a;
if (b != this.n) {
this.ad("FilterPlaceholderText", b, this.n);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "f", {
get: function () {
return this.e;
},
set: function (a) {
var b = this.e;
this.e = a;
if (b != this.e) {
this.ad("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.e));
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "h", {
get: function () {
return this.g;
},
set: function (a) {
var b = this.g;
this.g = a;
if (b != this.g) {
this.ad("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.g));
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(ColumnPinning.prototype, "an", {
get: function () {
return this.al;
},
set: function (a) {
var b = this.al;
this.al = a;
if (b != this.al) {
this.ad("BackgroundColor", b, this.al);
}
},
enumerable: false,
configurable: true
});
ColumnPinning.prototype.ad = function (a, b, c) {
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
this.af(a, b, c);
};
ColumnPinning.prototype.af = function (a, b, c) {
switch (a) {
case "TargetGrid":
if (b != null) {
var d = b.actualColumns;
d.collectionChanged = delegateRemove(d.collectionChanged, runOn(this, this.z));
var e = b;
e.columnPinnedChanged = delegateRemove(e.columnPinnedChanged, runOn(this, this.aj));
}
if (this.b != null) {
var f = this.b.actualColumns;
f.collectionChanged = delegateCombine(f.collectionChanged, runOn(this, this.z));
var 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;
}
};
ColumnPinning.prototype.ai = function () {
if (this.d != null) {
this.d.baseTheme = this.f;
}
};
ColumnPinning.prototype.ah = function () {
if (this.d != null) {
this.d.density = this.h;
}
};
ColumnPinning.prototype.aj = function (a, b) {
if (this.m == false) {
this.aa();
}
this.m = false;
};
ColumnPinning.prototype.z = function (a, b) {
this.aa();
};
ColumnPinning.prototype.aa = function () {
var e_1, _a;
if (this.b != null && this.d != null) {
this.d.baseTheme = this.f;
this.d.density = this.h;
this.d.backgroundColor = this.an;
var a = void 0;
var b = new ObservableCollection$1(ColumnPinningInfo.$, 0);
try {
for (var _b = __values(fromEnum(this.b.actualColumns)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
a = new ColumnPinningInfo();
var 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);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
this.d.showSelectAll = false;
if (this.s != null) {
this.d.bm = this.s;
}
this.d.itemsSource = b;
var e = "";
var f = "";
e = "columnName";
f = "isPinned";
this.d.selectedMemberPath = f;
this.d.dataMemberPath = e;
}
};
ColumnPinning.prototype.ae = function (a, b) {
this.m = true;
var c = this.d.f.actualDataSource.getItemAtIndex(b.c);
var d = this.b.actualColumns.count;
for (var 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 = markType(ColumnPinning, 'ColumnPinning', Base.$, [INotifyPropertyChanged_$type]);
return ColumnPinning;
}(Base));
export { ColumnPinning };