LPXXX editor continued
authorBill Erickson <berickxx@gmail.com>
Thu, 21 Nov 2019 21:07:06 +0000 (16:07 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 6 Dec 2019 15:37:03 +0000 (10:37 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.css
Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html
Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.ts
Open-ILS/src/eg2/src/app/staff/share/marc-edit/fixed-field.component.html
Open-ILS/src/eg2/src/app/staff/share/marc-edit/fixed-field.component.ts
Open-ILS/src/eg2/src/app/staff/share/marc-edit/fixed-fields-editor.component.html
Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.css
Open-ILS/src/eg2/src/app/staff/share/marc-edit/rich-editor.component.html

index 1206312..d84ad8a 100644 (file)
@@ -8,7 +8,15 @@ div[contenteditable] {
    min-height: calc(1.5em + .75rem + 2px);
 }
 
-/* snuggle the delimiter and subfield codes */
-.sf-delimiter { margin-right: -0.4rem; }
-.sf-code { margin-left: -0.4rem; }
+.sf-delimiter { 
+  /* match angjs color */
+  color: rgb(0, 0, 255); 
+  /* snuggle up to my subfield code */
+  margin-right: -1rem; 
+}
+
+.sf-code { 
+  /* match angjs color */
+  color: rgb(0, 0, 255); 
+}
 
index f63f5aa..87fd2cf 100644 (file)
@@ -2,7 +2,7 @@
 <ng-container *ngIf="bigText">
   <div contenteditable
     id='{{randId}}' 
-    class="d-inline-block p-1 text-break {{moreClasses}}"
+    class="d-inline-block p-1 pt-2 text-dark text-break {{moreClasses}}"
     [attr.tabindex]="fieldText ? -1 : ''"
     (keydown)="inputKeyDown($event)"
     (focus)="focusBigText()"
@@ -13,7 +13,7 @@
 <ng-container *ngIf="!bigText">
   <input 
     id='{{randId}}' 
-    class="p-0 pl-1 text-break rounded-0 form-control {{moreClasses}}"
+    class="p-0 pl-1 text-dark rounded-0 form-control {{moreClasses}}"
     [size]="inputSize()" 
     [maxlength]="maxLength || ''"
     [disabled]="fieldText" 
index 1c3cc11..1dcbbf0 100644 (file)
@@ -143,7 +143,10 @@ export class EditableContentComponent implements OnInit, AfterViewInit {
     }
 
     inputSize(): number {
-        // give at least 2 chars space and grow with the content
+        if (this.maxLength) {
+            return this.maxLength;
+        }
+        // give at least 2+ chars space and grow with the content
         return Math.max(2, (this.getContent() || '').length) * 1.1;
     }
 
@@ -169,6 +172,9 @@ export class EditableContentComponent implements OnInit, AfterViewInit {
             case 'Delete': return this.keyDelete(evt);
             case 'ArrowDown': return this.keyArrowDown(evt);
             case 'ArrowUp': return this.keyArrowUp(evt);
+            case 'F6': return this.keyF6(evt);
+            case 'F7': return this.keyF7(evt);
+            case 'F8': return this.keyF8(evt);
         }
     }
 
@@ -243,12 +249,12 @@ export class EditableContentComponent implements OnInit, AfterViewInit {
                 this.field, 
                 this.context.record.cloneField(this.field)
             );
+        }
 
-            const field = this.record.getNextField(this.field.fieldId);
-            if (field) {
-                this.context.requestFieldFocus(
-                    {fieldId: field.fieldId, target: 'tag'});
-            }
+        const field = this.record.getNextField(this.field.fieldId);
+        if (field) {
+            this.context.requestFieldFocus(
+                {fieldId: field.fieldId, target: 'tag'});
         }
 
         evt.preventDefault();
@@ -264,15 +270,45 @@ export class EditableContentComponent implements OnInit, AfterViewInit {
                 this.field, 
                 this.context.record.cloneField(this.field)
             );
+        }
 
-            const field = this.record.getPreviousField(this.field.fieldId);
-            if (field) {
-                this.context.requestFieldFocus(
-                    {fieldId: field.fieldId, target: 'tag'});
-            }
+        const field = this.record.getPreviousField(this.field.fieldId);
+        if (field) {
+            this.context.requestFieldFocus(
+                {fieldId: field.fieldId, target: 'tag'});
         }
 
         evt.preventDefault();
     }
+
+    keyF6(evt: KeyboardEvent) {
+        console.log('f6');
+
+        if (evt.shiftKey) {
+
+            evt.preventDefault();
+            evt.stopPropagation();
+        }
+    }
+
+    keyF7(evt: KeyboardEvent) {
+        console.log('f7');
+
+        if (evt.shiftKey) {
+
+            evt.preventDefault();
+            evt.stopPropagation();
+        }
+    }
+
+    keyF8(evt: KeyboardEvent) {
+        console.log('f8');
+
+        if (evt.shiftKey) {
+            evt.preventDefault();
+            evt.stopPropagation();
+        }
+    }
 }
 
