From 6c32c679f06237a569c4be96537d8561f91ba54d Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sun, 26 May 2019 11:02:44 -0700 Subject: [PATCH] LP1822414 Ang date select readOnly & fixes Adds an @Input() readOnly field to eg-date-select. When set, the date value will be displayed as plain text - no widget. Teach the eg-fm-editor to pass the readOnly flag to the eg-date-select. Includes sandbox example. Fixes a display issue where the date select calendar button was bigger than the paired input group adding text input, because the material icon was too big. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- .../share/date-select/date-select.component.html | 46 ++++++++++++---------- .../app/share/date-select/date-select.component.ts | 11 +++--- .../app/share/fm-editor/fm-editor.component.html | 1 + .../src/app/staff/sandbox/sandbox.component.html | 9 +++++ .../eg2/src/app/staff/sandbox/sandbox.component.ts | 8 ++++ 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html index 7e65f7628e..6524606eb9 100644 --- a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html +++ b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html @@ -1,23 +1,29 @@ -
- -
- + + {{initialDate | formatValue:'timestamp'}} + + +
+ +
+ +
-
+ diff --git a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts index 625629026f..02d30e2def 100644 --- a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts @@ -9,7 +9,9 @@ import {NgbDateStruct} from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'eg-date-select', - templateUrl: './date-select.component.html' + templateUrl: './date-select.component.html', + /* prevent the calendar mat icon from expanding the button */ + styles: ['.material-icons {font-size: 15px}'] }) export class DateSelectComponent implements OnInit { @@ -19,11 +21,8 @@ export class DateSelectComponent implements OnInit { @Input() required: boolean; @Input() fieldName: string; @Input() domId = ''; - - _disabled: boolean; - @Input() set disabled(d: boolean) { - this._disabled = d; - } + @Input() disabled: boolean; + @Input() readOnly: boolean; current: NgbDateStruct; 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 1b0935fb0a..aac6b0815c 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 @@ -43,6 +43,7 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html index 54cd87d11e..f90b6ad6f6 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html @@ -154,3 +154,12 @@

PCRUD auto flesh and FormatService detection

Fingerprint: {{aMetarecord}}
+ + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts index 543e3cb72b..a15b854bf7 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts @@ -33,6 +33,9 @@ export class SandboxComponent implements OnInit { @ViewChild('fmRecordEditor') private fmRecordEditor: FmRecordEditorComponent; + @ViewChild('bresvEditor') + private bresvEditor: FmRecordEditorComponent; + // @ViewChild('helloStr') private helloStr: StringComponent; gridDataSource: GridDataSource = new GridDataSource(); @@ -134,6 +137,11 @@ export class SandboxComponent implements OnInit { idlField: 'metarecord' }); }); + + const b = this.idl.create('bresv'); + b.cancel_time('2019-03-25T11:07:59-0400'); + this.bresvEditor.mode = 'create'; + this.bresvEditor.record = b; } openEditor() { -- 2.11.0