Add empty text property to all blocks (#10332)

* Add noRowsMessage for Table

* CardsBlock noRowsMessage setting

* RowExplorer noRowsMessage setting

* Add noRowsMessage setting for FormBlock

* Fix default noRowsMessage
This commit is contained in:
melohagan 2023-04-20 10:36:43 +01:00 committed by GitHub
parent 22d42afe8f
commit 3073fcfc63
6 changed files with 46 additions and 3 deletions

View File

@ -3661,6 +3661,12 @@
"defaultValue": false, "defaultValue": false,
"info": "Row selection is only compatible with internal or SQL tables" "info": "Row selection is only compatible with internal or SQL tables"
}, },
{
"type": "text",
"label": "Empty text",
"key": "noRowsMessage",
"defaultValue": "No rows found"
},
{ {
"section": true, "section": true,
"name": "On Row Click", "name": "On Row Click",
@ -4375,6 +4381,12 @@
"key": "filter", "key": "filter",
"nested": true "nested": true
}, },
{
"type": "text",
"label": "Empty text",
"key": "noRowsMessage",
"defaultValue": "No rows found"
},
{ {
"type": "searchfield", "type": "searchfield",
"label": "Search fields", "label": "Search fields",
@ -4532,6 +4544,12 @@
"label": "Paginate", "label": "Paginate",
"key": "paginate" "key": "paginate"
}, },
{
"type": "text",
"label": "Empty text",
"key": "noRowsMessage",
"defaultValue": "No rows found"
},
{ {
"section": true, "section": true,
"name": "Cards", "name": "Cards",
@ -4945,6 +4963,17 @@
], ],
"defaultValue": "spectrum--medium" "defaultValue": "spectrum--medium"
}, },
{
"type": "text",
"label": "Empty text",
"key": "noRowsMessage",
"defaultValue": "We couldn't find a row to display",
"dependsOn": {
"setting": "actionType",
"value": "Create",
"invert": true
}
},
{ {
"section": true, "section": true,
"name": "Fields", "name": "Fields",
@ -5064,6 +5093,12 @@
"key": "height", "key": "height",
"defaultValue": "426px" "defaultValue": "426px"
}, },
{
"type": "text",
"label": "Empty text",
"key": "noRowsMessage",
"defaultValue": "No data"
},
{ {
"section": true, "section": true,
"name": "Cards", "name": "Cards",

View File

@ -29,6 +29,7 @@
export let cardButtonText export let cardButtonText
export let cardButtonOnClick export let cardButtonOnClick
export let linkColumn export let linkColumn
export let noRowsMessage
const { fetchDatasourceSchema } = getContext("sdk") const { fetchDatasourceSchema } = getContext("sdk")
@ -180,7 +181,7 @@
hAlign: "stretch", hAlign: "stretch",
vAlign: "top", vAlign: "top",
gap: "M", gap: "M",
noRowsMessage: "No rows found", noRowsMessage: noRowsMessage || "No rows found",
}} }}
styles={{ styles={{
custom: `display: grid;\ngrid-template-columns: repeat(auto-fill, minmax(min(${cardWidth}px, 100%), 1fr));`, custom: `display: grid;\ngrid-template-columns: repeat(auto-fill, minmax(min(${cardWidth}px, 100%), 1fr));`,

View File

@ -16,6 +16,8 @@
export let detailFields export let detailFields
export let detailTitle export let detailTitle
export let noRowsMessage
const stateKey = generate() const stateKey = generate()
let listDataProviderId let listDataProviderId
@ -105,7 +107,7 @@
dataProvider: `{{ literal ${safe(listDataProviderId)} }}`, dataProvider: `{{ literal ${safe(listDataProviderId)} }}`,
direction: "column", direction: "column",
gap: "S", gap: "S",
noRowsMessage: "No data", noRowsMessage: noRowsMessage || "No data",
}} }}
> >
<BlockComponent <BlockComponent

View File

@ -25,6 +25,7 @@
export let titleButtonText export let titleButtonText
export let titleButtonClickBehaviour export let titleButtonClickBehaviour
export let onClickTitleButton export let onClickTitleButton
export let noRowsMessage
const { fetchDatasourceSchema, API } = getContext("sdk") const { fetchDatasourceSchema, API } = getContext("sdk")
const stateKey = `ID_${generate()}` const stateKey = `ID_${generate()}`
@ -221,6 +222,7 @@
allowSelectRows, allowSelectRows,
size, size,
onClick: rowClickActions, onClick: rowClickActions,
noRowsMessage: noRowsMessage || "No rows found",
}} }}
/> />
</BlockComponent> </BlockComponent>

View File

@ -16,6 +16,7 @@
export let showDeleteButton export let showDeleteButton
export let rowId export let rowId
export let actionUrl export let actionUrl
export let noRowsMessage
const { fetchDatasourceSchema } = getContext("sdk") const { fetchDatasourceSchema } = getContext("sdk")
@ -89,7 +90,7 @@
bind:id={repeaterId} bind:id={repeaterId}
props={{ props={{
dataProvider, dataProvider,
noRowsMessage: "We couldn't find a row to display", noRowsMessage: noRowsMessage || "We couldn't find a row to display",
direction: "column", direction: "column",
hAlign: "center", hAlign: "center",
}} }}

View File

@ -13,6 +13,7 @@
export let allowSelectRows export let allowSelectRows
export let compact export let compact
export let onClick export let onClick
export let noRowsMessage
const component = getContext("component") const component = getContext("component")
const { styleable, getAction, ActionTypes, rowSelectionStore } = const { styleable, getAction, ActionTypes, rowSelectionStore } =
@ -144,6 +145,7 @@
autoSortColumns={!columns?.length} autoSortColumns={!columns?.length}
on:sort={onSort} on:sort={onSort}
on:click={handleClick} on:click={handleClick}
placeholderText={noRowsMessage || "No rows found"}
> >
<slot /> <slot />
</Table> </Table>