UNPKG

@agile-ts/multieditor

Version:

Simple Form Manager for UI-Frameworks

70 lines (69 loc) 2.21 kB
import { State, StateIngestConfigInterface } from '@agile-ts/core'; import { Item } from '../item'; import { StatusTracker } from './status.tracker'; export declare class Status<ValueType = any> extends State<StatusValueType> { config: StatusConfigInterface; item: Item<ValueType>; statusTracker: StatusTracker; lastTrackedValues: StatusValueType[]; /** * Represents the current status of the specified Item. * * @public * @param item - Item the Status belongs to. * @param config - Configuration object */ constructor(item: Item<ValueType>, config?: CreateStatusConfigInterface); /** * Returns a reference-free version of the current Status value * if the Status should be displayed. * * @public */ get value(): StatusValueType; /** * Assigns a new value to the Status * and re-renders all subscribed UI-Components. * * @public * @param value - New Status value * @param config - Configuration object */ set(value: StatusValueType, config?: StatusSetInterface): this; } export declare type StatusType = 'error' | 'success' | 'warn' | string; export declare type StatusValueType = StatusInterface | null; export interface StatusInterface { /** * Type of Status ('error', 'success', ..) */ type: StatusType; /** * Message of Status */ message: string; } export interface StatusSetInterface extends StateIngestConfigInterface { /** * If tracking of the particular Status is active, * the value is only tracked (not applied). * If the tracking has been finished the last tracked Status value should be applied to the Status. * (See: https://github.com/agile-ts/agile/pull/204#issuecomment-925934647) * @default false */ waitForTracking?: boolean; } export interface StatusConfigInterface { /** * Whether the Status should be displayed or stay hidden (in the UI). * @default false */ display: boolean; } export interface CreateStatusConfigInterface { /** * Whether the Status should be displayed or stay hidden (in the UI). * @default false */ display?: boolean; }