UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

1,229 lines (1,228 loc) 42.4 kB
/* 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, 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 */ var GridFilterDialogView = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridFilterDialogView, _super); function GridFilterDialogView(a) { var _this = _super.call(this) || this; _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; return _this; } GridFilterDialogView.prototype.y = function () { this.x(); this.b.bk(); }; GridFilterDialogView.prototype.t = function () { this.b.bc(this.l, this.k, this.aa); }; GridFilterDialogView.prototype.s = function () { if (KeyFrameAnimationFactory.h == null) { KeyFrameAnimationFactory.h = this.m; } }; GridFilterDialogView.prototype.a = function (a) { return new AnimationKeyFrameEffect(0, this.m.rootWrapper, 0, null, a); }; GridFilterDialogView.prototype.v = function (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); var 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; var e = this.h; var f = Math.round(d.rootWrapper.width()); var g = Math.round(d.rootWrapper.height()); var h = this.b.ak * e; var 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(); }; GridFilterDialogView.prototype.r = function (a) { var b = a; this.m.append(b.an); }; GridFilterDialogView.prototype.p = function () { return this.m; }; GridFilterDialogView.prototype.x = function () { 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"); } var a = intDivide(this.o.height(), 2) - (this.k / 2); this.m.rootWrapper.setStyleProperty("top", a + "px"); }; GridFilterDialogView.prototype.z = function () { this.y(); }; GridFilterDialogView.prototype.w = function (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(); }; GridFilterDialogView.prototype.u = function () { 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 = markType(GridFilterDialogView, 'GridFilterDialogView'); return GridFilterDialogView; }(Base)); export { GridFilterDialogView }; /** * @hidden */ var GridFilterDialogPanel = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridFilterDialogPanel, _super); function GridFilterDialogPanel(a, b, c, d) { var _this = _super.call(this) || this; _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; var e = c.createElement("div"); var 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"); var 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; return _this; } GridFilterDialogPanel.prototype.o = function (a) { a.stopPropagation(); }; GridFilterDialogPanel.prototype.onDocumentKeyDown = function (a) { if (BaseDOMEventProxy.c0(a) == 8) { } }; GridFilterDialogPanel.prototype.onDocumentMouseClick = function (e_) { { } }; GridFilterDialogPanel.prototype.onFilterApplyClick = function () { }; GridFilterDialogPanel.prototype.onFilterCancelClick = function () { }; GridFilterDialogPanel.prototype.t = function (a) { var _this = this; this.n(); this.g.setStyleProperty("display", "block"); this.f.appendToBody(this.g); if (this.k == null) { this.e.getPortal(this.g, "GridColumnOptions", function (b) { _this.d = b; var comp_ = b.componentRef; var col_ = a; var displayDensity_ = a.grid.density; var buttonDensity_ = GridFilterDialogPanel.c(displayDensity_, true); var filterListDensity_ = GridFilterDialogPanel.c(displayDensity_, true); _this.k = comp_.i; var 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); }; GridFilterDialogPanel.prototype.n = function () { var a = this.h.width(); var b = this.h.height(); var c = this.h.getNativeElement(); var d = c.getBoundingClientRect(); var e = (d.left); var f = (d.top); var g = (window.innerWidth); var h = (window.innerHeight); var i = 0; var j = 0; var 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"); }; GridFilterDialogPanel.prototype.l = function () { document.removeEventListener("keydown", this.onDocumentKeyDown, false); document.removeEventListener("mousedown", this.onDocumentMouseClick, false); var 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(); }; GridFilterDialogPanel.prototype.m = function () { this.f.destroy(); this.g.unlistenAll(); this.k = null; this.g = null; if (this.d != null) { this.d.destroy(); } }; GridFilterDialogPanel.c = function (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 = markType(GridFilterDialogPanel, 'GridFilterDialogPanel'); return GridFilterDialogPanel; }(Base)); export { GridFilterDialogPanel }; /** * @hidden */ var GridFilterDialog = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridFilterDialog, _super); function GridFilterDialog() { var _this = _super.call(this) || this; _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); return _this; } Object.defineProperty(GridFilterDialog.prototype, "as", { get: function () { return this.ar; }, set: function (a) { this.ar = a; }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "ab", { get: function () { return this.z; }, set: function (a) { var b = this.z; this.z = a; if (b != this.z) { this.bj("IsAnimationEnabled", b, this.z); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "aj", { get: function () { return this.ag; }, set: function (a) { var b = this.ag; this.ag = a; this.bj("PixelScalingRatio", b, this.ag); }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "ai", { get: function () { return this.af; }, set: function (a) { var b = this.af; this.af = a; this.bj("ActualPixelScalingRatio", b, this.af); }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "l", { get: function () { return this.j; }, set: function (a) { var b = this.j; this.j = a; if (b != this.j) { this.bj("IconHorizontalAlignment", enumGetBox(CellContentHorizontalAlignment_$type, b), enumGetBox(CellContentHorizontalAlignment_$type, this.j)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "k", { get: function () { return this.i; }, set: function (a) { var b = this.i; this.i = a; if (b != this.i) { this.bj("HeaderTextALignment", enumGetBox(CellContentHorizontalAlignment_$type, b), enumGetBox(CellContentHorizontalAlignment_$type, this.i)); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "an", { get: function () { return this.al; }, set: function (a) { var b = this.al; this.al = a; if (b != this.al) { this.bj("CellPaddingLeft", b, this.al); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "ao", { get: function () { return this.am; }, set: function (a) { var b = this.am; this.am = a; if (b != this.am) { this.bj("CellPaddingRight", b, this.am); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "bw", { get: function () { return this.bs; }, set: function (a) { var b = this.bs; this.bs = a; if (b != this.bs) { this.bj("IconColor", b, this.bs); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "ak", { get: function () { return this.ah; }, set: function (a) { var b = this.ah; this.ah = a; if (b != this.ah) { this.bj("ViewSize", b, this.ah); } }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "ac", { get: function () { return this.v.bx; }, enumerable: false, configurable: true }); GridFilterDialog.prototype.bj = function (a, b, c) { this.bm(a, b, c); if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } }; GridFilterDialog.prototype.bm = function (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; } }; GridFilterDialog.prototype.bn = function (a, b, c) { this.s.v(a, b, c); this.bg(); }; Object.defineProperty(GridFilterDialog.prototype, "n", { get: function () { return this.m; }, set: function (a) { var b = this.m; this.m = a; if (this.m != b) { this.bf(b, this.m); } }, enumerable: false, configurable: true }); GridFilterDialog.prototype.bf = function (a, b) { this.x = true; }; GridFilterDialog.prototype.bg = function () { var _this = this; NativeUIComponent.au(this.s.p(), 18, function (a) { var 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; }); }; GridFilterDialog.prototype.a6 = function (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) { var c = new GridFilterDialogOpeningEventArgs(); this.dialogOpening(this, c); } }; GridFilterDialog.prototype.a8 = function (a, b) { switch (b.propertyName) { case "IsHidden": break; } }; GridFilterDialog.prototype.bh = function () { }; GridFilterDialog.prototype.bi = function (a, b) { a.onModified = delegateRemove(a.onModified, runOn(this, this.bl)); if (b) { this.bp(); } else { this.bo(a, true); } this.f = null; }; GridFilterDialog.prototype.a9 = function () { this.s.s(); if (this.w == null) { var 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))); } }; GridFilterDialog.prototype.bq = function () { var _this = this; if (this.filterChanged != null) { this.filterChanged(this, ((function () { var $ret = new GridFilterDialogFilterChangeEventArgs(); $ret.a = _this.f; return $ret; })())); } }; GridFilterDialog.prototype.bp = function () { if (this.filterChanged != null) { this.filterChanged(this, ((function () { var $ret = new GridFilterDialogFilterChangeEventArgs(); $ret.a = null; return $ret; })())); } }; GridFilterDialog.prototype.bo = function (a, b) { var c = this.e(a); if (b) { if (this.filterChanged != null) { this.filterChanged(this, ((function () { var $ret = new GridFilterDialogFilterChangeEventArgs(); $ret.a = c; return $ret; })())); } } else { if (this.filterChanging != null) { this.filterChanging(this, ((function () { var $ret = new GridFilterDialogFilterChangeEventArgs(); $ret.a = c; return $ret; })())); } } }; GridFilterDialog.prototype.e = function (a) { var b = new ColumnFilterConditionGroup(); b.usesOrOperator = a.k; var c = new Stack$1(ColumnFilterConditionGroup.$); var d = 0; var e = b; for (var f = 0; f < a.f.count; f++) { var 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; }; GridFilterDialog.prototype.ae = function (a, b) { var c = 0; for (var 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; }; GridFilterDialog.prototype.g = function (a, b, c, d) { var e = this.aq(c, d); if (a > e) { b.e(); return b.d(); } return null; }; GridFilterDialog.prototype.aq = function (a, b) { var c = a.c(b); if (c == null) { return 0; } return a.e.indexOf(c); }; GridFilterDialog.prototype.h = function (a, b, c, d) { var e = this.aq(c, d); if (a < e) { var f = c.b(d); var g = new ColumnFilterConditionGroup(); g.usesOrOperator = f.a; b.h(g); return g; } return null; }; GridFilterDialog.prototype.d = function (a) { var b = new ColumnComparisonFilterCondition(); b.operator = this.c(a.l); b.value = a.i; return b; }; GridFilterDialog.prototype.c = function (a) { return EnumUtil.getEnumValue(ColumnComparisonConditionOperatorType_$type, EnumUtil.parse(ColumnComparisonConditionOperatorType_$type, a, true)); }; GridFilterDialog.prototype.bl = function (a) { this.bo(a, false); }; GridFilterDialog.prototype.t = function (a, b) { var c = new GridFilterDialogViewModel(); if (a != null) { this.a7(c, a, b); } else { var 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; }; GridFilterDialog.prototype.a7 = function (a, b, c) { if (b.isGroup()) { var d = b; for (var e = 0; e < d.count; e++) { var f = d.item(e); this.a7(a, f, c); } } else { a.f.add(this.u(b, c)); } }; GridFilterDialog.prototype.u = function (a, b) { var 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; }; GridFilterDialog.ap = function (a) { return ColumnComparisonFilterCondition.getOperandNumber(a); }; GridFilterDialog.at = function (a, b, c) { if (a == 0) { return ""; } return c.value != null ? c.value.toString() : ""; }; GridFilterDialog.au = function (a, b, c) { return ""; }; GridFilterDialog.b = function (a) { return ColumnComparisonFilterCondition.getOperandNumbers(a); }; GridFilterDialog.a = function (a) { var b = new Array(a.length); for (var c = 0; c < a.length; c++) { b[c] = EnumUtil.getName(ColumnComparisonConditionOperatorType_$type, a[c]); } return b; }; GridFilterDialog.az = function (a) { return EnumUtil.getName(ColumnComparisonConditionOperatorType_$type, a); }; GridFilterDialog.prototype.be = function (a, b) { this.s.w(a, b); }; GridFilterDialog.prototype.bd = function () { this.s.u(); }; GridFilterDialog.prototype.bc = function (a, b, c) { var 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; }; GridFilterDialog.prototype.br = function () { var _this = this; 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(function (a) { return _this.w.commitStyles(); }); } else { NativeUI.y(this.s.q, 1); } }; GridFilterDialog.prototype.bb = function () { var _this = this; 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(function (a) { return _this.w.commitStyles(); }); } else { NativeUI.y(this.s.q, 0); } this.y = false; } }; Object.defineProperty(GridFilterDialog.prototype, "commandCompleted", { get: function () { return this._commandCompleted; }, set: function (a) { this._commandCompleted = a; }, enumerable: false, configurable: true }); Object.defineProperty(GridFilterDialog.prototype, "invalidateActions", { get: function () { return this._invalidateActions; }, set: function (a) { this._invalidateActions = a; }, enumerable: false, configurable: true }); GridFilterDialog.prototype.bk = function () { if (this.renderCompleted != null) { this.renderCompleted(this, new FilterDialogRenderCompletedEventArgs()); } }; GridFilterDialog.prototype.ba = function () { if (this.v != null) { if (this.n != null && this.v.b1 != this.n) { this.v.b1 = this.n; } } }; GridFilterDialog.prototype.getDesiredToolbarActions = function () { if (!GridFilterDialog.aa) { GridFilterDialog.aa = true; SvgIconRegistry.instance.addSvgPathString("XGrid", "DotDotDot", GridFilterDialog.ay); } var 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; var b = [a]; return b; }; GridFilterDialog.prototype.addCommandAvailabilityListener = function (a) { }; GridFilterDialog.prototype.removeCommandAvailabilityListener = function (a) { }; GridFilterDialog.prototype.addCommandStateChangedListener = function (a) { }; GridFilterDialog.prototype.removeCommandStateChangedListener = function (a) { }; GridFilterDialog.prototype.onToolCommandExecuting = function (a) { return 0; }; GridFilterDialog.prototype.provideContextAccessor = function (a) { }; GridFilterDialog.prototype.dismissContextAccessor = function (a) { }; GridFilterDialog.prototype.ad = function (e_) { var a = e_.originalEvent.srcElement; var 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 = 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; }(Base)); export { GridFilterDialog }; /** * @hidden */ var GridFilterDialogViewModel = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridFilterDialogViewModel, _super); function GridFilterDialogViewModel() { var _this = _super.call(this) || this; _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); var a = _this.f; a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.t)); return _this; } GridFilterDialogViewModel.prototype.n = function () { var a = new GridFilterDialogViewModelRow(); var 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); }; GridFilterDialogViewModel.prototype.u = function (a) { if (this.onModified != null) { this.onModified(this); } }; GridFilterDialogViewModel.prototype.t = function (a, b) { switch (b.action) { case 0: if (b.newItems != null) { for (var c = 0; c < b.newItems.count; c++) { var d = b.newItems.item(c); this.q(c + b.newStartingIndex, d); } } break; case 1: if (b.oldItems != null) { for (var e = 0; e < b.oldItems.count; e++) { this.r(b.oldStartingIndex); } } break; case 2: if (b.oldItems != null) { for (var f = 0; f < b.oldItems.count; f++) { this.r(b.oldStartingIndex); } } if (b.newItems != null) { for (var g = 0; g < b.newItems.count; g++) { var 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); } }; GridFilterDialogViewModel.prototype.r = function (a) { var b = this.c(a); if (b == null) { return; } var c = this.b(a); if (c == null) { return; } this.w(c, a); for (var d = b.indexOf(c) + 1; d < b.count; d++) { this.v(b._inner[d], -1); } }; GridFilterDialogViewModel.prototype.w = function (a, b) { a.b--; }; GridFilterDialogViewModel.prototype.s = function () { this.e.clear(); }; GridFilterDialogViewModel.prototype.q = function (a, b) { var c = this.c(a); if (c == null) { return; } var d = this.b(a); if (d == null) { return; } this.p(d, a); for (var e = c.indexOf(d) + 1; e < c.count; e++) { this.v(c._inner[e], +1); } }; GridFilterDialogViewModel.prototype.v = function (a, b) { a.c += b; a.b -= b; }; GridFilterDialogViewModel.prototype.p = function (a, b) { a.b++; }; GridFilterDialogViewModel.prototype.b = function (a) { for (var b = this.e.count - 1; b >= 0; b--) { for (var 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; }; GridFilterDialogViewModel.prototype.c = function (a) { for (var b = this.e.count - 1; b >= 0; b--) { for (var 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; }; GridFilterDialogViewModel.prototype.h = function (a, b) { var c = this.d(a, b); if (this.i(c, a, b)) { if (this.e.count < this.m) { return true; } else { return false; } } return true; }; GridFilterDialogViewModel.prototype.i = function (a, b, c) { if (a == null) { return false; } for (var d = 0; d < a.count; d++) { if (this.j(a._inner[d], b, c)) { return true; } } return false; }; GridFilterDialogViewModel.prototype.j = function (a, b, c) { if (c > a.c || b > a.b) { return false; } return true; }; GridFilterDialogViewModel.prototype.d = function (a, b) { if (this.e.count == 0) { return null; } for (var 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]; }; GridFilterDialogViewModel.prototype.aa = function (a, b) { for (var c = 0; c < this.e.count; c++) { for (var 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); } }; GridFilterDialogViewModel.prototype.x = function () { for (var a = this.e.count - 1; a >= 0; a--) { var b = new List$1(GridFilterDialogViewModelGrouping.$, 0); for (var c = 0; c < this.e._inner[a].count; c++) { var 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 (var 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(); }; GridFilterDialogViewModel.prototype.y = function () { for (var a = this.e.count - 1; a >= 0; a--) { var b = new List$1(GridFilterDialogViewModelGrouping.$, 0); for (var c = 0; c < this.e._inner[a].count; c++) { b.add(this.e._inner[a]._inner[c]); } b.aa(function (d, e) { return Base.compareSimple(d.c, e.c); }); this.e._inner[a].clear(); for (var d = 0; d < this.e._inner[a].count; d++) { this.e._inner[a].add(b._inner[d]); } } }; GridFilterDialogViewModel.prototype.l = function (a, b) { for (var c = 0; c < this.e.count; c++) { for (var 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; }; GridFilterDialogViewModel.prototype.z = function (a, b) { for (var c = 0; c < this.e.count; c++) { for (var 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); } }; GridFilterDialogViewModel.prototype.o = function (a, b, c) { if (!this.h(a, b)) { return; } var d = this.d(a, b); var e = d; if (this.i(d, a, b)) { this.e.add(new GridFilterDialogViewModelGroupingLevel()); e = this.d(a, b); } e.add(((function () { var $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 = markType(GridFilterDialogViewModel, 'GridFilterDialogViewModel'); return GridFilterDialogViewModel; }(Base)); export { GridFilterDialogViewModel }; /** * @hidden */ var GridFilterDialogViewModelRowCollection = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GridFilterDialogViewModelRowCollection, _super); function GridFilterDialogViewModelRowCollection() { var _this = _super.call(this, GridFilterDialogViewModelRow.$, 0) || this; _this.ae = null; _this.af = null; _this.collectionChanged = delegateCombine(_this.collectionChanged, runOn(_this, _this.ah)); return _this; } GridFilterDialogViewModelRowCollection.prototype.ah = function (a, b) { if (b.oldItems != null) { for (var c = 0; c < b.oldItems.count; c++) { var d = b.oldItems.item(c); d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.ai)); } } if (b.newItems != null) { for (var e = 0; e < b.newItems.count; e++) { var f = b.newItems.item(e); f.propertyChanged = delegateCombine(f.propertyChanged, runOn(this, this.ai)); } } }; GridFilterDialogViewModelRowCollection.prototype.ai = function (a, b) { if (this.af != null) { this.af(this.ae); } }; Object.defineProperty(GridFilterDialogViewModelRowCollection.prototype, "ag", { get: function () { return this.af; }, set: function (a) { this.af = a; }, enumerable: false, configurable: true }); GridFilterDialogViewModelRowCollection.$t = markType(GridFilterDialogViewModelRowCollection, 'GridFilterDialogViewModelRowCollection', ObservableCollection$1.$.specialize(GridFilterDialogViewModelRow.$)); return GridFilterDialogViewModelRowCollection; }(ObservableCollection$1)); export { GridFilterDialogViewModelRowCollection };