import { Component, Input, OnInit } from '@angular/core'; import { LocaleService } from '@farris/ui-locale'; import { ServerSideToken } from '@farris/ui-lookup'; import { LookupService } from './lookup.service'; import { IFeature } from './type'; @Component({ selector: 'farris-feature-editor', templateUrl: 'feature-editor.component.html', styles: ['feature-editor.component.css'], // providers: [ // { provide: ServerSideToken, useClass: LookupService } // ] }) export class FeatureEditorComponent implements OnInit { public localeId: string; /** * 特性 */ @Input() features: Array; constructor( private localeService: LocaleService ) { if (this.localeService) { this.localeId = this.localeService.localeId; } } ngOnInit() { } /** * 帮助选择数据后的回调 * @param event event */ public onSelectRows(event: any) { const { code = null, rows = [] } = event || {}; if (code) { const item = this.features.find((feature: IFeature) => feature.field === code); item.results = rows; } } }