0.0.3 of ng select supports footer.
This commit is contained in:
parent
419c3e2383
commit
f9cceadaa6
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@poweredsoft/ng-select",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^9.1.9",
|
||||
"@angular/core": "^9.1.9"
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { Directive, TemplateRef } from '@angular/core';
|
||||
|
||||
|
||||
@Directive({
|
||||
selector: '[psNgSelectFooter]'
|
||||
})
|
||||
export class SelectFooterTemplateDirective {
|
||||
constructor(public template: TemplateRef<any>) { }
|
||||
|
||||
}
|
@ -7,3 +7,5 @@ export class SelectLabelTemplateDirective {
|
||||
constructor(public template: TemplateRef<any>) { }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,3 +28,7 @@
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
</ng-select>
|
||||
<ng-container *ngIf="footerTemplate">
|
||||
<ng-container [ngTemplateOutlet]="footerTemplate.template" [ngTemplateOutletContext]="{ $implicit: selectedModel }">
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
@ -6,6 +6,7 @@ import { map, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
||||
import { NgSelectComponent as SelectComponent } from '@ng-select/ng-select';
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
import { SelectOptionTemplateDirective } from '../directives/select-option-template.directive';
|
||||
import { SelectFooterTemplateDirective } from '../directives/select-footer-template.directive';
|
||||
|
||||
@Component({
|
||||
selector: 'ps-ng-multi-select',
|
||||
@ -22,6 +23,7 @@ export class MultiSelectComponent implements OnInit,OnDestroy {
|
||||
|
||||
@ContentChild(SelectOptionTemplateDirective) optionTemplate: SelectOptionTemplateDirective;
|
||||
@ContentChild(SelectLabelTemplateDirective) labelTemplate: SelectLabelTemplateDirective;
|
||||
@ContentChild(SelectFooterTemplateDirective) footerTemplate: SelectFooterTemplateDirective;
|
||||
|
||||
@ViewChild(SelectComponent, { static: true }) selectComponent: SelectComponent;
|
||||
@Input() dataSource: IDataSource<any>;
|
||||
|
@ -35,3 +35,7 @@
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
</ng-select>
|
||||
<ng-container *ngIf="footerTemplate">
|
||||
<ng-container [ngTemplateOutlet]="footerTemplate.template" [ngTemplateOutletContext]="{ $implicit: selectedModel }">
|
||||
</ng-container>
|
||||
</ng-container>
|
@ -7,6 +7,8 @@ import { NgSelectComponent as SelectComponent } from '@ng-select/ng-select';
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
import { SelectOptionTemplateDirective } from '../directives/select-option-template.directive';
|
||||
import { NotFoundTemplateDirective } from '../directives/not-found-template.directive';
|
||||
import { NgFooterTemplateDirective } from '@ng-select/ng-select/lib/ng-templates.directive';
|
||||
import { SelectFooterTemplateDirective } from '../directives/select-footer-template.directive';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -24,6 +26,7 @@ export class NgSelectComponent implements OnInit,OnDestroy {
|
||||
@ContentChild(SelectOptionTemplateDirective) optionTemplate: SelectOptionTemplateDirective;
|
||||
@ContentChild(SelectLabelTemplateDirective) labelTemplate: SelectLabelTemplateDirective;
|
||||
@ContentChild(NotFoundTemplateDirective) notFoundTemplate: NotFoundTemplateDirective;
|
||||
@ContentChild(SelectFooterTemplateDirective) footerTemplate: SelectFooterTemplateDirective;
|
||||
|
||||
|
||||
|
||||
|
@ -7,11 +7,12 @@ import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { SelectLabelTemplateDirective } from './directives/select-label-template.directive';
|
||||
import { SelectOptionTemplateDirective } from './directives/select-option-template.directive';
|
||||
import { NotFoundTemplateDirective } from './directives/not-found-template.directive';
|
||||
import { SelectFooterTemplateDirective } from './directives/select-footer-template.directive';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [NgSelectComponent, MultiSelectComponent, SelectLabelTemplateDirective, SelectOptionTemplateDirective, NotFoundTemplateDirective],
|
||||
declarations: [NgSelectComponent, MultiSelectComponent, SelectLabelTemplateDirective, SelectOptionTemplateDirective, NotFoundTemplateDirective, SelectFooterTemplateDirective],
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
@ -22,6 +23,7 @@ import { NotFoundTemplateDirective } from './directives/not-found-template.direc
|
||||
MultiSelectComponent,
|
||||
SelectLabelTemplateDirective,
|
||||
SelectOptionTemplateDirective,
|
||||
SelectFooterTemplateDirective,
|
||||
NotFoundTemplateDirective
|
||||
]
|
||||
})
|
||||
|
@ -7,4 +7,5 @@ export * from './lib/ps-ng-select/ng-select/ng-select.component';
|
||||
export * from './lib/ps-ng-select/multi-select/multi-select.component';
|
||||
export * from './lib/ps-ng-select/directives/select-label-template.directive';
|
||||
export * from './lib/ps-ng-select/directives/select-option-template.directive';
|
||||
export * from './lib/ps-ng-select/directives/select-footer-template.directive';
|
||||
export * from './lib/ps-ng-select/directives/not-found-template.directive';
|
||||
|
Loading…
Reference in New Issue
Block a user