import type { FormElementSize } from "./constants"; import type { TimeFormat } from "./dateUtilities"; import type { NumberDisplayFormat } from "./numberFormatter"; import type { ExternalEvent } from "../execution/ExternalEvent"; /** * References a container. * @product This is intended for internal use only within VertiGIS Studio products. */ export type ContainerRef = "default" | "modal" | { /** Indicates the name of the container. */ name: string; /** Indicates the region to display the form within. */ region?: string; }; /** References the date/time format criteria. */ export type DateTimeFormat = { /** Indicates the locale for the date/time value. */ locale: string; /** Indicates the time zone for the date/time value. */ timezone: string; }; /** References the date/time type. */ export type DateTimeType = "date" | "time" | "datetime"; export type EventType = "cancel" | "changed" | "checked" | "clicked" | "custom" | "dragged" | "end" | "external" | "load" | "populate" | "prepare" | "submit" | "suggest" | "validate" | "verify"; /** References the format types. */ export type FormatRef = DateTimeFormat | GeometryFormat | NumberFormat | SectionFormat; /** * References geometry format. * @product This is intended for internal use only within VertiGIS Studio products. */ export type GeometryFormat = "circle" | "extent" | "line" | "multipoint" | "point" | "polygon" | "polygon-freehand" | "polyline" | "polyline-freehand"; /** Types of matching that can be performed when finding an Item within a Form Element. */ export type ItemMatchType = "index" | "item" | "key" | "label" | "value"; /** * Indicates how a form element's items should be laid out. */ export type Orientation = "horizontal" | "vertical"; export type SectionFormat = "accordion-section" | "basic-section" | "collapsible-section" | "fieldset-section" | "tab-section" | "unstyled-section"; /** References a section. */ export type SectionRef = "header" | "footer" | { /** Indicates the section to bind to. */ name: string; }; /** * References any kind of text. * @product This is intended for internal use only within VertiGIS Studio products. */ export type Text = string | MarkdownRef | StatusRef; /** * Indicates how a form element's title should be positioned relative to its content. */ export type TitleLocation = "above" | "beside"; /** * References any kind of value appropriate for a form element. * @product This is intended for internal use only within VertiGIS Studio products. */ export type Value = boolean | number | number[] | string | DataRef | DateRangeRef | DateTimeRef | FilesRef | GeometryRef | ItemsRef | NumberRef | ScanRef | SignatureRef | SketchRef; /** References data for a data-based value. */ export interface DataRef { /** Indicates the data. */ data?: any; /** Discriminates this object from others. */ format?: void; /** Indicates the type of data. */ type: string; } export interface DateRangeRef { /** * The upper end of the date range. The time is set to midnight local time, * based on the user's time-zone. * */ endDate: Date; /** * The lower end of the date range. The time is set to midnight local time, * based on the user's time-zone. * */ startDate: Date; } /** References data for a date-based value. */ export interface DateTimeRef { /** Indicates the display form for the date/time value. */ display: string; /** Indicates the format for the date/time value. */ format: DateTimeFormat; /** Indicates the value for the date/time value. */ value: number; } export interface FilesRef { /** Indicates the files. */ files: File[]; /** Discriminates this object from others. */ format?: void; } /** References a geometry. */ export interface GeometryRef { /** Indicates the format of the value. */ format: GeometryFormat; /** Indicates the geometry. */ geometry: object[]; } /** * References one or more items within the element. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface ItemsRef { /** The items that were selected. */ items: Item[]; } /** * Indicates the number. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface NumberRef { /** Indicates the display value. */ display: string; /** Indicates the format for the number. */ format: NumberFormat; /** Indicates the numeric value. */ numeric: number; } /** * References markdown for a markdown-based value. * @public */ export interface MarkdownRef { markdown: string; } export interface ScanRef { /** Type of entry method. */ entryMethod: "camera" | "manual"; /** Type of barcode scanned. */ scanType?: "barcode" | "qrcode"; /** Indicates the returned scanner data. */ value: string; } export interface SignatureRef { /** A Data URL describing the image as a PNG. */ dataUrl: string; /** A File object for a PNG image of the signature. */ file: File; } export interface SketchRef { /** A Data URL describing the sketched image as a PNG. */ dataUrl: string; /** A File object for a PNG image of the sketched image. */ file: File; } /** * References an error, warnings, and statuses. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface StatusRef { /** missing - Input is missing. */ /** invalid - Input is invalid. */ /** failure - Input experienced a failure during validation or population. */ /** pending - Input items are being populated. */ /** trivial - Input items are empty, not relevant, not significant etc. */ status: "missing" | "invalid" | "failure" | "pending" | "trivial"; } /** * Constraints to be applied to numeric values within form elements that deal with selecting numbers. */ export interface NumberConstraints { /** * The highest accepted value. Values higher than this value should be replaced by it. * If this is `undefined`, there is no upper limit. */ maximum: number | undefined; /** * The lowest accepted value. Values lower than this value should be replaced by it. * If this is `undefined`, there is no lower limit. */ minimum: number | undefined; /** * The amount that the number changes when the user increments/decrements the value. * This must be a value > 0. * * If `minimum` is also defined, values must fall on `minimum + step * n` where `n` is an integer. * Values that do not should be rounded to the nearest valud step. If `minimum` is not defined, * the formula becomes `step * n`. */ step: number; } /** * References the number format criteria. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface NumberFormat { /** * The 3-letter ISO 4217 currency code (e.g "USD", "CAD"). Required when * formatting a number using NumberFormat.CURRENCY or NumberFormat.ACCOUNTING. */ currency?: string; /** * A custom display pattern. Required when formatting a number using NumberDisplayFormat.CUSTOM */ customDisplayFormat?: string; /** * Indicates the display format - one of Number, Fixed Point, Currency, * Accounting, Percent or a custom format string like '##.##'. */ displayFormat?: NumberDisplayFormat; /** Indicates the lower bound. */ lowerBound?: number; /** * Indicates the minimum increment/decrement and precision of values. * * Positive precision values indicates the number of decimal places to round to. * For example, `1` would round to `0.1`, `2` would round to `0.01` etc. * * Negative precision values indicates the number of whole digits to round to. * For example, `-1` would round to `10`, `-2` would round to `100` etc. */ precision?: number; /** Indicates the step size which is the amount to increment/decrement. */ step?: number; /** Whether the clock should appear in 12-hour or 24-hour format. */ timeFormat?: TimeFormat; /** Indicates the upper bound. */ upperBound?: number; } /** * The `SectionFormat` to use when no value is specified. * @product This is intended for internal use only within VertiGIS Studio products. */ export declare const DEFAULT_SECTION_FORMAT = "unstyled-section"; /** References a two-dimensional size. */ export interface Size { /** The height. */ height?: number; /** The width. */ width?: number; } /** * Defines a form. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface Form { /** Indicates the defaults for the form. */ defaults?: { container?: ContainerRef; }; /** Indicates the elements for the form. */ elements: { [name: string]: Element; }; } /** * Defines any element used in a form. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface Element { /** * An accessible description to be used by assistive technologies such as screen readers. */ accessibleDescription?: string; /** * True if this element should activate on the next render, false otherwise. * The meaning of "activate" can vary from element to element. In the case of * GeometryPicker, it means to click the "Add" button. */ autoActivate?: boolean; /** Indicates that the element is checked or not. */ checked?: boolean; /** Indicates that the element is collapsed or not. */ collapsed?: boolean; /** Indicates the current item. */ current?: string; /** Indicates the type name of the custom implementation (used by Custom form elements). */ customType?: string; /** Indicates if the element is a default. */ default?: boolean; /** Indicates the delay in milliseconds before acting on an edit (used by AutoComplete). */ delay?: number; /** Indicates what element to react to when populating. */ dependsOn?: string | boolean; /** Indicates the description for the element. */ description?: Text; /** Indicates that the element is enabled or not. */ enabled?: boolean; /** Indicates the error for the item. */ error?: Text; /** Indicates a comma-separated list of file extensions and MIME types that you want to accept. */ fileTypes?: string; /** Indicates the format of the value. */ format?: FormatRef; /** Indicates whether the element is hoisted or not. */ hoisted?: boolean; /** * The order of this element in a single-dimensional column. * @deprecated Use rowNumber and rowIndex instead. */ index?: number; /** Indicates the item label for items which are opaquely constructed such as geometries in the Geometry Picker. */ itemLabel?: Text | Text[]; /** Indicates the items. */ items?: Record; /** Indicates the label for the element. */ label?: Text; /** Indicates the locally unique identifier for application specific use. */ luid?: string; /** * True if this element should support manual user entry, false otherwise (used by Scanner). */ manualEntry?: boolean; /** Indicates the maximum number of characters allows in the input field */ maxLength?: number; /** Indicates the minimum number of characters required for searches (used by AutoComplete). */ minLength?: number; /** Indicates how the form element's items should be laid out. */ orientation?: Orientation; /** Indicates that the element is in overlay mode. */ overlay?: boolean; /** * Indicates if the current value should be retained when the element is refreshed. * This is used in conjunction with dependsOn when options in an element are valid * for more than one option in the element that it depends upon. * This does not just mean the items have the same value, but they have the same meaning. * Default is false. */ persistValueOnRefresh?: boolean; /** Indicates the prompt for the element. */ prompt?: Text; /** Indicates if the element is read only. */ readOnly?: boolean; /** Instructs any validation that the element is required. */ require?: boolean; /** * The position of this element within its row. The lowest rowIndex appears first in the row, the highest last. */ rowIndex?: number; /** * The row that this element belongs to. Row numbers increase downwards. */ rowNumber?: number; /** Indicates whether to support barcode scanning, qrcode scanning or both (used by Scanner). If undefined (default) allow both. */ scanType?: "barcode" | "qrcode" | "both"; /** Indicates the enclosing section. */ section?: SectionRef; /** Indicates if the user can select one item, several items or no items. */ selectionMode?: "single" | "multiple" | "none"; /** Indicates if the items can be filtered by the user. */ showFilter?: boolean; /** Indicates if the minimum/maximum labels should be displayed by the user (used by NumberRangeSlider) */ showMinMaxLabels?: boolean; /** Indicates if ticks should be displayed along the axis (used by NumberRangeSlider). */ showTickMarks?: boolean; /** Indicates the element's size, which could be a one-dimensional number, a two-dimensional object or the name of a size. */ size?: number | Size | FormElementSize; /** The source of the thing to be enhanced by the element. For example, the Sketch element enhances an image. */ source?: string | File; /** * Indicates the current state. */ state?: object; /** Indicates the style name to be used. */ styleName?: string; /** Indicates the title for the element. */ title?: Text; /** Indicates if the element's title should appear above or beside its content. */ titleLocation?: TitleLocation; /** Indicates the tooltip for the element. */ tooltip?: Text; /** Indicates the type of the element. */ type?: string; /** Indicates if the element triggers validation when submitting. */ validates?: boolean; /** Indicates the current value. */ value?: Value; /** Indicates whether the element is visible or not. */ visible?: boolean; /** Indicates how the control wraps text. */ wrap?: "hard" | "soft" | "off"; } /** The style of border on an item. */ export type BorderStyle = "rounded" | "square"; /** The level of emphasis on an item. */ export type Emphasis = "low" | "medium" | "high"; /** The position of an item's icon relative to the text. */ export type IconPosition = "above" | "below" | "before" | "after"; /** The size of an item. */ export type ItemSize = "small" | "medium" | "large"; /** Details of the appearance of an item. */ export interface ItemAppearance { /** The background color of the item. */ backgroundColor?: string; /** The style of the button. */ borderStyle?: BorderStyle; /** The emphasis of the button. This affects border and colours. */ emphasis?: Emphasis | "custom"; /** The foreground color of the item. */ foregroundColor?: string; /** The name of the icon to be shown on this item. */ icon?: string; /** Where the icon should be shown on this item, if {@link icon} is set. Default is "before". */ iconPosition?: IconPosition; /** Set whether the item should show a border. */ showBorder?: boolean; /** The size of the button. */ size?: ItemSize; } /** * Defines an ad hoc item. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface Item { /** Settings controlling the appearance of the item. */ appearance?: ItemAppearance; /** Indicates the checked state for the item. */ checked?: boolean; /** Indicates if the item is a default. */ default?: boolean; /** Indicates the enabled state for the item. */ enabled?: boolean; /** Indicates the placement of the item. */ index?: number; /** Indicates the label for the item. */ label?: Text; /** Indicates the style name to be used. */ styleName?: string; /** Indicates the tooltip for the element. */ tooltip?: Text; /** Indicates if the element triggers validation when submitting. */ validates?: boolean; /** Indicates the value for the item. */ value?: Value; /** Indicates the visible state for the item. */ visible?: boolean; } /** @product This is intended for internal use only within VertiGIS Studio products. */ export interface Event { /** Indicates the argument for the event. */ argument?: Value | ExternalEvent; /** Indicates the cancellation token fro the event. */ cancellationToken?: PromiseLike; /** Indicates the item of the element raising the event. */ item?: string; /** Indicates the name of the element raising the event. */ name?: string; /** Indicates the routing key of the event. */ routingKey?: string; /** Indicates the type of the event. */ type?: EventType; /** Indicates the value associated with the element or item. */ value?: Value; } /** Allows tracking the current state of the AutoComplete element between renders. */ export interface AutoCompleteState { /** The next action to be performed while pre-selecting a value. */ nextAction: PreSelectionAction; /** True if the `select` element (the list of suggestions) is disabled, false otherwise. */ selectDisabled: boolean; /** The key of the currently selected item in the list of suggestions. */ selectValue: string; } /** @product This is intended for internal use only within VertiGIS Studio products. */ export interface GeometryState { /** Indicates the checked state. */ checked?: boolean; /** Indicates the content. */ content?: object; /** Indicates the application specific context. */ context?: object; /** Indicates the focused state. */ focused?: boolean; /** Indicates the pending state. */ pending?: boolean; } /** @product This is intended for internal use only within VertiGIS Studio products. */ export interface ItemPickerState { /** The geometry for each item in the picker. */ items: GeometryState[]; /** Mapping information to find the index of an item's state in `items` by its key. */ keyToIndex: { [key: string]: number; }; } /** * A set of actions that can be performed as part of pre-selecting an item. */ export declare enum PreSelectionAction { /** * No action is to be performed relating to pre-selection. */ None = 0, /** * Suggestions need to be retrieved. */ RetrieveSuggestions = 1, /** * The first item needs to be selected. This assumes the suggestions have already been retrieved. */ SelectFirstItem = 2 } export type ElementTuple = [string, Element];