diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index 5ab7a7f047..b518ac3d92 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -80,8 +80,4 @@ .active svg { color: var(--spectrum-global-color-blue-600); } - - .spectrum-ActionButton-label { - padding-bottom: 2px; - } diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 1d957b3f30..863dc84040 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -36,6 +36,7 @@ export let disableSorting = false export let autoSortColumns = true export let compact = false + export let customPlaceholder = false const dispatch = createEventDispatcher() @@ -387,13 +388,24 @@ {/each} {:else} -
-
- - - -
No rows found
-
+
+ {#if customPlaceholder} + + {:else} +
+ + + +
No rows found
+
+ {/if}
{/if}
@@ -458,6 +470,13 @@ justify-content: flex-start; align-items: center; user-select: none; + border-top: var(--table-border); + } + .spectrum-Table-headCell:first-of-type { + border-left: var(--table-border); + } + .spectrum-Table-headCell:last-of-type { + border-right: var(--table-border); } .spectrum-Table-headCell--alignCenter { justify-content: center; @@ -576,16 +595,19 @@ border-top: none; grid-column: 1 / -1; background-color: var(--table-bg); + padding: 40px; } .placeholder--no-fields { border-top: var(--table-border); } + .placeholder--custom { + justify-content: flex-start; + } .wrapper--quiet .placeholder { border-left: none; border-right: none; } .placeholder-content { - padding: 40px; display: flex; flex-direction: column; justify-content: center; diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte index 9132fc1c89..6a1befd7e4 100644 --- a/packages/builder/src/components/backend/DataTable/DataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte @@ -14,7 +14,7 @@ import Table from "./Table.svelte" import { TableNames } from "constants" import CreateEditRow from "./modals/CreateEditRow.svelte" - import { Pagination } from "@budibase/bbui" + import { Pagination, Heading, Body, Layout } from "@budibase/bbui" import { fetchData } from "@budibase/frontend-core" import { API } from "api" @@ -27,6 +27,8 @@ $: enrichedSchema = enrichSchema($tables.selected?.schema) $: id = $tables.selected?._id $: fetch = createFetch(id) + $: hasCols = checkHasCols(schema) + $: hasRows = !!$fetch.rows?.length const enrichSchema = schema => { let tempSchema = { ...schema } @@ -47,6 +49,20 @@ return tempSchema } + + const checkHasCols = schema => { + if (!schema || Object.keys(schema).length === 0) { + return false + } + let fields = Object.values(schema) + for (let field of fields) { + if (!field.autocolumn) { + return true + } + } + return false + } + // Fetches new data whenever the table changes const createFetch = tableId => { return fetchData({ @@ -104,40 +120,73 @@ disableSorting on:updatecolumns={onUpdateColumns} on:updaterows={onUpdateRows} + customPlaceholder > - - {#if schema && Object.keys(schema).length > 0} - {#if !isUsersTable} - - {/if} - {#if isInternal} - - {/if} - - {#if isUsersTable} - - {/if} - {#if !isInternal} - +
+ - {/if} - - - - - {#key id} - - {/key} - {/if} + {#if !isUsersTable} + + {/if} + {#if isInternal} + + {/if} +
+
+ + {#if isUsersTable} + + {/if} + {#if !isInternal} + + {/if} + + + + {#key id} + + {/key} +
+ +
+ + {#if !hasCols} + Let's create some columns + + Start building out your table structure
+ by adding some columns + + {:else} + Now let's add a row + + Add some data to your table
+ by adding some rows + + {/if} +
+
{#key id}
@@ -162,4 +211,20 @@ align-items: center; margin-top: var(--spacing-xl); } + .buttons { + flex: 1 1 auto; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + flex-wrap: wrap; + } + .left-buttons, + .right-buttons { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + gap: var(--spacing-m); + } diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index 81edb39667..85b271dee8 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -25,6 +25,7 @@ export let rowCount export let type export let disableSorting = false + export let customPlaceholder = false let selectedRows = [] let editableColumn @@ -117,10 +118,10 @@ -
+ {#if title}
- {title} + {title} {#if loading}
@@ -134,7 +135,7 @@ {/if}
-
+
{#key tableId}
editRow(e.detail)} on:clickrelationship={e => selectRelationship(e.detail)} on:sort - /> + > + +
{/key} @@ -176,6 +180,7 @@ flex-direction: row; justify-content: flex-start; align-items: center; + margin-top: var(--spacing-m); } .table-title > div { margin-left: var(--spacing-xs); diff --git a/packages/builder/src/components/backend/DataTable/buttons/CreateColumnButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/CreateColumnButton.svelte index abf7e25d2a..8644ee86da 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/CreateColumnButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/CreateColumnButton.svelte @@ -2,10 +2,21 @@ import { ActionButton, Modal } from "@budibase/bbui" import CreateEditColumn from "../modals/CreateEditColumn.svelte" + export let highlighted = false + export let disabled = false + let modal - + Create column diff --git a/packages/builder/src/components/backend/DataTable/buttons/CreateRowButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/CreateRowButton.svelte index 2a31d02375..1676a5b23c 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/CreateRowButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/CreateRowButton.svelte @@ -4,11 +4,21 @@ export let modalContentComponent = CreateEditRow export let title = "Create row" + export let disabled = false + export let highlighted = false let modal - + {title} diff --git a/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte index 297d120ede..0133b5bd79 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte @@ -2,10 +2,18 @@ import { Modal, ActionButton } from "@budibase/bbui" import CreateViewModal from "../modals/CreateViewModal.svelte" + export let disabled = false + let modal - + Create view diff --git a/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte index d8502c7d3e..093ca33182 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte @@ -3,11 +3,18 @@ import ExportModal from "../modals/ExportModal.svelte" export let view + export let disabled = false let modal - + Export diff --git a/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte index 3d74188ee4..e9b042a653 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/HideAutocolumnButton.svelte @@ -8,6 +8,12 @@ } - - {#if hideAutocolumns}Show auto columns{:else}Hide auto columns{/if} + + Auto columns diff --git a/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte index c07b11237b..cf9e4b1358 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte @@ -5,6 +5,7 @@ export let schema export let filters + export let disabled = false const dispatch = createEventDispatcher() let modal @@ -17,6 +18,7 @@ icon="Filter" size="S" quiet + {disabled} on:click={modal.show} active={tempValue?.length > 0} >