Hide add row FAB when selecting rows
This commit is contained in:
parent
9991fd9558
commit
ed9065aae3
|
@ -5,9 +5,10 @@
|
|||
import { Grid } from "@budibase/frontend-core"
|
||||
|
||||
export let table
|
||||
export let allowAddRows
|
||||
export let allowEditRows
|
||||
export let allowDeleteRows
|
||||
export let allowAddRows = true
|
||||
export let allowEditRows = true
|
||||
export let allowDeleteRows = true
|
||||
export let stripeRows = false
|
||||
|
||||
const component = getContext("component")
|
||||
const { styleable, API, builderStore } = getContext("sdk")
|
||||
|
@ -23,6 +24,7 @@
|
|||
{allowAddRows}
|
||||
{allowEditRows}
|
||||
{allowDeleteRows}
|
||||
{stripeRows}
|
||||
showControls={false}
|
||||
allowExpandRows={false}
|
||||
allowSchemaChanges={false}
|
||||
|
|
|
@ -6,15 +6,9 @@
|
|||
|
||||
let modal
|
||||
|
||||
$: selectedRowCount = Object.values($selectedRows).filter(x => !!x).length
|
||||
$: selectedRowCount = Object.values($selectedRows).length
|
||||
$: rowsToDelete = Object.entries($selectedRows)
|
||||
.map(entry => {
|
||||
if (entry[1] === true) {
|
||||
return $rows.find(x => x._id === entry[0])
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})
|
||||
.map(entry => $rows.find(x => x._id === entry[0]))
|
||||
.filter(x => x != null)
|
||||
|
||||
// Deletion callback when confirmed
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
allowEditRows,
|
||||
allowDeleteRows,
|
||||
stripeRows,
|
||||
showControls,
|
||||
})
|
||||
|
||||
// Build up context
|
||||
|
@ -91,6 +92,7 @@
|
|||
allowEditRows,
|
||||
allowDeleteRows,
|
||||
stripeRows,
|
||||
showControls,
|
||||
})
|
||||
|
||||
// Set context for children to consume
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
maxScrollTop,
|
||||
rowVerticalInversionIndex,
|
||||
columnHorizontalInversionIndex,
|
||||
config,
|
||||
selectedRows,
|
||||
} = getContext("grid")
|
||||
|
||||
let visible = false
|
||||
|
@ -37,6 +39,7 @@
|
|||
$: width = GutterWidth + ($stickyColumn?.width || 0)
|
||||
$: $tableId, (visible = false)
|
||||
$: invertY = shouldInvertY(offset, $rowVerticalInversionIndex, $renderedRows)
|
||||
$: selectedRowCount = Object.values($selectedRows).length
|
||||
|
||||
const shouldInvertY = (offset, inversionIndex, rows) => {
|
||||
if (offset === 0) {
|
||||
|
@ -142,7 +145,7 @@
|
|||
</script>
|
||||
|
||||
<!-- New row FAB -->
|
||||
{#if !visible}
|
||||
{#if !visible && !$config.showControls && !selectedRowCount}
|
||||
<div
|
||||
class="new-row-fab"
|
||||
on:click={() => dispatch("add-row-inline")}
|
||||
|
@ -243,7 +246,7 @@
|
|||
position: absolute;
|
||||
top: var(--default-row-height);
|
||||
left: calc(var(--gutter-width) / 2);
|
||||
transform: translateX(8px) translateY(-50%);
|
||||
transform: translateX(6px) translateY(-50%);
|
||||
background: var(--cell-background);
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
} = getContext("grid")
|
||||
|
||||
$: rowCount = $rows.length
|
||||
$: selectedRowCount = Object.values($selectedRows).filter(x => !!x).length
|
||||
$: selectedRowCount = Object.values($selectedRows).length
|
||||
$: width = GutterWidth + ($stickyColumn?.width || 0)
|
||||
|
||||
const selectAll = () => {
|
||||
|
|
Loading…
Reference in New Issue