UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

182 lines (181 loc) 7.57 kB
/** * @packageDocumentation * * Extends the Setting class with additional methods for adding components. */ import type { BaseComponent } from 'obsidian'; import { Setting } from 'obsidian'; import { CheckboxComponent } from './Components/SettingComponents/CheckboxComponent.cjs'; import { CodeHighlighterComponent } from './Components/SettingComponents/CodeHighlighterComponent.cjs'; import { DateComponent } from './Components/SettingComponents/DateComponent.cjs'; import { DateTimeComponent } from './Components/SettingComponents/DateTimeComponent.cjs'; import { EmailComponent } from './Components/SettingComponents/EmailComponent.cjs'; import { FileComponent } from './Components/SettingComponents/FileComponent.cjs'; import { MonthComponent } from './Components/SettingComponents/MonthComponent.cjs'; import { MultipleDropdownComponent } from './Components/SettingComponents/MultipleDropdownComponent.cjs'; import { MultipleEmailComponent } from './Components/SettingComponents/MultipleEmailComponent.cjs'; import { MultipleFileComponent } from './Components/SettingComponents/MultipleFileComponent.cjs'; import { MultipleTextComponent } from './Components/SettingComponents/MultipleTextComponent.cjs'; import { NumberComponent } from './Components/SettingComponents/NumberComponent.cjs'; import { PasswordComponent } from './Components/SettingComponents/PasswordComponent.cjs'; import { TelephoneComponent } from './Components/SettingComponents/TelephoneComponent.cjs'; import { TimeComponent } from './Components/SettingComponents/TimeComponent.cjs'; import { TriStateCheckboxComponent } from './Components/SettingComponents/TriStateCheckboxComponent.cjs'; import { TypedDropdownComponent } from './Components/SettingComponents/TypedDropdownComponent.cjs'; import { TypedMultipleDropdownComponent } from './Components/SettingComponents/TypedMultipleDropdownComponent.cjs'; import { UrlComponent } from './Components/SettingComponents/UrlComponent.cjs'; import { WeekComponent } from './Components/SettingComponents/WeekComponent.cjs'; /** * Extends the Setting class with additional methods for adding components. */ export declare class SettingEx extends Setting { /** * Adds a {@link CheckboxComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addCheckbox(cb: (checkbox: CheckboxComponent) => void): this; /** * Adds a {@link CodeHighlighterComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addCodeHighlighter(cb: (codeHighlighter: CodeHighlighterComponent) => void): this; /** * Adds a component to the setting. * * @typeParam T - The type of the component to add. * @param componentClass - The class of the component to add. * @param cb - The callback to call with the component. * @returns The setting instance. */ addComponent<T extends BaseComponent>(componentClass: new (containerEl: HTMLElement) => T, cb: (component: T) => void): this; /** * Adds a {@link DateComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addDate(cb: (date: DateComponent) => void): this; /** * Adds a {@link DateTimeComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addDateTime(cb: (dateTime: DateTimeComponent) => void): this; /** * Adds an {@link EmailComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addEmail(cb: (email: EmailComponent) => void): this; /** * Adds a {@link FileComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addFile(cb: (file: FileComponent) => void): this; /** * Adds a {@link MonthComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addMonth(cb: (month: MonthComponent) => void): this; /** * Adds a {@link MultipleDropdownComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addMultipleDropdown(cb: (multipleDropdown: MultipleDropdownComponent) => void): this; /** * Adds a {@link MultipleEmailComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addMultipleEmail(cb: (multipleEmail: MultipleEmailComponent) => void): this; /** * Adds a {@link MultipleFileComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addMultipleFile(cb: (multipleFile: MultipleFileComponent) => void): this; /** * Adds a {@link MultipleTextComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addMultipleText(cb: (multipleText: MultipleTextComponent) => void): this; /** * Adds a {@link NumberComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addNumber(cb: (number: NumberComponent) => void): this; /** * Adds a {@link PasswordComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addPassword(cb: (password: PasswordComponent) => void): this; /** * Adds a {@link TelephoneComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addTelephone(cb: (telephone: TelephoneComponent) => void): this; /** * Adds a {@link TimeComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addTime(cb: (time: TimeComponent) => void): this; /** * Adds a {@link TriStateCheckboxComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addTriStateCheckbox(cb: (triStateCheckbox: TriStateCheckboxComponent) => void): this; /** * Adds a {@link TypedDropdownComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addTypedDropdown<T>(cb: (typedDropdown: TypedDropdownComponent<T>) => void): this; /** * Adds a {@link TypedMultipleDropdownComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addTypedMultipleDropdown<T>(cb: (typedMultipleDropdown: TypedMultipleDropdownComponent<T>) => void): this; /** * Adds an {@link UrlComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addUrl(cb: (url: UrlComponent) => void): this; /** * Adds a {@link WeekComponent} to the setting. * * @param cb - The callback to call with the component. * @returns The setting instance. */ addWeek(cb: (week: WeekComponent) => void): this; }