Skip to content

Commit fb9859c

Browse files
committed
Added empty state in tables
1 parent 63ae2fd commit fb9859c

File tree

9 files changed

+611
-380
lines changed

9 files changed

+611
-380
lines changed

src/components/PDataTable/PDataTable.md

Lines changed: 78 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,6 @@ PDataTable example:
5151
sortable: false,
5252
}]"
5353
:rows="[
54-
[
55-
{content: 'Emerald Silk Gown', url: 'https://www.google.com/'},
56-
'$875.00',
57-
{content: 121212, status:'success', progress:'incomplete'},
58-
140,
59-
{status: false,onAction:handleToggle,id: 1},
60-
61-
],
62-
[
63-
{content: 'Mauve Cashmere Scarf', url: 'https://www.google.com/'},
64-
'$230.00',
65-
{content: 'A-1234', status:'success', progress:'incomplete'},
66-
2,
67-
{status: true,onAction:handleToggle,id: 3},
68-
],
69-
[
70-
{content: 'Mauve Cashmere', url: 'https://www.google.com/'},
71-
'$230.00',
72-
{content: 'A-1234', status:'success', progress:'incomplete'},
73-
{content: 299},
74-
{status: true,onAction:handleToggle,id: 2},
75-
],
7654
]"
7755
:ids="[1,2,3]"
7856
footerContent="Showing 3 of 3 results">
@@ -159,9 +137,87 @@ export default {
159137
},
160138
handleToggle($val) {
161139
console.log($val)
140+
},
141+
handlePrimaryAction() {
142+
alert(`transferred`)
143+
},
144+
handleSecondaryAction() {
145+
alert(`Learn more`)
162146
}
163147
}
164148
}
165149
</script>
166150
```
167151

152+
Empty Table
153+
154+
```vue
155+
<template>
156+
<PDataTable
157+
@input-filter-changed="handleSearch"
158+
hasFilter
159+
:rows="[
160+
]">
161+
162+
<PEmptyState
163+
slot="emptyState"
164+
heading="Manage your inventory transfers"
165+
:fullWidth="true"
166+
:primaryAction="{ content: 'Add transfer', onAction: this.handlePrimaryAction}"
167+
:secondaryAction="{ content: 'Learn more', onAction: this.handleSecondaryAction}"
168+
image="https://cdn.shopify.com/s/files/1/0262/4071/2726/files/emptystate-files.png">
169+
<div slot="footer" class="Polaris-TextContainer"><p>If you don’t want to add a transfer, you can import your inventory
170+
from <a class="Polaris-Link Polaris-Link--monochrome" href="/settings" data-polaris-unstyled="true">settings</a>.
171+
</p></div>
172+
<p>You can use the Files section to upload images, videos, and
173+
other documents. This example shows the content with a centered layout and full width.</p>
174+
</PEmptyState>
175+
</PDataTable>
176+
</template>
177+
<script>
178+
export default {
179+
methods: {
180+
handlePrimaryAction() {
181+
alert(`transferred`)
182+
},
183+
handleSecondaryAction() {
184+
alert(`Learn more`)
185+
},
186+
handleSearch(val) {
187+
alert('handle search ' + val);
188+
this.search = val;
189+
},
190+
}
191+
}
192+
</script>
193+
```
194+
195+
196+
Empty table with default layout
197+
198+
```vue
199+
<template>
200+
<PDataTable
201+
@input-filter-changed="handleSearch"
202+
hasFilter
203+
:rows="[]">
204+
</PDataTable>
205+
</template>
206+
<script>
207+
export default {
208+
methods: {
209+
handlePrimaryAction() {
210+
alert(`transferred`)
211+
},
212+
handleSecondaryAction() {
213+
alert(`Learn more`)
214+
},
215+
handleSearch(val) {
216+
alert('handle search ' + val);
217+
this.search = val;
218+
},
219+
}
220+
}
221+
</script>
222+
```
223+

0 commit comments

Comments
 (0)