igniteui-react-core
Version:
Ignite UI React Core.
119 lines (118 loc) • 3.85 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 { __extends, __values } from "tslib";
import { Base, fromEnum, String_$type, markType } from "./type";
import { Brush } from "./Brush";
import { BrushCollection } from "./BrushCollection";
import { List$1 } from "./List$1";
import { MathUtil } from "./MathUtil";
import { ColorUtil } from "./ColorUtil";
import { truncate, isNaN_ } from "./number";
/**
* @hidden
*/
var BrushCollectionUtil = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(BrushCollectionUtil, _super);
function BrushCollectionUtil() {
return _super !== null && _super.apply(this, arguments) || this;
}
BrushCollectionUtil.d = function (a, b) {
if (isNaN_(b)) {
return null;
}
b = MathUtil.d(b, 0, a.count - 1);
var c = truncate(Math.floor(b));
if (c == b) {
return a.item(c);
}
return BrushCollectionUtil.e(b - c, a.item(c), a.item(c + 1), a.af);
};
BrushCollectionUtil.e = function (a, b, c, d) {
var e = b.color;
var f = c.color;
var g = ColorUtil.x(e, a, f, d);
var h = new Brush();
h.color = g;
return h;
};
BrushCollectionUtil.b = function (a) {
var e_1, _a;
var b = new BrushCollection();
try {
for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
var c = _c.value;
var d = ColorUtil.q(c);
if (d != null) {
b.add(d);
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
return b;
};
BrushCollectionUtil.c = function (a) {
if (a == null) {
return null;
}
var b = true;
if (typeof a === 'string') {
var str_ = a;
str_ = str_.trim();
var c = (str_.split(/[\s,]+(?![^(]*\))/gm));
for (var d = 0; d < c.length; d++) {
c[d] = c[d].trim();
}
a = c;
}
var e = a != null ? a[0] : null;
if (typeof e === 'string' && e == "HSV" || e == "RGB") {
if (a[0] == "HSV") {
b = false;
}
var f = new Array(a.length - 1);
for (var g = 1; g < a[0].length; g++) {
f[g] = a[g];
}
a = f;
}
var h = new BrushCollection();
for (var i = 0; a != null && i < a.length; i++) {
var j = Brush.create(a[i]);
h.add(j);
}
return h;
};
BrushCollectionUtil.a = function (a) {
if (a == null) {
return null;
}
var b = a;
var c = new List$1(String_$type, 0);
for (var d = 0; d < b.count; d++) {
var e = b.item(d);
if (e != null) {
c.add(e._fill);
}
}
return c.toArray();
};
BrushCollectionUtil.$t = markType(BrushCollectionUtil, 'BrushCollectionUtil');
return BrushCollectionUtil;
}(Base));
export { BrushCollectionUtil };