UNPKG

@arcgis/map-components

Version:
482 lines (481 loc) 22.7 kB
/// <reference path="../../index.d.ts" /> import type Graphic from "@arcgis/core/Graphic.js"; import type CreateFeaturesWorkflow from "@arcgis/core/widgets/Editor/CreateFeaturesWorkflow.js"; import type UpdateWorkflow from "@arcgis/core/widgets/Editor/UpdateWorkflow.js"; import type SketchLabelOptions from "@arcgis/core/views/interactive/sketch/SketchLabelOptions.js"; import type SelectionManager from "@arcgis/core/views/SelectionManager.js"; import type SnappingOptions from "@arcgis/core/views/interactive/snapping/SnappingOptions.js"; import type SketchTooltipOptions from "@arcgis/core/views/interactive/sketch/SketchTooltipOptions.js"; import type { CreateFeaturesCreationInfo, EditorStartMergeFeaturesWorkflowOptions, EditorStartSplitFeatureWorkflowOptions } from "@arcgis/core/widgets/Editor.js"; import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { ArcgisReferenceElement, IconName } from "../types.js"; import type { EditorSketchUpdateEvent, EditorSketchCreateEvent, FeatureInfo, LayerInfo, State, SupportingWidgetDefaults } from "@arcgis/core/widgets/Editor/types.js"; import type { MapViewOrSceneView } from "@arcgis/core/views/MapViewOrSceneView.js"; import type { HeadingLevel } from "@arcgis/core/widgets/support/types.js"; import type { Icon } from "@esri/calcite-components/components/calcite-icon"; /** * The Editor component provides an out-of-the-box editing experience to help streamline editing within a web application. * * @since 4.28 */ export abstract class ArcgisEditor extends LitElement { /** * A property indicating the current active workflow. This is either * [CreateFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/CreateFeaturesWorkflow/) or [UpdateWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateWorkflow/). */ get activeWorkflow(): CreateFeaturesWorkflow | UpdateWorkflow | null | undefined; /** * If true, the component will not be destroyed automatically when it is * disconnected from the document. This is useful when you want to move the * component to a different place on the page, or temporarily hide it. If this * is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/#destroy) method when you are done to * prevent memory leaks. * * @default false */ accessor autoDestroyDisabled: boolean; /** * A reference to the selection manager currently in use by Editor. * * @internal */ get effectiveSelectionManager(): SelectionManager; /** * Indicates the heading level to use for title of the component. By default, the title (i.e. "Editor") is rendered * as a level 4 heading (e.g. `<h4>Editor</h4>`). Depending on the component's placement * in your app, you may need to adjust this heading for proper semantics. This is * important for meeting accessibility standards. * * @default 4 * @since 4.20 * @see [Heading Elements](https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements) * @example * // "Editor" will render as an <h3> * editor.headingLevel = 3; */ accessor headingLevel: HeadingLevel; /** * Indicates whether to hide the "create features" section of the component in the default view. * * @default false * @since 5.0 */ accessor hideCreateFeaturesSection: boolean; /** * Indicates whether to hide the "edit features" section of the component in the default view. * * @default false * @since 5.0 */ accessor hideEditFeaturesSection: boolean; /** * Indicates whether to hide the sketch labels toggle. * * @default false * @since 5.0 */ accessor hideLabelsToggle: boolean; /** * Indicates whether to hide the "Merge features" button in contexts where that command is available. Default value is `true`. * * @default false * @since 5.0 */ accessor hideMergeButton: boolean; /** * Controls whether to use the fully featured selection experience. This includes the * selection toolbar — which provides multiple selection tools — and the * selection list, which allows modifying selections and starting * multi-feature editing workflows, like bulk updates and merges. * * If set to `true`, the component will use a simplified selection experience, * consisting of a single "Select" button. * * @default false * @internal * @sine 5.1 */ accessor hideSelectionToolbar: boolean; /** * Indicates whether to hide the settings menu. This menu contains the snapping and tooltips settings. * * @default false * @since 5.0 */ accessor hideSettingsMenu: boolean; /** * Determines whether the component should display an embedded Sketch component to provide graphical controls for choosing drawing tools. * * @default false * @since 5.0 */ accessor hideSketch: boolean; /** * Indicates whether to hide the `enabledToggle` (Enable snapping). This toggles * the [SnappingOptions#enabled](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/#enabled) property. * > [!WARNING] * > * > **Note** * > * > It is recommended to set `SnappingControls.snappingOptions.enabled = true` if `enabledToggle` is set to `false`. * > This is because `selfEnabledToggle` and `featureEnabledToggle` require snapping globally to be enabled in order to be interactive. Otherwise, these toggles will not be responsive. * * @default false * @since 5.0 */ accessor hideSnappingControlsElementsEnabledToggle: boolean; /** * Indicates whether to hide the `featureEnabledToggle` (Feature to feature). This toggles * the [SnappingOptions#featureEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/#featureEnabled) property. * * @default false * @since 5.0 */ accessor hideSnappingControlsElementsFeatureEnabledToggle: boolean; /** * Indicates whether to hide the `gridControls` (configuration of the snapping grid). * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControls: boolean; /** * Indicates whether to hide the `colorSelection` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsColorSelection: boolean; /** * Indicates whether to hide the `dynamicScaleToggle` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle: boolean; /** * Indicates whether to hide the `lineIntervalInput` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsLineIntervalInput: boolean; /** * Indicates whether to hide the `numericInputs` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsNumericInputs: boolean; /** * Indicates whether to hide the `outOfScaleWarning` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning: boolean; /** * Indicates whether to hide the `placementButtons` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsPlacementButtons: boolean; /** * Indicates whether to hide the `rotateWithMapToggle` within the snapping grid controls. * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle: boolean; /** * Indicates whether to hide the `gridEnabledToggle` (snap-to-grid). * * @default false * @since 5.1 */ accessor hideSnappingControlsElementsGridEnabledToggle: boolean; /** * Indicates whether to hide the [FeatureSnappingLayerSource](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/FeatureSnappingLayerSource/) layerList. The layerlist provides the available layer sources supported for snapping. * * @default false * @since 5.0 */ accessor hideSnappingControlsElementsLayerList: boolean; /** * Indicates whether to hide the `selfEnabledToggle` (Geometry guides). This toggles * the [SnappingOptions#selfEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/#selfEnabled) property. * * @default false * @since 5.0 */ accessor hideSnappingControlsElementsSelfEnabledToggle: boolean; /** * Indicates whether to hide the "Split" button in contexts where that command is available. Default value is `true`. * * @default false * @since 5.0 */ accessor hideSplitButton: boolean; /** * Indicates whether to hide the tooltips toggle. Default value is `true`. * * @default false * @since 5.0 */ accessor hideTooltipsToggle: boolean; /** * Indicates whether to hide undo/redo buttons in the embedded Sketch toolbar. Default value is `true`. * * @default false * @since 5.0 */ accessor hideUndoRedoButtons: boolean; /** * Indicates whether to hide the "Zoom to" button when creating and editing features. Default value is `true`. * * @default false * @since 5.0 */ accessor hideZoomToButton: boolean; /** * Icon which represents the component. * Typically used when the component is controlled by another component (e.g. by the Expand component). * * @default "pencil" * @since 4.27 * @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/) */ get icon(): Icon["icon"]; set icon(value: IconName); /** * The component's default label. * * @since 4.11 */ accessor label: string; /** * Options to configure the sketch labels shown next to each segment of the geometry being created or updated. * * > [!WARNING] * > * > **Known Limitation** * > * > Sketch labels are currently only supported when working with a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * * @since 4.24 */ accessor labelOptions: SketchLabelOptions; /** * An array of editing configurations for individual layers. It is possible to iterate through the map's [Map#editableLayers](https://developers.arcgis.com/javascript/latest/references/core/Map/#editableLayers) and configure these individual layers as needed. * * If you have an editable feature layer but do not want * the end user to do any type of editing, you can limit this by * setting the `enabled` property to `false`. * * @see [Sample - Editor widget with configurations](https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-configurable/) * @see [Map#editableLayers](https://developers.arcgis.com/javascript/latest/references/core/Map/#editableLayers) * @example * const editor = new Editor({ * view: view, * layerInfos: [{ * layer: featureLayer, // pass in the feature layer, * formTemplate: { // autocastable to FormTemplate * elements: [ * { // autocastable to FieldElement * type: "field", * fieldName: "fulladdr", * label: "Full Address" * } * ] * }, * enabled: true, // Default is true, set to false to disable editing functionality. * addEnabled: true, // Default is true, set to false to disable the ability to add a new feature. * updateEnabled: false, // Default is true, set to false to disable the ability to edit an existing feature. * deleteEnabled: false, // Default is true, set to false to disable the ability to delete features. * attributeUpdatesEnabled: true, // Default is true, set to false to disable the ability to edit attributes in the update workflow. * geometryUpdatesEnabled: true, // Default is true, set to false to disable the ability to edit feature geometries in the update workflow. * attachmentsOnCreateEnabled: true, //Default is true, set to false to disable the ability to work with attachments while creating features. * attachmentsOnUpdateEnabled: true //Default is true, set to false to disable the ability to work with attachments while updating/deleting features. * }] * }); */ accessor layerInfos: Array<LayerInfo> | null | undefined; /** * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene. * * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component) */ accessor referenceElement: ArcgisReferenceElement | string | undefined; /** * Use this property to supply a custom [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) that overrides the default selection manager. * This is useful when applications want to share selection sets between components, without relying on the view's selection manager. This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/#syncViewSelection) is `true`. * * @since 5.0 * @beta */ accessor selectionManager: SelectionManager | null | undefined; /** * Indicates whether to display the header. Default is `false`. * * @default false * @since 5.0 */ accessor showSnappingControlsElementsHeader: boolean; /** * The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/) for editing. Supports self snapping and feature snapping. Starting with version 4.23, the [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/) UI is automatically integrated into the Editor component. * Modify the `snappingOptions` if modifications are needed from what is provided in the default UI. * * @since 4.19 * @see [Sample - Editor widget with configurations](https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-configurable/) * @example * // Creates the Editor with SnappingOptions with no snapping UI * const editor = new Editor({ * view: view, * snappingOptions: { // autocasts to SnappingOptions() * enabled: true, * featureSources: [{layer: streetsLayer}] // autocasts to FeatureSnappingLayerSource() * } * }); * * // Add the component to the view component * <arcgis-map> * <arcgis-editor slot="top-right"></arcgis-editor> * </arcgis-map> */ accessor snappingOptions: SnappingOptions; /** The current state of the component. */ get state(): State; /** * This property allows customization of supporting Editor components and their default behavior. * These components include [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/), [FeatureTemplates](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTemplates/), and the * [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/). * * > [!WARNING] * > * > This property is useful for basic overrides of the default components. There may be some limitations * > to what the Editor can do with these overridden properties. For example, the Editor will disable the `multipleSelectionEnabled` property in [Sketch#defaultUpdateOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#defaultUpdateOptions) * > no matter what is set within this property. * * @see [Sample - Editor component with configurations](https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-configurable/) * @see [Sample - Editing with calculated field expressions](https://developers.arcgis.com/javascript/latest/sample-code/widgets-featureform-async/) */ accessor supportingWidgetDefaults: SupportingWidgetDefaults | null | undefined; /** * Controls whether the editor should sync with the view's selection manager. * This does not include selection sources, which must be configured independently * on the view's selection manager. * * @default false * @since 5.0 * @beta */ accessor syncViewSelection: boolean; /** * Options to configure the tooltip shown next to the cursor when creating or updating graphics. * * @since 4.24 */ accessor tooltipOptions: SketchTooltipOptions; /** * Starting at version 5.0, `arcgis-editor` is transitioning to a next generation geometry * creation experience. This new experience provides advanced curve creation tools * and allows multiple tools to be used in combination to define a single geometry. * * As of 5.0, this experience is only available in 2D (e.g. [`arcgis-map`](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map)). * * This property is available to allow 2D applications to temporarily * opt out of this experience. * * > [!CAUTION] * > * > This option will be removed in an upcoming release. * * @deprecated * @default false * @since 5.0 */ accessor useLegacyCreateTools: boolean; /** * The view associated with the component. * > **Note:** The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this `view` property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-editor component will be associated with a map or scene component rather than using the `view` property. */ accessor view: MapViewOrSceneView | null | undefined; /** * Cancels any active selection operation. * * @since 5.0 */ cancelSelectionTool(): void; cancelWorkflow(): Promise<void>; deleteFeatureFromWorkflow(): Promise<void>; /** Permanently destroy the component. */ destroy(): Promise<void>; /** @param info */ startCreateFeaturesWorkflowAtFeatureCreation(info: CreateFeaturesCreationInfo): Promise<void>; startCreateFeaturesWorkflowAtFeatureTypeSelection(): Promise<void>; /** * Starts a [MergeFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/MergeFeaturesWorkflow/) using * the provided features. All features must belong to the same layer. * * @param features - The features to be merged. These can be supplied * either as an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) instances or as a single * [FeatureInfo](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/types/#FeatureInfo) object specifying a layer * and the object IDs of the features. * @param options - Options for the merge features workflow. * @returns Resolves once the workflow has been initialized and is active. * @since 5.0 */ startMergeFeaturesWorkflow(features: FeatureInfo | Graphic[], options: EditorStartMergeFeaturesWorkflowOptions): Promise<void>; /** * Starts a [SplitFeatureWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/SplitFeatureWorkflow/) using the provided feature. * * @param feature - The feature to be split. * @param options - Options for the split feature workflow. * @returns Resolves once the workflow has been initialized and is active. * @since 5.0 */ startSplitFeatureWorkflow(feature: Graphic, options: EditorStartSplitFeatureWorkflowOptions): Promise<void>; /** * Starts an [UpdateFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateFeaturesWorkflow/) using * the provided features. * * @param features - The features to be updated. These can be supplied * either as an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) instances or as a single * [FeatureInfo](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/types/#FeatureInfo) object specifying a layer * and the object IDs of the features. * @returns Resolves once the workflow has been initialized and is active. * @since 5.0 */ startUpdateFeaturesWorkflow(features: FeatureInfo | Graphic[]): Promise<void>; /** @param feature */ startUpdateWorkflowAtFeatureEdit(feature: Graphic): Promise<void>; startUpdateWorkflowAtFeatureSelection(): Promise<void>; /** @param candidates */ startUpdateWorkflowAtMultipleFeatureSelection(candidates: Graphic[]): Promise<void>; "@setterTypes": { icon?: IconName; }; /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */ readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "activeWorkflow" | "state"; }>; /** Emitted when the component associated with a map or scene view is ready to be interacted with. */ readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>; /** * Fires when a user starts drawing a feature, is actively drawing a feature, and completes drawing a feature. * * @since 4.34 */ readonly arcgisSketchCreate: import("@arcgis/lumina").TargetedEvent<this, EditorSketchCreateEvent>; /** * Fires when a user starts updating a feature's geometry, is actively updating a feature's geometry, and completes updating a feature's geometry. * * @since 4.34 */ readonly arcgisSketchUpdate: import("@arcgis/lumina").TargetedEvent<this, EditorSketchUpdateEvent>; readonly "@eventTypes": { arcgisPropertyChange: ArcgisEditor["arcgisPropertyChange"]["detail"]; arcgisReady: ArcgisEditor["arcgisReady"]["detail"]; arcgisSketchCreate: ArcgisEditor["arcgisSketchCreate"]["detail"]; arcgisSketchUpdate: ArcgisEditor["arcgisSketchUpdate"]["detail"]; }; }