UNPKG

jb-date-input

Version:
158 lines 6.09 kB
import 'jb-calendar'; import 'jb-input'; import 'jb-popover'; import { type InputType } from 'jb-calendar'; import type { JBFormInputStandards } from 'jb-form'; import { ValidationHelper, type ValidationResult, type WithValidation, type ShowValidationErrorParameters } from 'jb-validation'; import { type ElementsObject, type DateRestrictions, type ValueType, type ValidationValue } from './types.js'; import { handleBeforeInput, getFixedCaretPos, emptyInputValueString } from 'jb-date-input/module'; import { InputTypes, type JBDateInputValueObject } from 'jb-date-input/module'; import { dictionary } from './i18n'; export * from "./types.js"; export { handleBeforeInput, emptyInputValueString, getFixedCaretPos, InputTypes, JBDateInputValueObject, InputType, dictionary }; export declare class JBDateInputWebComponent extends HTMLElement implements WithValidation<ValidationValue>, JBFormInputStandards<string> { #private; static formAssociated: boolean; elements: ElementsObject; /** * component internal validation system will be disabled so you can control validation by yourself */ get isAutoValidationDisabled(): boolean; /** * component internal validation system will be disabled so you can control validation by yourself */ set isAutoValidationDisabled(value: boolean); /** * jb date input internal validation mechanism works with */ get validation(): ValidationHelper<ValidationValue>; /** * create a restriction for Dates user can input or select */ dateRestrictions: DateRestrictions; get disabled(): boolean; set disabled(value: boolean); /** * return start position of the selected text */ get selectionStart(): number; /** * set start position of the selected text */ set selectionStart(value: number); /** * return end position of the selected text */ get selectionEnd(): number; /** * set end position of the selected text */ set selectionEnd(value: number); /** * return the user selection direction */ get selectionDirection(): "forward" | "backward" | "none"; /** * set the user selection direction */ set selectionDirection(value: "forward" | "backward" | "none"); /** * set input selection * @param start start of the selection * @param end end of the selection * @param direction direction of the selection */ setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; /** * if set true validation failed when user dont fill date completely */ set required(value: boolean); get required(): boolean; get name(): string; get form(): HTMLFormElement; get value(): string; set value(value: string | Date); initialValue: string | null; get isDirty(): boolean; setMonthList(inputType: InputType, monthName: string[]): void; /** * @description return date value if value valid and return null if inputted value is not valid */ get valueInDate(): Date | null; get inputValue(): string; get placeholder(): string | null; set placeholder(value: string | null); get showCalendar(): boolean; set showCalendar(value: boolean); get inputType(): InputType; set inputType(value: InputType); get valueType(): ValueType; set valueType(value: ValueType); get yearValue(): number | null; get yearDisplayValue(): number | null; get monthValue(): number | null; get monthDisplayValue(): number | null; get dayValue(): number | null; get dayDisplayValue(): number | null; get yearBaseOnInputType(): number | null; get monthBaseOnInputType(): number | null; get dayBaseOnInputType(): number | null; get typedYear(): string; get typedMonth(): string; get typedDay(): string; get sTypedYear(): string; get sTypedMonth(): string; get sTypedDay(): string; get valueFormat(): string; get showPersianNumber(): boolean; set showPersianNumber(value: boolean); constructor(); connectedCallback(): void; static get dateInputObservedAttributes(): string[]; static get observedAttributes(): string[]; attributeChangedCallback(name: string, oldValue: string, newValue: string): void; /** * set the date value string format for parsing and converting. * @param newFormat */ setFormat(newFormat: string): void; setMinDate(minDate: string | Date): void; setMaxDate(maxDate: string | Date): void; /** * @description will convert current valueObject to expected value string */ getDateValue(type?: ValueType): string; /** * @public * @description focus on date input web-component */ focus(): void; /** * @deprecated use dom.validation.checkValidity instead */ triggerInputValidation(showError?: boolean): Promise<ValidationResult<ValidationValue>>; showValidationError(error: ShowValidationErrorParameters): void; clearValidationError(): void; onInputTypeChange(): Promise<void>; /** * set opened calendar date when date input value is empty * @public * @param year which year you want to show in empty state in calendar. * @param month which month you want to show in empty state in calendar. * @param dateType default is your configured input-type but you can set it otherwise if you want to change other type of calendar in case of change in input-type. */ setCalendarDefaultDateView(year: number, month: number, dateType: InputType | undefined): void; /** * @public * @description this method used to check for validity but doesn't show error to user and just return the result * this method used by #internal of component */ checkValidity(): boolean; /** * @public * @description this method used to check for validity and show error to user */ reportValidity(): boolean; get validationMessage(): string; } //# sourceMappingURL=jb-date-input.d.ts.map