1
0
Fork 0
mirror of synced 2024-09-03 19:21:11 +12:00

Update column editor and filter editor to make action buttons full width

This commit is contained in:
Andrew Kingston 2023-06-19 18:32:03 +01:00
parent 757d2d11ef
commit 7b75d7f13d
2 changed files with 27 additions and 2 deletions

View file

@ -75,7 +75,9 @@
} }
</script> </script>
<ActionButton on:click={open}>Configure columns</ActionButton> <div class="column-editor">
<ActionButton on:click={open}>Configure columns</ActionButton>
</div>
<Drawer bind:this={drawer} title="{subject} Columns"> <Drawer bind:this={drawer} title="{subject} Columns">
<svelte:fragment slot="description"> <svelte:fragment slot="description">
Configure the columns in your {subject.toLowerCase()}. Configure the columns in your {subject.toLowerCase()}.
@ -89,3 +91,9 @@
{allowCellEditing} {allowCellEditing}
/> />
</Drawer> </Drawer>
<style>
.column-editor :global(.spectrum-ActionButton) {
width: 100%;
}
</style>

View file

@ -20,15 +20,26 @@
$: datasource = getDatasourceForProvider($currentAsset, componentInstance) $: datasource = getDatasourceForProvider($currentAsset, componentInstance)
$: schema = getSchemaForDatasource($currentAsset, datasource)?.schema $: schema = getSchemaForDatasource($currentAsset, datasource)?.schema
$: schemaFields = Object.values(schema || {}) $: schemaFields = Object.values(schema || {})
$: text = getText(value)
async function saveFilter() { async function saveFilter() {
dispatch("change", tempValue) dispatch("change", tempValue)
notifications.success("Filters saved") notifications.success("Filters saved")
drawer.hide() drawer.hide()
} }
const getText = filters => {
if (!filters?.length) {
return "No filters set"
} else {
return `${filters.length} filter${filters.length === 1 ? "" : "s"} set`
}
}
</script> </script>
<ActionButton on:click={drawer.show}>Define filters</ActionButton> <div class="filter-editor">
<ActionButton on:click={drawer.show}>{text}</ActionButton>
</div>
<Drawer bind:this={drawer} title="Filtering"> <Drawer bind:this={drawer} title="Filtering">
<Button cta slot="buttons" on:click={saveFilter}>Save</Button> <Button cta slot="buttons" on:click={saveFilter}>Save</Button>
<FilterDrawer <FilterDrawer
@ -40,3 +51,9 @@
on:change={e => (tempValue = e.detail)} on:change={e => (tempValue = e.detail)}
/> />
</Drawer> </Drawer>
<style>
.filter-editor :global(.spectrum-ActionButton) {
width: 100%;
}
</style>