igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
1,457 lines (1,456 loc) • 83.3 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 } from "tslib";
import { Base, String_$type, Number_$type, typeCast, Array_$type, Boolean_$type, markType } from "./type";
import { ISupportsDataChangeNotifications_$type } from "./ISupportsDataChangeNotifications";
import { List$1 } from "./List$1";
import { SectionData } from "./SectionData";
import { SectionMap } from "./SectionMap";
import { Dictionary$2 } from "./Dictionary$2";
import { DataSourceSpecialRow } from "./DataSourceSpecialRow";
import { SummaryGroup } from "./SummaryGroup";
import { RemovedShiftedRowInfo } from "./RemovedShiftedRowInfo";
import { dateNow } from "./date";
/**
* @hidden
*/
var RearrangedListView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(RearrangedListView, _super);
function RearrangedListView(a) {
var _this = _super.call(this) || this;
_this.n = null;
_this.a4 = null;
_this.z = new SectionMap();
_this.e = null;
_this.a = null;
_this.b = null;
_this.c = null;
_this.d = null;
_this.a8 = 0;
_this.a7 = 0;
_this.am = false;
_this.as = false;
_this.o = null;
_this.a0 = null;
_this.az = null;
_this.s = null;
_this.aa = null;
_this.ac = null;
_this.m = null;
_this.ae = null;
_this.af = null;
_this.ag = null;
_this.ap = false;
_this.k = 0;
_this.j = 0;
_this.av = false;
_this.au = false;
_this.aw = false;
_this.ah = false;
_this.a3 = new List$1(Array_$type, 0);
_this.ay = new Dictionary$2(String_$type, Boolean_$type, 0);
_this.n = a;
return _this;
}
Object.defineProperty(RearrangedListView.prototype, "bk", {
get: function () {
return this.a7;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "i", {
get: function () {
return this.e;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "a6", {
get: function () {
return this.a4;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "aq", {
get: function () {
if (!this.m.isSectionContentVisible) {
return true;
}
return this.m.isSectionCollapsable;
},
enumerable: false,
configurable: true
});
RearrangedListView.prototype.w = function (a) {
return this.z.e(a);
};
RearrangedListView.prototype.v = function () {
return this.z.d();
};
Object.defineProperty(RearrangedListView.prototype, "p", {
get: function () {
return this.o;
},
set: function (a) {
this.o = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "a2", {
get: function () {
return this.a0;
},
set: function (a) {
this.a0 = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "a1", {
get: function () {
return this.az;
},
set: function (a) {
this.az = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "t", {
get: function () {
return this.s;
},
set: function (a) {
this.s = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "ab", {
get: function () {
return this.aa;
},
set: function (a) {
this.aa = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "ad", {
get: function () {
return this.ac;
},
set: function (a) {
this.ac = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "l", {
get: function () {
return this.k;
},
set: function (a) {
this.k = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(RearrangedListView.prototype, "ar", {
get: function () {
if (!this.m.isSectionContentVisible) {
return false;
}
if (this.aq) {
return this.m.isSectionExpandedDefault;
}
return true;
},
enumerable: false,
configurable: true
});
RearrangedListView.prototype.b6 = function () {
var _this = this;
if (this.a4 == this.n || this.a4 == null) {
this.a4 = new List$1(Base.$, 0);
}
this.a4.clear();
if (!this.aq) {
this.ay.clear();
}
if (this.n == null) {
return;
}
var a = this.n.actualCount;
this.a7 = 0;
this.a8 = this.ba();
this.br(null);
var b = this.ag.k.count > 0 && this.l != 2 && this.l != 3;
if (this.s == null) {
for (var c = 0; c < a; c++) {
var d = this.n.getItemAtIndex(c);
this.a4.add1(d);
if (b) {
this.bq(null, d);
}
}
}
else {
for (var e = 0; e < a; e++) {
var f = this.n.getItemAtIndex(e);
if (this.s(f)) {
this.a4.add1(f);
if (b) {
this.bq(null, f);
}
}
}
}
this.bu(null);
if (this.a0 != null) {
this.a4.z(this.a0);
}
this.ah = false;
this.z.v();
if (this.ae != null && this.ae.k.count > 0) {
this.ah = true;
this.b1();
}
else {
this.z.t.add(((function () {
var $ret = new SectionData();
$ret.ae = 0;
$ret.e = null;
$ret.f = null;
$ret.af = 0;
$ret.ad = _this.a4.count;
$ret.c = new Array(0);
$ret.d = new Array(1);
return $ret;
})()));
}
if (b) {
this.bw(this.e);
}
var g = this.p;
var h = new List$1(Base.$, 0);
if (this.a3.count > 0 && this.aw) {
if (!this.ah) {
var i = this.z.t._inner[0];
for (var j = 0; j < this.a3.count; j++) {
var k = this.m.indexOfKey(this.a3._inner[j]);
if (k != -1) {
this.bj(i, this.a4._inner[k], j);
}
}
}
else {
for (var l = 0; l < this.a3.count; l++) {
var m = this.m.indexOfKey(this.a3._inner[l]);
if (m != -1) {
var n = this.z.e(m);
this.bj(n, this.a4._inner[m], l);
}
}
}
}
if (this.ab != null) {
this.ab.notifyClearItems();
}
};
RearrangedListView.prototype.bl = function (a, b) {
var c = null;
if (a.p) {
if (b) {
var d = a.af + a.v() + a.ah + a.aa;
c = this.a4._inner[d];
}
else {
var e = a.ad - a.u - a.ag;
c = this.a4._inner[e];
}
}
return c;
};
Object.defineProperty(RearrangedListView.prototype, "a5", {
get: function () {
return this.z.t;
},
enumerable: false,
configurable: true
});
RearrangedListView.prototype.b1 = function () {
if (this.a4.count == 0) {
return;
}
var a = dateNow();
var b = this.f();
var c = this.g();
var d = this.j == 1 ? c.length : 1;
if (this.b == null || this.b.length != c.length) {
this.a = new Array(d);
this.b = new Array(d);
for (var e = 0; e < d; e++) {
this.a[e] = null;
this.b[e] = null;
}
}
this.c = new Array(d);
for (var f = 0; f < d; f++) {
this.c[f] = new Array(this.ag.k.count);
}
var g = this.l == 3 || this.l == 1;
var h = new List$1(Base.$, 0);
var i = null;
var j = null;
if (this.m.isSectionContentVisible || !this.av) {
for (var k = 0; k < this.a4.count; k++) {
var l = this.a4._inner[k];
if (l == null) {
continue;
}
if (i == null) {
var m = this.x(k, l, c);
k += this.bc(m, k, b, c, true);
this.bs(m, true, g);
this.z.z(m, 1);
this.bq(m, l);
j = l;
}
else {
if (this.a1.compare(i, l) != 0) {
var n = this.z.t._inner[this.z.t.count - 1];
if (n.q) {
k += this.bb(k, j, b, c);
}
this.bt(k - 1, j, b);
var o = this.x(k, l, c);
this.bs(o, false, g);
var p = this.bc(o, k, b, c, true);
k += p;
o.q = this.z.r(o);
this.z.z(o, 1);
this.bq(o, l);
j = l;
}
else {
var q = this.z.t._inner[this.z.t.count - 1];
this.z.z(q, 1);
this.bq(q, l);
}
}
if (k == this.a4.count - 1) {
var r = this.z.t._inner[this.z.t.count - 1];
if (r.q) {
k += this.bb(k + 1, j, b, c);
}
this.bt(k, j, b);
}
i = l;
}
if (!g) {
if (this.j == 1) {
for (var s = 0; s < c.length; s++) {
if (this.b[s] == null) {
continue;
}
for (var t = 0; t < this.ag.k.count; t++) {
this.b[s].i[s][t] = this.c[s][t].endCalculation();
this.b[s].i[s][t].summaryIndex = t;
this.b[s].i[s][t].groupKey = this.b[s].f;
}
for (var u = 0; u < this.b[s].h.length; u++) {
if (this.b[s].h[u] == -1) {
this.b[s].h[u] = this.z.t._inner[this.z.t.count - 1].ad + 1;
}
}
}
}
else {
if (this.b[0] != null) {
for (var v = 0; v < this.ag.k.count; v++) {
this.b[0].i[0][v] = this.c[0][v].endCalculation();
this.b[0].i[0][v].summaryIndex = v;
this.b[0].i[0][v].groupKey = this.b[0].f;
}
this.b[0].h[0] = this.z.t._inner[this.z.t.count - 1].ad + 1;
}
}
}
this.bx();
for (var w = 0; w < this.z.t.count; w++) {
var x = this.z.t._inner[w];
if (this.av) {
if (!x.q) {
var y = x.ad - x.af + 1;
if (this.j == 1 && this.ae.k.count > 1 && this.am && this.as) {
var z = x.w();
var aa = false;
if (w + 1 < this.z.t.count && this.z.t._inner[w + 1].w() == 0) {
aa = true;
}
if (aa) {
var ab = x.v();
y = ab + x.d[x.d.length - 1];
}
}
this.a4.v(x.af, y);
this.z.ae(x.ae);
this.z.ab(x, -y, -y);
w--;
}
else if (!x.p) {
var ac = 0;
var ad = x.w();
for (var ae = ad; ae < x.c.length; ae++) {
ac = x.b[ae];
if (!x.c[ae]) {
break;
}
}
var af = x.af + ac + 1;
var ag = x.d[x.d.length - 1];
this.a4.v(af, ag);
x.ad -= ag;
this.z.ac(x, -ag, -ag);
}
}
}
}
else {
for (var ah = 0; ah < this.a4.count; ah++) {
var ai = this.a4._inner[ah];
if (ai == null) {
continue;
}
if (i == null) {
var aj = this.x(ah, ai, c);
this.bd(h, aj, ai, b, c, true);
this.bs(aj, true, g);
this.z.z(aj, 1);
this.bq(aj, ai);
j = ai;
}
else {
if (this.a1.compare(i, ai) != 0) {
var ak = this.z.t._inner[this.z.t.count - 1];
this.bt(h.count - 1, j, b);
var al = this.x(ah, ai, c);
this.bs(al, false, g);
this.bd(h, al, ai, b, c, true);
al.q = this.z.r(al);
this.z.z(al, 1);
this.bq(al, ai);
j = ai;
}
else {
var am = this.z.t._inner[this.z.t.count - 1];
this.z.z(am, 1);
this.bq(am, ai);
}
}
if (ah == this.a4.count - 1) {
var an = this.z.t._inner[this.z.t.count - 1];
this.bt(ah, j, b);
}
i = ai;
}
this.a4 = h;
}
for (var ao = 0; ao < this.b.length; ao++) {
this.a[ao] = null;
this.b[ao] = null;
}
this.c = null;
var ap = dateNow();
};
RearrangedListView.prototype.bs = function (a, b, c) {
if (b) {
for (var d = 0; d < this.b.length; d++) {
this.b[d] = a;
if (!c) {
for (var e = 0; e < this.ag.k.count; e++) {
var f = this.ag.k.item(e);
this.c[d][e] = f.f();
this.c[d][e].beginCalculation(this.m, f.propertyName);
}
}
}
}
if (this.j == 1) {
var g = false;
var h = a.e.length;
for (var i = 0; i < h; i++) {
if (g) {
if (!c) {
for (var j = 0; j < this.ag.k.count; j++) {
this.b[i].i[i][j] = this.c[i][j].endCalculation();
this.b[i].i[i][j].summaryIndex = j;
this.b[i].i[i][j].groupKey = this.b[i].f;
this.c[i][j].beginCalculation(this.m, this.ag.k.item(j).propertyName);
}
this.b[i].h[i] = a.af;
}
this.b[i] = a;
continue;
}
var k = false;
if (this.b[i].f[i] == null) {
k = a.f[i] != null;
}
else {
k = !Base.equalsStatic(this.b[i].f[i], a.f[i]);
}
if (k) {
if (!c) {
for (var l = 0; l < this.ag.k.count; l++) {
this.b[i].i[i][l] = this.c[i][l].endCalculation();
this.b[i].i[i][l].summaryIndex = l;
this.b[i].i[i][l].groupKey = this.b[i].f;
this.c[i][l].beginCalculation(this.m, this.ag.k.item(l).propertyName);
}
this.b[i].h[i] = a.af;
}
this.b[i] = a;
if (i - 1 > -1) {
var m = i - 1;
while (m >= 0 && this.b[m].o) {
m = m - 1;
}
a.z = this.b[m].ae;
}
g = true;
}
}
}
else {
var n = false;
for (var o = 0; o < a.e.length; o++) {
if (this.b[0].f[o] == null) {
if (this.b[0].f[o] != a.f[o]) {
n = true;
break;
}
continue;
}
if (!Base.equalsStatic(this.b[0].f[o], a.f[o])) {
n = true;
break;
}
}
if (n) {
if (!c) {
for (var p = 0; p < this.ag.k.count; p++) {
this.b[0].i[0][p] = this.c[0][p].endCalculation();
this.b[0].i[0][p].summaryIndex = p;
this.b[0].i[0][p].groupKey = this.b[0].f;
this.c[0][p].beginCalculation(this.m, this.ag.k.item(p).propertyName);
}
this.b[0].h[0] = a.af;
}
this.b[0] = a;
}
}
};
RearrangedListView.prototype.ba = function () {
var a = 0;
var b = new Dictionary$2(String_$type, Number_$type, 0);
for (var c = 0; c < this.ag.k.count; c++) {
var d = this.ag.k.item(c).propertyName;
if (!b.containsKey(d)) {
b.addItem(d, 1);
}
else {
b.item(d, b.item(d) + 1);
}
if (b.item(d) > a) {
a = b.item(d);
}
}
return a;
};
RearrangedListView.prototype.bd = function (a, b, c, d, e, f) {
var g = 0;
if (this.av) {
if (this.m.sectionHeaderDisplayMode == 0) {
if (this.an(a, 0, c, d, e, f)) {
this.z.y();
g++;
if (b != null) {
var h = this.bm(b);
b.a[0] = h;
b.c[0] = this.al(h);
b.b[0] = (a.count - 1) - b.af;
}
}
}
else if (this.m.sectionHeaderDisplayMode == 1) {
for (var i = 0, j = 0; i < e.length; i++) {
var k = a.count + j;
if (this.an(a, i, c, d, [e[i]], f)) {
g++;
this.z.y();
if (b != null) {
var l = this.bn(b, i);
b.a[i] = l;
b.c[i] = this.al(l);
b.b[i] = k - b.af;
if (!b.c[i]) {
break;
}
}
else if (!this.ar) {
break;
}
j++;
}
}
}
}
return g;
};
RearrangedListView.prototype.bc = function (a, b, c, d, e) {
var f = 0;
if (this.av) {
var g = this.a4._inner[b];
if (this.m.sectionHeaderDisplayMode == 0) {
if (this.ao(b, 0, g, c, d, e)) {
this.z.y();
f++;
if (a != null) {
var h = this.bm(a);
a.a[0] = h;
a.c[0] = this.al(h);
a.b[0] = b - a.af;
}
}
}
else if (this.m.sectionHeaderDisplayMode == 1) {
for (var i = 0, j = 0; i < d.length; i++) {
var k = b + j;
if (this.ao(k, i, g, c, [d[i]], e)) {
f++;
this.z.y();
if (a != null) {
var l = this.bn(a, i);
a.a[i] = l;
a.c[i] = this.al(l);
a.b[i] = k - a.af;
if (!a.c[i]) {
break;
}
}
else if (!this.ar) {
break;
}
j++;
}
}
}
}
return f;
};
RearrangedListView.prototype.ao = function (a, b, c, d, e, f) {
var g = new DataSourceSpecialRow();
g.level = b;
for (var h = 0; h < d.length; h++) {
g.setValue(d[h], this.m.getItemProperty(c, d[h]));
if (h < e.length) {
g.setSectionValue(e[h], this.m.getItemProperty(c, e[h]));
}
}
g.rowType = 1;
g.summaryResults = new Array(this.ag.k.count);
if (f && this.a != null) {
if (this.a[b] != null) {
if (this.a[b].l(g)) {
return false;
}
else {
this.a[b] = g;
for (var i = b + 1; i < this.a.length; i++) {
this.a[i] = null;
}
}
}
else {
this.a[b] = g;
}
}
this.a4.insert1(a, g);
return true;
};
RearrangedListView.prototype.an = function (a, b, c, d, e, f) {
var g = new DataSourceSpecialRow();
g.level = b;
for (var h = 0; h < d.length; h++) {
g.setValue(d[h], this.m.getItemProperty(c, d[h]));
if (h < e.length) {
g.setSectionValue(e[h], this.m.getItemProperty(c, e[h]));
}
}
g.rowType = 1;
g.summaryResults = new Array(this.ag.k.count);
if (f && this.a != null) {
if (this.a[b] != null) {
if (this.a[b].l(g)) {
return false;
}
else {
this.a[b] = g;
for (var i = b + 1; i < this.a.length; i++) {
this.a[i] = null;
}
}
}
else {
this.a[b] = g;
}
}
a.add1(g);
return true;
};
RearrangedListView.prototype.bb = function (a, b, c, d) {
var e = 0;
if (this.au) {
if (this.m.sectionHeaderDisplayMode == 0) {
this.bv(a, 0, b, c, d);
e++;
}
else if (this.m.sectionHeaderDisplayMode == 1) {
for (var f = d.length - 1; f >= 0; f--) {
if (this.z.t._inner[this.z.t.count - 1].c[f]) {
this.bv(a, f, b, c, [d[f]]);
a++;
e++;
}
}
}
}
return e;
};
RearrangedListView.prototype.bv = function (a, b, c, d, e) {
var f = new DataSourceSpecialRow();
f.level = b;
for (var g = 0; g < d.length; g++) {
f.setValue(d[g], this.m.getItemProperty(c, d[g]));
if (g < e.length) {
f.setSectionValue(e[g], this.m.getItemProperty(c, e[g]));
}
}
f.rowType = 2;
this.a4.insert1(a, f);
};
RearrangedListView.prototype.q = function (a, b, c) {
var d = this.r(b, 0, c, 5);
if (this.as) {
a.ag++;
}
else {
a.ah++;
}
a.ad++;
this.z.ac(a, 1, 1);
return d;
};
RearrangedListView.prototype.r = function (a, b, c, d) {
var e = ((function () {
var $ret = new DataSourceSpecialRow();
$ret.level = b;
$ret.rowType = d;
$ret.summaryResults = c;
return $ret;
})());
this.a4.insert1(a, e);
return e;
};
RearrangedListView.prototype.bf = function (a, b, c) {
var d = a.v();
var e = a.af + a.ah + a.aa;
if (this.av) {
e += d;
}
this.bh(e, a.c.length, b);
a.aa++;
a.ad++;
a.t++;
if (c) {
this.z.ac(a, 1, 1);
}
return e;
};
RearrangedListView.prototype.bg = function (a, b, c) {
var d = a.v();
if (this.av) {
b += d;
}
this.bh(b, a.c.length, c);
a.aa++;
a.ad++;
a.t++;
this.z.ac(a, 1, 1);
return b;
};
RearrangedListView.prototype.bh = function (a, b, c) {
var d = new DataSourceSpecialRow();
d.rowType = 3;
d.targetRow = c;
d.level = b;
this.a4.insert1(a, d);
return a + 1;
};
RearrangedListView.prototype.bi = function (a, b) {
var c = -1;
for (var d = 0; d < this.a3.count; d++) {
if (this.p.i(b, this.a3._inner[d]) == 0) {
c = d;
break;
}
}
return this.bj(a, b, c);
};
RearrangedListView.prototype.bj = function (a, b, c) {
var d = -1;
if (c != -1) {
var e = a.af;
var f = e + a.aa;
var g = false;
for (var h = e; h < f; h++) {
var i = this.av ? h + 1 : h;
var j = typeCast(DataSourceSpecialRow.$, this.a4._inner[i]);
if (j.targetRow != null) {
if (this.a0 != null) {
var k = this.a0.compare(b, j.targetRow);
if (k == 0 || k < 0) {
d = this.bg(a, h, b);
g = true;
break;
}
}
else {
var l = -1;
for (var m = 0; m < this.a3.count; m++) {
if (this.p.i(j.targetRow, this.a3._inner[m]) == 0) {
l = m;
break;
}
}
if (l > c) {
d = this.bg(a, h, b);
g = true;
break;
}
}
}
}
if (!g) {
d = this.bf(a, b, true);
g = true;
}
}
return d;
};
RearrangedListView.prototype.bw = function (a) {
var b = SectionData.r(a);
this.a7 = b.count;
for (var c = 0; c < b.count; c++) {
var d = new Array(b._inner[c].count);
b._inner[c].values.copyTo(d, 0);
this.r(this.a4.count, 0, d, 4);
}
};
RearrangedListView.prototype.bx = function () {
if (this.l == 0 || this.l == 2) {
for (var a = 0; a < this.z.t.count; a++) {
var b = this.z.t._inner[a];
if (!b.q) {
continue;
}
if (this.am) {
if (this.as) {
this.by(b, false);
}
else {
this.bz(b, false);
}
}
else {
for (var c = 0; c < b.i.length; c++) {
var d = this.a4._inner[b.af + b.b[c]];
if (d != null) {
d.summaryResults = b.i[c];
}
if (!b.c[c]) {
break;
}
}
}
}
}
};
RearrangedListView.prototype.bz = function (a, b) {
var c = 0;
var d = this.bl(a, !this.as);
for (var e = 0; e < a.i.length; e++) {
if (a.a[e] == null || !a.c[e]) {
continue;
}
var f = SectionData.r(a.i[e]);
if (this.av) {
c += 1;
}
a.g[e] = new SummaryGroup();
a.g[e].a = new Array(this.a8);
for (var g = 0; g < f.count; g++) {
var h = new Array(f._inner[g].count);
f._inner[g].values.copyTo(h, 0);
var i = a.af + c + g;
var j = this.r(i, e + 1, h, 5);
a.ak(j, g);
for (var k = e + 1; k < a.b.length; k++) {
a.b[k]++;
}
a.ad++;
a.ah++;
this.z.ad(a, 1, 1);
if (d != null) {
var l = this.f();
for (var m = 0; m < l.length; m++) {
j.setValue(l[m], this.m.getItemProperty(d, l[m]));
}
}
if (b && this.ab != null) {
this.ab.notifyInsertItem(i, j);
}
}
c += f.count;
}
};
RearrangedListView.prototype.be = function (a, b, c) {
var d = a.h[b];
var e = SectionData.r(a.i[b]);
for (var f = 0; f < e.count; f++) {
var g = new Array(e._inner[f].count);
e._inner[f].values.copyTo(g, 0);
var h = this.z.e(d - 1);
var i = this.r(d + f, b + 1, g, 5);
a.ak(i, f);
h.ad++;
h.ag++;
this.z.ac(h, 1, 1);
var j = null;
var k = 0;
for (var l = d + f - 1; l >= 0; l--) {
var m = this.m.getRowType(l);
if (m == 0 || m == 1) {
j = this.a4._inner[l];
k = m;
break;
}
}
if (j != null) {
var n = this.f();
if (k == 1) {
var o = typeCast(DataSourceSpecialRow.$, j);
for (var p = 0; p < n.length; p++) {
i.setValue(n[p], o.getValue(n[p]));
}
}
else {
for (var q = 0; q < n.length; q++) {
i.setValue(n[q], this.m.getItemProperty(j, n[q]));
}
}
}
if (c && this.ab != null) {
this.ab.notifyInsertItem(d + f, i);
}
}
return e.count;
};
RearrangedListView.prototype.by = function (a, b) {
for (var c = 0; c < a.i.length; c++) {
if (!a.c[c]) {
break;
}
if (a.h[c] == -1) {
continue;
}
a.g[c] = new SummaryGroup();
a.g[c].a = new Array(this.a8);
var d = this.be(a, c, b);
}
};
RearrangedListView.prototype.f = function () {
var a = new Array(this.ae.k.count + this.af.k.count);
var b = 0;
for (var c = 0; c < this.ae.k.count; c++) {
a[b] = this.ae.k.item(c).propertyName;
b++;
}
for (var d = 0; d < this.af.k.count; d++) {
a[b] = this.af.k.item(d).propertyName;
b++;
}
return a;
};
RearrangedListView.prototype.g = function () {
var a = new Array(this.ae.k.count);
var b = 0;
for (var c = 0; c < this.ae.k.count; c++) {
a[b] = this.ae.k.item(c).propertyName;
b++;
}
return a;
};
RearrangedListView.prototype.bt = function (a, b, c) {
this.z.x(a);
};
RearrangedListView.prototype.x = function (a, b, c) {
return this.z.i(a, this.m, b, c, this.m.sectionHeaderDisplayMode, this.ar);
};
RearrangedListView.prototype.cb = function (a) {
this.a3 = new List$1(Array_$type, 0);
for (var b = 0; b < a.count; b++) {
this.a3.add(a._inner[b]);
}
};
RearrangedListView.prototype.b2 = function () {
this.a4.clear();
if (this.ab != null) {
this.ab.notifyClearItems();
}
};
RearrangedListView.prototype.notifySetItem = function (a, b, c) {
if (this.a0 != null) {
this.b8(b);
this.bo(c);
}
else {
this.b9(a, b);
this.bp(a, c);
}
};
RearrangedListView.prototype.bp = function (a, b) {
if (!this.ax(b)) {
return;
}
var c = this.a9(a);
this.b3(c, b);
};
RearrangedListView.prototype.b3 = function (a, b) {
this.b0(a, b);
this.ce(a, b);
this.cj(a, b);
};
RearrangedListView.prototype.b0 = function (a, b) {
if (this.ah) {
var c = this.z.e(a);
if (c == null) {
c = this.z.d();
}
var d = c.v();
var e = true;
if (a >= c.af && a <= c.af + (d - 1) + c.ah + c.aa) {
if (!this.ai(c, b, this.a4._inner[c.af])) {
c = this.z.e(c.af - 1);
if (c == null) {
c = this.z.c();
c.af++;
}
e = false;
}
else {
a = c.af + d + c.ah + c.aa;
}
}
if (e && !c.p) {
return;
}
c.ad++;
this.z.ac(c, 1, 0);
if (this.ai(c, b, this.a4._inner[c.af])) {
if (!c.p) {
c.ad--;
this.z.ac(c, -1, 0);
return;
}
if (a >= c.ad - c.u - c.ag && a <= c.ad) {
a = c.ad - c.u - c.ag;
}
}
}
this.a4.insert1(a, b);
if (this.ab != null) {
this.ab.notifyInsertItem(a, b);
}
};
RearrangedListView.prototype.ce = function (a, b) {
var c = null;
if (this.ah) {
c = this.z.e(a);
}
else {
c = this.z.t._inner[0];
}
if (c == null) {
if (this.ah && a == 0) {
c = this.z.c();
}
else {
c = this.z.d();
}
}
if (this.ai(c, b, this.a4._inner[c.af])) {
this.z.z(c, 1);
if (this.aw && c.p) {
var d = this.bi(c, b);
if (d != -1 && this.ab != null) {
this.ab.notifyInsertItem(d, this.a4._inner[d]);
}
}
}
else {
var e = this.z.e(a - 1);
if (e != null && this.ai(e, b, this.a4._inner[e.af])) {
this.z.z(e, 1);
if (this.aw && e.p) {
var f = this.bi(e, b);
if (f != -1 && this.ab != null) {
this.ab.notifyInsertItem(f, this.a4._inner[f]);
}
}
}
else {
var g = false;
if (a <= c.af) {
g = true;
}
var h = 0;
var i = null;
var j = null;
var k = this.f();
var l = this.g();
var m = this.z.b(this.m, b, l, this.j, this.ar);
m.af = a;
m.ad = a;
m.ae = g ? c.ae : c.ae + 1;
if (this.j == 1) {
this.z.af(m, g);
for (var n = 0; n < c.f.length; n++) {
if (Base.equalsStatic(c.f[n], m.f[n]) && !c.c[n]) {
this.z.z(c, 1);
return;
}
}
}
this.z.aa(m.ae, m);
if (this.av) {
var o = this.bc(m, a, k, l, false);
m.ad += o;
h += o;
i = this.a4._inner[a];
if (!g) {
c.ad--;
}
}
if (m.p) {
if (this.aw) {
for (var p = 0; p < this.a3.count; p++) {
if (this.p.i(b, this.a3._inner[p]) == 0) {
this.bf(m, b, false);
h++;
break;
}
}
}
}
else {
this.a4.removeAt(a + h);
m.ad--;
h--;
}
if (this.au) {
var q = this.bb(a + (h - 1), b, k, l);
if (q > 1) {
m.ad += q;
}
h += q;
j = this.a4._inner[a + (h - 1)];
}
this.z.ad(m, h, h);
if (this.j == 1) {
this.b7(m);
}
else {
if (m.a[0] != null && m.h[0] == -1) {
m.h[0] = m.ad + 1;
}
}
if (m.p) {
this.z.z(m, 1);
}
if (this.ab != null) {
if (i != null) {
this.ab.notifyInsertItem(a, i);
}
if (j != null) {
this.ab.notifyInsertItem(a + (h - 1), j);
}
}
}
}
};
RearrangedListView.prototype.cm = function (a) {
var b = this.a4.indexOf1(a);
if (b >= 0) {
var c = this.a4._inner[b - 1];
var d = typeCast(DataSourceSpecialRow.$, c);
var e = this.f();
for (var f = 0; f < e.length; f++) {
if (d == null) {
a.setValue(e[f], this.m.getItemProperty(c, e[f]));
}
else {
a.setValue(e[f], d.getValue(e[f]));
}
}
}
};
RearrangedListView.prototype.b7 = function (a) {
var b = false;
var c = false;
if (a.ae > 0) {
var d = this.z.t._inner[a.ae - 1];
var e = 0;
for (var f = 0, g = 0; f < a.e.length; f++, g++) {
if (!b && Base.equalsStatic(d.f[f], a.f[f])) {
this.a4.removeAt(a.af + g);
a.ad--;
this.z.ac(a, -1, -1);
if (this.am && (this.l == 2 || this.l == 0)) {
for (var h = 0; h < this.a8; h++) {
var i = typeCast(DataSourceSpecialRow.$, this.a4._inner[a.af - 1]);
if (i != null && i.rowType == 5 && i.level == f + 1) {
this.a4.removeAt(a.af - 1);
d.ad--;
this.z.ac(d, -1, -1);
this.a4.insert1(a.ad + 1, i);
e++;
this.cm(i);
}
}
}
a.a[f] = null;
a.b[f] = 0;
a.c[f] = true;
if (d.a[f] != null) {
a.z = d.ae;
}
g--;
c = true;
}
else {
b = true;
a.b[f] = g;
if (e > 0) {
a.ad += e;
this.z.ac(a, e, e);
a.h[f] = a.ad - (e - 1);
}
else {
a.h[f] = a.ad + 1;
}
}
}
if (a.z == -1 && c) {
a.z = d.z;
}
}
if (a.ae < this.z.t.count - 1) {
b = false;
c = false;
var j = this.z.t._inner[a.ae + 1];
for (var k = 0, l = 0; k < a.e.length; k++, l++) {
if (!b && Base.equalsStatic(j.f[k], a.f[k])) {
if (j.a[k] != null) {
this.a4.removeAt(j.af + l);
j.ad--;
this.z.ac(j, -1, -1);
a.al(k, -1);
a.i[k] = j.i[k];
a.d[k] = j.d[k];
if (this.am && (this.l == 2 || this.l == 0)) {
var m = j.g[k].a[0];
var n = this.a4.indexOf1(m);
a.h[k] = n;
var o = this.z.e(n);
var p = j.g[k].a.length;
for (var q = 0; q < p; q++) {
j.g[k].a[q] = null;
this.a4.removeAt(n);
o.ad--;
if (this.as) {
o.ag--;
}
else {
o.ah--;
}
}
this.z.ac(o, -p, -p);
a.al(k, -p);
}
j.h[k] = -1;
j.d[k] = 0;
j.i[k] = null;
j.g[k] = null;
j.a[k] = null;
j.b[k] = 0;
j.c[k] = true;
c = true;
}
l--;
}
else {
b = true;
j.b[k] = l;
if (a.a[k] != null && a.h[k] == -1) {
a.h[k] = a.ad + 1;
}
}
}
}
};
RearrangedListView.prototype.ai = function (a, b, c) {
if (this.ae.k.count == 0) {
return true;
}
if (this.a1.compare(b, c) == 0) {
return true;
}
return false;
};
RearrangedListView.prototype.h = function (a, b) {
var c = new Array(a.length);
for (var d = 0; d < c.length; d++) {
c[d] = this.m.getItemProperty(b, a[d]);
}
return c;
};
RearrangedListView.prototype.at = function (a, b) {
if (a == null && b == null) {
return true;
}
if (a == null && b != null) {
return false;
}
if (a != null && b == null) {
return false;
}
return Base.equalsStatic(a, b);
};
RearrangedListView.prototype.a9 = function (a) {
if (this.ae.k.count == 0 && this.a3.count == 0 && this.s == null && this.n.actualCount == this.a4.count) {
return a;
}
var b = 0;
var c = 0;
var d = this.a4.count;
while (b < a && c < d) {
while (c < d) {
var e = this.a4._inner[c];
var f = false;
var viewItem_ = e;
if ((viewItem_.$$isSpecialRow !== undefined)) {
f = true;
}
if (!f) {
break;
}
c++;
}
var g = this.n.getItemAtIndex(b);
if (this.at(g, this.a4._inner[c])) {
c++;
b++;
}
else {
b++;
}
}
return c;
};
RearrangedListView.prototype.b9 = function (a, b) {
var c = this.a9(a);
if (c < this.a4.count) {
if (this.at(b, this.a4._inner[c])) {
this.b4(c, b);
}
}
};
RearrangedListView.prototype.b4 = function (a, b) {
this.a4.removeAt(a);
if (this.ab != null) {
this.ab.notifyRemoveItem(a, b);
}
var c = this.y(a, b);
this.ck(a, b, c);
};
RearrangedListView.prototype.y = function (a, b) {
var c = null;
if (this.ah) {
c = this.z.e(a);
}
else {
c = this.z.t._inner[0];
}
if (c != null) {
this.z.z(c, -1);
if (c.p) {
c.ad--;
this.z.ac(c, -1, 0);
if (this.aw) {
for (var d = 0; d < c.aa; d++) {
var e = 0;
if (this.av) {
e = 1;
}
e += c.ah;
var f = this.a4._inner[c.af + d + e];
var g = null;
var item_ = f;
if ((item_ != null && item_.$$isSpecialRow !== undefined)) {
g = f;
}
if (g != null) {
if (g.targetRow == b) {
this.a4.removeAt(c.af + d + e);
c.ad--;
c.aa--;
c.t--;
this.z.ac(c, -1, -1);
if (this.ab != null) {
this.ab.notifyRemoveItem(c.af + d + e, g);
}
}
}
}
}
}
if (this.ah && !c.m() && this.aj(c)) {
var h = 0;
if (this.z.p(c)) {
var i = c.w();
var j = i;
var k = this.ae.k.count;
var l = this.g();
var m = this.z.t._inner[c.ae + 1];
for (var n = 0; n < c.f.length; n++) {
if (!Base.equalsStatic(c.f[n], m.f[n])) {