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