import {
Component,
Input,
ChangeDetectionStrategy,
SimpleChanges,
OnChanges,
inject,
} from "@angular/core";
import { FormGroup } from "@angular/forms";
import { FormlyFieldConfig } from "@ngx-formly/core";
import { SamPageNextService } from "../experimental/patterns/layout/architecture";
@Component({
selector: "sam-filters",
template: `
`,
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
export class SamFiltersComponent implements OnChanges {
private _service = inject(SamPageNextService, { optional: true });
@Input() public form: FormGroup;
@Input() public fields: FormlyFieldConfig[];
@Input() public model: Record;
public ngOnChanges(c: SimpleChanges) {
if (this._service && c.fields) {
this._service.get("filterFields").setValue(this.fields);
}
}
}