UNPKG

@arcgis/map-components

Version:
270 lines (269 loc) • 11.2 kB
/// <reference path="../../index.d.ts" /> import type MapView from "@arcgis/core/views/MapView.js"; import type SceneView from "@arcgis/core/views/SceneView.js"; import type Sublayer from "@arcgis/core/layers/support/Sublayer.js"; import type Layer from "@arcgis/core/layers/Layer.js"; import type SubtypeSublayer from "@arcgis/core/layers/support/SubtypeSublayer.js"; import type LinkChartView from "@arcgis/core/views/LinkChartView.js"; import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { ArcgisReferenceElement, IconName } from "../types.js"; import type { SupportedRegion } from "./spriteSheetsUtils.js"; import type { T9nMeta } from "@arcgis/lumina/controllers"; /** * The Scale Range Slider component allows the user to set a minimum and maximum scale based on named scale ranges. When a layer is provided, the component's minScale and maxScale properties will be set to the scale range of the layer. * * @since 5.1 */ export abstract class ArcgisSliderScaleRange extends LitElement { /** * 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-slider-scale-range/#destroy) method when you are done to * prevent memory leaks. * * @default false */ accessor autoDestroyDisabled: boolean; /** * When true, the component is visually withdrawn and cannot receive user interaction. * * @default false */ accessor disabled: boolean; /** * Indicates whether the maximum scale dropdown menu is visible. Default value is `false`. * * @default false */ accessor hideMaxScaleMenu: boolean | undefined; /** * Indicates whether the minimum scale dropdown menu is visible. Default value is `false`. * * @default false */ accessor hideMinScaleMenu: boolean | undefined; /** * Indicates whether the preview thumbnail of the scale is visible. * Default value is `false`. * * @default false */ accessor hidePreview: boolean | undefined; /** * Icon which represents the component. * Typically used when the component is controlled by another component (e.g. by the Expand component). * * @default "actual-size" * @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/) */ accessor icon: IconName; /** The component's default label. */ accessor label: string | undefined; /** * When provided, the initial [minScale](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#minScale) * and [maxScale](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#maxScale) values will match the scale range * within which the layer will render. * * If a [TileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/TileLayer/) with resampling disabled is provided, * the slider thumbs will not be allowed to move past the `lods` of the layer's tiling scheme. * If a [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) is provided, the same restrictions to the thumbs * will be applied via the min/max scale defined by the map service. The unavailable range will be designated with a dashed line. */ accessor layer: Layer | Sublayer | SubtypeSublayer | undefined; /** * The maximum scale of the active scale range. * * @default 0 */ accessor maxScale: number; /** * The lowest possible maximum scale value on the slider, at which [maxScale](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#maxScale) may not be set below. * * @default 100000000 */ accessor maxScaleLimit: number; /** @internal */ protected messages: Partial<{ componentLabel: string; noLimit: string; preview: string; currentScaleTooltip: string; customScaleInputTooltip: string; current: string; setTo: string; selectOne: string; setToSelectOne: string; aboveSuffix: string; belowSuffix: string; currentScale: string; scaleRangeLabels: { world: string; continent: string; countriesBig: string; countriesSmall: string; statesProvinces: string; stateProvince: string; counties: string; county: string; metropolitanArea: string; cities: string; city: string; town: string; neighborhood: string; streets: string; street: string; buildings: string; building: string; smallBuilding: string; rooms: string; room: string; }; featuredScaleLabels: { custom: string; current: string; world: string; continent: string; countriesBig: string; countriesSmall: string; statesProvinces: string; stateProvince: string; counties: string; county: string; metropolitanArea: string; cities: string; city: string; town: string; neighborhood: string; streets: string; street: string; buildings: string; building: string; smallBuilding: string; rooms: string; room: string; }; }> & T9nMeta<{ componentLabel: string; noLimit: string; preview: string; currentScaleTooltip: string; customScaleInputTooltip: string; current: string; setTo: string; selectOne: string; setToSelectOne: string; aboveSuffix: string; belowSuffix: string; currentScale: string; scaleRangeLabels: { world: string; continent: string; countriesBig: string; countriesSmall: string; statesProvinces: string; stateProvince: string; counties: string; county: string; metropolitanArea: string; cities: string; city: string; town: string; neighborhood: string; streets: string; street: string; buildings: string; building: string; smallBuilding: string; rooms: string; room: string; }; featuredScaleLabels: { custom: string; current: string; world: string; continent: string; countriesBig: string; countriesSmall: string; statesProvinces: string; stateProvince: string; counties: string; county: string; metropolitanArea: string; cities: string; city: string; town: string; neighborhood: string; streets: string; street: string; buildings: string; building: string; smallBuilding: string; rooms: string; room: string; }; }>; /** * The minimum scale of the active scale range. * * @default 0 */ accessor minScale: number; /** * The highest possible minimum scale value on the slider, at which [minScale](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#minScale) may not be set above. * * @default 147914382 */ accessor minScaleLimit: number; /** * The mode of the component, indicating which slider thumbs can be adjusted. * * @default "range" */ accessor mode: "max-scale-only" | "min-scale-only" | "range"; /** * 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; /** * The region that the scale thumbnails will focus on. * Each region comes from the [ISO 3166-1 alpha-2 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). * See [SupportedRegion](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/types/#SupportedRegion) for the list of regions that are currently supported. */ accessor region: SupportedRegion | undefined; /** * Indicates whether the world scale value is shown in the scale menu. * * @default false */ accessor showWorldValue: boolean; /** * The current state of the component. * * @default "disabled" */ get state(): "disabled" | "ready"; /** * 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-slider-scale-range component will be associated with a map or scene component rather than using the `view` property. */ accessor view: LinkChartView | MapView | SceneView | undefined; /** Permanently destroy the component. */ destroy(): Promise<void>; /** Fires when the thumb or range is released on the component. Use [@arcgisInput](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/#event-arcgisInput) for continuous updates during a drag. */ readonly arcgisChange: import("@arcgis/lumina").TargetedEvent<this, void>; /** Fires continuously while the thumb or range is being dragged. This event can fire frequently; consider debouncing or throttling expensive work. */ readonly arcgisInput: import("@arcgis/lumina").TargetedEvent<this, void>; /** 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: "state" | "minScale" | "maxScale"; }>; /** 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>; readonly "@eventTypes": { arcgisChange: ArcgisSliderScaleRange["arcgisChange"]["detail"]; arcgisInput: ArcgisSliderScaleRange["arcgisInput"]["detail"]; arcgisPropertyChange: ArcgisSliderScaleRange["arcgisPropertyChange"]["detail"]; arcgisReady: ArcgisSliderScaleRange["arcgisReady"]["detail"]; }; }