Transfer functions and result model
Import transferCominsRowBetweenTables and transferCominsGroupBetweenTables from comins-table. These synchronous pure functions return next models without mutating input arrays. The view changes only after applying the result to parent state.
Success and rejection
Section titled “Success and rejection”A null result indicates an invalid move or rejected conflict; retain both current states. Apply source and target together on success. Pure functions have no coordinator, canTransfer, or pointer lifecycle, so enforce application permissions before calling them. They emit neither tooltips nor onTransferRejected. Handle exceptions thrown by application resolvers/getters.
CominsTableTransferEndpoint
Section titled “CominsTableTransferEndpoint”data: readonly TData[];Required parent-owned source row array.
getRowId
Section titled “getRowId”getRowId: (row: TData, dataIndex: number) => CominsRowId;Required stable row-ID resolver; identity must be preserved after transfer.
tableId
Section titled “tableId”tableId: string;Required distinct ID for source and target.
groups
Section titled “groups”groups?: readonly TGroup[];Group definitions required for grouped transfers. Omission denotes a flat endpoint.
getGroupId
Section titled “getGroupId”getGroupId?: (group: TGroup) => CominsRowId;Unique group-ID resolver required for grouped endpoints.
getRowGroupId
Section titled “getRowGroupId”getRowGroupId?: (row: TData, dataIndex: number) => CominsRowId;Row membership resolver required for grouped endpoints.
setRowGroupId
Section titled “setRowGroupId”setRowGroupId?: (params: { fromGroupId: CominsRowId; row: TData; rowId: CominsRowId; toGroupId: CominsRowId; }) => TData;Returns a new row with destination membership. Preserve original objects and business IDs.
CominsRowBetweenTablesInput
Section titled “CominsRowBetweenTablesInput”source
Section titled “source”source: CominsTableTransferEndpoint<TData, TGroup>;Required source endpoint.
sourceRowId
Section titled “sourceRowId”sourceRowId: CominsRowId;Required source row ID to move.
target
Section titled “target”target: CominsTableTransferEndpoint<TData, TGroup>;Required target endpoint. Matching source/target tableId is rejected.
targetRowId
Section titled “targetRowId”targetRowId?: CominsRowId;Inserts before the target row. Omission appends for flat data or uses the target group insertion position for grouped data.
targetGroupId
Section titled “targetGroupId”targetGroupId?: CominsRowId;Destination group ID for grouped row moves. Omit for flat data.
resolveConflict
Section titled “resolveConflict”resolveConflict?: CominsTableTransferConflictResolver<TData, TGroup>;Duplicate-ID policy; omitted/undefined means reject.
CominsGroupBetweenTablesInput
Section titled “CominsGroupBetweenTablesInput”source
Section titled “source”source: CominsTableTransferEndpoint<TData, TGroup>;Required grouped source endpoint.
sourceGroupId
Section titled “sourceGroupId”sourceGroupId: CominsRowId;Required group ID to move with its members. Empty groups can move.
target
Section titled “target”target: CominsTableTransferEndpoint<TData, TGroup>;Required grouped target endpoint.
targetGroupId
Section titled “targetGroupId”targetGroupId?: CominsRowId;Reference group for before/after. Omission defaults to append.
position
Section titled “position”position?: CominsTableTransferDropPosition;after/append/before. Defaults to append without targetGroupId, otherwise before.
resolveConflict
Section titled “resolveConflict”resolveConflict?: CominsTableTransferConflictResolver<TData, TGroup>;Handles duplicate group/member IDs. Defaults to reject.
CominsTableTransferResult
Section titled “CominsTableTransferResult”kind: "group" | "row";Executed transfer kind: row/group.
source
Section titled “source”source: CominsTableTransferNextEndpoint<TData, TGroup>;Source tableId, next data, and optional groups.
target
Section titled “target”target: CominsTableTransferNextEndpoint<TData, TGroup>;Target tableId, next data, and optional groups.
details
Section titled “details”details: CominsTableTransferDetails<TData, TGroup>;Moved IDs, target position, and resolved conflicts. Narrow the detail variant using kind.
CominsTableTransferRowEndpoint
Section titled “CominsTableTransferRowEndpoint”export type CominsTableTransferRowEndpoint<TData> = { dataIndex: number; row: TData; rowId: CominsRowId; tableId: string;};Row location in conflict payloads. dataIndex is the position in its original array; row/rowId/tableId identify the data.
CominsTableTransferGroupEndpoint
Section titled “CominsTableTransferGroupEndpoint”export type CominsTableTransferGroupEndpoint<TData, TGroup> = { group: TGroup; groupId: CominsRowId; groupIndex: number; rows: readonly CominsTableTransferRowEndpoint<TData>[]; tableId: string;};Group location in conflict payloads. groupIndex is its groups position; rows are member endpoints.
CominsTableTransferResolvedConflict
Section titled “CominsTableTransferResolvedConflict”export type CominsTableTransferResolvedConflict<TData, TGroup> = { conflict: CominsTableTransferConflict<TData, TGroup>; policy: CominsTableTransferConflictPolicy;};Pair of a conflict and the chosen reject/overwrite policy.
CominsTableRowTransferDetails
Section titled “CominsTableRowTransferDetails”export type CominsTableRowTransferDetails<TData, TGroup> = { conflicts: readonly CominsTableTransferResolvedConflict<TData, TGroup>[]; kind: "row"; sourceRowId: CominsRowId; targetGroupId?: CominsRowId; targetRowId?: CominsRowId;};Row transfer identifiers and resolved conflicts. Target row/group may be absent.
CominsTableGroupTransferDetails
Section titled “CominsTableGroupTransferDetails”export type CominsTableGroupTransferDetails<TData, TGroup> = { conflicts: readonly CominsTableTransferResolvedConflict<TData, TGroup>[]; kind: "group"; position: CominsTableTransferDropPosition; sourceGroupId: CominsRowId; targetGroupId?: CominsRowId;};Group identifiers, position, and conflicts. targetGroupId may be absent for append.
transferCominsRowBetweenTables
Section titled “transferCominsRowBetweenTables”export declare function transferCominsRowBetweenTables<TData, TGroup = never>(input: CominsRowBetweenTablesInput<TData, TGroup>): CominsTableTransferResult<TData, TGroup> | null;Takes CominsRowBetweenTablesInput above. Returns both next models on success, null on rejection.
transferCominsGroupBetweenTables
Section titled “transferCominsGroupBetweenTables”export declare function transferCominsGroupBetweenTables<TData, TGroup>(input: CominsGroupBetweenTablesInput<TData, TGroup>): CominsTableTransferResult<TData, TGroup> | null;Takes CominsGroupBetweenTablesInput above. Transfers the group and all members together; returns null on rejection.