UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

91 lines (87 loc) 6.01 kB
import type Graphic from "../../Graphic.js"; import type Accessor from "../../core/Accessor.js"; import type Collection from "../../core/Collection.js"; import type AttachmentsOrderByInfo from "../../popup/support/AttachmentsOrderByInfo.js"; import type AttachmentInfo from "../../rest/query/support/AttachmentInfo.js"; import type { AttachmentsCapabilities } from "./types.js"; import type { GraphicProperties } from "../../Graphic.js"; import type { AttachmentsOrderByInfoProperties } from "../../popup/support/AttachmentsOrderByInfo.js"; export interface AttachmentsViewModelProperties extends Partial<Pick<AttachmentsViewModel, "activeAttachmentInfo" | "attachmentKeywords" | "attachmentTypes" | "capabilities" | "mode">> { /** The graphic for the attachments. */ graphic?: GraphicProperties | null; /** An array of [AttachmentsOrderByInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/support/AttachmentsOrderByInfo/) indicating the display order for the attachments, and whether they should be sorted in ascending `asc` or descending `desc` order. */ orderByFields?: AttachmentsOrderByInfoProperties[] | null; } export type AttachmentsViewModelState = "disabled" | "loading" | "ready"; export type AttachmentsViewModelMode = "add" | "edit" | "view"; /** * Provides the logic for the [Attachments](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attachments/) widget. * * @since 4.15 * @see [Attachments](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attachments/) * @see [Editor](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/) * @see [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) * @see [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) * @see [AttachmentInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/query/support/AttachmentInfo/) * @see [AttachmentsContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/AttachmentsContent/) * @see [ArcGIS REST API - Attachment Infos (Feature Service)](https://developers.arcgis.com/rest/services-reference/attachment-infos-feature-service-.htm) * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern) */ export default class AttachmentsViewModel extends Accessor { constructor(properties?: AttachmentsViewModelProperties); /** * The current [AttachmentInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/query/support/AttachmentInfo/) being edited. * * @see [ArcGIS REST API - Attachment Infos (Feature Service)](https://developers.arcgis.com/rest/services-reference/attachment-infos-feature-service-.htm) */ accessor activeAttachmentInfo: AttachmentInfo | null | undefined; /** * A collection of [AttachmentInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/query/support/AttachmentInfo/) defined on a feature. * * @see [ArcGIS REST API - Attachment Infos (Feature Service)](https://developers.arcgis.com/rest/services-reference/attachment-infos-feature-service-.htm) */ get attachmentInfos(): Collection<AttachmentInfo>; /** An array of strings used to identify attachment(s). When attachments are displayed, this property is used to query attachments using an exact match on the keywords provided. */ accessor attachmentKeywords: string[] | null | undefined; /** An array of strings representing MIME types. When attachments are displayed, this property is used to query attachments based on MIME type. Valid values: application, audio, image, model, text, and video. */ accessor attachmentTypes: ("application" | "audio" | "image" | "model" | "text" | "video")[] | null | undefined; /** * Configures the attachment editing functionality that can be performed by the user. * * @since 4.27 */ accessor capabilities: AttachmentsCapabilities; /** The graphic for the attachments. */ get graphic(): Graphic | null | undefined; set graphic(value: GraphicProperties | null | undefined); /** * The current mode performed by the user. * * @default "view" */ accessor mode: AttachmentsViewModelMode; /** An array of [AttachmentsOrderByInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/support/AttachmentsOrderByInfo/) indicating the display order for the attachments, and whether they should be sorted in ascending `asc` or descending `desc` order. */ get orderByFields(): AttachmentsOrderByInfo[] | null | undefined; set orderByFields(value: AttachmentsOrderByInfoProperties[] | null | undefined); /** * The current state of the widget. * * @default "ready" */ get state(): AttachmentsViewModelState; /** * Defines whether or not the feature supports resizing attachments. This depends on whether the * feature layer's [capabilities.attachment.supportsResize](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#capabilities) is set to `true`. */ get supportsResizeAttachments(): boolean; /** * Queries for the attachments on a feature. Attachments for multiple features can be queried if the layer's * [capabilities.operations.supportsQueryAttachments](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#capabilities) is `true`. * * @returns When resolved, returns the [AttachmentInfo](https://developers.arcgis.com/javascript/latest/references/core/rest/query/support/AttachmentInfo/) * of the queried feature. * @see [FeatureLayer.queryAttachments()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryAttachments) */ getAttachments(): Promise<AttachmentInfo[]>; }