UNPKG

@empathyco/x-components

Version:
37 lines (34 loc) 1.18 kB
import { isRawFilter } from '@empathyco/x-types'; /** * Allows selecting and deselecting a filter of {@link @empathyco/x-types#RawFilter | RawFilter}. * * @internal */ class RawFilterEntity { constructor(store) { this.store = store; } /** * It deselects the {@link @empathyco/x-types#RawFilter | RawFilter}. * * @param filter - The filter to deselect. * @remarks As the {@link @empathyco/x-types#RawFilter.selected} is always true, * the deselection just removes the filter from the store. */ deselect(filter) { this.store.commit('x/facets/removeFilter', filter); } /** * It selects the {@link @empathyco/x-types#RawFilter | RawFilter}. * * @param filter - The filter to select. * @remarks As the {@link @empathyco/x-types#RawFilter.selected} is always true, * there is no need to set this property. */ select(filter) { this.store.commit('x/facets/mutateFilter', { filter, newFilterState: { selected: true } }); } } RawFilterEntity.accepts = isRawFilter; export { RawFilterEntity }; //# sourceMappingURL=raw-filter.entity.js.map