Quantity field is a form control element that switches between native select dropdown and input field based on the quantity value.
import { DaffSfQuantityFieldComponent } from '@daffodil/storefront/quantity-field'
@Component()
class DaffSfQuantityFieldComponent extends DaffFormFieldControl<number> implements ControlValueAccessor, DaffFormFieldControl<number>, OnInit {
_destroyed: Subject<boolean> = new Subject<boolean>()
@Optional() @Self() ngControl: NgControl
get value(): number
readonly supportsAutoLabelling: boolean = true
readonly id: string
get raised(): boolean
get state(): DaffFormFieldState
_stateChanges: BehaviorSubject = new BehaviorSubject({
focused: false,
filled: false,
disabled: false,
error: false,
valid: true,
})
stateChanges: Observable<DaffFormFieldState>
min: InputSignal<number> = input(1)
max: InputSignal<number> = input(500)
selectMax: InputSignal<number> = input(10)
emitState(deferred: boolean = false): void
}
InputSignal| Default | input(1) |
|---|---|
| Description | The minimum valid value of the quantity field. Must be greater than or equal to 1. |
InputSignal| Default | input(500) |
|---|---|
| Description | The maximum valid value of the quantity field.
Must be greater than |
InputSignal| Default | input(10) |
|---|---|
| Description | The maximum number allowed before the field switches from a dropdown to an input. When the value reaches this number, an input field is shown instead of a select. Default is 10. |
Subject| Default | new Subject<boolean>() |
|---|---|
| Description |
NgControl| Default | – |
|---|---|
| Description |
number| Default | – |
|---|---|
| Description | Implemented as part of DaffFormFieldControl. |
boolean| Default | true |
|---|---|
| Description | Whether the control supports automatic label behavior.
When Defaults to |
string| Default | – |
|---|---|
| Description | The unique identifier for the control element. |
boolean| Default | – |
|---|---|
| Description | Whether the label should be in the raised position. By default, matches the focused state. |
DaffFormFieldState| Default | – |
|---|---|
| Description | Computes the current state of the form field control. Combines control properties and form validation state. |
BehaviorSubject| Default | new BehaviorSubject({
focused: false,
filled: false,
disabled: false,
error: false,
valid: true,
}) |
|---|---|
| Description |
Observable| Default | – |
|---|---|
| Description | Observable stream of state changes for the form field control. |
voidEmits the current state.
| Parameter | deferred: boolean |
|---|---|
| Default | false |
| Description |