From 36cff0efb782810664d779c9dc8dcdf5811bc723 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 25 Nov 2019 15:36:34 -0500 Subject: [PATCH] LPXXX editor continued Signed-off-by: Bill Erickson --- .../context-menu-container.component.html | 7 +-- .../share/marc-edit/editable-content.component.css | 2 +- .../marc-edit/editable-content.component.html | 4 +- .../share/marc-edit/editable-content.component.ts | 30 ++++++---- .../staff/share/marc-edit/editor.component.html | 8 ++- .../share/marc-edit/rich-editor.component.html | 29 ++++++---- .../app/staff/share/marc-edit/tagtable.service.ts | 67 +++++++++++++++++++--- 7 files changed, 109 insertions(+), 38 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html index d32159a30e..0d6c0a0ede 100644 --- a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html +++ b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html @@ -1,9 +1,8 @@ +
- {{entry.label}} + (click)="entryClicked(entry)" class="menu-entry {{entryClasses}}"> + {{entry.label}}
diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.css b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.css index 7a1c050beb..e21bb843d8 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.css +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.css @@ -12,7 +12,7 @@ div[contenteditable] { /* match angjs color */ color: rgb(0, 0, 255)!important; /* snuggle up to my subfield code */ - margin-right: -1rem; + margin-right: -0.5rem; } .sf-code { diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html index f44f711162..e5da09ba0b 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html @@ -3,7 +3,7 @@
- + + + - + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.html index df18818a20..ca090f368e 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.html @@ -19,20 +19,24 @@
+ fieldText="LDR" i18n-fieldText moreClasses="p-1"> - +
- + + - +
@@ -41,17 +45,18 @@ *ngFor="let field of dataFields()"> - + - + - + @@ -59,18 +64,18 @@ + moreClasses="sf-delimiter border-right-0 bg-transparent p-1 pr-0"> + moreClasses="sf-code border-left-0 p-1 pl-0"> + [field]="field" [subfield]="subfield" moreClasses="p-1 pt-2">
diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/tagtable.service.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/tagtable.service.ts index 1896e75fed..9918739934 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/tagtable.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/tagtable.service.ts @@ -29,13 +29,49 @@ export class TagTableService { ffPosMap: {[rtype: string]: any[]} = {}; ffValueMap: {[rtype: string]: any} = {}; + extractedValuesCache: + {[valueType: string]: {[which: string]: any}} = {}; + constructor( private store: StoreService, private auth: AuthService, private net: NetService, private pcrud: PcrudService, private evt: EventService - ) {} + ) { + this.extractedValuesCache.fieldtags = {}; + this.extractedValuesCache.indicators = {}; + this.extractedValuesCache.sfcodes = {}; + this.extractedValuesCache.sfvalues = {}; + } + + // Various data needs munging for display. Cached the modified + // values since they are refernced repeatedly by the UI code. + fromCache(dataType: string, which?: string, which2?: string): ValueLabelPair[] { + const part1 = this.extractedValuesCache[dataType][which]; + if (which2) { + if (part1) { + return part1[which2]; + } + } else { + return part1; + } + } + + toCache(dataType: string, which: string, + which2: string, values: ValueLabelPair[]): ValueLabelPair[] { + const base = this.extractedValuesCache[dataType]; + const part1 = base[which]; + + if (which2) { + if (!base[which]) { base[which] = {}; } + base[which][which2] = values; + } else { + base[which] = values; + } + + return values; + } getFFPosTable(rtype: string): Promise { const storeKey = 'FFPosTable_' + rtype; @@ -126,15 +162,24 @@ export class TagTableService { getSubfieldCodes(tag: string): ValueLabelPair[] { if (!tag || !this.tagMap[tag]) { return null; } - return this.tagMap[tag].subfields.map(sf => ({ + const cached = this.fromCache('sfcodes', tag); + + const list = this.tagMap[tag].subfields.map(sf => ({ value: sf.code, label: `${sf.code}: ${sf.description}` })) .sort((a, b) => a.label < b.label ? -1 : 1); + + return this.toCache('sfcodes', tag, null, list); } getFieldTags(): ValueLabelPair[] { + + const cached = this.fromCache('fieldtags'); + if (cached) { return cached; } + return Object.keys(this.tagMap) + .filter(tag => Boolean(this.tagMap[tag])) .map(tag => ({ value: tag, label: `${tag}: ${this.tagMap[tag].name}` @@ -145,6 +190,9 @@ export class TagTableService { getSubfieldValues(tag: string, sfCode: string): ValueLabelPair[] { if (!tag || !this.tagMap[tag]) { return []; } + const cached = this.fromCache('sfvalues', tag, sfCode) + if (cached) { return cached; } + const list: ValueLabelPair[] = []; this.tagMap[tag].subfields @@ -161,20 +209,25 @@ export class TagTableService { }) }); - return list.sort((a, b) => a.label < b.label ? -1 : 1); + return this.toCache('sfvalues', tag, sfCode, list); } - getIndicatorValues(tag: string, pos: number): ValueLabelPair[] { + getIndicatorValues(tag: string, which: 'ind1' | 'ind2'): ValueLabelPair[] { if (!tag || !this.tagMap[tag]) { return } - const value = this.tagMap[tag][`ind${pos}`]; - if (!value) { return; } + const cached = this.fromCache('indicators', tag, which); + if (cached) { return cached; } - return value.map(tag => ({ + let values = this.tagMap[tag][which]; + if (!values) { return; } + + values = values.map(value => ({ value: value.code, label: `${value.code}: ${value.description}` })) .sort((a, b) => a.label < b.label ? -1 : 1); + + return this.toCache('indicators', tag, which, values); } } -- 2.11.0