From: Bill Erickson Date: Fri, 16 Aug 2019 21:00:11 +0000 (-0400) Subject: LP1840050 Modularize various standalone components + more. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3453848854ae58d27e74cdd352b31bc5925a2a98;p=working%2FEvergreen.git LP1840050 Modularize various standalone components + more. Create container modules for the String, Translate, FM record editor, and Admin Page components & services. This simplifies imports and allows us to avoid requiring these modules on pages that don't need them. In particular, the staff splash page now loads fewer imports, which should improve initial load/login time. Additionally some components were enhanced. FM record editor now has a eg-fm-record-editor-action component so users can pass in an action, rendered as a button at the bottom of the editor. FM record editor gets a delete record option and hideBanner option. FM record editor now better handles real-time updates of its underlying recordId and record values, including updates to some editor callers to migrate to the modified API (replace recId with recordId). Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts new file mode 100644 index 0000000000..298856d684 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts @@ -0,0 +1,31 @@ +import {Component, Input, Output, EventEmitter, Host, OnInit} from '@angular/core'; +import {FmRecordEditorComponent} from './fm-editor.component'; + +@Component({ + selector: 'eg-fm-record-editor-action', + template: '' // no-op +}) + +export class FmRecordEditorActionComponent implements OnInit { + + // unique identifier + @Input() key: string; + + @Input() label: string; + + @Input() buttonCss = 'btn-outline-dark'; + + // Emits the 'key' of the clicked action. + @Output() actionClick: EventEmitter; + + @Input() disabled: boolean; + + constructor(@Host() private editor: FmRecordEditorComponent) { + this.actionClick = new EventEmitter(); + } + + ngOnInit() { + this.editor.actions.push(this); + } +} + diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html index fc11eee6c2..afae0effb1 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html @@ -4,8 +4,13 @@ + + + -