CreateCommitHandlerOptions
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#
SignalWhether to close the panel after a successful create. Read per dispatch so the consumer can flip the input without a re-bind.
CngxCommitControllerShared low-level commit controller. Every create routes through
begin(...) so supersede, state-machine, and intended-value
tracking match every other select-family commit path.
LocalItemsBufferPersistent 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.
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.
Reset the bridge's dirty flag so the next Escape press or click-outside dismisses normally.