From 2c29ea48c2a88554e5e868b5e63a45563fb635b3 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Thu, 4 Feb 2021 14:50:53 +0100 Subject: [PATCH] add icon column - not sure yet if this is shit or not --- zero.Web.UI/app/core/list-column.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/zero.Web.UI/app/core/list-column.ts b/zero.Web.UI/app/core/list-column.ts index f372c5d7..ba96d609 100644 --- a/zero.Web.UI/app/core/list-column.ts +++ b/zero.Web.UI/app/core/list-column.ts @@ -174,6 +174,31 @@ class ListColumn } + /** + * Outputs an icon + * @param {string} [icon] - Fixed icon name + * @param {string} [size=17] - Size of the icon + * @returns {ListColumn} + */ + icon(icon, size) + { + size = size || 17; + this.#type = 'icon'; + this.#asHtml = true; + this.#func = (value, opts) => + { + let ico = (icon || value).trim(); + let html = ``; + if (ico.indexOf('flag') !== 0) + { + html += ``; + } + return html + ``; + }; + return this; + } + + /** * Shortcut for text() with predefined label and class * @returns {ListColumn}