Skip to main content
cngx-src documentation

CreateCommitHandlerOptions

Interface

projects/forms/select/shared/create-commit-handler.ts

Import#

import { CreateCommitHandlerOptions } from '@cngx/forms/select'

Description#

Configuration for createCreateCommitHandler. Callbacks are plain functions - the handler reads no signals beyond quickCreateAction, so consumers keep ownership of the reactive surface.

Value-shape-agnostic: the handler never writes the component's primary value slot. The consumer's CreateCommitHandlerOptions.onCreated callback performs the semantic write (single: value.set(option.value); multi: append to values) plus selectionChange + created emissions, so CngxActionSelect and CngxActionMultiSelect share the same factory unchanged.

Prev carries the previous-snapshot shape (single: T | undefined; multi: readonly T[]) so onCreated receives a typed payload ready to splat into previousValue(s).

Index#

Instance Properties#

closeOnSuccess#Signal
Readonly

Whether to close the panel after a successful create. Read per dispatch so the consumer can flip the input without a re-bind.

commitController#CngxCommitController
Readonly

Shared low-level commit controller. Every create routes through begin(...) so supersede, state-machine, and intended-value tracking match every other select-family commit path.

localItemsBuffer#LocalItemsBuffer
Readonly

Persistent local-items buffer. On success the handler patches a CngxSelectOptionDef<T> with the server-returned value and the drafted label; it stays visible until the backend catches up and mergeLocalItems's dedup drops the local copy.

onAnnounce#function
Readonly

Announce the 'created' delta through the live-region.

onClose#function
Readonly

Close the panel (typically () => component.close()).

onCreated#function
Readonly

Emit the 'create' change-event payload and write the primary value slot. Fires after localItemsBuffer patch and dirty-flag reset, so consumer callbacks can selectionChange.emit(...) without racing downstream state.

onError#function
Readonly

Hook for the consumer's commitError output.

onResetDirty#function
Readonly

Reset the bridge's dirty flag so the next Escape press or click-outside dismisses normally.

onStateChange#function
Readonly

Hook for the consumer's stateChange output.

quickCreateAction#Signal
Readonly

Active create action. Read per dispatch so a swap mid-flight supersedes cleanly. Lets the handler short-circuit before begin(...) when the consumer cleared the input.