-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting to add the new custom dropdown module, UI: Renewing Study page
- Loading branch information
Showing
12 changed files
with
146 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
dcm4chee-arc-ui2/src/app/widgets/dropdown/dropdown.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<ng-container *ngIf="selectedValue"> | ||
<div class="selected_value" *ngIf="!selectedValue.htmlLabel" (click)="toggleDropdown()">{{selectedValue.label || selectedValue.text}}</div> | ||
<div class="selected_value" *ngIf="selectedValue && selectedValue.htmlLabel" [innerHTML]="selectedValue.htmlLabel" (click)="toggleDropdown()"></div> | ||
</ng-container> | ||
<div *ngIf="!selectedValue" class="selected_value empty_field" placeholder="Test" (click)="toggleDropdown()">Placeholder</div> | ||
<div class="select" *ngIf="showDropdown"> | ||
<ng-content></ng-content> | ||
</div> |
Empty file.
34 changes: 34 additions & 0 deletions
34
dcm4chee-arc-ui2/src/app/widgets/dropdown/dropdown.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | ||
import {OptionService} from "./option.service"; | ||
import {SelectDropdown} from "../../interfaces"; | ||
|
||
@Component({ | ||
selector: 'j4care-select', | ||
templateUrl: './dropdown.component.html', | ||
styleUrls: ['./dropdown.component.scss'] | ||
}) | ||
export class DropdownComponent implements OnInit { | ||
selectedValue:SelectDropdown; | ||
|
||
@Input() model: SelectDropdown; | ||
|
||
@Output() modelChange = new EventEmitter(); | ||
|
||
showDropdown:boolean = false; | ||
constructor(public service:OptionService) { | ||
this.service.valueSet$.subscribe(value=>{ | ||
console.log("value",value); | ||
this.selectedValue = value; | ||
this.modelChange.emit(value); | ||
}) | ||
} | ||
|
||
ngOnInit() { | ||
this.selectedValue = this.model; | ||
} | ||
|
||
toggleDropdown(){ | ||
this.showDropdown = !this.showDropdown; | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
dcm4chee-arc-ui2/src/app/widgets/dropdown/option.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {Component, ContentChild, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from "@angular/core"; | ||
import {OptionService} from "./option.service"; | ||
import {SelectDropdown} from "../../interfaces"; | ||
|
||
@Component({ | ||
selector: 'j4care-option', | ||
template:` | ||
<div class="option" (click)="select($event)" #options> | ||
<div *ngIf="htmlLabel" [innerHTML]="htmlLabel"></div> | ||
<ng-content *ngIf="!htmlLabel"> | ||
</ng-content> | ||
</div> | ||
` | ||
}) | ||
export class OptionComponent implements OnInit { | ||
@Input() value; | ||
@Input() htmlLabel; | ||
constructor( | ||
public service:OptionService, | ||
private element:ElementRef | ||
){} | ||
ngOnInit() { | ||
} | ||
|
||
select(e){ | ||
console.log("select",e); | ||
console.log("value",this.value); | ||
console.log("element",this.element); | ||
console.log("element",this.element.nativeElement.innerHTML); | ||
console.log("outerText",this.element.nativeElement.outerText); | ||
console.log("htmlLabel",this.htmlLabel); | ||
if(this.htmlLabel){ | ||
this.service.setValue(new SelectDropdown(this.value,'','','',this.htmlLabel)); | ||
}else{ | ||
this.service.setValue(new SelectDropdown(this.value,this.element.nativeElement.outerText)); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
dcm4chee-arc-ui2/src/app/widgets/dropdown/option.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {Injectable, Input, Output} from "@angular/core"; | ||
import {Subject} from "rxjs/Subject"; | ||
import {SelectDropdown} from "../../interfaces"; | ||
|
||
|
||
@Injectable() | ||
export class OptionService { | ||
|
||
|
||
|
||
private setValueSource = new Subject<SelectDropdown>(); | ||
|
||
valueSet$ = this.setValueSource.asObservable(); | ||
setValue(value: SelectDropdown) { | ||
console.log('in set value', value); | ||
this.setValueSource.next(value); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
dcm4chee-arc-ui2/src/app/widgets/modality/modality.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters