@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
672 lines (671 loc) • 21.4 kB
TypeScript
import type Graphic from "@arcgis/core/Graphic";
import type Layer from "@arcgis/core/layers/Layer";
import type Sublayer from "@arcgis/core/layers/support/Sublayer";
import type { SymbolUnion } from "@arcgis/core/unionTypes.js";
import type { Attachment } from "@vertigis/arcgis-extensions/data/Attachment";
import type { Feature } from "@vertigis/arcgis-extensions/data/Feature";
import type { FeatureSettingsProperties } from "@vertigis/arcgis-extensions/data/FeatureSettings";
import type { FeatureSource } from "@vertigis/arcgis-extensions/data/FeatureSource";
import type { FeatureStream } from "@vertigis/arcgis-extensions/data/FeatureStream.js";
import type { SchemaProperties } from "@vertigis/arcgis-extensions/data/Schema";
import type { FromCsvOptions, FromShapefileOptions, FromXLSXOptions, ToCsvOptions, ToShapefileOptions, ToXLSXOptions, UploadDataOptions } from "@vertigis/arcgis-extensions/data/convert";
import type { QueryOptions } from "@vertigis/arcgis-extensions/tasks/query/QueryOptions";
import type { CardSize, ViewMode } from "../../app-config/web/ResultsModelProperties.js";
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { Event } from "../Event.js";
import { EventRegistry } from "../EventRegistry.js";
import type { Operation } from "../Operation.js";
import { OperationRegistry } from "../OperationRegistry.js";
import type { Blob, Features, FeaturesLike, File, GraphicsLike, HasFeatures, HasFiles, Layers, MapsLike, ModelRef } from "../common.js";
import type { VisualElement } from "../mobile.js";
/**
* Well known Results Set Ids.
*/
export declare enum KnownResultSetIds {
STARRED = "vgs-starred"
}
/**
* Args for `results.from-files`.
*/
export type FromConverterArgs = FromCsvConversionArgs | FromShapefileConversionArgs | FromXLSXConversionArgs;
/**
* Arguments for various commands that target a result set of features.
*/
export interface TargetsResultsSetArgs {
/**
* If specified the results will be updated in the named results set only.
* Results sets with the prefix 'vgs' are reserved for system use and should
* not be used unless you are intentionally targeting a well known results
* set such as the 'vgs-starred' results. Web only.
*
* @webOnly
*/
resultsSetId?: KnownResultSetIds | string;
}
/**
* Arguments for various commands that affect a result component's features.
*/
export interface UpdateResultsFeaturesArgs extends TargetsResultsSetArgs, HasFeatures {
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Arguments for the "results.convert-to-csv" operation.
*/
export interface ToCsvConversionArgs extends ToCsvOptions {
/**
* The feature(s) to convert.
*/
features: Features;
}
/**
* Arguments for the "results.upload-data-args-to-feature" operation.
*/
export interface UploadDataArgs extends UploadDataOptions {
/**
* A title for this dataset.
*/
title?: string;
}
/**
* Arguments for the "results.from-csv" operation.
*/
export interface FromCsvConversionArgs extends FromCsvOptions, HasFiles {
}
/**
* Arguments for the "results.convert-to-xlsx" operation.
*/
export interface ToXLSXConversionArgs extends ToXLSXOptions {
/**
* The feature(s) to convert.
*/
features: Features;
}
/**
* Arguments for the "results.from-xlsx" operation.
*/
export interface FromXLSXConversionArgs extends FromXLSXOptions, HasFiles {
}
/**
* Arguments for the "results.convert-to-shapefile" operation.
*/
export interface ToShapefileConversionArgs extends ToShapefileOptions {
/**
* The feature(s) to convert.
*/
features: Features;
}
/**
* Arguments for the "results.from-shapefile" operation.
*/
export interface FromShapefileConversionArgs extends FromShapefileOptions, HasFiles {
}
/**
* Arguments for the "results.convert-to-layers" operation.
*/
export interface LayerConversionArgs {
/**
* Optionally a symbol to be used for point geometries.
*/
pointSymbol?: SymbolUnion;
/**
* Optionally a symbol to be used for multipoint geometries.
*/
multipointSymbol?: SymbolUnion;
/**
* Optionally a symbol to be used for polyline geometries.
*/
polylineSymbol?: SymbolUnion;
/**
* Optionally a symbol to be used for polygon geometries.
*/
polygonSymbol?: SymbolUnion;
/**
* Optionally a symbol to be used for mesh geometries.
*/
meshSymbol?: SymbolUnion;
/**
* The feature(s) to convert.
*/
features: Features;
}
/**
* Result of various operations that convert features into a downloadable file.
*/
export interface ConversionResult {
/**
* The result of the conversion in the specified form.
*/
result: Blob;
/**
* A file name representation for the conversion.
*/
name: string;
}
/**
* Arguments for the "results.from-graphics" operation.
*/
export interface FromGraphicsArgs {
/**
* A selection of graphics to be converted to features.
*/
graphics: GraphicsLike;
/**
* The layer the graphics originate from, or the ID of that layer. Used as
* the source for created features.
*/
layer?: Layer | string;
/**
* The sublayer the graphics originate from, or the ID of that sublayer.
* Used as the source for created features. Will not be used unless layer
* parameter is also provided.
*/
sublayer?: Sublayer | number;
/**
* The maps to search for the given layer.
*/
maps?: MapsLike;
/**
* FeatureSettings to use for feature metadata if the layer is not provided
* or can't be found.
*/
featureSettings?: FeatureSettingsProperties;
/**
* The schema to be associated with the returned features. This property is
* only necessary when no layer nor sublayer are present.
*/
schema?: SchemaProperties;
/**
* The feature source title to use if no layer or sublayer is associated
* with the features.
*/
title?: string;
/**
* The feature source ID to use if the results are associated with a
* workflow.
*/
workflowItemId?: string;
/**
* Whether to fetch attachments for the returned features. Defaults to
* false. Mobile only.
*
* @mobileOnly
*/
fetchAttachments?: boolean;
/**
* Whether to fetch related features for the returned features. Defaults to
* false. Mobile only.
*
* @mobileOnly
*/
fetchRelatedFeatures?: boolean;
}
/**
* Arguments for the "results.open-attachment" command.
*/
export interface OpenAttachmentArgs {
/**
* The index of the photo to start at.
*/
startIndex: number;
/**
* The attachment to open.
*/
attachments: Attachment[];
/**
* The sender UI element to use as an anchor point for animation when
* opening the attachment.
*/
sender: VisualElement;
}
/**
* Arguments for the "results.filter" operation.
*/
export interface FilterResultsArgs {
/**
* Features or Graphics to filter.
*/
features: FeaturesLike | GraphicsLike;
/**
* An SQL 'where' clause used to filter down a set of results.
*/
where?: string;
/**
* The source of the Results. This is only necessary if Graphics are passed
* into the filter operation.
*/
source?: FeatureSource;
/**
* Additional query options with which to filter the results.
*/
options?: QueryOptions;
}
/**
* Arguments for the "results.set-list-view-mode" command.
*/
export interface SetListViewModeArgs {
/**
* The view mode to activate on the results list component. Web only.
*
* @webOnly
*/
viewMode: ViewMode;
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Arguments for the "results.activate-group" command.
*/
export interface ActivateResultGroupArgs {
/**
* The layer to activate the corresponding group for in the results
* component. If more than one layer is included, only the first item in the
* array will be used. One of `sources` or `layers` is required. If both are
* specified, `sources` will take precedence. Web only.
*
* @webOnly
*/
layers?: Layers;
/**
* An array of sources to activate the corresponding group for in the
* results component. Only the first item in the array will be used. One of
* `sources` or `layers` is required. If both are specified, `sources` will
* take precedence. Web only.
*
* @webOnly
*/
sources?: FeatureSource[];
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Arguments for the "results.set-list-card-size" command.
*/
export interface SetListCardSizeArgs {
/**
* The card size to set on the results list component. Web only.
*
* @webOnly
*/
cardSize: CardSize;
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Arguments for various commands that manipulate the current set of shown
* results.
*/
export type ShowResultsArgs = Features | (UpdateResultsFeaturesArgs & {
/**
* Whether to activate the component showing the results of the
* operation. False by default.
*
* @mobileOnly
*/
activate?: boolean;
});
/**
* Arguments for the "results.set-display-components" command.
*/
export interface SetDisplayComponentArgs {
/**
* Sets the selector, using CSS selector syntax, which queries for results
* components in the app layout XML, such as the Results List or Results
* Table components. The selector is used to determine which components will
* be activated when displaying results using `results.display`.
*/
selector: string;
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Arguments for the "results.set-active-feature" command.
*/
export interface SetActiveFeatureArgs {
/**
* The feature to set as active in the results component, if it exists. If
* multiple features are specified, only the first will be set as active.
*/
features: Features;
/**
* The result component to update, referenced by results model or its ID.
* Web only.
*
* @webOnly
*/
results?: ModelRef;
}
/**
* Event args for attachment events.
*/
export interface AttachmentEventArgs {
/**
* The feature to which the attachment belongs.
*/
feature: Feature;
/**
* The attachment this event relates to.
*/
attachment: Attachment;
}
/**
* Event args for feature detail events.
*/
export interface FeatureDetailsEvent {
/**
* The feature.
*/
feature: Feature;
}
export declare class ResultsCommands extends CommandRegistry {
protected readonly _prefix = "results";
/**
* Activates the current set of results component(s), which is set via
* results.set-display-components. Web only.
*
* @webOnly
*/
get activateDisplayComponents(): Command<void>;
/**
* Activates the group with the specified layerId in the results component.
* Web only.
*
* @webOnly
*/
get activateGroup(): Command<ActivateResultGroupArgs>;
/**
* Presents features to the user within any components that can display
* features, such as a feature list, feature table, or feature details
* component. The argument is the features to display, or an object
* specifying both features and the target results component to update (Web
* only).
*/
get display(): Command<Features | UpdateResultsFeaturesArgs>;
/**
* Sets the active feature for a particular results component specified by
* the `results` arg. Or, if the `results` arg is not defined, sets the
* active feature for all results components. Note that each results
* component can only have one active feature at a time, but the active
* feature can differ between different results components. Web only.
*
* @webOnly
*/
get setActiveFeature(): Command<SetActiveFeatureArgs>;
/**
* Sets the selector, using CSS selector syntax, which queries for results
* components in the app layout XML, such as the Results List or Results
* Table components. The selector is used to determine which components will
* be activated when displaying results using `results.display`. All other
* components that do not match the selector are deactivated after running
* this command. Web only.
*
* @webOnly
*/
get setDisplayComponents(): Command<string | SetDisplayComponentArgs>;
/**
* Presents feature details to the user within the feature-details
* component. The argument is the feature(s) to display, or an object
* specifying both features and the target results component to update (Web
* only).
*/
get displayDetails(): Command<Features | UpdateResultsFeaturesArgs>;
/**
* Presents a feature summary to the user within the feature-summary
* component. The argument is the feature(s) to display, or an object
* specifying both features and the target results component to update. Web
* only.
*
* @webOnly
*/
get displaySummary(): Command<Features | UpdateResultsFeaturesArgs>;
/**
* Presents new feature details to the user within the feature-details
* component. If the feature-details component is contained within a panel,
* a 'back' button will be provided to navigate to the previous content;
* otherwise, the content of the feature-details component will be
* replaced.
*/
get displayNewDetails(): Command<Features | UpdateResultsFeaturesArgs>;
/**
* Adds features to a currently shown set of features.
*/
get add(): Command<ShowResultsArgs>;
/**
* Removes features from the existing results that are not present in the
* given list of features.
*/
get intersect(): Command<ShowResultsArgs>;
/**
* Removes features from a currently shown set of features.
*/
get remove(): Command<ShowResultsArgs>;
/**
* Replaces feature(s) in the shown set of features. If a feature is not
* contained in the current set it is ignored. Features are uniquely
* identified by ID and not by object quality. Web only.
*
* @webOnly
*/
get replace(): Command<ShowResultsArgs>;
/**
* Clear features from results list, results table, and results details. If
* a component model or model ID is given, then only the specified component
* is cleared (Web only).
*/
get clear(): Command<ModelRef | TargetsResultsSetArgs | void>;
/**
* Clears the feature details so that no feature data is shown. Mobile only.
*
* @mobileOnly
*/
get clearDetails(): Command;
/**
* Deactivates the feature details component that is displaying the given
* feature. Mobile only.
*
* @mobileOnly
*/
get hideDetails(): Command<Feature[] | Feature>;
/**
* Opens an attachment and displays it. Mobile only.
*
* @mobileOnly
*/
get openAttachment(): Command<OpenAttachmentArgs>;
/**
* Refreshes one or more features in the results list. Mobile only.
*
* @mobileOnly
*/
get refresh(): Command<Features>;
/**
* Sets the view mode for a particular results list component, or globally
* for all results list components. Web only.
*
* @webOnly
*/
get setListViewMode(): Command<ViewMode | SetListViewModeArgs>;
/**
* Sets the card size for a particular results list component, or globally
* for all results list components. Web only.
*
* @webOnly
*/
get setListCardSize(): Command<CardSize | SetListCardSizeArgs>;
}
export declare class ResultsEvents extends EventRegistry {
protected readonly _prefix = "results";
/**
* Raised when results are added or removed to a named results set. Web
* only.
*
* @webOnly
*/
get changed(): Event<TargetsResultsSetArgs>;
/**
* Raised when results are displayed. Mobile only.
*
* @mobileOnly
*/
get displayed(): Event<Features>;
/**
* Raised when a feature attachment has been opened. Mobile only.
*
* @mobileOnly
*/
get attachmentOpened(): Event<AttachmentEventArgs>;
/**
* Raised when feature details are being shown. Mobile only.
*
* @mobileOnly
*/
get detailsShown(): Event<FeatureDetailsEvent>;
/**
* Raised when feature details of a related feature are being shown. Mobile
* only.
*
* @mobileOnly
*/
get relatedDetailsShown(): Event<FeatureDetailsEvent>;
}
export declare class ResultsOperations extends OperationRegistry {
protected readonly _prefix = "results";
/**
* Display a dialog to configure the arguments for the upload layer
* operation. Web only.
*
* @webOnly
*/
get configureUploadData(): Operation<UploadDataArgs[], UploadDataArgs[]>;
/**
* Check if features are contained in the specified results. Web only.
*
* @webOnly
*/
get contains(): Operation<TargetsResultsSetArgs & HasFeatures, boolean[]>;
/**
* Converts the provided Feature(s) to a CSV file grouped by feature source.
* If there are multiple sources the CSV(s) will be bundled in a zip file.
* Web only.
*
* @webOnly
*/
get convertToCsv(): Operation<ToCsvConversionArgs | Features, ConversionResult>;
/**
* Converts the provided Feature(s) to a XLSX file grouped by feature
* source. If there are multiple sources the XLSX(s) will be bundled in a
* zip file. Web only.
*
* @webOnly
*/
get convertToXlsx(): Operation<ToXLSXConversionArgs | Features, ConversionResult>;
/**
* Converts the provided Feature(s) to a Shapefile grouped by feature
* source. If there are multiple sources the Shapefile(s) will be bundled in
* a zip file. Web only.
*
* @webOnly
*/
get convertToShapefile(): Operation<ToShapefileConversionArgs | Features, ConversionResult>;
/**
* Creates layer(s) from the specified features. Web only.
*
* @webOnly
*/
get convertToLayers(): Operation<LayerConversionArgs | Features, Layer[]>;
/**
* Convert the specified csv blob to Features. Web only.
*
* @webOnly
*/
get fromCsv(): Operation<FromCsvConversionArgs | Blob | Blob[], Features>;
/**
* Convert the specified csv, xlsx or shapefile files to Features. Web only.
*
* @webOnly
*/
get fromFiles(): Operation<FromConverterArgs | File[], Features>;
/**
* Returns the current active feature from a specific results component if
* model ID or model is specified, otherwise returns all active features
* from all results components. Note that each results component can only
* have one active feature at a time, but the active feature can differ
* between different results components. Web only.
*
* @webOnly
*/
get getActiveFeatures(): Operation<ModelRef | void, Features | undefined>;
/**
* Convert the specified csv, xlsx or shapefile files to args that can be
* used to create Features. Web only.
*
* @webOnly
*/
get uploadDataFromFiles(): Operation<FromConverterArgs | File[], UploadDataArgs[]>;
/**
* Convert the supplied upload data args to features.
*/
get uploadDataToFeatures(): Operation<UploadDataArgs[], FeatureStream[]>;
/**
* Convert the specified Shapefile blob to Features. Web only.
*
* @webOnly
*/
get fromShapefile(): Operation<FromShapefileConversionArgs | Blob | Blob[], Features>;
/**
* Convert the specified xlsx blob to Features. Web only.
*
* @webOnly
*/
get fromXlsx(): Operation<FromXLSXConversionArgs | Blob | Blob[], Features>;
/**
* Converts provided GraphicsLike to VertiGIS Studio Features using any
* available metadata.
*/
get fromGraphics(): Operation<FromGraphicsArgs, Features>;
/**
* Converts VertiGIS Studio Features to Esri graphics.
*/
get toGraphics(): Operation<Features, Graphic[]>;
/**
* Returns the current set of features from a specific results component if
* a model or model ID is specified, otherwise from all results components.
* Web only.
*
* @webOnly
*/
get getFeatures(): Operation<ModelRef | TargetsResultsSetArgs | void, Features>;
/**
* Filters down a set of results using an SQL 'where' clause and/or an
* intersecting geometry. Web only.
*
* @webOnly
*/
get filter(): Operation<FilterResultsArgs, Features>;
}