UNPKG

cv-dialog-sdk

Version:

Catavolt Dialog Javascript API

133 lines (132 loc) 5.23 kB
import { StringDictionary } from "../util"; import { AttributeCellValue } from './AttributeCellValue'; import { Dialog } from './Dialog'; import { LargeProperty } from './LargeProperty'; import { Menu } from './Menu'; import { Property } from './Property'; import { PropertyDef } from './PropertyDef'; import { ReadLargePropertyParameters } from './ReadLargePropertyParameters'; import { Record } from './Record'; import { Redirection } from './Redirection'; import { ViewMode } from './types'; /** * PanContext Subtype that represents an 'Editor Dialog'. * An 'Editor' represents and is backed by a single Record and Record definition. * See {@link Record} and {@link RecordDef}. */ export declare class EditorDialog extends Dialog { readonly recordId: string; private _buffer; static getSubType(jsonObj: StringDictionary): string; changeViewMode(viewMode: ViewMode): Promise<EditorDialog | Redirection>; /** * Get the associated properties */ readonly props: Property[]; readonly propertyDefs: PropertyDef[]; readonly constants: string[]; readonly attributeCells: AttributeCellValue[]; readonly labelsByPropName: StringDictionary; /** * Get the associated entity record * @returns {Record} */ readonly record: Record; /** * Get the current version of the entity record, with any pending changes present * @returns {Record} */ readonly recordNow: Record; getAvailableValues(propName: string): Promise<any[]>; /** * Returns whether or not this cell definition contains a binary value * * @param {AttributeCellValue} cellValue * @returns {boolean} */ isBinary(cellValue: AttributeCellValue): boolean; /** * Returns whether or not this Editor is in 'read' mode * @returns {boolean} */ readonly isReadMode: boolean; /** * Returns whether or not this property is read-only * @param propName * @returns {boolean} */ isReadModeFor(propName: string): boolean; /** * Returns whether or not this cell definition contains a binary value that should be treated as a signature control * @param cellValueDef * @returns {PropertyDef|boolean} */ isSignature(cellValueDef: AttributeCellValue): boolean; /** * Returns whether or not this property is 'writable' * @returns {boolean} */ readonly isWriteMode: boolean; performMenuActionWithId(actionId: string): Promise<Redirection>; /** * Perform the action associated with the given Menu on this EditorDialog * Given that the Editor could possibly be destroyed as a result of this action, * any provided pending writes will be saved if present. * @param {Menu} menu * @param {Record} pendingWrites * @returns {Promise<{actionId: string} | Redirection>} */ performMenuAction(menu: Menu): Promise<Redirection>; /** * Properties whose {@link PropertyDef.canCauseSideEffects} value is true, may change other underlying values in the model. * This method will update those underlying values, given the property name that is changing, and the new value. * This is frequently used with {@link EditorDialog.getAvailableValues}. When a value is selected, other properties' * available values may change. (i.e. Country, State, City dropdowns) */ processSideEffects(propertyName: string, value: any): Promise<void>; /** * Read (load) the {@link Record} assocated with this Editor * The record must be read at least once to initialize the Context * @returns {Future<Record>} */ read(): Promise<Record>; /** * Set the value of a property in this {@link Record}. * Values may be already constructed target types (CodeRef, TimeValue, Date, etc.) * or primitives, in which case the values will be parsed and objects constructed as necessary. * @param name * @param value * @returns {any} */ setPropertyValue(name: string, value: any): Property; newProperty(name: string, value: any): Property; newLargePropertyWithDataUrl(dataUrl: string): LargeProperty; newLargePropertyWithEncodedData(encodedData: string, mimeType?: string): LargeProperty; /** * Set a binary property from a string formatted as a 'data url' * See {@link https://en.wikipedia.org/wiki/Data_URI_scheme} * @param name * @param dataUrl */ setLargePropertyWithDataUrl(name: string, dataUrl: string): Property; /** * Set a binary property with base64 encoded data * @param name * @param encodedData * @param mimeType */ setLargePropertyWithEncodedData(name: string, encodedData: string, mimeType?: string): Property; /** * Write this record (i.e. {@link Record}} back to the server * @returns {Promise<Record | Redirection>} */ write(): Promise<EditorDialog | Redirection>; protected getProperty(params: ReadLargePropertyParameters, propertyName: string): Promise<LargeProperty>; /** * Get the current buffered record * @returns {RecordBuffer} */ private readonly buffer; private getWriteableRecord; private initBuffer; }