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