@arcgis/map-components
Version:
ArcGIS Map Components
71 lines (70 loc) • 6.18 kB
JavaScript
import { c as s } from "../../chunks/runtime.js";
import { usePropertyChange as o } from "@arcgis/components-controllers";
import { reEmitEvent as t } from "@arcgis/components-controllers/accessor";
import l from "@arcgis/core/layers/GraphicsLayer.js";
import n from "@arcgis/core/widgets/Sketch.js";
import { LitElement as a, createEvent as d, noShadowRoot as h } from "@arcgis/lumina";
import { m as r } from "../../chunks/useWidget.js";
import { css as g } from "@lit/reactive-element/css-tag.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
v4.32.13 */
const p = g` {arcgis-sketch{display:block}}`, c = r(n);
class m extends a {
// #endregion
// #region Lifecycle
constructor() {
super(), this.widget = c(this, { editConstructorProperties: this._editConstructorProperties }), this.viewModel = this.widget.viewModel, this.activeTool = this.widget.activeTool, this.autoDestroyDisabled = !1, this.availableCreateTools = this.widget.availableCreateTools, this.createGraphic = this.widget.createGraphic, this.creationMode = this.widget.creationMode, this.defaultCreateOptions = this.widget.defaultCreateOptions, this.defaultGraphicsLayerDisabled = !1, this.defaultUpdateOptions = this.widget.defaultUpdateOptions, this.hideCreateToolsCircle = this.widget.visibleElements.createTools.circle, this.hideCreateToolsPoint = this.widget.visibleElements.createTools.point, this.hideCreateToolsPolygon = this.widget.visibleElements.createTools.polygon, this.hideCreateToolsPolyline = this.widget.visibleElements.createTools.polyline, this.hideCreateToolsRectangle = this.widget.visibleElements.createTools.rectangle, this.hideDuplicateButton = this.widget.visibleElements.duplicateButton, this.hideDeleteButton = this.widget.visibleElements.deleteButton, this.hideSelectionCountLabel = this.widget.visibleElements.selectionCountLabel, this.hideLabelsToggle = this.widget.visibleElements.labelsToggle, this.hideSelectionToolsLassoSelection = this.widget.visibleElements.selectionTools["lasso-selection"], this.hideSelectionToolsRectangleSelection = this.widget.visibleElements.selectionTools["rectangle-selection"], this.hideSettingsMenu = this.widget.visibleElements.settingsMenu, this.hideSnappingControls = this.widget.visibleElements.snappingControls, this.hideSnappingControlsElementsEnabledToggle = this.widget.visibleElements.snappingControlsElements.enabledToggle, this.hideSnappingControlsElementsFeatureEnabledToggle = this.widget.visibleElements.snappingControlsElements.featureEnabledToggle, this.hideSnappingControlsElementsLayerList = this.widget.visibleElements.snappingControlsElements.layerList, this.hideSnappingControlsElementsSelfEnabledToggle = this.widget.visibleElements.snappingControlsElements.selfEnabledToggle, this.hideTooltipsToggle = this.widget.visibleElements.tooltipsToggle, this.hideUndoRedoMenu = this.widget.visibleElements.undoRedoMenu, this.icon = this.widget.icon, this.label = this.widget.label, this.labelOptions = this.widget.labelOptions, this.layer = this.widget.layer, this.layout = this.widget.layout, this.pointSymbol = this.viewModel.pointSymbol, this.polygonSymbol = this.viewModel.polygonSymbol, this.polylineSymbol = this.viewModel.polylineSymbol, this.position = "bottom-left", this.scale = this.widget.scale, this.toolbarKind = this.widget.toolbarKind, this.showSnappingControlsElementsHeader = this.widget.visibleElements.snappingControlsElements.header, this.snappingOptions = this.widget.snappingOptions, this.state = this.widget.state, this.tooltipOptions = this.widget.tooltipOptions, this.updateGraphics = this.widget.updateGraphics, this.arcgisCreate = t(() => this.widget, "create"), this.arcgisDelete = t(() => this.widget, "delete"), this.arcgisPropertyChange = o()("state"), this.arcgisReady = d(), this.arcgisRedo = t(() => this.widget, "redo"), this.arcgisUndo = t(() => this.widget, "undo"), this.arcgisUpdate = t(() => this.widget, "update"), this.listen("arcgisReady", this._arcgisReadyHandler);
}
static {
this.properties = { activeTool: 3, autoDestroyDisabled: 5, availableCreateTools: 0, createGraphic: 0, creationMode: 1, defaultCreateOptions: 0, defaultGraphicsLayerDisabled: 5, defaultUpdateOptions: 0, hideCreateToolsCircle: 5, hideCreateToolsPoint: 5, hideCreateToolsPolygon: 5, hideCreateToolsPolyline: 5, hideCreateToolsRectangle: 5, hideDuplicateButton: 5, hideDeleteButton: 5, hideSelectionCountLabel: 5, hideLabelsToggle: 5, hideSelectionToolsLassoSelection: 5, hideSelectionToolsRectangleSelection: 5, hideSettingsMenu: 5, hideSnappingControls: 5, hideSnappingControlsElementsEnabledToggle: 5, hideSnappingControlsElementsFeatureEnabledToggle: 5, hideSnappingControlsElementsLayerList: 5, hideSnappingControlsElementsSelfEnabledToggle: 5, hideTooltipsToggle: 5, hideUndoRedoMenu: 5, icon: 1, label: 1, labelOptions: 0, layer: 0, layout: 1, pointSymbol: 0, polygonSymbol: 0, polylineSymbol: 0, position: 1, referenceElement: 1, scale: 1, toolbarKind: 1, showSnappingControlsElementsHeader: 5, snappingOptions: 0, state: 3, tooltipOptions: 0, updateGraphics: 0 };
}
static {
this.shadowRootOptions = h;
}
static {
this.styles = p;
}
// #endregion
// #region Public Methods
async cancel() {
this.widget?.cancel();
}
async complete() {
this.widget?.complete();
}
async create(e, i) {
await this.widget?.create(e, i);
}
async delete() {
this.widget?.delete();
}
/** Permanently destroy the component */
async destroy() {
await this.manager.destroy();
}
async duplicate() {
this.widget?.duplicate();
}
async redo() {
this.widget?.redo();
}
async triggerUpdate(e, i) {
this.widget?.update(e, i);
}
async undo() {
this.widget?.undo();
}
// #endregion
// #region Private Methods
_arcgisReadyHandler() {
this.defaultGraphicsLayerDisabled || this.el.view?.map.add(this.widget.layer);
}
async _editConstructorProperties(e) {
return this.defaultGraphicsLayerDisabled || (e.layer ??= new l({ title: "Sketch Layer" })), e;
}
}
s("arcgis-sketch", m);
export {
m as ArcgisSketch
};