]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts
LP1849212: Grid improvements
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / share / marc-edit / simplified-editor / simplified-editor-field.component.ts
1 import {Component, Host, Input, OnInit} from '@angular/core';
2 import {MarcSimplifiedEditorComponent} from './simplified-editor.component';
3 import {MarcSubfield} from '../marcrecord';
4
5 /**
6  * A field that a user can edit, which will later be
7  * compiled into MARC
8  */
9
10 @Component({
11   selector: 'eg-marc-simplified-editor-field',
12   template: '<ng-template></ng-template>'
13 })
14 export class MarcSimplifiedEditorFieldComponent implements OnInit {
15
16   @Input() tag: string;
17   @Input() subfield: string;
18   @Input() defaultValue: string;
19
20   constructor(@Host() private editor: MarcSimplifiedEditorComponent) {}
21
22   ngOnInit() {
23       this.editor.addField({
24           tag: this.tag,
25           subfields: [[
26               this.subfield,
27               this.defaultValue ? this.defaultValue : '',
28               0
29           ]],
30           authValid: false,
31           authChecked: false,
32           isCtrlField: false,
33           isControlfield: () => false,
34           indicator: (ind: number) => '0',
35           deleteExactSubfields: (...subfield: MarcSubfield[]) => 0,
36       });
37   }
38
39 }
40
41
42