igniteui-react-grids
Version:
Ignite UI React grid components.
188 lines (187 loc) • 6.7 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 { DataGridCellLayoutPanel } from "./DataGridCellLayoutPanel";
import { DomWrapper_$type } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Stack$1 } from "igniteui-react-core";
import { FastIterationDictionary$2 } from "igniteui-react-core";
import { AccessibilityRow } from "./AccessibilityRow";
import { Number_$type, markType } from "igniteui-react-core";
/**
* @hidden
*/
export let DataGridAccessibilityLayoutPanel = /*@__PURE__*/ (() => {
class DataGridAccessibilityLayoutPanel extends DataGridCellLayoutPanel {
constructor(a, b, c) {
super(a, b, c);
this.a2 = new List$1(DomWrapper_$type, 0);
this.a3 = new Stack$1(DomWrapper_$type);
this.a0 = new FastIterationDictionary$2(Number_$type, AccessibilityRow.$, 0);
this.ay = null;
this.a7 = null;
this.a7 = DataGridAccessibilityLayoutPanel.a6.toString();
DataGridAccessibilityLayoutPanel.a6++;
}
refresh(a, b) {
super.refresh(a, b);
if (this.rootElement != null) {
let c = a.c5();
let d = a.b9.count;
if (a.c6 > 0) {
c++;
}
this.rootElement.setAttribute("role", "grid");
this.rootElement.setAttribute("aria-rowcount", c.toString());
this.rootElement.setAttribute("aria-colcount", d.toString());
this.rootElement.setAttribute("aria-multiselectable", "true");
}
}
ah(a, b) {
if (this.a1(a)) {
if (a.l.g) {
if (this.ay == null) {
this.ay = new AccessibilityRow();
this.ay.i = this.a7;
this.ay.e = -1;
this.ay.d = this.g.b9.count;
this.ay.f = "columnheader";
}
this.ay.j(a, b);
}
else {
let c = a.l.g ? -1 : a.l.x;
let d = this.az(c);
if (d == null) {
d = new AccessibilityRow();
d.i = this.a7;
d.e = c;
d.d = this.g.b9.count;
d.f = "gridcell";
this.a0.s(c, d);
}
d.j(a, b);
}
}
}
aj(a, b) {
if (this.a1(a)) {
this.bb(b, "id");
this.bb(b, "role");
this.bb(b, "aria-colindex");
this.bb(b, "aria-selected");
if (a.l.g) {
this.bb(b, "aria-sort");
}
}
}
ai(a, b) {
if (this.a1(a)) {
this.ah(a, b);
}
}
an() {
this.a8();
if (this.ay != null) {
this.ba(this.ay);
this.ay.k();
}
let a = this.a0.q;
for (let b = 0; b < a.count; b++) {
let c = a._inner[b];
this.ba(c);
c.k();
}
this.ay = null;
this.a0.u();
}
az(a) {
let b = this.a0.o;
for (let c = 0; c < b.count; c++) {
let d = b._inner[c];
let e = this.a0.item(d);
if (e != null && e.e == a) {
return e;
}
}
return null;
}
a4() {
if (this.a3.f > 0) {
return this.a3.e();
}
return null;
}
a5(a) {
for (let b = 0; b < this.a2.count; b++) {
let c = parseInt(this.a2._inner[b].getAttribute("aria-rowindex"));
if (c == a.c) {
return this.a2._inner[b];
}
}
return null;
}
ba(a) {
let b = this.a5(a);
if (b != null) {
b.setAttribute("aria-owns", a.h());
return;
}
b = this.a4();
if (b != null) {
b.setAttribute("aria-rowindex", a.c.toString());
b.setAttribute("aria-owns", a.h());
this.a9(a, b);
return;
}
b = this.s.createElement("div");
b.setAttribute("role", "row");
b.setAttribute("aria-rowindex", a.c.toString());
b.setAttribute("aria-owns", a.h());
this.a9(a, b);
}
a8() {
for (let a = 0; a < this.a2.count; a++) {
let b = this.a2._inner[a];
let c = parseInt(b.getAttribute("aria-rowindex")) - 2;
if (c != -1 && !this.a0.d(c)) {
b.remove();
this.a3.h(b);
this.a2.removeAt(a);
a--;
}
}
}
a9(a, b) {
let c = -1;
for (let d = 0; d < this.a2.count; d++) {
let e = parseInt(this.a2._inner[d].getAttribute("aria-rowindex"));
if (a.c < e) {
c = d;
break;
}
}
if (c != -1) {
let native_ = this.element.getNativeElement();
native_.insertBefore(b.getNativeElement(), this.a2._inner[c].getNativeElement());
this.a2.insert(c, b);
}
else {
this.element.append(b);
this.a2.add(b);
}
}
a1(a) {
return a.l.aj || (a.l.an && !a.l.h);
}
bb(a, b) {
a.getNativeElement().removeAttribute(b);
}
}
DataGridAccessibilityLayoutPanel.$t = /*@__PURE__*/ markType(DataGridAccessibilityLayoutPanel, 'DataGridAccessibilityLayoutPanel', DataGridCellLayoutPanel.$);
DataGridAccessibilityLayoutPanel.a6 = 0;
return DataGridAccessibilityLayoutPanel;
})();