Add settings to grid block for controlling CRUD
This commit is contained in:
parent
0dbd709438
commit
0ab1346577
|
@ -5243,6 +5243,24 @@
|
||||||
"label": "Table",
|
"label": "Table",
|
||||||
"key": "table",
|
"key": "table",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Add rows",
|
||||||
|
"key": "allowAddRows",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Edit rows",
|
||||||
|
"key": "allowEditRows",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Delete rows",
|
||||||
|
"key": "allowDeleteRows",
|
||||||
|
"defaultValue": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
export let allowDeleteRows
|
export let allowDeleteRows
|
||||||
|
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
const { styleable, API } = getContext("sdk")
|
const { styleable, API, builderStore } = getContext("sdk")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:styleable={$component.styles}>
|
<div
|
||||||
|
use:styleable={$component.styles}
|
||||||
|
class:in-builder={$builderStore.inBuilder}
|
||||||
|
>
|
||||||
<Grid
|
<Grid
|
||||||
tableId={table?.tableId}
|
tableId={table?.tableId}
|
||||||
{API}
|
{API}
|
||||||
|
@ -33,4 +36,7 @@
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
border: 1px solid var(--spectrum-global-color-gray-300);
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
||||||
}
|
}
|
||||||
|
div.in-builder :global(*) {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
border-bottom: 2px solid var(--spectrum-global-color-gray-200);
|
border-bottom: 2px solid var(--spectrum-global-color-gray-200);
|
||||||
padding: var(--cell-padding);
|
padding: var(--cell-padding);
|
||||||
gap: var(--cell-spacing);
|
gap: var(--cell-spacing);
|
||||||
background: var(--background);
|
background: var(--spectrum-global-color-gray-100);
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.controls-left,
|
.controls-left,
|
||||||
|
|
|
@ -141,6 +141,17 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- New row FAB -->
|
||||||
|
{#if !visible}
|
||||||
|
<div
|
||||||
|
class="new-row-fab"
|
||||||
|
on:click={() => dispatch("add-row-inline")}
|
||||||
|
transition:fade|local={{ duration: 130 }}
|
||||||
|
>
|
||||||
|
<Icon name="Add" size="S" />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!-- Only show new row functionality if we have any columns -->
|
<!-- Only show new row functionality if we have any columns -->
|
||||||
{#if visible}
|
{#if visible}
|
||||||
<div
|
<div
|
||||||
|
@ -227,6 +238,23 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
/* New row FAB */
|
||||||
|
.new-row-fab {
|
||||||
|
position: absolute;
|
||||||
|
top: var(--default-row-height);
|
||||||
|
left: calc(var(--gutter-width) / 2);
|
||||||
|
transform: translateX(8px) translateY(-50%);
|
||||||
|
background: var(--cell-background);
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: var(--cell-border);
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
.new-row-fab:hover {
|
||||||
|
background: var(--cell-background-hover);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: var(--default-row-height);
|
top: var(--default-row-height);
|
||||||
|
|
Loading…
Reference in New Issue