igniteui-react-grids
Version:
Ignite UI React grid components.
130 lines (129 loc) • 5.21 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 } from "igniteui-react-core";
import { Color } from "igniteui-react-core";
import { CellModel } from "./CellModel";
import { FontUtil } from "igniteui-react-core";
/**
* @hidden
*/
export let ContentCellModelHelper = /*@__PURE__*/ (() => {
class ContentCellModelHelper extends Base {
static g(a) {
if (a == null) {
return ContentCellModelHelper.f;
}
return a.color;
}
static c(a, b, c) {
switch (c) {
case 0:
a.setRawStyleProperty("text-align", "left");
break;
case 1:
a.setRawStyleProperty("text-align", "center");
break;
case 2:
a.setRawStyleProperty("text-align", "right");
break;
case 3:
a.setRawStyleProperty("text-align", "center");
break;
}
}
static e(a, b, c) {
switch (c) {
case 0:
b.setRawStyleProperty("vertical-align", "top");
break;
case 1:
b.setRawStyleProperty("vertical-align", "center");
break;
case 2:
b.setRawStyleProperty("vertical-align", "bottom");
break;
case 3:
b.setRawStyleProperty("vertical-align", "center");
break;
}
}
static a(a, b, c, d, e) {
if (b.a3) {
if (b.a8(CellModel.fa) || b.a8(CellModel.eg) || b.a8(CellModel.hc) || b.a7("IsRowPinned") || b.a7("IsRowSticky") || b.a7("PinnedRowOpacity")) {
let f = Math.min(1, Math.max(0, b.ct));
let g = b.cg * (1 - f);
d.setRawStyleProperty("opacity", g.toString());
if (b.bi) {
e.ci(b.cg * f);
}
}
if (b.a8(CellModel.er)) {
ContentCellModelHelper.d(d, b.lw);
if (b.bi) {
e.cf(b.lw);
}
}
if (b.a8(CellModel.gg)) {
switch (b.aa) {
case 0:
d.setRawStyleProperty("white-space", "nowrap");
d.setRawStyleProperty("text-overflow", "ellipsis");
break;
case 3:
case 2:
d.setRawStyleProperty("white-space", "pre-wrap");
d.setRawStyleProperty("text-overflow", "ellipsis");
break;
case 1:
d.setRawStyleProperty("white-space", "nowrap");
d.setRawStyleProperty("text-overflow", "clip");
break;
}
}
if (b.a8(CellModel.fw) || b.a8(CellModel.hb)) {
let h = b.g;
let i = b.i;
ContentCellModelHelper.c(c, d, h);
e.bq(c, d, h);
ContentCellModelHelper.e(c, d, i);
if (b.bi) {
e.ce(h, i);
}
}
if (b.a7("ActualFontInfo")) {
ContentCellModelHelper.b(a, d, b.ae);
}
if (b.a7("IsEdited") || b.a7("IsDeleted")) {
if (b.a9 || b.a6) {
if (b.a6) {
d.setRawStyleProperty("text-decoration", "line-through");
}
else {
d.setRawStyleProperty("text-decoration", "none");
}
}
else {
d.setRawStyleProperty("text-decoration", "none");
}
}
}
}
static b(a, b, c) {
if (c == null) {
c = FontUtil.getDefaultFont(a);
}
b.setRawStyleProperty("font", c.fontString);
}
static d(a, b) {
let c = ContentCellModelHelper.g(b);
a.setRawStyleProperty("color", c.colorString);
}
}
ContentCellModelHelper.$t = /*@__PURE__*/ markType(ContentCellModelHelper, 'ContentCellModelHelper');
ContentCellModelHelper.f = /*@__PURE__*/ Color.u(0, 0, 0, 0);
return ContentCellModelHelper;
})();