feat(data-table): hide batch actions if overflow visible

This commit is contained in:
Eric Liu 2020-10-26 08:15:31 -07:00
commit a2b375f32e
8 changed files with 104 additions and 48 deletions

View file

@ -1966,8 +1966,8 @@
[
"keydown",
{
"start": 5616,
"end": 5626,
"start": 5618,
"end": 5628,
"type": "EventHandler",
"name": "keydown",
"modifiers": [],
@ -1977,8 +1977,8 @@
[
"focus",
{
"start": 6203,
"end": 6211,
"start": 6205,
"end": 6213,
"type": "EventHandler",
"name": "focus",
"modifiers": [],
@ -1988,8 +1988,8 @@
[
"blur",
{
"start": 6220,
"end": 6227,
"start": 6222,
"end": 6229,
"type": "EventHandler",
"name": "blur",
"modifiers": [],
@ -1999,8 +1999,8 @@
[
"clear",
{
"start": 6678,
"end": 6686,
"start": 6680,
"end": 6688,
"type": "EventHandler",
"name": "clear",
"modifiers": [],
@ -2010,8 +2010,8 @@
[
"scroll",
{
"start": 7220,
"end": 7229,
"start": 7246,
"end": 7255,
"type": "EventHandler",
"name": "scroll",
"modifiers": [],
@ -15644,7 +15644,30 @@
}
]
],
"forwarded_events": [],
"forwarded_events": [
[
"click",
{
"start": 109,
"end": 117,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": null
}
],
[
"keydown",
{
"start": 118,
"end": 128,
"type": "EventHandler",
"name": "keydown",
"modifiers": [],
"expression": null
}
]
],
"dispatched_events": []
},
"ToolbarSearch": {

View file

@ -1,9 +1,9 @@
---
components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarBatchActions"]
components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarMenu", "ToolbarMenuItem", "ToolbarBatchActions"]
---
<script>
import { DataTable, DataTableSkeleton, Toolbar, ToolbarContent, ToolbarSearch, Button, Link } from "carbon-components-svelte";
import { DataTable, DataTableSkeleton, Toolbar, ToolbarContent, ToolbarSearch, ToolbarMenu, ToolbarMenuItem, Button, Link } from "carbon-components-svelte";
import Launch16 from "carbon-icons-svelte/lib/Launch16";
import Preview from "../../components/Preview.svelte";
</script>
@ -316,7 +316,12 @@ The slot name for the table header cells is `"cell-header"`.
<Toolbar>
<ToolbarContent>
<ToolbarSearch />
<Button>Create</Button>
<ToolbarMenu>
<ToolbarMenuItem primaryFocus>Restart all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">API Documentation</ToolbarMenuItem>
<ToolbarMenuItem danger>Stop all</ToolbarMenuItem>
</ToolbarMenu>
<Button>Create balancer</Button>
</ToolbarContent>
</Toolbar>
</DataTable>
@ -378,7 +383,12 @@ The slot name for the table header cells is `"cell-header"`.
<Toolbar size="sm">
<ToolbarContent>
<ToolbarSearch />
<Button>Create</Button>
<ToolbarMenu>
<ToolbarMenuItem primaryFocus>Restart all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">API Documentation</ToolbarMenuItem>
<ToolbarMenuItem danger>Stop all</ToolbarMenuItem>
</ToolbarMenu>
<Button>Create balancer</Button>
</ToolbarContent>
</Toolbar>
</DataTable>

View file

@ -4,6 +4,8 @@
Toolbar,
ToolbarContent,
ToolbarSearch,
ToolbarMenu,
ToolbarMenuItem,
ToolbarBatchActions,
Button,
} from "carbon-components-svelte";
@ -36,7 +38,14 @@
</ToolbarBatchActions>
<ToolbarContent>
<ToolbarSearch />
<Button>Create</Button>
<ToolbarMenu>
<ToolbarMenuItem primaryFocus>Restart all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">
API Documentation
</ToolbarMenuItem>
<ToolbarMenuItem danger>Stop all</ToolbarMenuItem>
</ToolbarMenu>
<Button>Create balancer</Button>
</ToolbarContent>
</Toolbar>
</DataTable>