From a17518d24471282ddb667552657365a38bdff7a3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 11 Jul 2018 10:35:05 -0400 Subject: [PATCH] LP#1775466 Grid vert expand fixes; lint updates Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/core/format.service.ts | 2 +- .../src/app/share/catalog/marc-html.component.ts | 4 ++-- .../app/share/combobox/combobox-entry.component.ts | 2 +- .../src/app/share/combobox/combobox.component.ts | 22 +++++++++++----------- .../src/eg2/src/app/share/grid/grid.component.css | 8 ++++++-- .../src/eg2/src/app/share/grid/grid.component.ts | 2 +- Open-ILS/src/eg2/src/app/share/grid/grid.ts | 4 +++- .../app/share/org-select/org-select.component.ts | 6 +++--- Open-ILS/src/eg2/src/app/staff/login.component.ts | 4 ++-- .../eg2/src/app/staff/sandbox/sandbox.component.ts | 8 ++++---- 10 files changed, 34 insertions(+), 28 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/core/format.service.ts b/Open-ILS/src/eg2/src/app/core/format.service.ts index f8bf0d908d..e384f22e38 100644 --- a/Open-ILS/src/eg2/src/app/core/format.service.ts +++ b/Open-ILS/src/eg2/src/app/core/format.service.ts @@ -36,7 +36,7 @@ export class FormatService { // not available in PhantomJS for unit testing. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN if (!Number.isNaN) { - // "The following works because NaN is the only value + // "The following works because NaN is the only value // in javascript which is not equal to itself." Number.isNaN = (value: any) => { return value !== value; diff --git a/Open-ILS/src/eg2/src/app/share/catalog/marc-html.component.ts b/Open-ILS/src/eg2/src/app/share/catalog/marc-html.component.ts index 0f782219b9..38b1da779b 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/marc-html.component.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/marc-html.component.ts @@ -43,7 +43,7 @@ export class MarcHtmlComponent implements OnInit { let service = 'open-ils.search'; let method = 'open-ils.search.biblio.record.html'; - let params: any[] = [this.recId]; + const params: any[] = [this.recId]; switch (this.recType) { @@ -79,7 +79,7 @@ export class MarcHtmlComponent implements OnInit { // remove reference to nonexistant CSS file html = html.replace(//, ''); - // there shouldn't be any, but while we're at it, + // there shouldn't be any, but while we're at it, // kill any embedded script tags html = html.replace(//, ''); diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox-entry.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox-entry.component.ts index 059a4398c9..26015b7b60 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox-entry.component.ts +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox-entry.component.ts @@ -5,7 +5,7 @@ import {ComboboxComponent} from './combobox.component'; selector: 'eg-combobox-entry', template: '' }) -export class ComboboxEntryComponent implements OnInit{ +export class ComboboxEntryComponent implements OnInit { @Input() entryId: any; @Input() entryLabel: string; diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts index 9e5dce78db..39e9b59503 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts @@ -53,7 +53,7 @@ export class ComboboxComponent implements OnInit { @Input() allowFreeText = false; // Add a 'required' attribute to the input - isRequired: boolean + isRequired: boolean; @Input() set required(r: boolean) { this.isRequired = r; } @@ -87,7 +87,7 @@ export class ComboboxComponent implements OnInit { // When the UI value is cleared, null is emitted. @Output() onChange: EventEmitter; - // Useful for massaging the match string prior to comparison + // Useful for massaging the match string prior to comparison // and display. Default version trims leading/trailing spaces. formatDisplayString: (ComboboxEntry) => string; @@ -119,10 +119,10 @@ export class ComboboxComponent implements OnInit { // Apply a default selection where needed applySelection() { - if (this.startId && + if (this.startId && this.entrylist && !this.defaultSelectionApplied) { - const entry = + const entry = this.entrylist.filter(e => e.id === this.startId)[0]; if (entry) { @@ -155,7 +155,7 @@ export class ComboboxComponent implements OnInit { id: null, label: this.selected, freetext: true - } + }; } else { @@ -184,9 +184,9 @@ export class ComboboxComponent implements OnInit { return new Observable(observer => { this.asyncDataSource(term).subscribe( - (entry: ComboboxEntry) => { - if (!this.asyncIds[''+entry.id]) { - this.asyncIds[''+entry.id] = true; + (entry: ComboboxEntry) => { + if (!this.asyncIds['' + entry.id]) { + this.asyncIds['' + entry.id] = true; this.addEntry(entry); } }, @@ -195,7 +195,7 @@ export class ComboboxComponent implements OnInit { observer.next(term); observer.complete(); } - ) + ); }); } @@ -206,7 +206,7 @@ export class ComboboxComponent implements OnInit { // Merge click actions in with the stream of text entry merge( - // Inject a specifier indicating the source of the + // Inject a specifier indicating the source of the // action is a user click instead of a text entry. // This tells the filter to show all values in sync mode. this.click$.pipe(filter(() => @@ -230,7 +230,7 @@ export class ComboboxComponent implements OnInit { // Filter entrylist whose labels substring-match the // text entered. - return this.entrylist.filter(entry => + return this.entrylist.filter(entry => entry.label.toLowerCase().indexOf(term.toLowerCase()) > -1 ); }) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.component.css b/Open-ILS/src/eg2/src/app/share/grid/grid.component.css index ecf305cb79..a16bb4eb8b 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.component.css +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.component.css @@ -57,10 +57,14 @@ overflow: hidden; } +/* in overflow mode, allow white space to wrap so the + * full contents of the cell can be seen inline. leaving + * text-overflow and overlow as-is means long strings with + * no space will still be truncated with ellipses to avoid + * inconsistent grid column widths + */ .eg-grid-cell-overflow { white-space: normal; - text-overflow: inherit; - overflow: inherit; } .eg-grid-body-cell { diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts index fb8b92db02..06522f6c02 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, Output, OnInit, AfterViewInit, EventEmitter, +import {Component, Input, Output, OnInit, AfterViewInit, EventEmitter, OnDestroy, HostListener, ViewEncapsulation} from '@angular/core'; import {Subscription} from 'rxjs/Subscription'; import {IdlService} from '@eg/core/idl.service'; diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index bed200c21c..8b2f7b2cc6 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -240,7 +240,9 @@ export class GridColumnSet { if (this.defaultHiddenFields) { this.defaultHiddenFields.forEach(name => { const col = this.getColByName(name); - if (col) col.visible = false; + if (col) { + col.visible = false; + } }); } diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts index 83c616da3f..539b2fe326 100644 --- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts @@ -144,13 +144,13 @@ export class OrgSelectComponent implements OnInit { debounceTime(200), distinctUntilChanged(), merge( - // Inject a specifier indicating the source of the + // Inject a specifier indicating the source of the // action is a user click this.click$.pipe(filter(() => !this.instance.isPopupOpen())) .pipe(mapTo('_CLICK_')) ), map(term => { - + let orgs = this.org.list().filter(org => this.hidden.filter(id => org.id() === id).length === 0 ); @@ -165,7 +165,7 @@ export class OrgSelectComponent implements OnInit { }); } - + return orgs.map(org => this.formatForDisplay(org)); }) ); diff --git a/Open-ILS/src/eg2/src/app/staff/login.component.ts b/Open-ILS/src/eg2/src/app/staff/login.component.ts index d33bf0b0d1..3413ea29b1 100644 --- a/Open-ILS/src/eg2/src/app/staff/login.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/login.component.ts @@ -62,8 +62,8 @@ export class StaffLoginComponent implements OnInit { // prevent sending the user back to the login page or looping // back to the workstation removal page. if (url.startsWith('/staff/login') || - url.startsWith('/staff/admin/workstation/workstations/remove/')) { - url = '/staff/splash'; + url.startsWith('/staff/admin/workstation/workstations/remove/')) { + url = '/staff/splash'; } const workstation: string = this.args.workstation; 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 c415f8f509..9314e709cc 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 @@ -71,21 +71,21 @@ export class SandboxComponent implements OnInit { {name: 'The Tick', state: 'TX'} ]; - this.pcrud.retrieveAll('cmrcfld', {order_by:{cmrcfld: 'name'}}) + this.pcrud.retrieveAll('cmrcfld', {order_by: {cmrcfld: 'name'}}) .subscribe(format => { if (!this.cbEntries) { this.cbEntries = []; } - this.cbEntries.push({id: format.id(), label: format.name()}) + this.cbEntries.push({id: format.id(), label: format.name()}); }); this.cbAsyncSource = term => { return this.pcrud.search( - 'cmrcfld', + 'cmrcfld', {name: {'ilike': `%${term}%`}}, // could -or search on label {order_by: {cmrcfld: 'name'}} ).pipe(map(marcField => { return {id: marcField.id(), label: marcField.name()}; })); - } + }; this.btSource.getRows = (pager: Pager, sort: any[]) => { -- 2.11.0