require(["esri/form/elements"], (elements) => { /* code goes here */ });
import * as elements from "@arcgis/core/form/elements.js";
esri/form/elements
A convenience module for importing Element classes when developing with TypeScript. For example, rather than importing form elements one at a time like this:
import FieldElement from "esri/form/elements/FieldElement";
import GroupElement from "esri/form/elements/GroupElement";
import RelationshipElement from "esri/form/elements/RelationshipElement";
import TextElement from "esri/form/elements/TextElement";
You can use this module to import them on a single line:
import { FieldElement, GroupElement, RelationshipElement, TextElement } from "esri/form/elements";
This module also allows you to implement type guards on the form elements, making your code smarter.
import { Element } from "esri/form/elements";
function logFormElement(element: Element): void {
if (element.type === "field") {
console.log("Form element type is field");
}
else {
// The compiler knows the content element must be `field | group | relationship`
console.log("The value is not a valid form element.")
}
}
Type Definitions
-
AttachmentElement
AttachmentElement AttachmentElement
-
AttachmentElement
defines how one or more attachments can participate in the form. When present in the form, the user has the ability to upload an attachment specific to the form element.
-
Element
Element FieldElement |GroupElement |RelationshipElement |TextElement |AttachmentElement |UtilityNetworkAssociationsElement
-
Form element types.
-
FieldElement
FieldElement FieldElement
-
FieldElement
defines how a feature layer's field participates in the form.
-
GroupElement
GroupElement GroupElement
-
GroupElement
defines a container that holds a set of form elements that can be expanded, collapsed, or displayed together.
-
RelationshipElement
RelationshipElement RelationshipElement
-
RelationshipElement
defines how a relationship between feature layers and tables participates in the FeatureForm.
-
TextElement
TextElement TextElement
-
TextElement
form element is used to define descriptive text as an element within a layer or FeatureForm FormTemplate and can be used to aid those entering or updating information.
-
UtilityNetworkAssociationsElement
UtilityNetworkAssociationsElement UtilityNetworkAssociationsElement
-
UtilityNetworkAssociationsElement
defines how utility network associations can participate in the form.