UNPKG

igniteui-webcomponents-inputs

Version:

Ignite UI Web Components inputs components.

212 lines (211 loc) 7.16 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 { Base, String_$type, Number_$type, fromEnum, markType } from "igniteui-webcomponents-core"; import { Dictionary$2 } from "igniteui-webcomponents-core"; import { List$1 } from "igniteui-webcomponents-core"; import { HashSet$1 } from "igniteui-webcomponents-core"; import { Replaced } from "./Replaced"; import { ObservableCollection$1 } from "igniteui-webcomponents-core"; let MaskParsingService = /*@__PURE__*/ (() => { class MaskParsingService extends Base { h(a, b) { let c = ""; let d = ""; let e = b.a; let f = this.d(e); let g = new List$1(Number_$type, 1, f.keys); let h = this.e(e, g); let i = new List$1(String_$type, 1, f.values); if (a != null) { d = a.toString(); } for (let j = 0; j < e.length; j++) { c += b.b; } for (let k of fromEnum(f)) { c = this.j(c, k.key, k.value); } if (d == "") { return c; } let l = this.f(d, i); for (let m = 0; m < l.count; m++) { let n = l._inner[m]; let o = this.c(n, h._inner[m], e); if (!o && n != b.b) { l._inner[m] = b.b; } } if (l.count > h.count) { l.v(h.count + 1, l.count); } let p = 0; for (let q of fromEnum(l)) { let r = q; c = this.j(c, h._inner[p++], r); } return c; } i(a, b) { let c = ""; let d = b.a; let e = this.d(d); let f = new HashSet$1(String_$type, 0); for (let g of fromEnum(e.values)) { f.add_1(g); } for (let h = 0; h < a.length; h++) { let i = a.charAt(h).toString(); if (!f.contains(i)) { if (i != b.b) { c += i; } } } return c; } a(a, b, c, d, e) { let f = this.d(c.a); let g = new ObservableCollection$1(String_$type, 0); for (let h = 0; h < b.length; h++) { g.add(b.charAt(h).toString()); } let i = d; e = Math.min(e, a.length); for (let j = d; j < e || (g.count > 0 && j < a.length); j++) { if (f.containsKey(j)) { if (g._inner[0] == a.charAt(j).toString()) { i = j + 1; g.removeAt(0); } continue; } if (g._inner[0] != null && !this.c(g._inner[0].toString(), j, c.a) && g._inner[0].toString() != c.b) { break; } let k = c.b; if (g.count > 0) { i = j + 1; k = g._inner[0]; g.removeAt(0); } a = this.j(a, j, k); } let l = new Replaced(); l.b = a; l.a = i; return l; } j(a, b, c) { if (a != null) { return a.substr(0, b) + c + a.substr(b + 1); } return null; } b(a, b) { return a.test(b); } c(a, b, c) { let d; let e; let f = "[\\d\\u00C0-\\u1FFF\\u2C00-\\uD7FFa-zA-Z]"; let g = "[\\d\\u00C0-\\u1FFF\\u2C00-\\uD7FFa-zA-Z\\u0020]"; let h = "[\\u00C0-\\u1FFF\\u2C00-\\uD7FFa-zA-Z]"; let i = "[\\u00C0-\\u1FFF\\u2C00-\\uD7FFa-zA-Z\\u0020]"; let j = "[\\d]"; let k = "[\\d\\u0020]"; let l = "[\\d-\\+\\s]"; switch (c.charAt(b)) { case 'C': e = a != ""; break; case '&': d = new RegExp("[\\u0020]"); e = !this.b(d, a); break; case 'a': d = new RegExp(g); e = this.b(d, a); break; case 'A': d = new RegExp(f); e = this.b(d, a); break; case '?': d = new RegExp(i); e = this.b(d, a); break; case 'L': d = new RegExp(h); e = this.b(d, a); break; case '0': d = new RegExp(j); e = this.b(d, a); break; case '9': d = new RegExp(k); e = this.b(d, a); break; case '#': d = new RegExp(l); e = this.b(d, a); break; default: e = false; break; } return e; } d(a) { let b = new Dictionary$2(Number_$type, String_$type, 0); for (let c = 0; c < a.length; c++) { let d = a.charAt(c); if (!MaskParsingService.g.contains(d)) { b.addItem(c, d.toString()); } } return b; } e(a, b) { let c = new List$1(Number_$type, 0); for (let d = 0; d < a.length; d++) { if (!b.contains(d)) { c.add(d); } } return c; } f(a, b) { let c = new List$1(String_$type, 0); for (let d = 0; d < a.length; d++) { let e = a.charAt(d).toString(); if (!b.contains(e)) { b.remove(e); c.add(e); } } return c; } } MaskParsingService.$t = /*@__PURE__*/ markType(MaskParsingService, 'MaskParsingService'); MaskParsingService.g = /*@__PURE__*/ ((() => { let $ret = new List$1(String_$type, 0); $ret.add('C'); $ret.add('&'); $ret.add('a'); $ret.add('A'); $ret.add('?'); $ret.add('L'); $ret.add('9'); $ret.add('0'); $ret.add('#'); return $ret; })()); return MaskParsingService; })(); export { MaskParsingService };