Merge pull request #185 from mabentley85/pagination-event-forwarding

Added Event Forwarding To Pagination Component
This commit is contained in:
Eric Liu 2020-05-29 17:14:09 -07:00 committed by GitHub
commit 5e205719eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,13 @@
import CaretRight24 from 'carbon-icons-svelte/lib/CaretRight24'; import CaretRight24 from 'carbon-icons-svelte/lib/CaretRight24';
import { cx, fillArray } from '../../lib'; import { cx, fillArray } from '../../lib';
import Select, { SelectItem } from '../Select'; import Select, { SelectItem } from '../Select';
import { afterUpdate, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
afterUpdate(() => {
dispatch('update', {pageSize: parseInt(pageSize), page: parseInt(page)});
});
$: totalPages = Math.max(Math.ceil(totalItems / pageSize), 1); $: totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
$: selectItems = fillArray(totalPages); $: selectItems = fillArray(totalPages);