diff --git a/frontend/app/framework/angular/forms/editors/checkbox-group.component.html b/frontend/app/framework/angular/forms/editors/checkbox-group.component.html index 03ac612dd..0825af933 100644 --- a/frontend/app/framework/angular/forms/editors/checkbox-group.component.html +++ b/frontend/app/framework/angular/forms/editors/checkbox-group.component.html @@ -1,9 +1,11 @@ -
- - - +
+
+ + + +
\ No newline at end of file diff --git a/frontend/app/framework/angular/forms/editors/checkbox-group.component.scss b/frontend/app/framework/angular/forms/editors/checkbox-group.component.scss index ce04eb06c..923fbc3a3 100644 --- a/frontend/app/framework/angular/forms/editors/checkbox-group.component.scss +++ b/frontend/app/framework/angular/forms/editors/checkbox-group.component.scss @@ -1,13 +1,10 @@ -.form-check { - display: block; - margin-bottom: .5rem; - margin-left: 0; -} +.form-check-block { + & { + margin-bottom: .5rem; + margin-left: 0; + } -.form-check-input { - margin-top: .4rem; -} - -label { - min-width: 5rem; + .form-check-input { + margin-top: .4rem; + } } \ No newline at end of file diff --git a/frontend/app/framework/angular/forms/editors/checkbox-group.component.ts b/frontend/app/framework/angular/forms/editors/checkbox-group.component.ts index 74998408b..e1107bdcd 100644 --- a/frontend/app/framework/angular/forms/editors/checkbox-group.component.ts +++ b/frontend/app/framework/angular/forms/editors/checkbox-group.component.ts @@ -7,7 +7,7 @@ // tslint:disable: readonly-array -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input } from '@angular/core'; +import { AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, forwardRef, Input, OnChanges, ViewChild } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { @@ -20,6 +20,8 @@ export const SQX_CHECKBOX_GROUP_CONTROL_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CheckboxGroupComponent), multi: true }; +let CACHED_FONT: string; + interface State { // The checked values. checkedValues: ReadonlyArray; @@ -34,9 +36,18 @@ interface State { ], changeDetection: ChangeDetectionStrategy.OnPush }) -export class CheckboxGroupComponent extends StatefulControlComponent { +export class CheckboxGroupComponent extends StatefulControlComponent implements AfterViewInit, AfterViewChecked, OnChanges { + private childrenWidth = 0; + private containerWidth = 0; + private labelsMeasured = false; + public readonly controlId = MathHelper.guid(); + public isSingleLine = false; + + @ViewChild('container', { static: false }) + public containerElement: ElementRef; + @Input() public values: ReadonlyArray = []; @@ -46,6 +57,88 @@ export class CheckboxGroupComponent extends StatefulControlComponent this.values.indexOf(x) >= 0) : []; @@ -70,3 +163,5 @@ export class CheckboxGroupComponent extends StatefulControlComponent= 0; } } + +let canvas: HTMLCanvasElement | null = null; \ No newline at end of file