UNPKG

@serenity-is/sleekgrid

Version:

A modern Data Grid / Spreadsheet component

93 lines (88 loc) 3.6 kB
var Slick = Slick || {}; Slick._ = (() => { var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/formatters/index.ts var index_exports = {}; __export(index_exports, { CheckboxFormatter: () => CheckboxFormatter, CheckmarkFormatter: () => CheckmarkFormatter, Formatters: () => Formatters, PercentCompleteBarFormatter: () => PercentCompleteBarFormatter, PercentCompleteFormatter: () => PercentCompleteFormatter, YesNoFormatter: () => YesNoFormatter }); // global-externals:_ var { escapeHtml } = Slick; // src/formatters/formatters.ts function PercentCompleteFormatter(ctx) { if (ctx.value == null || ctx.value === "") return "-"; if (ctx.value < 50) return "<span style='color:red; font-weight:bold;'>" + ctx.escape() + "%</span>"; return "<span style='color:green'>" + ctx.escape() + "%</span>"; } function PercentCompleteBarFormatter(ctx) { if (ctx.value == null || ctx.value === "") return ""; var color; if (ctx.value < 30) color = "red"; else if (ctx.value < 70) color = "silver"; else color = "green"; return "<span class='percent-complete-bar slick-percentcomplete-bar' style='background:" + color + ";width:" + ctx.escape() + "%' title='" + ctx.escape() + "%'></span>"; } function YesNoFormatter(ctx) { return ctx.value ? "Yes" : "No"; } function CheckboxFormatter(ctx) { return `<i class="slick-checkbox slick-edit-preclick${ctx.value ? " checked" : ""}"></i>`; } function CheckmarkFormatter(ctx) { return ctx.value ? '<i class="slick-checkmark"></i>' : ""; } // src/formatters/index.ts var Formatters; ((Formatters2) => { function PercentComplete(_row, _cell, value) { return PercentCompleteFormatter({ escape: escapeHtml, value }); } Formatters2.PercentComplete = PercentComplete; function PercentCompleteBar(_row, _cell, value) { return PercentCompleteBarFormatter({ escape: escapeHtml, value }); } Formatters2.PercentCompleteBar = PercentCompleteBar; function YesNo(_row, _cell, value) { return YesNoFormatter({ escape: escapeHtml, value }); } Formatters2.YesNo = YesNo; function Checkbox(_row, _cell, value) { return CheckboxFormatter({ escape: escapeHtml, value }); } Formatters2.Checkbox = Checkbox; function Checkmark(_row, _cell, value) { return CheckmarkFormatter({ escape: escapeHtml, value }); } Formatters2.Checkmark = Checkmark; })(Formatters || (Formatters = {})); return __toCommonJS(index_exports); })(); ["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; //# sourceMappingURL=slick.formatters.js.map