UNPKG

@try-at-software/input-elements

Version:

A package providing different input elements that are extensible and easily configurable for your custom needs.

54 lines (53 loc) 2.96 kB
import * as React from 'react'; import { ExtendedInputElement } from '../ExtendedInputElement'; import { UpdateCallback } from '../IInputElement'; import { ValidationRule } from '../IValueInputElement'; import { InvalidValueChangeSubscription, ValueChangeSubscription } from '../Subscriptions'; import { IDynamicProps } from './IDynamicProps'; import { SingleValueInputElementWrapper } from './InternalPresentationComponents/SingleValueInputElementWrapper'; import { IOperativeProps } from './IOperativeProps'; import { ISingleValueInputElementConfiguration } from './ISingleInputElementConfiguration'; import { ISingleValueInputElement } from './ISingleValueInputElement'; import { ISingleValueInputElementProps } from './ISingleValueInputElementProps'; export declare class SingleValueInputElement<TValue, TOperativeProps, TDynamicProps = unknown> extends ExtendedInputElement<TValue, SingleValueInputElementWrapper<TValue, TOperativeProps, TDynamicProps>> implements ISingleValueInputElement<TValue, TOperativeProps, TDynamicProps> { private readonly _configuration; private readonly valueChangeSubscriptions; private readonly initialValueChangeSubscriptions; private readonly invalidValueChangeSubscriptions; private _dynamicProps; private _isInvalidated; constructor(config: ISingleValueInputElementConfiguration<TValue>, component: React.ComponentType<ISingleValueInputElementProps<TValue> & IOperativeProps<TOperativeProps> & IDynamicProps<TDynamicProps>>, props: TOperativeProps, update: UpdateCallback, ...validationRules: ValidationRule<TValue>[]); /** @inheritdoc */ subscribeToValueChange(subscription: ValueChangeSubscription<TValue>): void; /** @inheritdoc */ subscribeToInitialValueChange(subscription: ValueChangeSubscription<TValue>): void; /** @inheritdoc */ subscribeToInvalidValueChange(subscription: InvalidValueChangeSubscription): void; /** @inheritdoc */ protected setInternalValue(value: TValue, isInitial: boolean): void; /** @inheritdoc */ protected resetInternalValue(): void; /** @inheritdoc */ get hasChanges(): boolean; /** @inheritdoc */ value: TValue; /** @inheritdoc */ validationRules: ValidationRule<TValue>[]; /** @inheritdoc */ get isValid(): boolean; /** @inheritdoc */ readonly componentToRender: React.ComponentType<ISingleValueInputElementProps<TValue> & IOperativeProps<TOperativeProps> & IDynamicProps<TDynamicProps>>; /** @inheritdoc */ componentProps: TOperativeProps; /** @inheritdoc */ getDynamicProps(): TDynamicProps; /** @inheritdoc */ protected renderComponent(): JSX.Element; /** @inheritdoc */ changeDynamicProps<K extends keyof TDynamicProps>(dynamicProps: Pick<TDynamicProps, K>): void; /** @inheritdoc */ validate(): void; private setError; private valueIsValid; private invalidateInput; }