import type Layer from "../../../layers/Layer.js"; import type Accessor from "../../../core/Accessor.js"; import type SelectionManager from "../../../views/SelectionManager.js"; import type FeatureItem from "./FeatureItem.js"; import type GroupLayerItem from "./GroupLayerItem.js"; import type LayerItem from "./LayerItem.js"; import type { SelectableLayer, SelectableLayerView, SelectableSublayerUnion, SelectableViewUnion, SelectionIdentifier } from "../../../views/selection/types.js"; import type { ListItem, ParentItem, SelectionListParentLayerUnion, State } from "./types.js"; /** @internal */ export interface SelectionListViewModelProperties extends Partial> {} /** * Displays selected features from a SelectionManager in a list format. * * @internal */ export default class SelectionListViewModel extends Accessor { /** @internal */ constructor(properties?: SelectionListViewModelProperties); /** * Reference to a singular LayerItem being displayed in the list, if the * 'layer' property is set and the layer has selected features. * * @internal */ get activeLayerItem(): LayerItem | null | undefined; /** * Items representing all individual layers and group layers with an active selection. * * @internal */ get allLayerItems(): ParentItem[]; /** * Total number of selected features. * * @internal */ get effectiveCount(): number; /** * Reference to the SelectionManager being represented by the widget view. * * @internal */ get effectiveSelectionManager(): SelectionManager | null | undefined; /** * Current value of the list's text filter. * * @internal */ accessor filterText: string | undefined; /** * Indicates the widget is currently updating. * * @internal */ get isUpdating(): boolean; /** * Setting this property causes the list to only display features from this layer. * If there are no selected features from this layer, the full list will appear. * This value also reflects when a layer is selected from the layer dropdown. * * @internal */ accessor layer: SelectableLayer | null | undefined; /** * Items representing individual layers with an active selection. Excludes group layer items. * * @internal */ get layerItems(): LayerItem[]; /** * Lookup of layer views by layer id. * * @internal */ get layerViewMap(): Map; /** * Indicates at least one item in the list has hidden features due to * the selection being greater than the current value of the * 'maxVisibleFeatureCountPerLayer' property. * * @internal */ get maxVisibleFeatureCountExceeded(): boolean; /** * Maximum number of selected feature items displayed per layer. * Does not limit or restrict the selection itself. * * @default 500 * @internal */ accessor maxVisibleFeatureCountPerLayer: number; /** * Override for viewing a selection without having to modify the view's selection * * @internal */ accessor selectionManager: SelectionManager | null | undefined; /** * Reflects the widget's current state. * * @internal */ get state(): State; /** * Reference to the associated view. Required for temporary highlights. * * @internal */ accessor view: SelectableViewUnion | null | undefined; /** * Convenience property for all layers and tables on the associated view. * Used to identify group layers that selection sources may belong to. * * @internal */ get viewLayersAndTables(): Layer[]; /** * Total number of feature list items visible in the list itself. This value accounts for the limit imposed by 'maxVisibleFeatureCountPerLayer' and 'filterText' so this * value will be less than the actual total selection count when a selection on a single layer exceeds the current value of 'maxVisibleFeatureCountPerLayer' or * a value has been provided for 'filterText'. For the unmodified total selection count on all relevant layers, use the [effectiveCount](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SelectionList/SelectionListViewModel/#effectiveCount) property. * * @internal */ get visibleFeatureCount(): number; /** * Current number of visible feature list items, accounting for 'maxVisibleFeatureCountPerLayer'. * Excludes feature list items hidden by the filter. * * @internal */ get visibleFeatureItems(): FeatureItem[]; /** * Count for total number of visible layer items in the list, excluding group layer items. * * @internal */ get visibleLayerCount(): number; /** * Adds temporary highlight to the provided item. Removes a previously configured * temporary highlight. * * @param item - Feature item to highlight. * @internal */ addTemporaryHighlight(item: FeatureItem): void; /** * Clears all active selections for all groups, layers and features. * * @internal */ clear(): void; /** * Utility method for collapsing all parent list items. * * @internal */ collapseAll(): void; /** * Removes a specific feature from the overall selection. * * @param item - Feature item to remove from the selection. * @internal */ deselectFeatureItem(item: FeatureItem): void; /** * Removes all features and layers inside a specific group from the overall selection. * * @param item - Group layer item to remove from the selection. * @internal */ deselectGroupItem(item: GroupLayerItem): void; /** * Utility method to unselect any group, layer or feature item. * Typically calls deselectFeatureItem(), deselectGroupItem() or deselectLayerItem(). * * @param item - List item to remove from the selection. * @internal */ deselectItem(item: ListItem): void; /** * Removes all features from a specific layer from the overall selection. * * @param item - Layer item to remove from the selection. * @internal */ deselectLayerItem(item: LayerItem): void; /** @internal */ destroy(): void; /** * Utility method for expanding all parent list items. * * @internal */ expandAll(): void; /** * Utility method for finding the layer item associated with a specific layer. * * @param layer - The layer to find the associated layer item for. * @returns The layer item associated with the provided layer, or null if not found. * @internal */ findLayerItem(layer: SelectableLayer): LayerItem | null | undefined; /** * Utility method for finding the parent item associated with a specific layer. * * @param layer - The layer to find the associated parent item for. * @returns The parent item associated with the provided layer, or null if not found. * @internal */ findParentItem(layer: SelectableLayer | SelectionListParentLayerUnion): ParentItem | null | undefined; /** * Repositions the view to center based on the chosen item. * * @param item - List item to center the view on. * @internal */ goToItem(item: ListItem): void; /** * Internal convenience method for generating a list of items to display. * If no layers are provided, creates a list based on the view's layers and tables. * Typically used by SelectionListGroupItem to generate children. * Implemented as such to avoid having a cyclical dependency. * * @param params - Parameters used to generate the list of items. * @returns List of items to display in the selection list. * @internal */ layersToItems(params: { controller: AbortController; promises: Promise[]; groupLayerItem?: GroupLayerItem | null | undefined; layers?: Layer[] | SelectableSublayerUnion[] | SelectionListParentLayerUnion[]; }): Promise; /** * Removes specific features from the selection, based on the provided * layer and object IDs. * * @param params - Parameters used to remove features from the selection. * @internal */ removeFromSelection(params: { layer: SelectableLayer; selection: SelectionIdentifier[]; }): void; /** * Removes all temporary highlights. * * @internal */ removeTemporaryHighlight(): void; /** * Adds specific features to the selection, based on the provided * layer and object IDs. * * @param params - Parameters used to replace features in the selection. * @internal */ replace(params: { layer: SelectableLayer; selection: SelectionIdentifier[]; }): void; /** * Selects a single feature and unselects all other features. * * @param item - Feature item to select. * @internal */ selectSingleFeatureItem(item: FeatureItem): void; /** * Selects all features from layers within a specific group layer and unselects all other features. * * @param item - Group layer item to select. * @internal */ selectSingleGroupItem(item: GroupLayerItem): void; /** * Selects all features contextual to a given item. Unselects all other features. * * @param item - List item to select. * @internal */ selectSingleItem(item: ListItem): void; /** * Selects all features for the specified layer. Unselects all other selected features. * * @param item - Layer item to select. * @internal */ selectSingleLayerItem(item: LayerItem): void; }