UNPKG

obsidian-dev-utils

Version:

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

56 lines (55 loc) 1.73 kB
/** * @packageDocumentation * * Contains a component that displays and edits a number. */ import type { TextBasedComponent } from './TextBasedComponent.cjs'; import { TypedRangeTextComponent } from './TypedRangeTextComponent.cjs'; /** * A component that displays and edits a number. * * You can add this component using {@link SettingEx.addNumber}. * * In order to add the styles for the component, use {@link initPluginContext} in your plugin's `onload()` function. * * Alternatively, you can copy styles from {@link https://github.com/mnaoumov/obsidian-dev-utils/releases/latest/download/styles.css}. */ export declare class NumberComponent extends TypedRangeTextComponent<number> implements TextBasedComponent<number> { /** * Creates a new number component. * * @param containerEl - The container element of the component. */ constructor(containerEl: HTMLElement); /** * Empties the component. */ empty(): void; /** * Checks if the component is empty. * * @returns `true` if the component is empty, `false` otherwise. */ isEmpty(): boolean; /** * Sets the placeholder of the component. * * @param placeholder - The placeholder to set. * @returns The component. */ setPlaceholder(placeholder: string): this; /** * Sets the placeholder value of the component. * * @param placeholderValue - The placeholder value to set. * @returns The component. */ setPlaceholderValue(placeholderValue: number): this; /** * Converts a string to a number. * * @param str - The string to convert. * @returns The number. */ valueFromString(str: string): number; }