<!-- todo disabled -->
<ng-template #displayTemplate let-r="result">
- <span id="{{domId}}-{{r.id}}">{{r.label}}</span>
+ <span id="{{domId}}-{{r.id}}" class="{{orgClassCallback(r.id)}}">{{r.label}}</span>
</ng-template>
<ng-container *ngIf="readOnly && selected">
this.applyPermLimitOrgs(perms);
}
+ // Function which should return a string value representing
+ // a CSS class name to use for styling each org unit label
+ // in the selector.
+ @Input() orgClassCallback: (orgId: number) => string;
+
// Emitted when the org unit value is changed via the selector.
// Does not fire on initialOrg
@Output() onChange = new EventEmitter<IdlObject>();
private serverStore: ServerStoreService,
private org: OrgService,
private perm: PermService
- ) { }
+ ) {
+ this.orgClassCallback = (orgId: number): string => '';
+ }
ngOnInit() {
idlClass="cbt" mode="update" recordId="1" orgDefaultAllowed="owner">
</eg-fm-record-editor>
</div>
+
+<div class="m-4">
+ <div class="col-lg-4">
+ <h4>Org Unit Selector With Styled Orgs</h4>
+ <eg-org-select [orgClassCallback]="orgClassCallback">
+ </eg-org-select>
</div>
</div>
// cross-tab communications example
private sbChannel: any;
sbChannelText: string;
-
myTimeForm: FormGroup;
locId = 1; // Stacks
aLocation: IdlObject; // acpl
+ orgClassCallback: (orgId: number) => string;
constructor(
private idl: IdlService,
this.sbChannel = (typeof BroadcastChannel === 'undefined') ?
{} : new BroadcastChannel('eg.sbChannel');
this.sbChannel.onmessage = (e) => this.sbChannelHandler(e);
+
+ this.orgClassCallback = (orgId: number): string => {
+ if (orgId === 1) { return 'font-weight-bold'; }
+ return orgId <= 3 ? 'text-info' : 'text-danger';
+ };
}
ngOnInit() {