@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
130 lines (128 loc) • 5.79 kB
TypeScript
import type Element from "./Element.js";
import type { ElementProperties } from "./Element.js";
import type { AttachmentInputUnion } from "./inputs/attachments/types.js";
import type { VideoInputProperties } from "./inputs/attachments/VideoInput.js";
import type { SignatureInputProperties } from "./inputs/attachments/SignatureInput.js";
import type { ImageInputProperties } from "./inputs/attachments/ImageInput.js";
import type { DocumentInputProperties } from "./inputs/attachments/DocumentInput.js";
import type { AudioInputProperties } from "./inputs/attachments/AudioInput.js";
import type { AttachmentInputProperties } from "./inputs/attachments/AttachmentInput.js";
/** @internal */
export interface AttachmentElementProperties extends ElementProperties, Partial<Pick<AttachmentElement, "allowUserRename" | "attachmentKeyword" | "displayFilename" | "editableExpression" | "filenameExpression" | "maxAttachmentCount" | "minAttachmentCount" | "useOriginalFilename">> {
/**
* The input user interface to use for the attachment.
*
* @internal
*/
input?: ((AttachmentInputProperties & { type: "attachment" }) | (AudioInputProperties & { type: "audio" }) | (DocumentInputProperties & { type: "document" }) | (ImageInputProperties & { type: "image" }) | (SignatureInputProperties & { type: "signature" }) | (VideoInputProperties & { type: "video" })) | null;
}
/**
* An `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.
*
* > [!CAUTION]
* >
* > This class is not yet fully supported within the SDK and is not intended for use in development. Support will be added in an upcoming release.
*
* @internal
* @since 4.31
* @see [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/)
* @see [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/)
* @example
* // Create the attachment element
* const attachmentElement = new AttachmentElement({
* label: "Tree images",
* input: { // autocastable to ImageInput
* type: "image",
* maxFileSize: 800,
* },
* attachmentKeyword: "treeKeyword"
* displayFilename: true,
* minAttachmentCount: 1,
* maxAttachmentCount: 5,
* });
*
*
* // Next pass in element to the FormTemplate
* const formTemplate = new FormTemplate({
* title: "Tree inspection",
* description: "Attach tree info",
* elements: [attachmentElement] // Add element to the template
* });
*/
export default class AttachmentElement extends Element {
/** @internal */
constructor(properties?: AttachmentElementProperties);
/**
* Determines whether the user renaming an attachment is allowed.
*
* @default true
* @internal
*/
accessor allowUserRename: boolean | null | undefined;
/**
* A string to identify the attachment(s). When a file is attached using the form, this property is used to set the value of the keywords field for the attachment. When a form is displaying existing attachments, this property is used to query attachments using an exact match on the keywords field.
*
* @internal
*/
accessor attachmentKeyword: string | null | undefined;
/**
* Determines whether the file name should be displayed. Default is `false`.
*
* @default false
* @internal
*/
accessor displayFilename: boolean | null | undefined;
/**
* A reference to an Arcade expression that returns a boolean value. When this expression evaluates to `true`, the element is editable. When the expression evaluates to `false` the element is not editable.
*
* @internal
* @see [ExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/form/ExpressionInfo/)
*/
accessor editableExpression: string | null | undefined;
/**
* Determines the name of a new attachment. If not specified, a unique name will be generated using the `attachmentKeyword` and the current timestamp when attachment is added.
*
* @default 'StandardizeFilename(`${$formElement.attachmentKeyword}_${Text(Now(), "YMMDDHHmmss")}`)'
* @internal
*/
accessor filenameExpression: string;
/**
* The input user interface to use for the attachment.
*
* @internal
*/
get input(): AttachmentInputUnion | null | undefined;
set input(value: ((AttachmentInputProperties & { type: "attachment" }) | (AudioInputProperties & { type: "audio" }) | (DocumentInputProperties & { type: "document" }) | (ImageInputProperties & { type: "image" }) | (SignatureInputProperties & { type: "signature" }) | (VideoInputProperties & { type: "video" })) | null | undefined);
/**
* Defines the maximum number of attachments allowed for this element. If not specified, there is no maximum number required.
*
* @internal
*/
accessor maxAttachmentCount: number | null | undefined;
/**
* Defines the minimum number of attachments required for this element. If not specified, there is no minimum number required.
*
* @internal
*/
accessor minAttachmentCount: number | null | undefined;
/**
* The type of the [Element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/Element/).
*
* @internal
*/
get type(): "attachment";
/**
* Determines whether the uploaded attachment's file name is preserved. If `false`, the name is updated based on `filenameExpression`. Default is `true`.
*
* @default true
* @internal
*/
accessor useOriginalFilename: boolean | null | undefined;
/**
* Creates a deep clone of the AttachmentElement class.
*
* @returns A deep clone of the AttachmentElement instance.
* @internal
*/
clone(): AttachmentElement;
}