igniteui-react-grids
Version:
Ignite UI React grid components.
221 lines (220 loc) • 7.73 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 { ObservableCollection$1 } from "igniteui-react-core";
import { PrimaryKeyValue } from "./PrimaryKeyValue";
import { PropertyChangedEventArgs, delegateCombine, Delegate_$type, delegateRemove, Number_$type, fromEnum, markType } from "igniteui-react-core";
import { NotifyCollectionChangedEventArgs } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
/**
* @hidden
*/
var GridSelectedKeysCollection = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(GridSelectedKeysCollection, _super);
function GridSelectedKeysCollection() {
var _this = _super.call(this, PrimaryKeyValue.$, 0) || this;
_this.ak = new List$1(Delegate_$type, 0);
_this.ah = false;
_this.af = true;
_this.ai = new Dictionary$2(PrimaryKeyValue.$, Number_$type, 0);
_this.aj = new Dictionary$2(Number_$type, PrimaryKeyValue.$, 0);
return _this;
}
Object.defineProperty(GridSelectedKeysCollection.prototype, "ae", {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
GridSelectedKeysCollection.prototype.an = function (a) {
this.collectionChanged = delegateCombine(this.collectionChanged, a);
};
GridSelectedKeysCollection.prototype.am = function (a) {
this.ak.add(a);
};
GridSelectedKeysCollection.prototype.ao = function (a) {
this.ak.remove(a);
};
GridSelectedKeysCollection.prototype.ap = function (a) {
this.collectionChanged = delegateRemove(this.collectionChanged, a);
};
Object.defineProperty(GridSelectedKeysCollection.prototype, "ag", {
get: function () {
return this.af;
},
set: function (a) {
this.af = a;
},
enumerable: false,
configurable: true
});
GridSelectedKeysCollection.prototype.n = function (a) {
_super.prototype.n.call(this, a);
if (this.ag) {
this.ai.addItem(a, this.count - 1);
this.aj.addItem(this.count - 1, a);
}
};
GridSelectedKeysCollection.prototype.o = function (a) {
var e_1, _a;
var b = this.count;
_super.prototype.o.call(this, a);
if (this.ag) {
try {
for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
this.ai.addItem(c, b);
this.aj.addItem(b, c);
b++;
}
}
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;
}
}
}
};
GridSelectedKeysCollection.prototype.p = function () {
var e_2, _a, e_3, _b;
var a = new List$1(Delegate_$type, 0);
try {
for (var _c = __values(fromEnum(this.ak)), _d = _c.next(); !_d.done; _d = _c.next()) {
var b = _d.value;
a.add(b);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_d && !_d.done && (_a = _c.return))
_a.call(_c);
}
finally {
if (e_2)
throw e_2.error;
}
}
try {
for (var _e = __values(fromEnum(a)), _f = _e.next(); !_f.done; _f = _e.next()) {
var c = _f.value;
c();
}
}
catch (e_3_1) {
e_3 = { error: e_3_1 };
}
finally {
try {
if (_f && !_f.done && (_b = _e.return))
_b.call(_e);
}
finally {
if (e_3)
throw e_3.error;
}
}
_super.prototype.p.call(this);
if (this.ag) {
this.ai.clear();
this.aj.clear();
}
};
GridSelectedKeysCollection.prototype.u = function (a) {
if (this.ag) {
if (this.aj.containsKey(a)) {
var b = this.aj.item(a);
this.ai.removeItem(b);
this.aj.removeItem(a);
for (var c = a + 1; c < this.count; c++) {
if (this.aj.containsKey(c)) {
var d = this.aj.item(c);
this.aj.removeItem(c);
this.aj.addItem(c - 1, d);
this.ai.item(d, c - 1);
}
}
}
}
var e = this._inner[a];
if (a == 0) {
this._inner.shift();
}
else {
this._inner.splice(a, 1);
}
this.ad(new PropertyChangedEventArgs("Count"));
this.ad(new PropertyChangedEventArgs("Item[]"));
if (!this.ah) {
this.ac(new NotifyCollectionChangedEventArgs(1, 1, e, a));
}
};
GridSelectedKeysCollection.prototype.v = function (index_, numToRemove_) {
_super.prototype.v.call(this, index_, numToRemove_);
if (this.ag) {
for (var a = index_; a < index_ + numToRemove_; a++) {
if (this.aj.containsKey(a)) {
var b = this.aj.item(a);
this.ai.removeItem(b);
this.aj.removeItem(a);
}
}
}
};
GridSelectedKeysCollection.prototype.x = function (a, b) {
_super.prototype.x.call(this, a, b);
if (this.ag) {
if (this.aj.containsKey(a)) {
var c = this.aj.item(a);
this.aj.item(a, b);
this.ai.removeItem(c);
this.ai.addItem(b, a);
}
}
};
GridSelectedKeysCollection.prototype.r = function (a, b) {
_super.prototype.r.call(this, a, b);
if (this.ag) {
for (var c = a; c < this.count; c++) {
var d = this._inner[c];
if (this.ai.containsKey(d)) {
this.ai.item(d, c);
this.aj.removeItem(c);
this.aj.addItem(c, d);
}
else {
this.ai.addItem(d, c);
this.aj.addItem(c, d);
}
}
}
};
GridSelectedKeysCollection.prototype.al = function (a) {
if (this.ag) {
if (this.ai.containsKey(a)) {
return this.ai.item(a);
}
return -1;
}
return this.indexOf(a);
};
GridSelectedKeysCollection.$t = markType(GridSelectedKeysCollection, 'GridSelectedKeysCollection', ObservableCollection$1.$.specialize(PrimaryKeyValue.$));
return GridSelectedKeysCollection;
}(ObservableCollection$1));
export { GridSelectedKeysCollection };