diff --git a/config.xml b/config.xml index 0b45edf82..8c4e85556 100755 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + RADAR Questionnaire An application that collects active data for research. RADAR-Base diff --git a/src/app/pages/questions/components/question/question.component.ts b/src/app/pages/questions/components/question/question.component.ts index 5876cc6da..c710f2963 100755 --- a/src/app/pages/questions/components/question/question.component.ts +++ b/src/app/pages/questions/components/question/question.component.ts @@ -38,7 +38,8 @@ export class QuestionComponent implements OnInit, OnChanges { NON_SCROLLABLE_SET: Set = new Set([ QuestionType.timed, QuestionType.audio, - QuestionType.info + QuestionType.info, + QuestionType.text ]) HIDE_FIELD_LABEL_SET: Set = new Set([QuestionType.audio]) diff --git a/src/app/pages/questions/components/question/text-input/text-input.component.html b/src/app/pages/questions/components/question/text-input/text-input.component.html index 9bc6de969..a1053ba05 100644 --- a/src/app/pages/questions/components/question/text-input/text-input.component.html +++ b/src/app/pages/questions/components/question/text-input/text-input.component.html @@ -1,28 +1,34 @@ - +
+ +
- +
+ +
- +
+ +
diff --git a/src/app/pages/questions/components/question/text-input/text-input.component.scss b/src/app/pages/questions/components/question/text-input/text-input.component.scss index 7d4a6abaa..fcce81f0a 100644 --- a/src/app/pages/questions/components/question/text-input/text-input.component.scss +++ b/src/app/pages/questions/components/question/text-input/text-input.component.scss @@ -6,4 +6,8 @@ text-input { ion-item { margin-bottom: 8px !important; } + + .mid { + padding-top: 96px; + } } diff --git a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.html b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.html index 960ab56cc..d5ff484c9 100644 --- a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.html +++ b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.html @@ -1,13 +1,19 @@ - + - +
{{ labels[col] }}
-
-

- {{ row }} -

+
+
+

+ {{ row }} +

+
diff --git a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.scss b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.scss index 6f79acbee..faf853cb7 100644 --- a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.scss +++ b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.scss @@ -12,12 +12,25 @@ wheel-selector { display: none; } + .inner { + mask-image: + radial-gradient( + circle at 50% 50%, + black 30%, + rgba(0, 0, 0, 0.1) 70% + ); + } + + + .bg { + border-radius: 28px; + background-color: $cl-primary-40; + } + .picker-opts { overflow: scroll; width: fit-content; - height: 40px; - border-radius: $label-height; - background-color: $cl-primary-40; + height: 120px; font-size: 20px; scroll-snap-type: y mandatory; } diff --git a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.ts b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.ts index 5a8317028..3bdad0db7 100644 --- a/src/app/pages/questions/components/wheel-selector/wheel-selector.component.ts +++ b/src/app/pages/questions/components/wheel-selector/wheel-selector.component.ts @@ -4,16 +4,19 @@ import { ElementRef, EventEmitter, Input, + OnInit, Output, QueryList, ViewChildren } from '@angular/core' +import { Utility } from '../../../../shared/utilities/util' + @Component({ selector: 'wheel-selector', templateUrl: 'wheel-selector.component.html' }) -export class WheelSelectorComponent implements AfterViewInit { +export class WheelSelectorComponent implements AfterViewInit, OnInit { keys = Object.keys @ViewChildren('wheel') wheels: QueryList @@ -26,20 +29,37 @@ export class WheelSelectorComponent implements AfterViewInit { @Output() onSelect: EventEmitter = new EventEmitter() + valuesWithNulls + emitterLocked = false scrollHeight = 40 - constructor() {} + constructor(private util: Utility) {} + + ngOnInit() { + this.valuesWithNulls = this.util.deepCopy(this.values) + this.addNullValues() + } ngAfterViewInit() { + console.log(this.valuesWithNulls) if (this.selection) this.scrollToDefault() } + addNullValues() { + const keys = this.keys(this.valuesWithNulls) + keys.forEach(d => { + this.valuesWithNulls[d].unshift('-') + this.valuesWithNulls[d].push('-') + }) + } + scrollToDefault() { this.wheels.forEach((d, i) => { - const col = this.keys(this.values)[i] - let row = this.values[col].findIndex(a => a == this.selection[col]) - if (row == -1) row = 0 + const col = this.keys(this.valuesWithNulls)[i] + let row = + this.valuesWithNulls[col].findIndex(a => a == this.selection[col]) - 1 + if (row < 0) row = 0 d.nativeElement.scrollTo(0, row * this.scrollHeight) }) } @@ -48,8 +68,8 @@ export class WheelSelectorComponent implements AfterViewInit { if (!this.emitterLocked) { this.emitterLocked = true setTimeout(() => { - const row = Math.round(event.target.scrollTop / this.scrollHeight) - const value = this.values[col][row] + const row = Math.round(event.target.scrollTop / this.scrollHeight) + 1 + const value = this.valuesWithNulls[col][row] if (value) { this.selection[col] = value this.onSelect.emit(this.selection)