src/app/resources/resources-list.ts
Compbaser
changeDetection | ChangeDetectionStrategy.OnPush |
selector | resources-list |
template |
|
filter
|
|
Defined in src/app/resources/resources-list.ts:44
|
resources
|
|
Defined in src/app/resources/resources-list.ts:39
|
setViewMode
|
|
Defined in src/app/resources/resources-list.ts:47
|
onSelected
|
$event type: EventEmitter<ResourcesModel>
|
Defined in src/app/resources/resources-list.ts:63
|
constructor(bs: BlockService, el: ElementRef)
|
Defined in src/app/resources/resources-list.ts:32
|
_onSelected |
_onSelected(event: MouseEvent, i_resource: ResourcesModel, index: any)
|
Defined in src/app/resources/resources-list.ts:65
|
Returns :
void
|
resetSelection |
resetSelection()
|
Defined in src/app/resources/resources-list.ts:71
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in src/app/resources/resources-list.ts:75
|
Returns :
void
|
destroy |
destroy()
|
Defined in src/app/resources/resources-list.ts:78
|
Returns :
void
|
bs |
bs: |
m_resources |
m_resources: |
Defined in src/app/resources/resources-list.ts:31
|
m_selected |
m_selected: |
Defined in src/app/resources/resources-list.ts:32
|
selectedIdx |
selectedIdx: |
Defined in src/app/resources/resources-list.ts:30
|
import {ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output} from "@angular/core";
import {Compbaser} from "ng-mslib";
import {ResourcesModel} from "../../store/imsdb.interfaces_auto";
import {List} from "immutable";
import {BlockService} from "../blocks/block-service";
import {IUiState} from "../../store/store.data";
import {SideProps} from "../../store/actions/appdb.actions";
@Component({
selector: 'resources-list',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<small class="debug">{{me}}</small>
<ul style="padding: 10px" (click)="$event.preventDefault()" class="appList list-group">
<a *ngFor="let resource of m_resources; let i = index" (click)="_onSelected($event, resource, i)"
[class.hidden]="resource | FilterModelPipe:filter:resource:'getResourceName'"
[ngClass]="{'selectedItem': selectedIdx == i}" href="#" class="list-group-item resourcesListItems">
<h4>{{resource.getResourceName()}}</h4>
<i class="pull-left fa {{bs.getFontAwesome(resource.getResourceType())}}"></i>
<p class="pull-left list-group-item-text">file type: {{resource.getResourceType()}} </p>
<span class="clearfix"></span>
<!--<div class="openProps">-->
<!--<button type="button" class="props btn btn-default btn-sm"><i style="font-size: 1.5em" class="props fa fa-gear"></i></button>-->
<!--</div>-->
</a>
</ul>
`,
})
export class ResourcesList extends Compbaser {
selectedIdx = -1;
m_resources: List<ResourcesModel>;
m_selected;
constructor(public bs: BlockService, private el: ElementRef) {
super();
}
@Input()
set resources(i_resources: List<ResourcesModel>) {
this.m_resources = i_resources;
}
@Input() filter;
@Input()
set setViewMode(i_viewMode: 'grid' | 'list') {
if (i_viewMode == 'list') {
var query = $('.resourcesListItems', this.el.nativeElement);
$(query).addClass('col-xs-12');
$(query).removeClass('col-xs-3');
}
if (i_viewMode == 'grid') {
var query = $('.resourcesListItems', this.el.nativeElement);
$(query).addClass('col-xs-3');
$(query).removeClass('col-xs-12');
}
}
@Output()
onSelected: EventEmitter<ResourcesModel> = new EventEmitter<ResourcesModel>();
_onSelected(event: MouseEvent, i_resource: ResourcesModel, index) {
this.selectedIdx = index;
this.onSelected.emit(i_resource)
this.m_selected = i_resource;
}
resetSelection() {
this.selectedIdx = -1;
}
ngOnInit() {
}
destroy() {
}
}