igniteui-react-grids
Version:
Ignite UI React grid components.
1,156 lines (1,155 loc) • 39.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 { Base, markType, runOn, INotifyPropertyChanged_$type, PropertyChangedEventArgs, enumGetBox, delegateRemove, EnumUtil, delegateCombine } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { KeyFrameAnimationFactory } from "igniteui-react-core";
import { AnimationKeyFrameEffect } from "igniteui-react-core";
import { AnimationKeyFrameEffectTiming } from "igniteui-react-core";
import { NativeUIComponent } from "igniteui-react-core";
import { CellContentHorizontalAlignment_$type } from "./CellContentHorizontalAlignment";
import { intDivide, isNaN_ } from "igniteui-react-core";
import { ElevationHelper } from "igniteui-react-core";
import { BaseDOMEventProxy } from "igniteui-react-core";
import { IToolbarTarget_$type } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-core";
import { GridFilterDialogOpeningEventArgs } from "./GridFilterDialogOpeningEventArgs";
import { AnimationKeyFrameProperty } from "igniteui-react-core";
import { GridFilterDialogFilterChangeEventArgs } from "./GridFilterDialogFilterChangeEventArgs";
import { ColumnFilterConditionGroup } from "./ColumnFilterConditionGroup";
import { Stack$1 } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { GridFilterDialogViewModelRow } from "./GridFilterDialogViewModelRow";
import { GridFilterDialogViewModelGroupingLevel } from "./GridFilterDialogViewModelGroupingLevel";
import { GridFilterDialogViewModelGrouping } from "./GridFilterDialogViewModelGrouping";
import { ColumnComparisonFilterCondition } from "./ColumnComparisonFilterCondition";
import { ColumnComparisonConditionOperatorType_$type } from "./ColumnComparisonConditionOperatorType";
import { Geometry } from "igniteui-react-core";
import { GridStyleRepository } from "./GridStyleRepository";
import { NativeUI } from "igniteui-react-core";
import { FilterDialogRenderCompletedEventArgs } from "./FilterDialogRenderCompletedEventArgs";
import { ToolActionIconMenuInfo } from "igniteui-react-core";
import { SvgIconRegistry } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
import { GridFilterDialogViewModelGroupingLevelCollection } from "./GridFilterDialogViewModelGroupingLevelCollection";
import { ObservableCollection$1 } from "igniteui-react-core";
/**
* @hidden
*/
export let GridFilterDialogView = /*@__PURE__*/ (() => {
class GridFilterDialogView extends Base {
constructor(a) {
super();
this.b = null;
this.q = null;
this.aa = new Path();
this.j = 0;
this.i = 0;
this.d = null;
this.m = null;
this.n = null;
this.o = null;
this.g = 0;
this.f = 0;
this.h = 1;
this.l = 0;
this.k = 0;
this.e = false;
this.c = null;
this.b = a;
}
y() {
this.x();
this.b.bk();
}
t() {
this.b.bc(this.l, this.k, this.aa);
}
s() {
if (KeyFrameAnimationFactory.h == null) {
KeyFrameAnimationFactory.h = this.m;
}
}
a(a) {
return new AnimationKeyFrameEffect(0, this.m.rootWrapper, 0, null, a);
}
v(a, b, c) {
if (a == null) {
this.m = null;
this.n = null;
this.d = null;
return;
}
this.h = (isNaN_(this.b.aj) ? this.b.ai : this.b.aj);
let d = a;
this.m = d;
this.n = c;
this.o = b;
this.m.rootWrapper.addClass("ig-filter-icon");
this.m.rootWrapper.setStyleProperty("cursor", "pointer");
this.q = this.m.rootWrapper;
let e = this.h;
let f = Math.round(d.rootWrapper.width());
let g = Math.round(d.rootWrapper.height());
let h = this.b.ak * e;
let i = this.b.ak * e;
this.x();
this.l = f;
this.k = g;
if (isNaN_(this.b.aj)) {
this.b.ai = window.devicePixelRatio;
this.h = this.b.ai;
}
this.y();
}
r(a) {
let b = a;
this.m.append(b.an);
}
p() {
return this.m;
}
x() {
if (this.b.k == this.b.l) {
this.m.rootWrapper.setStyleProperty("position", "relative");
this.m.rootWrapper.setStyleProperty("left", "0px");
this.m.rootWrapper.setStyleProperty("top", "0px");
return;
}
this.m.rootWrapper.setStyleProperty("position", "absolute");
if (this.b.l == 2) {
this.m.rootWrapper.setStyleProperty("left", "unset");
this.m.rootWrapper.setStyleProperty("right", this.b.ao + "px");
}
else {
this.m.rootWrapper.setStyleProperty("left", this.b.an + "px");
}
let a = intDivide(this.o.height(), 2) - (this.k / 2);
this.m.rootWrapper.setStyleProperty("top", a + "px");
}
z() {
this.y();
}
w(a, b) {
if (isNaN_(this.b.aj)) {
this.b.ai = window.devicePixelRatio;
this.h = this.b.ai;
}
this.l = a;
this.k = b;
this.y();
}
u() {
if (isNaN_(this.b.aj)) {
this.b.ai = window.devicePixelRatio;
if (this.h != this.b.ai) {
this.h = this.b.ai;
this.y();
return;
}
}
this.x();
}
}
GridFilterDialogView.$t = /*@__PURE__*/ markType(GridFilterDialogView, 'GridFilterDialogView');
return GridFilterDialogView;
})();
/**
* @hidden
*/
export let GridFilterDialogPanel = /*@__PURE__*/ (() => {
class GridFilterDialogPanel extends Base {
constructor(a, b, c, d) {
super();
this.b = null;
this.k = null;
this.d = null;
this.j = 264;
this.i = 0;
this.a = null;
this.h = null;
this.f = null;
this.e = null;
this.g = null;
this.b = a;
let e = c.createElement("div");
let f = c.getSubRenderer(e);
e.setStyleProperty("position", "absolute");
e.setStyleProperty("width", this.j + "px");
e.setStyleProperty("top", "0px");
e.setStyleProperty("left", "0px");
e.setStyleProperty("display", "none");
e.setStyleProperty("z-index", "10000");
e.setStyleProperty("background-color", "#fff");
e.setStyleProperty("border-radius", "3px");
e.setStyleProperty("overflow", "auto");
let g = ElevationHelper.e(12, this.b.bv, this.b.bu, this.b.bt);
e.setStyleProperty("boxShadow", g);
e.listen("mousedown", runOn(this, this.o));
this.onDocumentKeyDown = this.onDocumentKeyDown.bind(this);
this.onDocumentMouseClick = this.onDocumentMouseClick.bind(this);
this.h = b;
this.f = f;
this.g = e;
this.e = d;
}
o(a) {
a.stopPropagation();
}
onDocumentKeyDown(a) {
if (BaseDOMEventProxy.c0(a) == 8) {
}
}
onDocumentMouseClick(e_) {
{
}
}
onFilterApplyClick() {
}
onFilterCancelClick() {
}
t(a) {
this.n();
this.g.setStyleProperty("display", "block");
this.f.appendToBody(this.g);
if (this.k == null) {
this.e.getPortal(this.g, "GridColumnOptions", (b) => {
this.d = b;
let comp_ = b.componentRef;
let col_ = a;
let displayDensity_ = a.grid.density;
let buttonDensity_ = GridFilterDialogPanel.c(displayDensity_, true);
let filterListDensity_ = GridFilterDialogPanel.c(displayDensity_, true);
this.k = comp_.i;
let options_ = this.k;
options_.column = col_;
options_.density = displayDensity_;
options_.buttonDensity = buttonDensity_;
options_.summaryListDensity = filterListDensity_;
options_.filterListDensity = filterListDensity_;
options_.applyButtonClick = delegateCombine(options_.applyButtonClick, runOn(this, this.onFilterApplyClick));
options_.cancelButtonClick = delegateCombine(options_.cancelButtonClick, runOn(this, this.onFilterCancelClick));
this.j = this.g.width();
this.i = this.g.height();
this.n();
}, false);
}
document.addEventListener("keydown", this.onDocumentKeyDown, false);
document.addEventListener("mousedown", this.onDocumentMouseClick, false);
}
n() {
let a = this.h.width();
let b = this.h.height();
let c = this.h.getNativeElement();
let d = c.getBoundingClientRect();
let e = (d.left);
let f = (d.top);
let g = (window.innerWidth);
let h = (window.innerHeight);
let i = 0;
let j = 0;
let k = true;
if (e > g - this.j - 10) {
k = false;
i = -(this.j - a);
}
if (f > h - this.i - 10) {
j = h - this.i - 10 - f - b;
if (k) {
i += a + 10;
}
else {
i -= a + 10;
}
}
this.g.setStyleProperty("left", (this.h.getOffset().left + i) + "px");
this.g.setStyleProperty("top", (this.h.getOffset().top + this.h.outerHeight() + j) + "px");
}
l() {
document.removeEventListener("keydown", this.onDocumentKeyDown, false);
document.removeEventListener("mousedown", this.onDocumentMouseClick, false);
let options_ = this.k;
options_.applyButtonClick = delegateRemove(options_.applyButtonClick, runOn(this, this.onFilterApplyClick));
options_.cancelButtonClick = delegateRemove(options_.cancelButtonClick, runOn(this, this.onFilterCancelClick));
;
options_.column = null;
this.g.setStyleProperty("display", "none");
this.g.remove();
}
m() {
this.f.destroy();
this.g.unlistenAll();
this.k = null;
this.g = null;
if (this.d != null) {
this.d.destroy();
}
}
static c(a, b) {
switch (a) {
case 1: return b ? 2 : 1;
case 2: return b ? 3 : 1;
case 3: return b ? 4 : 2;
case 4: return b ? 4 : 3;
case 0: return a;
default: return a;
}
}
}
GridFilterDialogPanel.$t = /*@__PURE__*/ markType(GridFilterDialogPanel, 'GridFilterDialogPanel');
return GridFilterDialogPanel;
})();
/**
* @hidden
*/
export let GridFilterDialog = /*@__PURE__*/ (() => {
class GridFilterDialog extends Base {
get as() {
return this.ar;
}
set as(a) {
this.ar = a;
}
get ab() {
return this.z;
}
set ab(a) {
let b = this.z;
this.z = a;
if (b != this.z) {
this.bj("IsAnimationEnabled", b, this.z);
}
}
get aj() {
return this.ag;
}
set aj(a) {
let b = this.ag;
this.ag = a;
this.bj("PixelScalingRatio", b, this.ag);
}
get ai() {
return this.af;
}
set ai(a) {
let b = this.af;
this.af = a;
this.bj("ActualPixelScalingRatio", b, this.af);
}
get l() {
return this.j;
}
set l(a) {
let b = this.j;
this.j = a;
if (b != this.j) {
this.bj("IconHorizontalAlignment", enumGetBox(CellContentHorizontalAlignment_$type, b), enumGetBox(CellContentHorizontalAlignment_$type, this.j));
}
}
get k() {
return this.i;
}
set k(a) {
let b = this.i;
this.i = a;
if (b != this.i) {
this.bj("HeaderTextALignment", enumGetBox(CellContentHorizontalAlignment_$type, b), enumGetBox(CellContentHorizontalAlignment_$type, this.i));
}
}
get an() {
return this.al;
}
set an(a) {
let b = this.al;
this.al = a;
if (b != this.al) {
this.bj("CellPaddingLeft", b, this.al);
}
}
get ao() {
return this.am;
}
set ao(a) {
let b = this.am;
this.am = a;
if (b != this.am) {
this.bj("CellPaddingRight", b, this.am);
}
}
get bw() {
return this.bs;
}
set bw(a) {
let b = this.bs;
this.bs = a;
if (b != this.bs) {
this.bj("IconColor", b, this.bs);
}
}
get ak() {
return this.ah;
}
set ak(a) {
let b = this.ah;
this.ah = a;
if (b != this.ah) {
this.bj("ViewSize", b, this.ah);
}
}
get ac() {
return this.v.bx;
}
bj(a, b, c) {
this.bm(a, b, c);
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
}
bm(a, b, c) {
switch (a) {
case "PixelScalingRatio":
this.ai = this.aj;
break;
case "ActualPixelScalingRatio":
this.s.z();
break;
case "IconHorizontalAlignment":
case "IconColor":
case "HeaderTextALignment":
case "CellPaddingLeft":
case "CellPaddingRight":
case "ViewSize":
this.s.z();
break;
}
}
constructor() {
super();
this.ar = null;
this.z = true;
this.propertyChanged = null;
this.ag = NaN;
this.af = 1;
this.j = 2;
this.i = 0;
this.al = 0;
this.am = 0;
this.bs = null;
this.ah = DeviceUtils.g(24);
this.bv = null;
this.bu = null;
this.bt = null;
this.w = null;
this.y = false;
this.m = null;
this.x = false;
this.v = null;
this.f = null;
this.dialogOpening = null;
this.filterChanging = null;
this.filterChanged = null;
this.s = null;
this._commandCompleted = null;
this._invalidateActions = null;
this.renderCompleted = null;
this.s = new GridFilterDialogView(this);
this.bv = BrushUtil.h(66, 0, 0, 0);
this.bu = BrushUtil.h(30, 0, 0, 0);
this.bt = BrushUtil.h(20, 0, 0, 0);
}
bn(a, b, c) {
this.s.v(a, b, c);
this.bg();
}
get n() {
return this.m;
}
set n(a) {
let b = this.m;
this.m = a;
if (this.m != b) {
this.bf(b, this.m);
}
}
bf(a, b) {
this.x = true;
}
bg() {
NativeUIComponent.au(this.s.p(), 18, (a) => {
let b = a;
this.v = b;
this.v.b0 = 16;
this.v.b4 = BrushUtil.h(0, 0, 0, 0);
this.v.bq = runOn(this, this.a6);
this.v.by = false;
this.s.r(this.v);
this.v.c = 1;
this.v.b1 = this;
});
}
a6(a, b) {
if (this.x) {
this.x = false;
this.v.b1 = this.n;
}
if (this.n != null) {
if (this.n.grid != null) {
this.n.grid.va();
}
this.n.mx();
}
if (this.dialogOpening != null) {
let c = new GridFilterDialogOpeningEventArgs();
this.dialogOpening(this, c);
}
}
a8(a, b) {
switch (b.propertyName) {
case "IsHidden": break;
}
}
bh() {
}
bi(a, b) {
a.onModified = delegateRemove(a.onModified, runOn(this, this.bl));
if (b) {
this.bp();
}
else {
this.bo(a, true);
}
this.f = null;
}
a9() {
this.s.s();
if (this.w == null) {
let a = new AnimationKeyFrameEffectTiming();
a.g = 200;
a.b = 0;
this.w = KeyFrameAnimationFactory.f.c(this.s.a(a).m(new AnimationKeyFrameProperty(1, 0)).m(new AnimationKeyFrameProperty(1, 1)));
}
}
bq() {
if (this.filterChanged != null) {
this.filterChanged(this, ((() => {
let $ret = new GridFilterDialogFilterChangeEventArgs();
$ret.a = this.f;
return $ret;
})()));
}
}
bp() {
if (this.filterChanged != null) {
this.filterChanged(this, ((() => {
let $ret = new GridFilterDialogFilterChangeEventArgs();
$ret.a = null;
return $ret;
})()));
}
}
bo(a, b) {
let c = this.e(a);
if (b) {
if (this.filterChanged != null) {
this.filterChanged(this, ((() => {
let $ret = new GridFilterDialogFilterChangeEventArgs();
$ret.a = c;
return $ret;
})()));
}
}
else {
if (this.filterChanging != null) {
this.filterChanging(this, ((() => {
let $ret = new GridFilterDialogFilterChangeEventArgs();
$ret.a = c;
return $ret;
})()));
}
}
}
e(a) {
let b = new ColumnFilterConditionGroup();
b.usesOrOperator = a.k;
let c = new Stack$1(ColumnFilterConditionGroup.$);
let d = 0;
let e = b;
for (let f = 0; f < a.f.count; f++) {
let g = this.h(d, c, a, f);
while (g != null) {
e.add(g);
e = g;
d++;
g = this.h(d, c, a, f);
}
g = this.g(d, c, a, f);
while (g != null) {
e = g;
d--;
g = this.g(d, c, a, f);
}
if (e == null) {
e = b;
}
if (this.ae(a, a.f._inner[f])) {
continue;
}
e.add(this.d(a.f._inner[f]));
}
if (b.count == 0) {
return null;
}
return b;
}
ae(a, b) {
let c = 0;
for (let d = 0; d < b.e.length; d++) {
if (b.e[d] == b.l) {
c = d;
break;
}
}
if (b.d[c] > 0 && b.i == null) {
return true;
}
if (a.a != 0 && b.d[c] > 0 && typeof b.i === 'string' && stringIsNullOrEmpty(b.i)) {
return true;
}
return false;
}
g(a, b, c, d) {
let e = this.aq(c, d);
if (a > e) {
b.e();
return b.d();
}
return null;
}
aq(a, b) {
let c = a.c(b);
if (c == null) {
return 0;
}
return a.e.indexOf(c);
}
h(a, b, c, d) {
let e = this.aq(c, d);
if (a < e) {
let f = c.b(d);
let g = new ColumnFilterConditionGroup();
g.usesOrOperator = f.a;
b.h(g);
return g;
}
return null;
}
d(a) {
let b = new ColumnComparisonFilterCondition();
b.operator = this.c(a.l);
b.value = a.i;
return b;
}
c(a) {
return EnumUtil.getEnumValue(ColumnComparisonConditionOperatorType_$type, EnumUtil.parse(ColumnComparisonConditionOperatorType_$type, a, true));
}
bl(a) {
this.bo(a, false);
}
t(a, b) {
let c = new GridFilterDialogViewModel();
if (a != null) {
this.a7(c, a, b);
}
else {
let d = new GridFilterDialogViewModelRow();
d.f = b;
d.e = GridFilterDialog.a(b);
d.d = GridFilterDialog.b(b);
d.l = GridFilterDialog.az(b[0]);
c.f.add(d);
}
return c;
}
a7(a, b, c) {
if (b.isGroup()) {
let d = b;
for (let e = 0; e < d.count; e++) {
let f = d.item(e);
this.a7(a, f, c);
}
}
else {
a.f.add(this.u(b, c));
}
}
u(a, b) {
let c = new GridFilterDialogViewModelRow();
c.l = GridFilterDialog.az(a.operator);
c.f = b;
c.e = GridFilterDialog.a(b);
c.i = GridFilterDialog.at(GridFilterDialog.ap(a.operator), a.operator, a);
c.j = GridFilterDialog.au(GridFilterDialog.ap(a.operator), a.operator, a);
c.d = GridFilterDialog.b(b);
return c;
}
static ap(a) {
return ColumnComparisonFilterCondition.getOperandNumber(a);
}
static at(a, b, c) {
if (a == 0) {
return "";
}
return c.value != null ? c.value.toString() : "";
}
static au(a, b, c) {
return "";
}
static b(a) {
return ColumnComparisonFilterCondition.getOperandNumbers(a);
}
static a(a) {
let b = new Array(a.length);
for (let c = 0; c < a.length; c++) {
b[c] = EnumUtil.getName(ColumnComparisonConditionOperatorType_$type, a[c]);
}
return b;
}
static az(a) {
return EnumUtil.getName(ColumnComparisonConditionOperatorType_$type, a);
}
be(a, b) {
this.s.w(a, b);
}
bd() {
this.s.u();
}
bc(a, b, c) {
let d = Geometry.a("M12 14c -1.1 0 -2 -0.9 -2 -2 s0.9 -2 2 -2 s2 0.9 2 2 S13.1 14 12 14 z M12 8c -1.1 0 -2 -0.9 -2 -2 s0.9 -2 2 -2 s2 0.9 2 2 S13.1 8 12 8z M12 16 c1.1 0 2 0.9 2 2s -0.9 2 -2 2 s-2 -0.9 -2 -2 S10.9 16 12 16z");
c.an = d;
c._fill = this.bw == null ? GridStyleRepository.a5 : this.bw;
}
br() {
this.y = false;
if (NativeUI.g(this.s.q) == 1) {
return;
}
if (this.ab) {
this.a9();
if (this.w.playbackRate < 0) {
this.w.reverse();
}
else {
this.w.play();
}
this.w.finished.f((a) => this.w.commitStyles());
}
else {
NativeUI.y(this.s.q, 1);
}
}
bb() {
this.y = true;
if (!this.ac) {
if (this.ab) {
this.a9();
if (this.w.playbackRate < 0) {
this.w.play();
}
else {
this.w.reverse();
}
this.w.finished.f((a) => this.w.commitStyles());
}
else {
NativeUI.y(this.s.q, 0);
}
this.y = false;
}
}
get commandCompleted() {
return this._commandCompleted;
}
set commandCompleted(a) {
this._commandCompleted = a;
}
get invalidateActions() {
return this._invalidateActions;
}
set invalidateActions(a) {
this._invalidateActions = a;
}
bk() {
if (this.renderCompleted != null) {
this.renderCompleted(this, new FilterDialogRenderCompletedEventArgs());
}
}
ba() {
if (this.v != null) {
if (this.n != null && this.v.b1 != this.n) {
this.v.b1 = this.n;
}
}
}
getDesiredToolbarActions() {
if (!GridFilterDialog.aa) {
GridFilterDialog.aa = true;
SvgIconRegistry.instance.addSvgPathString("XGrid", "DotDotDot", GridFilterDialog.ay);
}
let a = new ToolActionIconMenuInfo();
a.name = "DataGridColumnOptionsPlaceholder";
a.iconCollectionName = "XGrid";
a.iconName = "DotDotDot";
a.iconViewBoxWidth = 24;
a.iconViewBoxHeight = 24;
a.paddingBottom = 0;
a.paddingTop = 0;
a.paddingRight = 0;
a.paddingLeft = 0;
a.showArrowIcon = false;
a.density = 4;
a.name = "DataGridColumnOptions";
a.tooltipDelay = 500;
let b = [a];
return b;
}
addCommandAvailabilityListener(a) {
}
removeCommandAvailabilityListener(a) {
}
addCommandStateChangedListener(a) {
}
removeCommandStateChangedListener(a) {
}
onToolCommandExecuting(a) {
return 0;
}
provideContextAccessor(a) {
}
ad(e_) {
let a = e_.originalEvent.srcElement;
let b = e_.originalEvent.target;
if (this.s.m.rootWrapper.getNativeElement().contains(a) || this.s.m.rootWrapper.getNativeElement().contains(b)) {
return true;
}
return false;
}
}
GridFilterDialog.$t = /*@__PURE__*/ markType(GridFilterDialog, 'GridFilterDialog', Base.$, [INotifyPropertyChanged_$type, IToolbarTarget_$type]);
GridFilterDialog.aa = false;
GridFilterDialog.ay = "M12 14c -1.1 0 -2 -0.9 -2 -2 s0.9 -2 2 -2 s2 0.9 2 2 S13.1 14 12 14 z M12 8c -1.1 0 -2 -0.9 -2 -2 s0.9 -2 2 -2 s2 0.9 2 2 S13.1 8 12 8z M12 16 c1.1 0 2 0.9 2 2s -0.9 2 -2 2 s-2 -0.9 -2 -2 S10.9 16 12 16z";
return GridFilterDialog;
})();
/**
* @hidden
*/
export let GridFilterDialogViewModel = /*@__PURE__*/ (() => {
class GridFilterDialogViewModel extends Base {
n() {
let a = new GridFilterDialogViewModelRow();
let b = ColumnComparisonFilterCondition.getApplicableOperators(this.a);
a.f = b;
a.e = GridFilterDialog.a(b);
a.d = GridFilterDialog.b(b);
a.l = GridFilterDialog.az(b[0]);
this.f.add(a);
}
constructor() {
super();
this.a = 0;
this.e = null;
this.k = false;
this.m = 0;
this.f = null;
this.onModified = null;
this.k = false;
this.f = new GridFilterDialogViewModelRowCollection();
this.f.ae = this;
this.e = new GridFilterDialogViewModelGroupingLevelCollection();
this.f.ag = runOn(this, this.u);
let a = this.f;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.t));
}
u(a) {
if (this.onModified != null) {
this.onModified(this);
}
}
t(a, b) {
switch (b.action) {
case 0:
if (b.newItems != null) {
for (let c = 0; c < b.newItems.count; c++) {
let d = b.newItems.item(c);
this.q(c + b.newStartingIndex, d);
}
}
break;
case 1:
if (b.oldItems != null) {
for (let e = 0; e < b.oldItems.count; e++) {
this.r(b.oldStartingIndex);
}
}
break;
case 2:
if (b.oldItems != null) {
for (let f = 0; f < b.oldItems.count; f++) {
this.r(b.oldStartingIndex);
}
}
if (b.newItems != null) {
for (let g = 0; g < b.newItems.count; g++) {
let h = b.newItems.item(g);
this.q(g + b.newStartingIndex, b.newItems.item(g));
}
}
break;
case 4:
this.s();
break;
}
if (this.onModified != null) {
this.onModified(this);
}
}
r(a) {
let b = this.c(a);
if (b == null) {
return;
}
let c = this.b(a);
if (c == null) {
return;
}
this.w(c, a);
for (let d = b.indexOf(c) + 1; d < b.count; d++) {
this.v(b._inner[d], -1);
}
}
w(a, b) {
a.b--;
}
s() {
this.e.clear();
}
q(a, b) {
let c = this.c(a);
if (c == null) {
return;
}
let d = this.b(a);
if (d == null) {
return;
}
this.p(d, a);
for (let e = c.indexOf(d) + 1; e < c.count; e++) {
this.v(c._inner[e], +1);
}
}
v(a, b) {
a.c += b;
a.b -= b;
}
p(a, b) {
a.b++;
}
b(a) {
for (let b = this.e.count - 1; b >= 0; b--) {
for (let c = 0; c < this.e._inner[b].count; c--) {
if (this.e._inner[b]._inner[c].c <= a && this.e._inner[b]._inner[c].b >= a) {
return this.e._inner[b]._inner[c];
}
}
}
return null;
}
c(a) {
for (let b = this.e.count - 1; b >= 0; b--) {
for (let c = 0; c < this.e._inner[b].count; c--) {
if (this.e._inner[b]._inner[c].c <= a && this.e._inner[b]._inner[c].b >= a) {
return this.e._inner[b];
}
}
}
return null;
}
h(a, b) {
let c = this.d(a, b);
if (this.i(c, a, b)) {
if (this.e.count < this.m) {
return true;
}
else {
return false;
}
}
return true;
}
i(a, b, c) {
if (a == null) {
return false;
}
for (let d = 0; d < a.count; d++) {
if (this.j(a._inner[d], b, c)) {
return true;
}
}
return false;
}
j(a, b, c) {
if (c > a.c || b > a.b) {
return false;
}
return true;
}
d(a, b) {
if (this.e.count == 0) {
return null;
}
for (let c = 0; c < this.e.count; c++) {
if (!this.i(this.e._inner[c], a, b)) {
return this.e._inner[c];
}
}
return this.e._inner[this.e.count - 1];
}
aa(a, b) {
for (let c = 0; c < this.e.count; c++) {
for (let d = 0; d < this.e._inner[c].count; d++) {
if (this.e._inner[c]._inner[d].c == a && this.e._inner[c]._inner[d].b == b) {
this.e._inner[c].removeAt(d);
break;
}
}
}
this.x();
if (this.onModified != null) {
this.onModified(this);
}
}
x() {
for (let a = this.e.count - 1; a >= 0; a--) {
let b = new List$1(GridFilterDialogViewModelGrouping.$, 0);
for (let c = 0; c < this.e._inner[a].count; c++) {
let d = this.e._inner[a]._inner[c];
if (a > 0) {
if (!this.i(this.e._inner[a - 1], d.c, d.b)) {
b.add(d);
}
}
}
for (let e = 0; e < b.count; e++) {
this.e._inner[a].remove(b._inner[e]);
this.e._inner[a - 1].add(b._inner[e]);
}
if (this.e._inner[a].count == 0) {
this.e.removeAt(a);
}
}
this.y();
}
y() {
for (let a = this.e.count - 1; a >= 0; a--) {
let b = new List$1(GridFilterDialogViewModelGrouping.$, 0);
for (let c = 0; c < this.e._inner[a].count; c++) {
b.add(this.e._inner[a]._inner[c]);
}
b.aa((d, e) => Base.compareSimple(d.c, e.c));
this.e._inner[a].clear();
for (let d = 0; d < this.e._inner[a].count; d++) {
this.e._inner[a].add(b._inner[d]);
}
}
}
l(a, b) {
for (let c = 0; c < this.e.count; c++) {
for (let d = 0; d < this.e._inner[c].count; d++) {
if (this.e._inner[c]._inner[d].c == a && this.e._inner[c]._inner[d].b == b) {
return true;
}
}
}
return false;
}
z(a, b) {
for (let c = 0; c < this.e.count; c++) {
for (let d = 0; d < this.e._inner[c].count; d++) {
if (this.e._inner[c]._inner[d].c == a && this.e._inner[c]._inner[d].b == b) {
this.e._inner[c]._inner[d].a = !this.e._inner[c]._inner[d].a;
}
}
}
if (this.onModified != null) {
this.onModified(this);
}
}
o(a, b, c) {
if (!this.h(a, b)) {
return;
}
let d = this.d(a, b);
let e = d;
if (this.i(d, a, b)) {
this.e.add(new GridFilterDialogViewModelGroupingLevel());
e = this.d(a, b);
}
e.add(((() => {
let $ret = new GridFilterDialogViewModelGrouping();
$ret.c = a;
$ret.b = b;
$ret.a = c;
return $ret;
})()));
this.y();
if (this.onModified != null) {
this.onModified(this);
}
}
}
GridFilterDialogViewModel.$t = /*@__PURE__*/ markType(GridFilterDialogViewModel, 'GridFilterDialogViewModel');
return GridFilterDialogViewModel;
})();
/**
* @hidden
*/
export let GridFilterDialogViewModelRowCollection = /*@__PURE__*/ (() => {
class GridFilterDialogViewModelRowCollection extends ObservableCollection$1 {
constructor() {
super(GridFilterDialogViewModelRow.$, 0);
this.ae = null;
this.af = null;
this.collectionChanged = delegateCombine(this.collectionChanged, runOn(this, this.ah));
}
ah(a, b) {
if (b.oldItems != null) {
for (let c = 0; c < b.oldItems.count; c++) {
let d = b.oldItems.item(c);
d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.ai));
}
}
if (b.newItems != null) {
for (let e = 0; e < b.newItems.count; e++) {
let f = b.newItems.item(e);
f.propertyChanged = delegateCombine(f.propertyChanged, runOn(this, this.ai));
}
}
}
ai(a, b) {
if (this.af != null) {
this.af(this.ae);
}
}
get ag() {
return this.af;
}
set ag(a) {
this.af = a;
}
}
GridFilterDialogViewModelRowCollection.$t = /*@__PURE__*/ markType(GridFilterDialogViewModelRowCollection, 'GridFilterDialogViewModelRowCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(GridFilterDialogViewModelRow.$));
return GridFilterDialogViewModelRowCollection;
})();