+
index 4ec4523..3cd6d73 100644 (file)
@@ -9,11 +9,14 @@
     </div>
   </ng-template>
 
-  <div class="form-inline d-flex border-bottom">
-    <label for='fixed-field-input-{{field}}' class="pr-2 flex-1">
-      {{fieldLabel}}
-    </label>
-    <input id='fixed-field-input-{{fieldCode}}-{{randId}}'
+  <div class="form-inline d-flex">
+    <div class="pr-2 flex-1">
+      <span id='label-{{randId}}' class="text-left font-weight-bold">
+        {{fieldLabel}}
+      </span>
+    </div>
+    <input 
+      [attr.aria-labelledby]="'label-' + randId"
       class="form-control rounded-0 flex-1 pl-1" type="text" 
       (change)="valueChange()"
       [(ngModel)]="fieldValue" 
index 28ad9d3..1f6bb8e 100644 (file)
@@ -32,13 +32,9 @@ export class FixedFieldComponent implements OnInit {
     fieldLength: number = null;
     fieldValues: FixedFieldValue[] = null;
     popOver: NgbPopover;
-    randId: string;
+    randId = Math.floor(Math.random() * 10000000);
 
-    constructor(
-        private tagTable: TagTableService
-    ) {
-        this.randId = Math.random().toFixed(5);
-    }
+    constructor(private tagTable: TagTableService) {}
 
     ngOnInit() {
         this.init().then(_ =>
index 33497e4..97d866f 100644 (file)
@@ -1,4 +1,4 @@
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="Type" fieldLabel="Type"></eg-fixed-field>
@@ -24,7 +24,7 @@
       fieldCode="Lang" fieldLabel="Lang"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="BLvl" fieldLabel="BLvl"></eg-fixed-field>
@@ -50,7 +50,7 @@
       fieldCode="Ctry" fieldLabel="Ctry"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="s_l" fieldLabel="s_l"></eg-fixed-field>
@@ -76,7 +76,7 @@
       fieldCode="Alph" fieldLabel="Alph"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="Desc" fieldLabel="Desc"></eg-fixed-field>
       fieldCode="Date2" fieldLabel="Date2"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="SrTp" fieldLabel="SrTp"></eg-fixed-field>
       fieldCode="EntW" fieldLabel="EntW"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="TrAr" fieldLabel="TrAr"></eg-fixed-field>
       fieldCode="Comp" fieldLabel="Comp"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="SpFm" fieldLabel="SpFm"></eg-fixed-field>
       fieldCode="CrTp" fieldLabel="CrTp"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="TMat" fieldLabel="TMat"></eg-fixed-field>
       fieldCode="File" fieldLabel="File"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="Type_tbmfhd" fieldLabel="Type_tbmfhd"></eg-fixed-field>
       fieldCode="CatLang" fieldLabel="CatLang"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="Kind" fieldLabel="Kind"></eg-fixed-field>
       fieldCode="NameUse" fieldLabel="NameUse"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="SubjUse" fieldLabel="SubjUse"></eg-fixed-field>
       fieldCode="UpdStatus" fieldLabel="UpdStatus"></eg-fixed-field>
   </div>
 </div>
-<div class="row pb-1">
+<div class="row p-0">
   <div class="col-lg-2">
     <eg-fixed-field i18n-fieldLabel [context]="context" 
       fieldCode="Name" fieldLabel="Name"></eg-fixed-field>
index e69de29..5c90f28 100644 (file)
@@ -0,0 +1,8 @@
+
+.fixed-fields-container {
+  /*
+   * wait for https://bugs.launchpad.net/evergreen/+bug/1735568 approval
+  background-color: lightcyan;
+  border-bottom: 1px solid gray;
+  */
+}
index b14628e..dd494ba 100644 (file)
@@ -4,10 +4,10 @@
 </ng-container>
 
 <ng-container *ngIf="dataLoaded">
-  <div class="mt-3 text-monospace" 
+  <div class="mt-3 text-monospace"
     (contextmenu)="$event.preventDefault()">
-    <div class="row">
-      <div class="col-lg-9">
+    <div class="row pb-2">
+      <div class="col-lg-9 fixed-fields-container">
         <eg-fixed-fields-editor [context]="context"></eg-fixed-fields-editor>
       </div>
     </div>
 
         <!-- SUBFIELD DECORATOR/DELIMITER -->
         <eg-marc-editable-content fieldText="‡" i18n-fieldText
-          moreClasses="sf-delimiter text-primary border-right-0 bg-transparent">
+          moreClasses="sf-delimiter border-right-0 bg-transparent">
         </eg-marc-editable-content>
 
         <!-- SUBFIELD CHARACTER -->
         <eg-marc-editable-content [context]="context" fieldType="sfc" 
           [field]="field" [subfield]="subfield" 
-          moreClasses="sf-code text-primary border-left-0">
+          moreClasses="sf-code border-left-0">
         </eg-marc-editable-content>
 
         <!-- SUBFIELD VALUE -->