openaire-library/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link....

55 lines
2.0 KiB
TypeScript

import {Component} from '@angular/core';
import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {PluginSearchDepositLink} from "./plugin-search-deposit-link.component";
@Component({
selector: 'plugin-search-deposit-link-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]=" pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)" ></plugin-field-edit>
<div class="uk-margin-top uk-text-muted">
Cards:
</div>
<ng-container *ngFor="let card of pluginObject.cardInfoArray; let i = index">
<div class="uk-grid uk-grid-small uk-margin-xsmall-top">
<div class="uk-text-small uk-width-3-4">{{card.tag}}</div>
<div class=" uk-width-auto">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].show"
type="boolean" field="cardInfoArray" (editClicked)="pluginEditEvent = $event" (changed)="cardShowChanged(i,$event)" >
</plugin-field-edit>
</div>
</div>
</ng-container>
</div>
`,
})
export class PluginSearchDepositLinkFormComponent extends PluginBaseComponent<PluginSearchDepositLink> /*implements OnChanges*/{
constructor(http:HttpClient) {
super()
}
cardShowChanged(i,$event:PluginEditEvent){
if(this.editTemplate){
this.pluginTemplate.object.cardInfoArray[i].show=$event.value;
$event.value =this.pluginTemplate.object.cardInfoArray;
}else{
this.plugin.object.cardInfoArray[i].show=$event.value;
$event.value =this.plugin.object.cardInfoArray;
}
this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'})
}
}