diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1987df171..a0e826c71 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -54,6 +54,7 @@ import { SafeHtmlPipe } from './safe-html.pipe'; import { LhcButtonPopoverComponent } from './lhc-button-popover/lhc-button-popover.component'; import { LhcItemAttachmentComponent } from './lhc-item-attachment/lhc-item-attachment.component'; import { LhcItemMessagesComponent } from './lhc-item-messages/lhc-item-messages.component'; +import { LhcGroupGridComponent } from './lhc-group-grid/lhc-group-grid.component'; registerLocaleData(en); @@ -87,7 +88,8 @@ registerLocaleData(en); SafeHtmlPipe, LhcButtonPopoverComponent, LhcItemAttachmentComponent, - LhcItemMessagesComponent + LhcItemMessagesComponent, + LhcGroupGridComponent ], imports: [ BrowserModule, diff --git a/src/app/lhc-form/lhc-form.component.html b/src/app/lhc-form/lhc-form.component.html index 64d13041c..f3a3a3b35 100644 --- a/src/app/lhc-form/lhc-form.component.html +++ b/src/app/lhc-form/lhc-form.component.html @@ -1,7 +1,7 @@
- {{lhcFormData.name || lhcFormData.fhirQName}} [{{ lhcFormData.code }}] @@ -21,6 +21,9 @@ + + + diff --git a/src/app/lhc-group-grid/lhc-group-grid.component.css b/src/app/lhc-group-grid/lhc-group-grid.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/lhc-group-grid/lhc-group-grid.component.html b/src/app/lhc-group-grid/lhc-group-grid.component.html new file mode 100644 index 000000000..f57906f48 --- /dev/null +++ b/src/app/lhc-group-grid/lhc-group-grid.component.html @@ -0,0 +1,51 @@ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{item.question}}{{header}}
+ + + +
+ + +
+
+
+ + +
+
+
diff --git a/src/app/lhc-group-grid/lhc-group-grid.component.spec.ts b/src/app/lhc-group-grid/lhc-group-grid.component.spec.ts new file mode 100644 index 000000000..48b4ecfff --- /dev/null +++ b/src/app/lhc-group-grid/lhc-group-grid.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LhcGroupGridComponent } from './lhc-group-grid.component'; + +describe('LhcGroupGridComponent', () => { + let component: LhcGroupGridComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ LhcGroupGridComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(LhcGroupGridComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/lhc-group-grid/lhc-group-grid.component.ts b/src/app/lhc-group-grid/lhc-group-grid.component.ts new file mode 100644 index 000000000..be2c91995 --- /dev/null +++ b/src/app/lhc-group-grid/lhc-group-grid.component.ts @@ -0,0 +1,31 @@ +import { Component, Input } from '@angular/core'; +import { LhcDataService} from '../../lib/lhc-data.service'; + +@Component({ + selector: 'lhc-group-grid', + templateUrl: './lhc-group-grid.component.html', + styleUrls: ['./lhc-group-grid.component.css'] +}) +export class LhcGroupGridComponent { + + + @Input() item; + @Input() formLevel: boolean = false; + uniqueGridHeaders: any[] = []; + constructor(public lhcDataService: LhcDataService) { + } + + ngOnInit(): void { + this.createCustomHeaders(this.item); + } + + createCustomHeaders(item):void{ + item.items.forEach(questionItems => { + questionItems.items.forEach(subItems => { + if(!this.uniqueGridHeaders.includes(subItems.question) && subItems.skipLogic?.conditions[0]?.trigger?.value != 'alwaysHide'){ + this.uniqueGridHeaders.push(subItems.question); + } + }); + }); + } +} diff --git a/src/app/lhc-item-group/lhc-item-group.component.html b/src/app/lhc-item-group/lhc-item-group.component.html index 7bfa62de7..a692c732b 100644 --- a/src/app/lhc-item-group/lhc-item-group.component.html +++ b/src/app/lhc-item-group/lhc-item-group.component.html @@ -8,4 +8,7 @@ + + +
diff --git a/src/fhir/sdc-import-common.js b/src/fhir/sdc-import-common.js index 936c17942..8552f28f7 100644 --- a/src/fhir/sdc-import-common.js +++ b/src/fhir/sdc-import-common.js @@ -801,13 +801,19 @@ function addCommonSDCImportFns(ns) { break; case 'Table': // backward-compatibility with old export case 'gtable': // Not in STU3, but we'll accept it - if(lfItem.dataType === 'SECTION') { + if (lfItem.dataType === 'SECTION') { displayControl.questionLayout = "horizontal"; } break; + + case 'grid': // Not in STU3, but we'll accept it + if (lfItem.dataType === 'SECTION') { + displayControl.questionLayout = "grid"; + } + break; case 'Matrix': // backward-compatibility with old export case 'table': - if(lfItem.dataType === 'SECTION') { + if (lfItem.dataType === 'SECTION') { displayControl.questionLayout = "matrix"; } break; diff --git a/src/grid-table.css b/src/grid-table.css new file mode 100644 index 000000000..bd8fd2585 --- /dev/null +++ b/src/grid-table.css @@ -0,0 +1,61 @@ +/*** grid layout ***/ +.lhc-form .lhc-layout-grid.lhc-item { + padding-bottom: 2px; + } + .lhc-form .lhc-form-grid-table { + border-collapse: separate; + border-radius: 4px; + box-sizing: border-box; + margin: 2px 4px 0 1px; + text-align: left; + border: 1px solid #ced5d9; + } + .lhc-form .lhc-form-grid-table .lhc-grid-table-header-row { + background: #E8E8E8; + } + + .lhc-form-grid-table-header { + overflow: hidden; + vertical-align: top; + background: none repeat scroll 0 0 #E8E8E8; + padding: 4px 2px; + text-align: left ; + color: #666666; + font-weight: 400; + -moz-border-radius: 4px; + border-radius: 4px; + } + + .lhc-form .lhc-form-grid-table-title { + background: #e6f1ff; /*#E8E8E8;*/ + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0 0 0 1px; + text-align: left; + + border-width: 0; + border-top: 2px solid white; /* leave space between headers */ + padding: 4px 2px 4px 2px; + } + .lhc-form .lhc-form-grid-table .lhc-question { + width: 25%; + } + .lhc-form .lhc-form-grid-answer { + padding-left: 5px; + padding-right: 5px; + } + + .lhc-form .lhc-form-grid-cell-other { + text-align: center; + } + .lhc-form .lhc-form-grid-table th { + padding: 4px; + } + .lhc-form .lhc-form-grid-table td { + padding: 4px; + border-top: 1px solid #ced5d9; + } + /*** end of grid layout ***/ \ No newline at end of file diff --git a/src/lhc-form.css b/src/lhc-form.css index c83e8ba93..1329d4e49 100644 --- a/src/lhc-form.css +++ b/src/lhc-form.css @@ -232,6 +232,10 @@ .lhc-form.lf-template-table .lhc-layout-matrix { padding-right: 6px; } +/*** grid layout ***/ +.lhc-form.lf-template-table .lhc-layout-grid { + padding-right: 6px; +} /* not to show title when the entire form is in horizontal or matrix layout */ .lf-top-section .lhc-layout-horizontal .lhc-form-horizontal-table-title, diff --git a/src/treeline-bar.css b/src/treeline-bar.css index 3cc8a2cab..27bfc8b01 100644 --- a/src/treeline-bar.css +++ b/src/treeline-bar.css @@ -46,6 +46,23 @@ } /* end of tree lines */ +/*no tree lines for form level horizontal and grid layouts */ +.lf-top-section .lhc-layout-grid.lhc-item, +.lf-top-section .lhc-layout-grid.lhc-item { + padding: 0 4px 0 3px; +} +.lf-top-section .lhc-layout-horizontal.lhc-item::before, +.lf-top-section .lhc-layout-grid.lhc-item::before { + border: 0; +} +.lf-top-section .lhc-layout-horizontal.lhc-item::after, +.lf-top-section .lhc-layout-grid.lhc-item::after { + border: 0; +} +/* end of tree lines */ + + + /* bar style */ /* no horizontal bar */ .lf-indentation-bar .lhc-item::before {