From ed8977beea8da9878638bcbb647c227b8d529e70 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 5 Dec 2020 16:56:33 -0800 Subject: [PATCH] fix(pagination): type dispatched update event --- COMPONENT_INDEX.md | 6 +- docs/src/COMPONENT_API.json | 118 ++++++++++++++++--------------- src/Pagination/Pagination.svelte | 4 ++ tests/Pagination.test.svelte | 8 ++- types/Pagination/Pagination.d.ts | 2 +- types/index.d.ts | 4 +- 6 files changed, 79 insertions(+), 63 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 7f672802..b26de2bf 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -2444,9 +2444,9 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| update | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :----------------------------------------------- | +| update | dispatched | { pageSize: number; page: number; } | ## `PaginationNav` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index cb34b90b..33b6772a 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -6356,31 +6356,6 @@ "typedefs": [], "rest_props": { "type": "Element", "name": "div" } }, - { - "moduleName": "SelectSkeleton", - "filePath": "/src/Select/SelectSkeleton.svelte", - "props": [ - { - "name": "hideLabel", - "kind": "let", - "description": "Set to `true` to hide the label text", - "type": "boolean", - "value": "false", - "isFunction": false, - "constant": false, - "reactive": false - } - ], - "slots": [], - "events": [ - { "type": "forwarded", "name": "click", "element": "div" }, - { "type": "forwarded", "name": "mouseover", "element": "div" }, - { "type": "forwarded", "name": "mouseenter", "element": "div" }, - { "type": "forwarded", "name": "mouseleave", "element": "div" } - ], - "typedefs": [], - "rest_props": { "type": "Element", "name": "div" } - }, { "moduleName": "SelectItem", "filePath": "/src/Select/SelectItem.svelte", @@ -6431,36 +6406,6 @@ "typedefs": [], "rest_props": { "type": "Element", "name": "option" } }, - { - "moduleName": "SelectItemGroup", - "filePath": "/src/Select/SelectItemGroup.svelte", - "props": [ - { - "name": "disabled", - "kind": "let", - "description": "Set to `true` to disable the optgroup element", - "type": "boolean", - "value": "false", - "isFunction": false, - "constant": false, - "reactive": false - }, - { - "name": "label", - "kind": "let", - "description": "Specify the label attribute of the optgroup element", - "type": "string", - "value": "\"Provide label\"", - "isFunction": false, - "constant": false, - "reactive": false - } - ], - "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], - "events": [], - "typedefs": [], - "rest_props": { "type": "Element", "name": "optgroup" } - }, { "moduleName": "Pagination", "filePath": "/src/Pagination/Pagination.svelte", @@ -6627,7 +6572,13 @@ } ], "slots": [], - "events": [{ "type": "dispatched", "name": "update" }], + "events": [ + { + "type": "dispatched", + "name": "update", + "detail": "{ pageSize: number; page: number; }" + } + ], "typedefs": [], "rest_props": { "type": "Element", "name": "div" } }, @@ -6989,6 +6940,61 @@ "typedefs": [], "rest_props": { "type": "Element", "name": "div" } }, + { + "moduleName": "SelectSkeleton", + "filePath": "/src/Select/SelectSkeleton.svelte", + "props": [ + { + "name": "hideLabel", + "kind": "let", + "description": "Set to `true` to hide the label text", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + } + ], + "slots": [], + "events": [ + { "type": "forwarded", "name": "click", "element": "div" }, + { "type": "forwarded", "name": "mouseover", "element": "div" }, + { "type": "forwarded", "name": "mouseenter", "element": "div" }, + { "type": "forwarded", "name": "mouseleave", "element": "div" } + ], + "typedefs": [], + "rest_props": { "type": "Element", "name": "div" } + }, + { + "moduleName": "SelectItemGroup", + "filePath": "/src/Select/SelectItemGroup.svelte", + "props": [ + { + "name": "disabled", + "kind": "let", + "description": "Set to `true` to disable the optgroup element", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + }, + { + "name": "label", + "kind": "let", + "description": "Specify the label attribute of the optgroup element", + "type": "string", + "value": "\"Provide label\"", + "isFunction": false, + "constant": false, + "reactive": false + } + ], + "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], + "events": [], + "typedefs": [], + "rest_props": { "type": "Element", "name": "optgroup" } + }, { "moduleName": "SkeletonPlaceholder", "filePath": "/src/SkeletonPlaceholder/SkeletonPlaceholder.svelte", diff --git a/src/Pagination/Pagination.svelte b/src/Pagination/Pagination.svelte index cb236369..efb9f5d6 100644 --- a/src/Pagination/Pagination.svelte +++ b/src/Pagination/Pagination.svelte @@ -1,4 +1,8 @@ - + diff --git a/types/Pagination/Pagination.d.ts b/types/Pagination/Pagination.d.ts index e0356a35..d255a3dc 100644 --- a/types/Pagination/Pagination.d.ts +++ b/types/Pagination/Pagination.d.ts @@ -102,6 +102,6 @@ export default class Pagination { $$prop_def: PaginationProps; $$slot_def: {}; - $on(eventname: "update", cb: (event: CustomEvent) => void): () => void; + $on(eventname: "update", cb: (event: CustomEvent<{ pageSize: number; page: number }>) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/index.d.ts b/types/index.d.ts index c1862c40..087e3347 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -86,9 +86,7 @@ export { default as NumberInput } from "./NumberInput/NumberInput"; export { default as NumberInputSkeleton } from "./NumberInput/NumberInputSkeleton"; export { default as OrderedList } from "./OrderedList/OrderedList"; export { default as Select } from "./Select/Select"; -export { default as SelectSkeleton } from "./Select/SelectSkeleton"; export { default as SelectItem } from "./Select/SelectItem"; -export { default as SelectItemGroup } from "./Select/SelectItemGroup"; export { default as Pagination } from "./Pagination/Pagination"; export { default as PaginationSkeleton } from "./Pagination/PaginationSkeleton"; export { default as PaginationNav } from "./PaginationNav/PaginationNav"; @@ -96,6 +94,8 @@ export { default as ProgressIndicator } from "./ProgressIndicator/ProgressIndica export { default as ProgressIndicatorSkeleton } from "./ProgressIndicator/ProgressIndicatorSkeleton"; export { default as ProgressStep } from "./ProgressIndicator/ProgressStep"; export { default as RadioButtonGroup } from "./RadioButtonGroup/RadioButtonGroup"; +export { default as SelectSkeleton } from "./Select/SelectSkeleton"; +export { default as SelectItemGroup } from "./Select/SelectItemGroup"; export { default as SkeletonPlaceholder } from "./SkeletonPlaceholder/SkeletonPlaceholder"; export { default as Slider } from "./Slider/Slider"; export { default as SliderSkeleton } from "./Slider/SliderSkeleton";