aia-kit
Version:
Read, Parse, Edit, Write, Analyze AIA/AIX/AIS files.
113 lines (112 loc) • 3.75 kB
TypeScript
import type { ComponentJson, ExtensionDescriptorJson } from "./types.js";
/**
* Class that describes a component with its properties and children.
*
* @since 1.0.0
* @access public
*/
export declare class Component {
/**
* Name of this component. It is unique and set by the user.
* @since 1.0.0
* @type {String}
*/
name: string;
/**
* Internal class name of this component, as defined by the name of the Java
* file it is declared in.
* @since 1.0.0
* @type {String}
*/
type: string;
/**
* Unique identifier for this component. Is internal and hidden from the user.
* Form components have a UID of 0.
* @since 1.0.0
* @type {String}
*/
uid: string;
/**
* Array of Component objects that represents the children of this component.
* @since 1.0.0
* @type {Array}
*/
children: Component[];
/**
* Origin of this component. Used in @see SummaryWriter::generateNativeShare
* to make summary charts of component usage.
* @since 1.0.0
* @type {String}
*/
private origin;
visible: boolean;
/**
* Array of property name-value pairs of this component. Properties are loaded
* asynchronously in AIScreen::generateComponent.
* @since 1.0.0
* @type {Array}
*/
properties: {
name: string;
value: string;
editorType?: string;
}[];
/**
* Flag which indicates whether there was a problem parsing this component's
* properties. @see Component::loadProperties
* @since 1.0.0
* @type {Boolean}
*/
private faulty;
/**
* Creates a new Component object.
*
* @since 1.0.0
* @access public
*
* @class
* @param {String} name The user-facing name of this component.
* @param {String} type The internal class name of this component.
* @param {String} uid The unique ID attached to this component.
* @param {String} origin 'EXTENSION' if this component is the instance of an
* extension, 'BUILT-IN' otherwise.
*
* @return {Component} New Component object.
*/
constructor(name: string, type: string, uid: string, origin: string);
/**
* Generates an array of name-value pair objects describing this compoent's
* properties.
*
* AIA files only store properties of a component that are not the default
* value. Therefore, we have to map the properties defined for this component
* type in the simple_components.json file (or custom descriptor JSON for
* extensions) to the properties saved in the AIA. This lets us generate the
* full list of properties for this component.
*
* @since 1.0.0
* @access private
*
* @param {Array} properties JSON array describing the properties of this
* component that have a non-default value.
* @param {Array} customDescriptorJSON The full list of properties and their
* default values for this component.
*
* @return {Promise} A Promise object, that when resolved, yields the complete
* array of properties of this component.
*/
loadProperties(properties: ComponentJson, customDescriptorJSON: ExtensionDescriptorJson): Promise<{
name: string;
value: string;
editorType?: string;
}[]>;
/**
* Adds a child component to this component.
*
* @since 1.0.0
* @access private
*
* @param {Component} component The child component to be added.
*/
addChild(component: Component): void;
}