UNPKG

@sassoftware/vi-api

Version:
77 lines (76 loc) 2.04 kB
import { PageMode } from "../page-model/page-model-api"; import { FieldValue } from "./data-types"; import { TypeAttributes } from "./page"; export interface ModeChange { type: "mode"; value: { new: PageMode; old: PageMode; }; } export interface FieldChange<Value extends FieldValue> { type: "field"; value: { new: Value | undefined; old: Value | undefined; }; field: string; /** * The object name, if applicable. Otherwise, "". */ objectName: string; /** * The object position, for child objects only. */ objectPosition?: number; } export interface ControlConfigChange<ControlTypeAttributes extends TypeAttributes> { type: "controlConfig"; config: TypeAttributesChange<ControlTypeAttributes> | ConfigStateChange; } export type TypeAttributesChange<ControlTypeAttributes extends TypeAttributes, Property extends keyof ControlTypeAttributes = keyof ControlTypeAttributes> = Property extends any ? { type: "typeAttributes"; value: { new: ControlTypeAttributes[Property]; old: ControlTypeAttributes[Property]; }; property: Property; } : never; export interface ConfigStateChange { type: "configState"; value: { new: boolean; old: boolean; }; property: "readOnly" | "hidden" | "required"; } export interface PageModelData { [property: string]: any; } export declare enum ChangeType { PAGE_MODE = "mode",// aligned with Mobile API PAGE_DATA = "pageData" } export interface PageDataChange { readonly type: ChangeType.PAGE_DATA; value: { new: PageModelData; old?: PageModelData; }; } export interface PageModeChange { readonly type: ChangeType.PAGE_MODE; value: { new: PageMode; old?: PageMode; }; } export interface StateChange { readOnly?: boolean; hidden?: boolean; required?: boolean; allowInput?: boolean; couldBeReadOnly?: boolean; couldBeRequired?: boolean; masked?: boolean; }