import { JBTimePickerWebComponent, TimeUnitsString } from "jb-time-picker"; import { JBInputWebComponent } from "jb-input"; import { JBButtonWebComponent } from "jb-button"; import { JBPopoverWebComponent } from "jb-popover"; import { EventTypeWithTarget } from "jb-core"; import { ShowValidationErrorParameters, ValidationHelper, ValidationResult, ValidationResultSummary, WithValidation } from "jb-validation"; //#region modules/jb-time-input/web-component/lib/types.d.ts type TimeUnits = "hour" | "minute" | "second"; type JBTimeInputElements = { input: JBInputWebComponent; timePicker: { wrapper: JBPopoverWebComponent; component: JBTimePickerWebComponent; closeButton: JBButtonWebComponent; }; }; type ValidationValue = { value: string; displayValue: string; valueObject: { [key in TimeUnits]: number | null }; }; declare global { interface ElementInternals { setFormValue(value: string): void; } } type JBTimeInputEventType = EventTypeWithTarget; //#endregion //#region modules/jb-form/web-component/dist/jb-form.d.ts //#region modules/jb-form/web-component/lib/virtual-element.d.ts declare class VirtualElement { #private; name: string; /** * name maybe repeated but id must be unique */ id?: string; validation?: ValidationHelper; dom?: HTMLElement; getValue?: () => TValue; getDirtyStatus?: () => boolean; setValue?: (value: TValue) => void; setInitialValue?: (value: TValue) => void; reset?: () => void; get value(): TValue | undefined; set Value(value: TValue); constructor(config: VirtualElementConfig); attachCallbacks(callbacks: VirtualElementCallbacks): void; /** * @public * @description call this function when form value change so it can trigger dirty and validation check for form */ dispatchOnChange: () => void; } //#endregion //#region modules/jb-form/web-component/lib/collections.d.ts /** * @public this symbol will be putted in Map value to indicate that value is gathered from multiple fields and it's not a array value */ declare const ValueCollectionSymbol: unique symbol; declare class TraverseCollection extends Map { [ValueCollectionSymbol]: boolean; constructor(...params: ConstructorParameters>); } //#endregion //#region modules/jb-form/web-component/lib/types.d.ts interface JBFormInputStandards extends HTMLElement { disabled: boolean; required: boolean; /** * name can't be null it must return empty string "" when it's not available (it's HTML standard) */ name: string; value: TValue; /** * if id is not defined it return empty string */ id: string; /** * @description check if user change the value of component based on value provided from outside and return true if user change a initial value */ readonly isDirty: boolean; initialValue: TValue; get form(): HTMLFormElement | JBFormWebComponent | null; /** * calls when element form changed. */ formAssociatedCallback?: (form: HTMLFormElement | null) => void; /** * when reset method of the forms called */ formResetCallback: () => void; /** * when form disable or enable function called */ formDisabledCallback?: (disabled: boolean) => void; /** * when form restore or autocomplete called. */ formStateRestoreCallback?: (state: string | File | FormData | null, mode: 'autocomplete' | 'restore') => void; } type NativeFormElements = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLFieldSetElement | HTMLOutputElement | HTMLObjectElement; type TraverseResult = { [key: string]: T | TraverseCollection; }; type FormValidationMessages = { [key: string]: string | null | TraverseCollection; }; type FormValidationSummary = { [key: string]: ValidationResultSummary | TraverseCollection | null; }; type FormValidationResult = { [key: string]: ValidationResult | TraverseCollection | null> | null; }; type FormValues = { [key: string]: TValue; }; type ValidationValue$1 = FormValues; type VirtualElementConfig = { /** * @requires * @property name of your virtual element */ name: string; /** * @property jb-validation ValidationHelper instance. if not provided, this virtual element will not be participated in validation methods and results */ validation?: ValidationHelper; /** * @property help you spot your virtual elements DOM so you could scroll to, in invalidate cases or use it any other way you see fit. */ dom?: HTMLElement; /** * @property we need your component value for value oriented methods like isDirty */ getValue?: () => TValue; /** * @property function that return true if your component value is changed from initialValue (write deep compare functions of value compare here) */ getDirtyStatus?: () => boolean; /** * @property this callback function will be called in case of form setValue called. */ setValue?: (value: TValue) => void; /** * @property this callback function will be called in case of form setInitialValue called. */ setInitialValue?: (value: TValue) => void; /** * Restore the virtual element to its initial value. */ reset?: () => void; }; type VirtualElementCallbacks = { onChange: () => void; }; type JBCheckValidityParameter = { /** * @property in case of error do you want to show it or you just want to get result. true will show error */ showError: boolean; }; type CheckValidityAsyncResult = { /** * @property result of all validations */ isAllValid: boolean; /** * @property keep validation result of standard jb-validation form elements (nested elements not included) */ elements: Map>; /** * @property keep validation result of virtual elements (nested elements not included) */ virtualElements: Map, ValidationResult>; /** * @property keep validation result of sub forms and sub forms (you can access nested elements from here) */ subForms: Map; }; //#endregion //#region modules/jb-form/web-component/lib/form-elements.d.ts declare class FormElements { #private; form: HTMLFormElement; observer: MutationObserver; customElements: Map>, null>; nativeElements: Map; get allElements(): (Partial> | NativeFormElements)[]; reset(): void; constructor(jbForm: JBFormWebComponent); initElements(): void; } //#endregion //#region modules/jb-form/web-component/lib/utils.d.ts /** * get the jbCheckValidity method result and extract invalid elements dom, you can scroll to the dom or play some animation for dom * @param result result of jbCheckValidity method * @returns list of HTMLElement of invalid doms */ //#endregion //#region modules/jb-form/web-component/lib/jb-form.d.ts declare class JBFormWebComponent extends HTMLElement { #private; static get formAssociated(): boolean; callbacks: { showValidationError: (_message: ShowValidationErrorParameters) => void; cleanValidationError: () => void; setValidationResult: () => void; }; get validElements(): (Partial> | NativeFormElements)[]; get validation(): ValidationHelper; get isDirty(): boolean; get value(): FormValues; set value(value: FormValues); get name(): string; set name(value: string | null | undefined); get virtualElements(): { list: ReadonlyArray>; dictionary: Readonly>>; add: (config: VirtualElementConfig) => VirtualElement; remove: ({ virtualElement }: { virtualElement: VirtualElement; }) => void; }; get subForms(): { list: readonly JBFormWebComponent[]; dictionary: Readonly<{ [x: string]: JBFormWebComponent | JBFormWebComponent[]; }>; }; get formElements(): FormElements; constructor(); initWebComponent(): void; connectedCallback(): void; static get observedAttributes(): string[]; attributeChangedCallback(name: string, _oldValue: string, newValue: string): void; checkValidity(): boolean; reportValidity(): boolean; /** * @description this function will check all standard jb validations includes async validations virtual elements and sub forms. it have most rich validation result betweens jb-form validation results methods * @public */ jbCheckValidity(params: JBCheckValidityParameter): Promise; /** * @description returns key value object contains validation message of named element * @returns @public */ getValidationMessages(): FormValidationMessages; /** * @description returns key value object contains validation summary result of named element * @returns @public */ getValidationSummary(): FormValidationSummary; /** * @description returns key value object contains validation summary result of named element * @returns @public */ getValidationResult(): FormValidationResult; /** * @description returns key value object contains value of named element * @returns @public */ getFormValues(): TFormValue; /** * @description returns key value object contains dirty status of named element * @returns @public */ getFormDirtyStatus(): TraverseResult; /** * @description set value of named form input elements * @param shouldUpdateInitialValue determine if we should also update initial value or not. pass false if you want initialValue remain untouched */ setFormValues(value: TFormValue, shouldUpdateInitialValue?: boolean): void; /** * @description set initial value of named form input elements used for dirty field detection */ setFormInitialValues(value: TFormValue, shouldUpdateValue?: boolean): void; /** * Restore all controls to their initial values and clear validation state. */ reset(): void; formResetCallback(): void; disconnectedCallback(): void; } //#endregion //#endregion //#region modules/jb-time-input/web-component/lib/jb-time-input.d.ts declare class JBTimeInputWebComponent extends HTMLElement implements WithValidation, JBFormInputStandards { #private; static get formAssociated(): boolean; elements: JBTimeInputElements; get value(): string; set value(value: string); get form(): HTMLFormElement | null; get name(): string; set name(value: string | null | undefined); /** * Default and reset value. It initializes `value` until the live value is explicitly set. */ get initialValue(): string; set initialValue(value: string | null); get isDirty(): boolean; formResetCallback(): void; formDisabledCallback(disabled: boolean): void; /** * @description will determine if component trigger jb-validation mechanism automatically on user event or it just let user-developer handle validation mechanism by himself */ get isAutoValidationDisabled(): boolean; get validation(): ValidationHelper; /** * @description return hour in string base on input value */ get hourString(): string; /** * * @return {Number} return hour in number base on input value * @memberof JBTimeInputWebComponent */ get hour(): number; set hour(value: number); /** * @description return minute in string base on input value */ get minuteString(): string; /** * * @description return minute in number. base on input value */ get minute(): number; set minute(value: number); /** * @description return minute in string base on input value */ get secondString(): string; /** * * @description second in number. base on input value */ get second(): number | null; set second(value: string | number | null); get showTimePicker(): boolean; set showTimePicker(value: boolean); get secondEnabled(): boolean; set secondEnabled(value: boolean); get showPersianNumber(): boolean; set showPersianNumber(value: boolean); get disabled(): boolean; set disabled(value: boolean); set required(value: boolean); get required(): boolean; set optionalUnits(value: TimeUnitsString[]); get optionalUnits(): TimeUnitsString[]; set frontalZero(value: boolean); get frontalZero(): boolean; constructor(); connectedCallback(): void; static get observedAttributes(): string[]; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; /** * @public * @description add given number to hour (you can provide negative value for subtract) */ addHour(interval: number): void; /** * @public * @description add given number to minute (you can provide negative value for subtract) */ addMinute(interval: number): void; /** * @public * @description add given number to second (you can provide negative value for subtract) */ addSecond(interval: number): void; showValidationError(error: ShowValidationErrorParameters): void; clearValidationError(): void; /** * @public */ focus(): void; /** * @description assign new value to time picker * @public */ updateTimePickerValue(hour: number, minute: number, second: number | null | 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; reportValidity(): boolean; get validationMessage(): string; } //#endregion export { JBTimeInputElements, JBTimeInputEventType, JBTimeInputWebComponent, TimeUnits, ValidationValue }; //# sourceMappingURL=jb-time-input.d.ts.map