Merge pull request #730 from Budibase/feature/remove-add-row-button-in-grid-component
Feature/remove add row button in grid component
This commit is contained in:
commit
6392383bd6
|
@ -11,13 +11,7 @@
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
import AgGrid from "@budibase/svelte-ag-grid"
|
import AgGrid from "@budibase/svelte-ag-grid"
|
||||||
import CreateRowButton from "./CreateRow/Button.svelte"
|
import { TextButton as DeleteButton, Icon, Modal, ModalContent } from "@budibase/bbui"
|
||||||
import {
|
|
||||||
TextButton as DeleteButton,
|
|
||||||
Icon,
|
|
||||||
Modal,
|
|
||||||
ModalContent,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
|
|
||||||
export let _bb
|
export let _bb
|
||||||
export let datasource = {}
|
export let datasource = {}
|
||||||
|
@ -98,13 +92,6 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const isEditable = type =>
|
|
||||||
type !== "boolean" &&
|
|
||||||
type !== "options" &&
|
|
||||||
// type !== "datetime" &&
|
|
||||||
type !== "link" &&
|
|
||||||
type !== "attachment"
|
|
||||||
|
|
||||||
const shouldHideField = name => {
|
const shouldHideField = name => {
|
||||||
if (name.startsWith("_")) return true
|
if (name.startsWith("_")) return true
|
||||||
// always 'row'
|
// always 'row'
|
||||||
|
@ -115,10 +102,6 @@
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleNewRow = async () => {
|
|
||||||
data = await fetchData(datasource)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleUpdate = ({ detail }) => {
|
const handleUpdate = ({ detail }) => {
|
||||||
data[detail.row] = detail.data
|
data[detail.row] = detail.data
|
||||||
updateRow(detail.data)
|
updateRow(detail.data)
|
||||||
|
@ -152,7 +135,6 @@
|
||||||
{#if dataLoaded}
|
{#if dataLoaded}
|
||||||
{#if canAddDelete}
|
{#if canAddDelete}
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<CreateRowButton {_bb} {table} on:newRow={handleNewRow} />
|
|
||||||
{#if selectedRows.length > 0}
|
{#if selectedRows.length > 0}
|
||||||
<DeleteButton text small on:click={modal.show()}>
|
<DeleteButton text small on:click={modal.show()}>
|
||||||
<Icon name="addrow" />
|
<Icon name="addrow" />
|
||||||
|
@ -183,6 +165,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.controls {
|
.controls {
|
||||||
|
min-height: 15px;
|
||||||
margin-bottom: var(--spacing-s);
|
margin-bottom: var(--spacing-s);
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: var(--spacing-s);
|
grid-gap: var(--spacing-s);
|
||||||
|
|
Loading…
Reference in New Issue