Ensure grid props are respected when using new features
This commit is contained in:
parent
e2ac112c18
commit
5c6cb0a73a
|
@ -171,7 +171,6 @@
|
|||
canEditColumns={false}
|
||||
canExpandRows={false}
|
||||
canSaveSchema={false}
|
||||
canSelectRows={true}
|
||||
showControls={false}
|
||||
notifySuccess={notificationStore.actions.success}
|
||||
notifyError={notificationStore.actions.error}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
const { config, dispatch, selectedRows } = getContext("grid")
|
||||
const svelteDispatch = createEventDispatcher()
|
||||
|
||||
$: selectionEnabled = $config.canSelectRows || $config.canDeleteRows
|
||||
|
||||
const select = e => {
|
||||
e.stopPropagation()
|
||||
svelteDispatch("select")
|
||||
|
@ -64,16 +62,14 @@
|
|||
<div
|
||||
on:click={select}
|
||||
class="checkbox"
|
||||
class:visible={selectionEnabled &&
|
||||
(disableNumber || rowSelected || rowHovered || rowFocused)}
|
||||
class:visible={disableNumber || rowSelected || rowHovered || rowFocused}
|
||||
>
|
||||
<Checkbox value={rowSelected} {disabled} />
|
||||
</div>
|
||||
{#if !disableNumber}
|
||||
<div
|
||||
class="number"
|
||||
class:visible={!selectionEnabled ||
|
||||
!(rowSelected || rowHovered || rowFocused)}
|
||||
class:visible={!(rowSelected || rowHovered || rowFocused)}
|
||||
>
|
||||
{row.__idx + 1}
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
selectedRowCount,
|
||||
selectedCells,
|
||||
rowLookupMap,
|
||||
config,
|
||||
} = getContext("grid")
|
||||
const duration = 260
|
||||
|
||||
|
@ -30,14 +31,14 @@
|
|||
const handleBulkDeleteRequest = () => {
|
||||
progressPercentage = 0
|
||||
menu.actions.close()
|
||||
if ($selectedRowCount) {
|
||||
if ($selectedRowCount && $config.canDeleteRows) {
|
||||
if ($selectedRowCount === 1) {
|
||||
bulkDeleteRows()
|
||||
} else {
|
||||
promptQuantity = $selectedRowCount
|
||||
rowsModal?.show()
|
||||
}
|
||||
} else if ($selectedCellCount) {
|
||||
} else if ($selectedCellCount && $config.canEditRows) {
|
||||
promptQuantity = $selectedCellCount
|
||||
cellsModal?.show()
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
export let canDeleteRows = true
|
||||
export let canEditColumns = true
|
||||
export let canSaveSchema = true
|
||||
export let canSelectRows = false
|
||||
export let stripeRows = false
|
||||
export let quiet = false
|
||||
export let collaboration = true
|
||||
|
@ -101,7 +100,6 @@
|
|||
canDeleteRows,
|
||||
canEditColumns,
|
||||
canSaveSchema,
|
||||
canSelectRows,
|
||||
stripeRows,
|
||||
quiet,
|
||||
collaboration,
|
||||
|
@ -211,12 +209,10 @@
|
|||
<ProgressCircle />
|
||||
</div>
|
||||
{/if}
|
||||
{#if $config.canDeleteRows}
|
||||
<BulkDeleteHandler />
|
||||
{/if}
|
||||
{#if $config.canAddRows}
|
||||
<BulkDuplicationHandler />
|
||||
{/if}
|
||||
<BulkDeleteHandler />
|
||||
<ClipboardHandler />
|
||||
<KeyboardManager />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue