Skip to content

Commit b448c41

Browse files
author
Dave Conway-Jones
committed
add unicode support to ui_list icon as optional icon_unicode
1 parent 4033261 commit b448c41

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

node-red-node-ui-list/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ An array of Items is passed in by `msg.payload`. It consists of objects contain
2626
- `description` - description of the item. optional if line type is `Single-line ` or action type is `menu`,
2727
- `icon` - URL of icon (optional),
2828
- `icon_name` - Font Awesome 4.7 icon name (optional),
29+
- `icon_unicode` - text to use as icon - useful for unicode symbols like flags, etc (optional).
2930
- `menu` - list of menu items (optional).
3031

3132
If you just need a simple text list then `msg.payload` can be a simple array of strings, e.g. `["Item1","Item2","Item3"]`
@@ -42,7 +43,9 @@ An action to be taken for a displayed item can be selected by the `Action` selec
4243

4344
If `Allow HTML in displayed text` checkbox is selected, HTML tags can be used in `title` and `description`.
4445

45-
Icon can be specified by `icon` or `icon_name` property. `icon` specifies URL of icon image. If `icon` is `null`, blank icon is displayed. `icon_name` specifies an icon name of Font Awesome 4.7 icons (e.g. `fa-home`). `icon` has precedence over `icon_name`.
46+
Icon can be specified by `icon` or `icon_name` property. `icon` specifies URL of icon image. If `icon` is `null`, blank icon is displayed. `icon_name` specifies an icon name of Font Awesome 4.7 icons (e.g. `fa-home`).
47+
`icon_unicode` specifies text character to use as an icon, useful for displaying unicode symbols like flags, etc.
48+
`icon` has precedence over `icon_name` and `icon_unicode`.
4649

4750
Example
4851
-------

node-red-node-ui-list/locales/en-US/ui_list.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ <h3>Inputs</h3>
1111
<li><b>menu</b> - list of menu items (optional),</li>
1212
<li><b>icon</b> - URL of icon (optional),</li>
1313
<li><b>icon_name</b> - font icon name (optional).</li>
14+
<li><b>icon_unicode</b> - alternative to icon name - uses text characters (optional).</li>
1415
<li><b>isChecked</b> - boolean, set the item checked or on (optional).</li>
1516
</ul>
1617
</dd>
@@ -37,5 +38,6 @@ <h3>Details</h3>
3738
</ul>
3839
<p>If <b>Allow HTML in displayed text</b> checkbox is selected, HTML tags can be used in the <code>title</code> and <code>description</code>.</p>
3940
<p>Icon can be specified by <code>icon</code> or <code>icon_name</code> propeety. <code>icon</code> specifies URL of icon file. If <code>icon</code> is <code>null</code>, blank icon is displayed.
40-
<code>icon_name</code> specifies icon name of font icons. <code>icon</code> has precedence over <code>icon_name</code>.</p>
41+
<code>icon_name</code> specifies icon name of font icons. <code>icon_unicode</code> specifies text to use as an icon - useful for unicode symbols like flags, etc.
42+
<code>icon</code> has precedence over <code>icon_name</code> and <code>icon_unicode</code>.</p>
4143
</script>

node-red-node-ui-list/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-ui-list",
3-
"version": "0.2.5",
3+
"version": "0.3.0",
44
"description": "Node-RED Dashboard UI widget node for simple list",
55
"author": "Hiroyasu Nishiyama",
66
"contributors": [

node-red-node-ui-list/ui_list.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ module.exports = function(RED) {
5858
var icon = String.raw`
5959
<img src="{{item.icon}}" class="md-avatar" ng-if="(item.icon !== undefined) && (item.icon !== null)">
6060
<md-icon aria-label="{{item.desc}}" ng-if="(item.icon === undefined) && (item.icon_name !== undefined)"><ui-icon icon="{{item.icon_name}}"></ui-icon></md-icon>
61-
<md-icon class="md-avatar-icon" aria-label="{{item.desc}}" ng-if="(item.icon === null) && (item.icon_name === undefined)"></md-icon>
61+
<span class="md-avatar" style="font-size:x-large; height:unset;" ng-if="(item.icon === undefined) && (item.icon_unicode !== undefined)"><h1>{{item.icon_unicode}}</h1></span>
62+
<md-icon class="md-avatar-icon" aria-label="{{item.desc}}" ng-if="(item.icon === null) && (item.icon_name === undefined) && (item.icon_unicode === undefined)"></md-icon>
6263
`;
6364
var body = null;
6465
if (line_type === "one") {

0 commit comments

Comments
 (0)