import type Graphic from "../../../Graphic.js"; import type AttachmentInfo from "../../../rest/query/support/AttachmentInfo.js"; import type EditableInput from "./EditableInput.js"; import type GroupInput from "./GroupInput.js"; import type { AttachmentInputUnion } from "../../../form/elements/inputs/attachments/types.js"; import type { AttributeFormSupportedLayerUnion, PendingAttachmentEdits } from "../types.js"; import type { ArcadeBatchFormCalculationContextInfo } from "../expressions/types.js"; import type { EditableInputProperties } from "./EditableInput.js"; import type { AttachmentEditState } from "./types.js"; import type { AttachmentValidationCriterionKey, AttachmentValidationCriterionState } from "./support/attachmentValidationCriteriaState.js"; /** @since 5.1 */ export interface AttachmentElementInputProperties extends EditableInputProperties, Partial> {} /** * This is a read-only support class that represents an [attachment element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/). * * @since 5.1 * @see [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/) * @see [BatchAttributeFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/) * @see [BatchFormInputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/BatchFormInputs/) */ export default class AttachmentElementInput extends EditableInput { constructor(properties: AttachmentElementInputProperties); /** * Indicates whether all attachments for this input are visible on the default page. * * @since 5.1 */ get allAttachmentsVisibleOnDefaultPage(): boolean; /** Indicates if the input allows users to rename attachments. */ get allowUserRename(): boolean | null | undefined; /** The input's attachment keyword. This is used to filter attachments associated with the active feature. */ get attachmentKeyword(): string | undefined; /** The attachments applicable to this input. */ accessor attachments: AttachmentInfo[]; /** * The attachments visible on the default page before showing the full attachments list action. * * @since 5.1 */ get defaultPageAttachments(): AttachmentInfo[]; /** * The maximum number of attachments displayed on the default page before showing the full attachments list action. * * @default 3 * @since 5.1 */ accessor displayCount: number; /** Indicates if the attachment filename should be displayed. */ get displayFilename(): boolean | null | undefined; /** * The single feature associated with this attachment element. * * @since 5.1 * @see [BatchAttributeFormViewModel.features](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#features) */ get feature(): Graphic | null | undefined; /** The group containing the attachment element input. */ get group(): GroupInput | null; /** The configured attachment input for this element. */ get input(): AttachmentInputUnion | null | undefined; /** * Identifies the single feature layer associated with this attachment element. The layer must support feature editing and field access. * * The following layer types are supported: * - [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) * - [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/) * - [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) (with `featureLayer` property) * - [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/) * - [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/) * - [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/) * * @since 5.1 * @see [BatchAttributeFormViewModel.layers](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#layers) */ get layer(): AttributeFormSupportedLayerUnion | null | undefined; /** The maximum number of attachments allowed. */ get maxAttachmentCount(): number | null | undefined; /** The minimum number of attachments required. */ get minAttachmentCount(): number | null | undefined; /** The type of input. */ get type(): "attachment"; /** Indicates if the original filename should be used when creating attachments. */ get useOriginalFilename(): boolean | null | undefined; /** @internal */ get validationCriterionStates(): ReadonlyMap; /** * @param attachments - Attachments fetched from the service for this input. * @internal */ applyFetchedAttachments(attachments: AttachmentInfo[]): void; /** @internal */ clearAttachmentChanges(): void; /** * @param attachment - Attachment whose staged changes should be cleared. * @internal */ discardStagedEdits(attachment: AttachmentInfo): void; /** * @param attachment - Attachment whose staged update data should be hydrated when needed. * @returns `true` when staged update data was hydrated for the attachment. * @internal */ ensureStagedUpdateData(attachment: AttachmentInfo): Promise; /** * @param attachmentKey - Stable key of the attachment to retrieve. * @internal */ findAttachment(attachmentKey: string): AttachmentInfo | undefined; /** * @param attachment - Attachment whose staged edit state should be resolved. * @returns The current staged edit state for the provided attachment. * @internal */ getAttachmentEditState(attachment: AttachmentInfo): AttachmentEditState; /** * @param attachment - Attachment whose preview URL should be resolved. * @param thumbnailSize - Optional thumbnail width to request for committed service-backed attachments. * @internal */ getAttachmentPreviewUrl(attachment: AttachmentInfo, thumbnailSize?: number): string | null; /** * @param key - The validation criterion key to read. * @internal */ getValidationCriterionState(key: AttachmentValidationCriterionKey): AttachmentValidationCriterionState | null; /** * @param file - File to validate against the configured attachment input types. * @internal */ isFileAllowed(file: Blob | File): boolean; /** * @param attachment - Attachment metadata to check. * @internal */ isStagedAttachmentAddition(attachment: AttachmentInfo): boolean; /** * @param params - Attachment information and content to stage as a new attachment. * @returns The staged attachment metadata. * @internal */ stageAddAttachment(params: { data: Blob | File | string; name: string; contentType?: string; globalId?: string; }): AttachmentInfo; /** * @param files - Files to stage for addition. * @param arcadeContextInfo - Context information used for filename expression evaluation. * @returns The attachments staged for addition. * @internal */ stageAddAttachments(files: (Blob | File)[], arcadeContextInfo: ArcadeBatchFormCalculationContextInfo): Promise; /** * @param attachment - Attachment metadata to stage for deletion. * @internal */ stageDeleteAttachment(attachment: AttachmentInfo): void; /** * @param attachment - Attachment metadata to rename. * @param name - New attachment name. * @internal */ stageRenameAttachment(attachment: AttachmentInfo, name: string): void; /** * @param attachment - Attachment metadata to replace. * @param file - File contents for the replacement attachment. * @param arcadeContextInfo - Context information used for filename expression evaluation. * @internal */ stageReplaceAttachment(attachment: AttachmentInfo, file: Blob | File, arcadeContextInfo: ArcadeBatchFormCalculationContextInfo): Promise; /** @internal */ toSubmitEdits(): PendingAttachmentEdits | null; /** @internal */ waitForPendingAttachmentUpdateData(): Promise; }