mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
fix(pagination): use toLocaleString
for default text formatting (#2161)
This commit is contained in:
parent
ed3928bb01
commit
cdf5659fa0
6 changed files with 85 additions and 33 deletions
|
@ -39,14 +39,14 @@
|
|||
* @type {(min: number, max: number) => string}
|
||||
*/
|
||||
export let itemText = (min, max) =>
|
||||
`${min}–${max} item${max === 1 ? "" : "s"}`;
|
||||
`${min.toLocaleString()}–${max.toLocaleString()} item${max === 1 ? "" : "s"}`;
|
||||
|
||||
/**
|
||||
* Override the item range text
|
||||
* @type {(min: number, max: number, total: number) => string}
|
||||
*/
|
||||
export let itemRangeText = (min, max, total) =>
|
||||
`${min}–${max} of ${total} item${max === 1 ? "" : "s"}`;
|
||||
`${min.toLocaleString()}–${max.toLocaleString()} of ${total.toLocaleString()} item${max === 1 ? "" : "s"}`;
|
||||
|
||||
/** Set to `true` to disable the page input */
|
||||
export let pageInputDisabled = false;
|
||||
|
@ -70,14 +70,14 @@
|
|||
* Override the page text
|
||||
* @type {(page: number) => string}
|
||||
*/
|
||||
export let pageText = (page) => `page ${page}`;
|
||||
export let pageText = (page) => `page ${page.toLocaleString()}`;
|
||||
|
||||
/**
|
||||
* Override the page range text
|
||||
* @type {(current: number, total: number) => string}
|
||||
*/
|
||||
export let pageRangeText = (current, total) =>
|
||||
`of ${total} page${total === 1 ? "" : "s"}`;
|
||||
`of ${total.toLocaleString()} page${total === 1 ? "" : "s"}`;
|
||||
|
||||
/** Set an id for the top-level element */
|
||||
export let id = "ccs-" + Math.random().toString(36);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue