@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
131 lines (130 loc) • 4.08 kB
TypeScript
import type OlFeature from 'ol/Feature';
import GirafeDraggableElement from '../../base/GirafeDraggableElement';
import type { GridDataById } from '../../tools/featuretogriddatabyid';
import CsvManager from '../../tools/export/csvmanager';
/**
* Represents a Feature displayed in the SelectionWindowComponent.
*/
interface WindowFeature {
id: string;
feature: OlFeature;
notOlProperties: Record<string, unknown>;
}
interface Layer {
id: string;
label: string;
}
/**
* Represents a draggable and resizable selection window component.
* Display itself when it should be visible and have selected features.
* To be visible, it has to be the defined selectionComponent.
*/
declare class SelectionWindowComponent extends GirafeDraggableElement {
template: () => import("uhtml").Hole;
private readonly eventsCallbacks;
private isVisibleComponentSetup;
private readonly debounceOnFeaturesSelected;
private resizeWindow;
private readonly featureToGridData;
private windowFeatures;
visible: boolean;
focusedIndex: number;
maxIndex: number;
iconCenter: any;
csvManager: CsvManager;
displayedProperties: [string, unknown][];
showDropdown: boolean;
constructor();
connectedCallback(): void;
/**
* Render the component regarding its visibility.
*/
render(): void;
/**
* @returns The WindowFeature at the currently focused index.
*/
getWindowFeature(): WindowFeature;
/**
* Recenter the map view based on the current feature.
*/
recenter(): void;
/**
* Toggles the visibility of the layers dropdown.
*/
openDropdown(): void;
/**
* Gets the list of layers to export.
* @returns The list of layers to export.
*/
getLayersList(): Layer[];
/**
* Generates a CSV file with the properties of the currently focused feature.
* @param layer The layer to export.
*/
generateCSV(layer: string): void;
/**
* Ignores undefined values in the data.
*/
ignoreUndefinedValues(data: Record<string, unknown>): void;
/**
* Closes the window and deselect the selected features.
*/
closeWindow(): void;
/**
* Sets the focus on a specific feature.
*/
onFocusWindowFeature(index: number): void;
/**
* Renders the component by calling the necessary methods.
* @private
*/
private renderComponent;
/**
* Sets up the components state and side-kicks.
* This must be called once at the first (visible) rendering.
* @private
*/
private setupVisibleComponent;
/**
* Render a placeholder, not visible component on hide.
* Removes event registration.
* @private
*/
private renderComponentEmpty;
/**
* Event about visibility that must be always listened by this component, even hidden.
* @private
*/
private registerVisibilityEvents;
/**
* Listen events that must be listened if the component is visible.
* @private
*/
private registerEvents;
/**
* Sets the selected features in the window and updates the window state to display the first feature.
* @private
*/
private onFeaturesSelected;
/**
* Selects a window feature by its first valid index.
* Out of bound index loops back to the first valid index.
* @returns The selected window feature.
* @private
*/
private selectedWindowFeature;
/**
* Toggles the panel visibility. If visible, tries to display a grid with selected feature.
* Can only be visible if the component is the wanted selection component.
* @private
*/
private togglePanel;
/**
* Creates an array of WindowFeature objects based on the provided GridDataById object.
* Using gridDataById orders by feature id the WindowFeatures.
* @returns An array of WindowFeature objects.
* @static
*/
static createWindowFeatures(gridDataById: GridDataById): WindowFeature[];
}
export default SelectionWindowComponent;