diff --git a/docs/examples/ui-table-cell-types.json b/docs/examples/ui-table-cell-types.json new file mode 100644 index 000000000..2d84a4745 --- /dev/null +++ b/docs/examples/ui-table-cell-types.json @@ -0,0 +1,171 @@ +[ + { + "id": "78b43be39f6db8e1", + "type": "ui-table", + "z": "9cb9bb3cd8e3faee", + "group": "5c66023267e5559e", + "name": "", + "label": "text", + "order": 3, + "width": 0, + "height": 0, + "maxrows": "0", + "autocols": false, + "showSearch": false, + "selectionType": "none", + "columns": [ + { + "title": "My Column", + "key": "columnA", + "type": "text", + "width": "", + "align": "start" + }, + { + "title": "My Other Column", + "key": "columnB", + "type": "text", + "width": "", + "align": "start" + }, + { + "title": "URL", + "key": "link", + "type": "link", + "width": "300px", + "align": "start" + }, + { + "title": "Progress", + "key": "progress", + "type": "progress", + "width": "", + "align": "start" + }, + { + "title": "Row", + "key": "", + "type": "row", + "width": "", + "align": "start" + }, + { + "title": "Trend", + "key": "array", + "type": "sparkline-trend", + "width": "", + "align": "start" + }, + { + "title": "Bar", + "key": "array", + "type": "sparkline-bar", + "width": "", + "align": "start" + }, + { + "title": "Tick/Cross", + "key": "boolean", + "type": "tickcross", + "width": "", + "align": "start" + }, + { + "title": "Spot", + "key": "color", + "type": "color", + "width": "", + "align": "center" + } + ], + "x": 490, + "y": 60, + "wires": [ + [] + ] + }, + { + "id": "6cdf36ffe9daf59c", + "type": "inject", + "z": "9cb9bb3cd8e3faee", + "name": "", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": 0.1, + "topic": "", + "payload": "[{\"columnA\":\"Hello\",\"columnB\":\"World\",\"link\":\"https://news.bbc.co.uk\",\"progress\":76,\"color\":\"#FF0000\",\"array\":[6,7,9,2,4],\"boolean\":true},{\"columnA\":\"Hey\",\"columnB\":\"Globe\",\"link\":\"https://flowfuse.com\",\"progress\":56,\"color\":\"#24aa69\",\"array\":[1,3,6,3,5],\"boolean\":false}]", + "payloadType": "json", + "x": 350, + "y": 60, + "wires": [ + [ + "78b43be39f6db8e1" + ] + ] + }, + { + "id": "5c66023267e5559e", + "type": "ui-group", + "name": "Table Cell Types", + "page": "bbc7b44a426b2b01", + "width": "12", + "height": "1", + "order": 3, + "showTitle": true, + "className": "", + "visible": "true", + "disabled": "false" + }, + { + "id": "bbc7b44a426b2b01", + "type": "ui-page", + "name": "UI Table Example", + "ui": "c2e1aa56f50f03bd", + "path": "/table", + "icon": "table", + "layout": "grid", + "theme": "c2ff5ba1f92a0f0e", + "order": 11, + "className": "", + "visible": "true", + "disabled": "false" + }, + { + "id": "c2e1aa56f50f03bd", + "type": "ui-base", + "name": "Dashboard", + "path": "/dashboard", + "includeClientData": true, + "acceptsClientConfig": [ + "ui-control", + "ui-notification" + ], + "showPathInSidebar": true, + "navigationStyle": "temporary", + "titleBarStyle": "fixed" + }, + { + "id": "c2ff5ba1f92a0f0e", + "type": "ui-theme", + "name": "Default", + "colors": { + "surface": "#ffffff", + "primary": "#0094ce", + "bgPage": "#eeeeee", + "groupBg": "#ffffff", + "groupOutline": "#cccccc" + }, + "sizes": { + "pagePadding": "12px", + "groupGap": "12px", + "groupBorderRadius": "4px", + "widgetGap": "12px" + } + } +] \ No newline at end of file diff --git a/docs/nodes/widgets/ui-table.md b/docs/nodes/widgets/ui-table.md index 3fdb9ab50..c67f3dd9a 100644 --- a/docs/nodes/widgets/ui-table.md +++ b/docs/nodes/widgets/ui-table.md @@ -16,9 +16,19 @@ dynamic: --- + # Data Table `ui-table` Renders a set of data in a tabular format. Expects an input (`msg.payload`) in the format of: @@ -47,19 +57,58 @@ The table will be rendered with colums `colA`, `colB` and `colC`, unless "Column - **Click**: The full row becomes a clickable entity, and the `ui-table` node will _output the full object_ associated to a row when clicked. - **Checkbox**: Each row has a checkbox, and the `ui-table` node will _output an array of objects_ associated to the checked rows when a checkbox is selected. + +### Configuring Columns + +![Screenshot of the configuration options available for column types in Node-RED](/images/node-examples/ui-table-column-config.png "Screenshot of the configuration options available for column types in Node-RED"){data-zoomable} +_Screenshot of the configuration options available for column types in Node-RED_ + +If you toggle "off" the "Auto Columns" option, you will have more control to define the columns for your table. For each column, you can define the following: + +- **Key**: The key in the object to use for the column data. +- **Label**: The text to display in the column header. +- **Width**: The width of the column, can be in `px`, `%`, or any other valid CSS sizing. +- **Align:** The alignment of the text in the column. Can be `Left`, `Center`, or `Right`. Note that some columns do look odd with "Center" alignment as the header does also contain space for the sorting icon. +- **Type**: Defines the cell's type and controls how your data will be rendered for this column. + +### Cell Types + +![An example of a ui-table displaying various of the cell types available](/images/node-examples/ui-table-cell-types.png "An example of a ui-table displaying various of the cell types available"){data-zoomable} +_An example of a ui-table displaying various of the cell types available_ + +- **Text**: Renders the cell as plain text. +- **HTML**: Will respect new line breaks (e.g. `\n`) and basic HTML tags. +- **Link**: Renders the cell as a hyperlink. The `Link` field should contain the URL to link to. +- **Color**: Renders the cell as a colored box. The `Color` field should contain a valid CSS color. +- **Tick/Cross**: Renders the cell as a tick or cross. The `Value` field should contain a boolean (`true`/`false`) value. +- **Progress**: Renders the cell as a progress bar. The `Value` field should contain a number between 0 and 100. +- **Sparkline - Trend**: Renders the cell as a small line chart without axes. The `Value` field should contain an array of numbers to be plotted. +- **Sparkline - Bar**: Renders the cell as a small bar chart without axes. The `Value` field should contain an array of numbers to be plotted. +- **Row Number**: Renders the row number into the cell. + +#### Example + + + ## Dynamic Properties -## Examples +## Table Configuration ### Search & Filter +The `ui-table` node can be configured to include a search bar above the table. This will allow users to search and filter across all columns, and automatically search across all columns when you type. + +#### Example + ![Example of a Data Table with Search & Filter](/images/node-examples/ui-table-search.png "Example of a Data Table with Search & Filter"){data-zoomable} *Example of a Data Table with Search & Filter" enabled.* ### Interaction +Example that show how a table will appear with different selection types chosen. + #### Default - No Selection Events ![Example of a Data Table](/images/node-examples/ui-table.png "Example of a Data Table"){data-zoomable} diff --git a/docs/public/images/node-examples/ui-table-cell-types.png b/docs/public/images/node-examples/ui-table-cell-types.png new file mode 100644 index 000000000..cc1e97ea2 Binary files /dev/null and b/docs/public/images/node-examples/ui-table-cell-types.png differ diff --git a/docs/public/images/node-examples/ui-table-column-config.png b/docs/public/images/node-examples/ui-table-column-config.png new file mode 100644 index 000000000..d5ebdef9c Binary files /dev/null and b/docs/public/images/node-examples/ui-table-column-config.png differ diff --git a/nodes/widgets/locales/en-US/ui_table.html b/nodes/widgets/locales/en-US/ui_table.html new file mode 100644 index 000000000..f6e708ac2 --- /dev/null +++ b/nodes/widgets/locales/en-US/ui_table.html @@ -0,0 +1,55 @@ + \ No newline at end of file diff --git a/nodes/widgets/locales/en-US/ui_table.json b/nodes/widgets/locales/en-US/ui_table.json index ea18e838c..4461935b5 100644 --- a/nodes/widgets/locales/en-US/ui_table.json +++ b/nodes/widgets/locales/en-US/ui_table.json @@ -8,6 +8,12 @@ "autoCalculateColumns": "Auto Calculate Columns", "key": "Key", "label": "Label", + "type": "Type", + "width": "Width", + "align": "Align", + "alignLeft": "Left", + "alignCenter": "Center", + "alignRight": "Right", "column": "column", "selection": "Interaction", "search": "Search", diff --git a/nodes/widgets/ui_table.html b/nodes/widgets/ui_table.html index 3381379f8..81d69a9ec 100644 --- a/nodes/widgets/ui_table.html +++ b/nodes/widgets/ui_table.html @@ -1,5 +1,61 @@ + + + +