UNPKG

@foblex/flow

Version:

An Angular library designed to simplify the creation and manipulation of dynamic flow. Provides components for flows, nodes, and connections, automating node manipulation and inter-node connections.

63 lines (62 loc) 2.71 kB
import { IExecution } from '@foblex/mediator'; import { FSingleSelectRequest } from './f-single-select.request'; import * as i0 from "@angular/core"; /** * Implements the functionality for selecting elements in a graphical interface. * This class handles both single and multi-selection, updating the selection state * of elements and managing related data. * * Logic flow: * 1. **Validate the selection event**: * - The event is considered valid if it occurs within the flow boundaries * and there are no active draggable data operations. * * 2. **Determine the target element to select**: * - The target element is determined based on the event’s target. * It can be a node, a group of nodes, or a connection. * - If no element is found, the current selection state is cleared. * * 3. **Update element layers**: * - If an element is found, its visual layer and the layers of its child elements are updated. * * 4. **Single or multi-selection**: * - If the event meets the criteria for multi-selection (e.g., a modifier key is pressed), * multi-selection logic is applied. * - Otherwise, single-selection logic is used. * * 5. **Single-selection logic**: * - If the element is not selected and can be selected: * - Clear the selection of all other elements. * - Mark the current element as selected. * - If the element cannot be selected, the current selection is cleared. * * 6. **Multi-selection logic**: * - If the element is already selected, it is removed from the selection. * - If the element is not selected and can be selected, it is added to the selection. * * 7. **Manage selection state**: * - Adding or removing an element from the selection triggers the corresponding methods. * - Selection state is tracked in the shared context for future use. */ export declare class FSingleSelectExecution implements IExecution<FSingleSelectRequest, void> { private readonly _fMediator; private readonly _fComponentsStore; private readonly _fDraggableDataContext; handle(request: FSingleSelectRequest): void; private _isValid; private _isEventInFlowBounds; private _getItemToSelect; private _getNodeOrGroup; private _getConnection; private _updateItemAndChildrenLayers; private _isMultiSelect; private _singleSelect; private _isItemNotSelectedAndSelectable; private _clearSelection; private _multiSelect; private _deselectItem; private _removeItemFromSelectedItems; private _selectItem; static ɵfac: i0.ɵɵFactoryDeclaration<FSingleSelectExecution, never>; static ɵprov: i0.ɵɵInjectableDeclaration<FSingleSelectExecution>; }