🚨 Announcement: A New Chapter for Vendure read more

FacetValueSelectorComponent

FacetValueSelectorComponent

A form control for selecting facet values.

Example

<vdr-facet-value-selector
  [facets]="facets"
  (selectedValuesChange)="selectedValues = $event"
></vdr-facet-value-selector>

The facets input should be provided from the parent component like this:

Example

this.facets = this.dataService
  .facet.getAllFacets()
  .mapSingle(data => data.facets.items);

Signature

class FacetValueSelectorComponent implements OnInit, ControlValueAccessor {
  @Output() selectedValuesChange = new EventEmitter<FacetValue.Fragment[]>();
  @Input() facets: FacetWithValues.Fragment[];
  @Input() readonly = false;
  @Input() transformControlValueAccessorValue: (value: FacetValueSeletorItem[]) => any[] = value => value;
  facetValues: FacetValueSeletorItem[] = [];
  onChangeFn: (val: any) => void;
  onTouchFn: () => void;
  disabled = false;
  value: Array<string | FacetValue.Fragment>;
  constructor(dataService: DataService)
  ngOnInit() => ;
  onChange(selected: FacetValueSeletorItem[]) => ;
  registerOnChange(fn: any) => ;
  registerOnTouched(fn: any) => ;
  setDisabledState(isDisabled: boolean) => void;
  focus() => ;
  writeValue(obj: string | FacetValue.Fragment[] | Array<string | number> | null) => void;
}

Implements

  • OnInit
  • ControlValueAccessor

Members

selectedValuesChange

property
type:

facets

property
type:
FacetWithValues.Fragment[]

readonly

property
type:

transformControlValueAccessorValue

property
type:
(value: FacetValueSeletorItem[]) => any[]

facetValues

property
type:
FacetValueSeletorItem[]

onChangeFn

property
type:
(val: any) => void

onTouchFn

property
type:
() => void

disabled

property
type:

value

property
type:
Array<string | FacetValue.Fragment>

constructor

method
type:
(dataService: DataService) => FacetValueSelectorComponent

ngOnInit

method
type:
() =>

onChange

method
type:
(selected: FacetValueSeletorItem[]) =>

registerOnChange

method
type:
(fn: any) =>

registerOnTouched

method
type:
(fn: any) =>

setDisabledState

method
type:
(isDisabled: boolean) => void

focus

method
type:
() =>

writeValue

method
type:
(obj: string | FacetValue.Fragment[] | Array<string | number> | null) => void