// 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;
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) {
// remove reference to nonexistant CSS file
html = html.replace(/<link(.*?)\/>/, '');
- // 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(/<script(.*?)<\/script>/, '');
selector: 'eg-combobox-entry',
template: '<ng-template></ng-template>'
})
-export class ComboboxEntryComponent implements OnInit{
+export class ComboboxEntryComponent implements OnInit {
@Input() entryId: any;
@Input() entryLabel: string;
@Input() allowFreeText = false;
// Add a 'required' attribute to the input
- isRequired: boolean
+ isRequired: boolean;
@Input() set required(r: boolean) {
this.isRequired = r;
}
// When the UI value is cleared, null is emitted.
@Output() onChange: EventEmitter<ComboboxEntry>;
- // 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;
// 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) {
id: null,
label: this.selected,
freetext: true
- }
+ };
} else {
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);
}
},
observer.next(term);
observer.complete();
}
- )
+ );
});
}
// 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(() =>
// 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
);
})
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 {
-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';
if (this.defaultHiddenFields) {
this.defaultHiddenFields.forEach(name => {
const col = this.getColByName(name);
- if (col) col.visible = false;
+ if (col) {
+ col.visible = false;
+ }
});
}
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
);
});
}
-
+
return orgs.map(org => this.formatForDisplay(org));
})
);
// 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;
{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[]) => {