import type * as defs from "./FormDefinition"; /** * The definition of a Form Element along with its name. */ export type ElementKeyValuePair = { /** The implementation of the element itself. */ element: defs.Element; /** The name of the form element as defined in the form. */ elementName: string; }; /** * This facilitates the lookup of related Section form elements, for cases where * mutually-exclusive operations must be performed, such as expand/collapse. * * You can use the name of a known Section form element to find all of the other Section form elements in the same group. * This is only relevant to special types of section that care about mutual exclusion. Regular sections are not added here. * * The key is the name of a Section form element. * The value is an object representing all elements in the same run as the named one. * The value has its own keys and values to keep track of both the names and actual elements. * * The same value is present for all elements in the run, to facilitate faster lookup. * The element objects are included as well as the names to avoid the need for extra lookup. */ export default class MutuallyExclusiveSectionGroup extends Array { /** * Gets the currently expanded section in this group. * if none are expanded, this returns undefined. */ get expandedSection(): defs.Element | undefined; /** * Gets a value indicating if a section is currently expanded in this group. */ get hasExpandedSection(): boolean; /** * Sets the currently expanded section in this group. * All others are collapsed. */ set expandedSection(element: defs.Element | undefined); getElement(elementName: string): defs.Element | undefined; }