reorderable_helpers.ts

Declarations
#

6 declarations

view source

calculate_reorderable_target_index
#

reorderable_helpers.ts view source

(source_index: number, current_index: number, position: ReorderableValidDropPosition): number

Calculate the target index based on source, current index, and position.

source_index

type number

current_index

type number

position

returns

number

detect_reorderable_direction
#

reorderable_helpers.ts view source

(element: HTMLElement): ReorderableDirection

Detect layout direction from an element - supports flex and grid.

element

type HTMLElement

returns

ReorderableDirection

get_reorderable_drop_position
#

reorderable_helpers.ts view source

(direction: ReorderableDirection, source_index: number, target_index: number): ReorderableValidDropPosition

Determine the drop position based on source and target indices and layout direction.

direction

source_index

type number

target_index

type number

returns

ReorderableValidDropPosition

is_reorder_allowed
#

reorderable_helpers.ts view source

(can_reorder: ((from_index: number, to_index: number) => boolean) | undefined, source_index: number, target_index: number): boolean

Check if reordering is allowed between two indices.

can_reorder

type ((from_index: number, to_index: number) => boolean) | undefined

source_index

type number

target_index

type number

returns

boolean

set_reorderable_drag_data_transfer
#

reorderable_helpers.ts view source

(dataTransfer: DataTransfer, item_id: ReorderableItemId): void

Set up drag data transfer with consistent properties and formats This centralizes the dataTransfer setup logic used in multiple places.

dataTransfer

type DataTransfer

item_id

returns

void

validate_reorderable_target_index
#

reorderable_helpers.ts view source

(target_index: number, max_index: number): number

Validate and adjust a target index to ensure it's within bounds

target_index

type number

max_index

type number

returns

number

Imported by
#