Skip to content

Commit

Permalink
Add types to ConfigProgrammatic
Browse files Browse the repository at this point in the history
  • Loading branch information
jtommy committed Apr 24, 2020
1 parent e185942 commit d787ddd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 50 deletions.
55 changes: 55 additions & 0 deletions types/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,53 @@ export class BComponent extends _Vue {
[key: string]: any
}

export declare type BuefyConfig = {
defaultContainerElement?: string,
defaultIconPack?: string;
defaultIconComponent?: string;
defaultIconPrev?: string;
defaultIconNext?: string;
defaultDialogConfirmText?: string;
defaultDialogCancelText?: string;
defaultSnackbarDuration?: number;
defaultSnackbarPosition?: GlobalPositions;
defaultToastDuration?: number;
defaultToastPosition?: GlobalPositions;
defaultNotificationDuration?: number;
defaultNotificationPosition?: GlobalPositions;
defaultTooltipType?: ColorModifiers;
defaultTooltipAnimated?: boolean;
defaultTooltipDelay?: number;
defaultInputAutocomplete?: string;
defaultDateFormatter?: Function;
defaultDateParser?: Function;
defaultDateCreator?: Function;
defaultDayNames?: string[];
defaultMonthNames?: string[];
defaultFirstDayOfWeek?: number;
defaultUnselectableDaysOfWeek?: number[];
defaultTimeFormatter?: Function;
defaultTimeParser?: Function;
defaultModalCanCancel?: string[];
defaultModalScroll?: string;
defaultDatepickerMobileNative?: boolean;
defaultTimepickerMobileNative?: boolean;
defaultNoticeQueue?: boolean;
defaultInputHasCounter?: boolean;
defaultTaginputHasCounter?: boolean;
defaultUseHtml5Validation?: boolean;
defaultDropdownMobileModal?: boolean;
defaultFieldLabelPosition?: 'inside' | 'on-border';
defaultDatepickerYearsRange?: number[];
defaultDatepickerNearbyMonthDays?: boolean;
defaultDatepickerNearbySelectableMonthDays?: boolean;
defaultDatepickerShowWeekNumber?: boolean;
customIconPacks?: any;
defaultClockpickerHoursLabel?: string;
defaultClockpickerMinutesLabel?: string;
defaultTrapFocus?: boolean;
};

export declare type BDialogConfig = {
/**
* Dialog title
Expand Down Expand Up @@ -317,3 +364,11 @@ export declare type BNotificationConfig = BNoticeConfig & {
export declare const NotificationProgrammatic: {
open: (params: BNotificationConfig | string) => BNoticeComponent;
}


export declare const ConfigProgrammatic: {
getOptions: () => BuefyConfig
setOptions: (params: BuefyConfig) => any
}


56 changes: 6 additions & 50 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import _Vue from "vue";

import {
BuefyConfig,
DialogProgrammatic,
ModalProgrammatic,
LoadingProgrammatic,
ToastProgrammatic,
SnackbarProgrammatic,
NotificationProgrammatic } from "./components";
import { ColorModifiers, GlobalPositions } from "./helpers";
NotificationProgrammatic,
ConfigProgrammatic } from "./components";

// Adds Buefy method signatures to Vue instance (ie this.$buefy.dialog)
declare module 'vue/types/vue' {
Expand All @@ -23,54 +24,8 @@ export declare type BuefyNamespace = {
snackbar: typeof SnackbarProgrammatic,
toast: typeof ToastProgrammatic,
notification: typeof NotificationProgrammatic
}

export declare type BuefyConfig = {
defaultContainerElement?: string,
defaultIconPack?: string;
defaultIconComponent?: string;
defaultIconPrev?: string;
defaultIconNext?: string;
defaultDialogConfirmText?: string;
defaultDialogCancelText?: string;
defaultSnackbarDuration?: number;
defaultSnackbarPosition?: GlobalPositions;
defaultToastDuration?: number;
defaultToastPosition?: GlobalPositions;
defaultNotificationDuration?: number;
defaultNotificationPosition?: GlobalPositions;
defaultTooltipType?: ColorModifiers;
defaultTooltipAnimated?: boolean;
defaultTooltipDelay?: number;
defaultInputAutocomplete?: string;
defaultDateFormatter?: Function;
defaultDateParser?: Function;
defaultDateCreator?: Function;
defaultDayNames?: string[];
defaultMonthNames?: string[];
defaultFirstDayOfWeek?: number;
defaultUnselectableDaysOfWeek?: number[];
defaultTimeFormatter?: Function;
defaultTimeParser?: Function;
defaultModalCanCancel?: string[];
defaultModalScroll?: string;
defaultDatepickerMobileNative?: boolean;
defaultTimepickerMobileNative?: boolean;
defaultNoticeQueue?: boolean;
defaultInputHasCounter?: boolean;
defaultTaginputHasCounter?: boolean;
defaultUseHtml5Validation?: boolean;
defaultDropdownMobileModal?: boolean;
defaultFieldLabelPosition?: 'inside' | 'on-border';
defaultDatepickerYearsRange?: number[];
defaultDatepickerNearbyMonthDays?: boolean;
defaultDatepickerNearbySelectableMonthDays?: boolean;
defaultDatepickerShowWeekNumber?: boolean;
customIconPacks?: any;
defaultClockpickerHoursLabel?: string;
defaultClockpickerMinutesLabel?: string;
defaultTrapFocus?: boolean;
};
}

declare const _default: {
install(Vue: typeof _Vue, config: BuefyConfig): void;
Expand All @@ -82,7 +37,8 @@ export {
ModalProgrammatic,
SnackbarProgrammatic,
ToastProgrammatic,
NotificationProgrammatic
NotificationProgrammatic,
ConfigProgrammatic
}

export default _default;

0 comments on commit d787ddd

Please sign in to comment.