UNPKG

igniteui-react-core

Version:
162 lines (161 loc) 5.36 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, String_$type, typeCast, markType } from "./type"; import { List$1 } from "./List$1"; import { FastReflectionHelper } from "./FastReflectionHelper"; import { FormatSpecifier } from "./FormatSpecifier"; import { NumberFormatSpecifier } from "./NumberFormatSpecifier"; import { DateTimeFormatSpecifier } from "./DateTimeFormatSpecifier"; /** * @hidden */ var BindingFormatter = /** @class */ /*@__PURE__*/ (function (_super) { __extends(BindingFormatter, _super); function BindingFormatter() { var _this = _super.call(this) || this; _this.h = null; _this.a = null; _this.f = null; _this.g = null; _this.b = null; _this.c = null; return _this; } Object.defineProperty(BindingFormatter.prototype, "j", { get: function () { return this.h; }, set: function (a) { this.h = a; this.l(); }, enumerable: false, configurable: true }); BindingFormatter.prototype.l = function () { var a = this.j; if (a == null) { return; } var b = 0; var c = new List$1(String_$type, 0); var d = new List$1(FastReflectionHelper.$, 0); var e = new List$1(String_$type, 0); for (var f = a.indexOf('{', b); f >= b; f = a.indexOf('{', b)) { e.add(a.substr(b, f - b)); var g = a.indexOf('}', f); if (g <= f) { return; } var h = a.substr(f + 1, g - f - 1).trim(); var i = h.indexOf(':'); if (i == -1) { c.add(h); if (h == "0" || h == ".") { d.add(null); } else { d.add(new FastReflectionHelper(false, h)); } } else { var j = h.substr(0, i).trim(); d.add(new FastReflectionHelper(false, j)); c.add(j); if (j == "0" || j == ".") { d.add(null); } else { d.add(new FastReflectionHelper(false, h)); } } b = g + 1; } e.add(a.substr(b)); this.f = e; this.g = d; }; Object.defineProperty(BindingFormatter.prototype, "d", { get: function () { return this.a; }, set: function (a) { this.a = a; this.k(); }, enumerable: false, configurable: true }); BindingFormatter.prototype.k = function () { if (this.a == null) { this.b = null; this.c = null; return; } this.b = new Array(this.a.length); this.c = new Array(this.a.length); for (var a = 0; a < this.a.length; a++) { var spec_ = this.a[a]; if ((spec_._implementation)) { spec_ = (spec_._implementation); } var b = this.e(spec_); this.c[a] = b; if (b != 0) { if (typeCast(FormatSpecifier.$, spec_) !== null) { this.b[a] = spec_.toIntl(); } else { this.b[a] = spec_; } } } }; BindingFormatter.prototype.e = function (a) { if (a == null) { return 0; } var v_ = a; if ((v_ instanceof Intl.NumberFormat) || typeCast(NumberFormatSpecifier.$, v_) !== null) { return 1; } if ((v_ instanceof Intl.DateTimeFormat) || typeCast(DateTimeFormatSpecifier.$, v_) !== null) { return 2; } return 0; }; BindingFormatter.prototype.i = function (a) { var b = ""; if (this.f == null) { return b; } for (var c = 0; c < this.f.count; c++) { b += this.f._inner[c]; if (c < this.g.count) { var obj_ = a; var d = this.g._inner[c]; if (d != null) { obj_ = d.getPropertyValue(obj_); } if (this.b != null && c < this.b.length && this.b[c] != null) { var platformSpecifier_ = this.b[c]; var e = this.c[c]; var intlSpecifier_ = platformSpecifier_; b += intlSpecifier_.format(obj_); } else { b += obj_ != null ? obj_.toString() : ""; } } } return b; }; BindingFormatter.$t = markType(BindingFormatter, 'BindingFormatter'); return BindingFormatter; }(Base)); export { BindingFormatter };