From d380fbba0a66a6ae1e67bf3a32cf6cc96180e82a Mon Sep 17 00:00:00 2001 From: denis Date: Tue, 13 Mar 2018 18:18:04 +0100 Subject: [PATCH] Add types to ScrollspyOption Add method and target to ScrollspyOption --- types/bootstrap/bootstrap-tests.ts | 10 ++++++++++ types/bootstrap/index.d.ts | 19 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/types/bootstrap/bootstrap-tests.ts b/types/bootstrap/bootstrap-tests.ts index f6b6246724..21286ad5f4 100755 --- a/types/bootstrap/bootstrap-tests.ts +++ b/types/bootstrap/bootstrap-tests.ts @@ -189,6 +189,16 @@ $("#scrollspy").on("activate.bs.scrollspy", () => {}); $("#scrollspy").scrollspy({ offset: 100, + target: "#navbar-example2", + method: "offset", +}); + +$("#scrollspy").scrollspy({ + target: document.getElementById("navbar-example2") as HTMLElement +}); + +$("#scrollspy").scrollspy({ + method: "position" }); // -------------------------------------------------------------------------------------- diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 15ef7a5f12..fbd804e3d0 100755 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -158,12 +158,27 @@ export interface PopoverOption extends TooltipOption { } export interface ScrollspyOption { + /** + * TODO: https://github.com/twbs/bootstrap/issues/25799 + * + * @default "auto" + */ + method?: "auto" | "offset" | "position"; + /** * Pixels to offset from top when calculating position of scroll. * * @default 10 */ offset?: number; + + /** + * A selector of the parent element or the parent element itself + * of any Bootstrap `.nav` or `.list-group` component. + * + * @default "" + */ + target?: string | Element; } export interface TooltipOption { @@ -302,11 +317,11 @@ export type AlertEvent = "close.bs.alert" | "closed.bs.alert"; export type CarouselEvent = "slide.bs.carousel" | "slid.bs.carousel"; export type CollapseEvent = "show.bs.collapse" | "shown.bs.collapse" | "hide.bs.collapse" | "hidden.bs.collapse"; export type DropdownEvent = "show.bs.dropdown" | "shown.bs.dropdown" | "hide.bs.dropdown" | "hidden.bs.dropdown"; -export type ModalEvent = "show.bs.modal" | "shown.bs.modal" | "hide.bs.modal" | "hidden.bs.modal"; +export type ModalEvent = "show.bs.modal" | "shown.bs.modal" | "hide.bs.modal" | "hidden.bs.modal"; export type PopoverEvent = "show.bs.popover" | "shown.bs.popover" | "hide.bs.popover" | "hidden.bs.popover" | "inserted.bs.popover"; export type ScrollspyEvent = "activate.bs.scrollspy"; export type TapEvent = "show.bs.tab" | "shown.bs.tab" | "hide.bs.tab" | "hidden.bs.tab"; -export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.tooltip" | "hidden.bs.tooltip" | "inserted.bs.tooltip"; +export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.tooltip" | "hidden.bs.tooltip" | "inserted.bs.tooltip"; // -------------------------------------------------------------------------------------- // jQuery