export class CourseTermMapComponent {
-}
\ No newline at end of file
+}
--- /dev/null
+import {Component, Host, Input, OnInit, AfterViewInit} from '@angular/core';
+import {MarcSimplifiedEditorComponent} from './simplified-editor.component';
+import {MarcField, MarcSubfield} from '../marcrecord';
+
+/**
+ * A field that a user can edit, which will later be
+ * compiled into MARC
+ */
+
+@Component({
+ selector: 'eg-marc-simplified-editor-field',
+ template: ''
+})
+export class MarcSimplifiedEditorFieldComponent implements OnInit, AfterViewInit {
+
+ @Input() tag = 'a';
+ @Input() ind1 = ' ';
+ @Input() ind2 = ' ';
+
+ subfieldIndex = 1;
+
+ marcVersion: MarcField;
+
+ addSubfield: (code: string, defaultValue?: string) => void;
+
+ constructor(@Host() private editor: MarcSimplifiedEditorComponent) {}
+
+ ngOnInit() {
+ this.marcVersion = {
+ tag: this.tag,
+ subfields: [],
+ authValid: false,
+ authChecked: false,
+ isCtrlField: false,
+ isControlfield: () => false,
+ indicator: (ind: number) => (ind === 1) ? this.ind1 : this.ind2,
+ deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, // not used by the simplified editor
+ };
+
+ this.addSubfield = (code: string, defaultValue?: string) => {
+ this.marcVersion.subfields.push(
+ [
+ code,
+ defaultValue ? defaultValue : '',
+ this.subfieldIndex
+ ]
+ );
+ this.subfieldIndex += 1;
+
+ };
+ }
+
+ ngAfterViewInit() {
+ this.editor.addField(this.marcVersion);
+ }
+
+}
+
+
+
+++ /dev/null
-import {Directive, Host, Input, OnInit, AfterViewInit} from '@angular/core';
-import {MarcSimplifiedEditorComponent} from './simplified-editor.component';
-import {MarcField, MarcSubfield} from '../marcrecord';
-import {MarcSimplifiedEditorSubfieldDirective} from './simplified-editor-subfield.directive';
-
-/**
- * A field that a user can edit, which will later be
- * compiled into MARC
- */
-
-@Directive({
- selector: 'eg-marc-simplified-editor-field',
-})
-export class MarcSimplifiedEditorFieldDirective implements OnInit, AfterViewInit {
-
- @Input() tag = 'a';
- @Input() ind1 = ' ';
- @Input() ind2 = ' ';
-
- subfieldIndex = 1;
-
- marcVersion: MarcField;
-
- addSubfield: (code: string, defaultValue?: string) => void;
-
- constructor(@Host() private editor: MarcSimplifiedEditorComponent) {}
-
- ngOnInit() {
- this.marcVersion = {
- tag: this.tag,
- subfields: [],
- authValid: false,
- authChecked: false,
- isCtrlField: false,
- isControlfield: () => false,
- indicator: (ind: number) => (ind === 1) ? this.ind1 : this.ind2,
- deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, // not used by the simplified editor
- };
-
- this.addSubfield = (code: string, defaultValue?: string) => {
- this.marcVersion.subfields.push(
- [
- code,
- defaultValue ? defaultValue : '',
- this.subfieldIndex
- ]
- );
- this.subfieldIndex += 1;
-
- }
- }
-
- ngAfterViewInit() {
- this.editor.addField(this.marcVersion);
- }
-
-}
-
-
-
--- /dev/null
+import {Directive, Input, Host, OnInit, Component} from '@angular/core';
+import {MarcSimplifiedEditorFieldComponent} from './simplified-editor-field.component';
+
+/**
+ * A subfield that a user can edit, which will later be
+ * compiled into MARC
+ */
+
+@Component({
+ selector: 'eg-marc-simplified-editor-subfield',
+ template: ''
+})
+export class MarcSimplifiedEditorSubfieldComponent implements OnInit {
+
+ @Input() code: string;
+ @Input() defaultValue: string;
+
+ constructor(@Host() private field: MarcSimplifiedEditorFieldComponent) {}
+
+ ngOnInit() {
+ this.field.addSubfield(this.code, this.defaultValue);
+ }
+
+}
+++ /dev/null
-import {Directive, Input, Host, OnInit} from '@angular/core';
-import {MarcSimplifiedEditorFieldDirective} from './simplified-editor-field.directive';
-
-/**
- * A subfield that a user can edit, which will later be
- * compiled into MARC
- */
-
-@Directive({
- selector: 'eg-marc-simplified-editor-subfield',
-})
-export class MarcSimplifiedEditorSubfieldDirective implements OnInit {
-
- @Input() code: string;
- @Input() defaultValue: string;
-
- constructor(@Host() private field: MarcSimplifiedEditorFieldDirective) {}
-
- ngOnInit() {
- this.field.addSubfield(this.code, this.defaultValue);
- }
-
-}
import {MarcField, MarcRecord} from '../marcrecord';
import {TagTableService} from '../tagtable.service';
import {NetService} from '@eg/core/net.service';
-import { ComboboxEntry } from '@eg/share/combobox/combobox.component';
-import { Observable, of } from 'rxjs';
-import { switchMap } from 'rxjs/operators';
+import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
const DEFAULT_RECORD_TYPE = 'BKS';
field.fieldId = this.fieldIndex;
this.fields.push(field);
field.subfields.forEach((subfield) => {
- this.editor.addControl(this.editorFieldIdentifier(field, subfield), new FormControl(null, []));
- })
+ this.editor.addControl(this.editorFieldIdentifier(field, subfield), new FormControl(null, []));
+ });
this.fieldIndex++;
};
this.editorFieldIdentifier = (field: MarcField, subfield: Array<any>) => {
return field.tag + subfield[0]; // e.g. 245a
- }
+ };
this.net.request('open-ils.cat',
'open-ils.cat.biblio.fixed_field_values.by_rec_type',
DEFAULT_RECORD_TYPE, 'Form')
.subscribe((forms) => {
this.marcForms = forms['Form'].map((form) => {
- return {id: form[0], label: form[1]}
- })
+ return {id: form[0], label: form[1]};
+ });
});
this.net.request('open-ils.cat',
DEFAULT_RECORD_TYPE, 'Type')
.subscribe((types) => {
this.marcTypes = types['Type'].map((type) => {
- return {id: type[0], label: type[1]}
- })
+ return {id: type[0], label: type[1]};
+ });
});
}
this.fields.forEach((field) => {
field.subfields.forEach((subfield) => {
this.subfieldLabels[this.editorFieldIdentifier(field, subfield)] = table.getSubfieldLabel(field.tag, subfield[0]);
- })
+ });
});
});
}
field.subfields.forEach((subfield) => {
if (subfield[1] === '') { // Default value has not been applied
subfield[1] = this.editor.get(this.editorFieldIdentifier(field, subfield)).value;
- }
- })
+ }
+ });
});
record.fields = this.fields;
import {StaffCommonModule} from '@eg/staff/common.module';
import {CommonWidgetsModule} from '@eg/share/common-widgets.module';
import {MarcSimplifiedEditorComponent} from './simplified-editor.component';
-import {MarcSimplifiedEditorFieldDirective} from './simplified-editor-field.directive';
-import {MarcSimplifiedEditorSubfieldDirective} from './simplified-editor-subfield.directive';
+import {MarcSimplifiedEditorFieldComponent} from './simplified-editor-field.component';
+import {MarcSimplifiedEditorSubfieldComponent} from './simplified-editor-subfield.component';
import {TagTableService} from '../tagtable.service';
@NgModule({
declarations: [
MarcSimplifiedEditorComponent,
- MarcSimplifiedEditorFieldDirective,
- MarcSimplifiedEditorSubfieldDirective,
+ MarcSimplifiedEditorFieldComponent,
+ MarcSimplifiedEditorSubfieldComponent,
],
imports: [
StaffCommonModule,
],
exports: [
MarcSimplifiedEditorComponent,
- MarcSimplifiedEditorFieldDirective,
- MarcSimplifiedEditorSubfieldDirective
+ MarcSimplifiedEditorFieldComponent,
+ MarcSimplifiedEditorSubfieldComponent
],
providers: [
TagTableService