feat(pagination): add pageSizeInputDisabled

useful for programs that have fixed pagination size, which cannot / must not be changed by the user
This commit is contained in:
weaseldotro 2020-09-29 11:28:11 +03:00 committed by GitHub
commit 734a5440ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,6 +54,12 @@
*/ */
export let pageInputDisabled = false; export let pageInputDisabled = false;
/**
* Set to `true` to disable the page size input
* @type {boolean} [pageSizeInputDisabled=false]
*/
export let pageSizeInputDisabled = false;
/** /**
* Specify the number of items to display in a page * Specify the number of items to display in a page
* @type {number} [pageSize=10] * @type {number} [pageSize=10]
@ -118,6 +124,7 @@
<div id="{id}" class:bx--pagination="{true}" {...$$restProps}> <div id="{id}" class:bx--pagination="{true}" {...$$restProps}>
<div class:bx--pagination__left="{true}"> <div class:bx--pagination__left="{true}">
{#if !pageSizeInputDisabled}
<label <label
id="bx--pagination-select-{id}-count-label" id="bx--pagination-select-{id}-count-label"
for="bx--pagination-select-{id}" for="bx--pagination-select-{id}"
@ -137,7 +144,8 @@
<SelectItem value="{size}" text="{size.toString()}" /> <SelectItem value="{size}" text="{size.toString()}" />
{/each} {/each}
</Select> </Select>
<span class:bx--pagination__text="{true}"> {/if}
<span class:bx--pagination__text="{!pageSizeInputDisabled}">
{#if pagesUnknown} {#if pagesUnknown}
{itemText(pageSize * (page - 1) + 1, page * pageSize)} {itemText(pageSize * (page - 1) + 1, page * pageSize)}
{:else} {:else}