import Graphic from '@arcgis/core/Graphic'; import FeatureLayer from '@arcgis/core/layers/FeatureLayer'; import Editor from '@arcgis/core/widgets/Editor'; import { Action, ActionOptions, ActionItem } from 'map-actions/api'; /** * Properties used to create an {@link Editor}. */ type EditorProperties = __esri.EditorProperties; /** * Extension point to access the editing widget or its configuration. */ interface EditorInterceptor { /** * Change editor widget or add listeners to it. * If undefined is returned, the original widget is used. */ interceptEditor: (editor: Editor) => Editor | undefined; /** * Change editor widgets configuration. * If undefined is returned, the original configuration is used. */ interceptConfig: (editor: EditorProperties) => EditorProperties | undefined; } /** * Used to open the editing widget. */ interface Editing { /** * Create the Editor widget and register it as a service. */ openEditingWidget(): void; /** * Closes the editing widget. */ closeEditingWidget(): void; /** * Starts an update workflow in the Editor widget for the given feature. */ startEditFeature(feature: Graphic, featureLayer: FeatureLayer): Promise; } /** * Provides a `map-actions.Action` to start a feature update workflow using the Editing widget. */ interface StartEditingMapAction extends Action { trigger(options?: StartEditingMapActionOptions): Promise; } /** * Options used in the {@link StartEditingMapAction}. */ interface StartEditingMapActionOptions extends ActionOptions { readonly items?: readonly StartEditingMapActionItem[]; layer: FeatureLayer; } /** * Item for which the {@link StartEditingMapAction} is triggered. */ interface StartEditingMapActionItem extends ActionItem { objectId: number; } export type { Editing, EditorInterceptor, EditorProperties, StartEditingMapAction, StartEditingMapActionItem, StartEditingMapActionOptions };