demo commit
This commit is contained in:
+9
@@ -23,5 +23,14 @@
|
||||
index: index
|
||||
}"></ng-container>
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="hasNotFoundTemplate">
|
||||
<ng-template ng-notfound-tmp let-searchTerm="searchTerm">
|
||||
<ng-container [ngTemplateOutlet]="selectNotFoundTemplate"
|
||||
[ngTemplateOutletContext]="{
|
||||
$implicit: searchTerm
|
||||
}"></ng-container>
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
</ng-select>
|
||||
|
||||
+13
@@ -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 '../select-option-template.directive';
|
||||
import { NotFoundTemplateDirective } from '../not-found-template.directive';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -22,6 +23,8 @@ export class NgSelectComponent implements OnInit {
|
||||
|
||||
@ContentChild(SelectOptionTemplateDirective) optionTemplate: SelectOptionTemplateDirective;
|
||||
@ContentChild(SelectLabelTemplateDirective) labelTemplate: SelectLabelTemplateDirective;
|
||||
@ContentChild(NotFoundTemplateDirective) notFoundTemplate: NotFoundTemplateDirective;
|
||||
|
||||
|
||||
|
||||
@ViewChild(SelectComponent, { static: true }) selectComponent: SelectComponent;
|
||||
@@ -154,4 +157,14 @@ export class NgSelectComponent implements OnInit {
|
||||
return this.labelTemplate.template;
|
||||
return null;
|
||||
}
|
||||
|
||||
get hasNotFoundTemplate() {
|
||||
return this.notFoundTemplate ? true : false;
|
||||
}
|
||||
|
||||
get selectNotFoundTemplate(){
|
||||
if(this.notFoundTemplate)
|
||||
return this.notFoundTemplate.template;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { Directive, TemplateRef } from '@angular/core';
|
||||
|
||||
|
||||
@Directive({
|
||||
selector: '[psNgNotFoundTemplate]'
|
||||
})
|
||||
export class NotFoundTemplateDirective {
|
||||
|
||||
constructor(public template: TemplateRef<any>) { }
|
||||
|
||||
}
|
||||
@@ -6,11 +6,12 @@ import { FormsModule } from '@angular/forms';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { SelectLabelTemplateDirective } from './select-label-template.directive';
|
||||
import { SelectOptionTemplateDirective } from './select-option-template.directive';
|
||||
import { NotFoundTemplateDirective } from './not-found-template.directive';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [NgSelectComponent, MultiSelectComponent, SelectLabelTemplateDirective, SelectOptionTemplateDirective],
|
||||
declarations: [NgSelectComponent, MultiSelectComponent, SelectLabelTemplateDirective, SelectOptionTemplateDirective, NotFoundTemplateDirective],
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
@@ -20,7 +21,8 @@ import { SelectOptionTemplateDirective } from './select-option-template.directiv
|
||||
NgSelectComponent,
|
||||
MultiSelectComponent,
|
||||
SelectLabelTemplateDirective,
|
||||
SelectOptionTemplateDirective
|
||||
SelectOptionTemplateDirective,
|
||||
NotFoundTemplateDirective
|
||||
]
|
||||
})
|
||||
export class PsNgSelectorsModule { }
|
||||
export class PsNgSelectorsModule { }//NGSELECT
|
||||
|
||||
@@ -6,7 +6,8 @@ export * from './lib/ps-ng-selectors/ps-ng-selectors.module';
|
||||
export * from './lib/ps-ng-selectors/ng-select/ng-select.component';
|
||||
export * from './lib/ps-ng-selectors/multi-select/multi-select.component';
|
||||
export * from './lib/ps-ng-selectors/select-label-template.directive';
|
||||
export * from './lib/ps-ng-selectors/select-option-template.directive'
|
||||
export * from './lib/ps-ng-selectors/select-option-template.directive';
|
||||
export * from './lib/ps-ng-selectors/not-found-template.directive';
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -24,4 +24,4 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip';
|
||||
],
|
||||
exports: [TextFilterComponent, NumberFilterComponent,DatetimeFilterComponent]
|
||||
})
|
||||
export class GridFilterModule { }
|
||||
export class GridFilterModule { } //DS Filter
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<ng-template #popTemplate>
|
||||
<form (ngSubmit)="applyFilter()">
|
||||
<div class="container" >
|
||||
<div class="row">
|
||||
<select class="custom-select" title="Choose one of the following..." [(ngModel)]="filterType" [ngModelOptions]="{standalone: true}">
|
||||
<option *ngFor="let filter of filterTypes" [value]="filter.value">{{filter.key}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-1">
|
||||
<input type="number" class="form-control" placeholder="column value" aria-label="number"
|
||||
aria-describedby="basic-addon1" [(ngModel)]="filterValue" [ngModelOptions]="{standalone: true}">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary mr-1">Filter</button>
|
||||
<button type="button" class="btn btn-warning" *ngIf="!isFiltering" (click)="pop.hide()">Hide</button>
|
||||
<button type="button" class="btn btn-dark" *ngIf="isFiltering" (click)="clearFilter()">Clear</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</ng-template>
|
||||
|
||||
<button [popover]="popTemplate" class="btn btn-default" [(isOpen)]="filterIsOpenned" [outsideClick]="true" #pop="bs-popover">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 477.875 477.875" style="enable-background:new 0 0 477.875 477.875;" xml:space="preserve" fill-opacity="0.5" [tooltip]="showTooltip()" [tooltipEnable]="!filterIsOpenned" width="13px" height="13px" [ngStyle]="{'fill': isFiltering ? 'red': 'black', 'fill-opacity': isFiltering ? '1': '0.5'}">
|
||||
<g>
|
||||
<g>
|
||||
<path d="M460.804,0H17.071C7.645,0,0.004,7.641,0.004,17.067V102.4c-0.004,4.842,2.05,9.458,5.649,12.698l165.018,148.514V460.8
|
||||
c-0.004,9.426,7.633,17.07,17.059,17.075c2.651,0.001,5.266-0.615,7.637-1.8l102.4-51.2c5.786-2.891,9.441-8.806,9.438-15.275
|
||||
V263.612l165.018-148.48c3.608-3.247,5.662-7.878,5.649-12.732V17.067C477.871,7.641,470.23,0,460.804,0z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
</button>
|
||||
+2
-1
@@ -3,7 +3,7 @@ import { IDataSource,IFilter } from '@poweredsoft/data';
|
||||
import { ISimpleFilter } from '../../models/IFilter';
|
||||
|
||||
@Component({
|
||||
selector: 'psbx-number-filter',
|
||||
selector: 'psbx-ds-number-filter',
|
||||
templateUrl: './number-filter.component.html',
|
||||
styleUrls: ['./number-filter.component.scss']
|
||||
})
|
||||
@@ -32,6 +32,7 @@ export class NumberFilterComponent implements OnInit {
|
||||
}
|
||||
|
||||
clearFilter() {
|
||||
this.filterValue = 0;
|
||||
this.isFiltering = false;
|
||||
const existingFilter = this.dataSource.filters.find(t => (t as ISimpleFilter).path == this.path) as ISimpleFilter;
|
||||
if (existingFilter) {
|
||||
+19
-15
@@ -1,21 +1,25 @@
|
||||
<ng-template #popTemplate>
|
||||
<div class="container" >
|
||||
<div class="row">
|
||||
<select class="custom-select" title="Choose one of the following..." [(ngModel)]="filterType">
|
||||
<option *ngFor="let filter of filterTypes" [value]="filter.value">{{filter.key}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-1">
|
||||
<input type="number" class="form-control" placeholder="column value" aria-label="number"
|
||||
aria-describedby="basic-addon1" [(ngModel)]="filterValue">
|
||||
</div>
|
||||
|
||||
<form (ngSubmit)="applyFilter(pop)">
|
||||
|
||||
<button class="btn btn-primary mr-1" (click)="applyFilter()">Filter</button>
|
||||
<button type="button" class="btn btn-warning" *ngIf="!isFiltering" (click)="pop.hide()">Hide</button>
|
||||
<button type="button" class="btn btn-dark" *ngIf="isFiltering" (click)="clearFilter()">Clear</button>
|
||||
<div class="container" >
|
||||
<div class="row">
|
||||
<select class="custom-select" title="Choose one of the following..." [(ngModel)]="filterType" [ngModelOptions]="{standalone: true}">
|
||||
<option *ngFor="let filter of filterTypes" [value]="filter.value">{{filter.key}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row mt-1 mb-1">
|
||||
<input type="text" class="form-control" placeholder="column value" aria-label="Username"
|
||||
aria-describedby="basic-addon1" [(ngModel)]="filterValue" [ngModelOptions]="{standalone: true}" >
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary mr-1" type="submit">Filter</button>
|
||||
<button type="button" class="btn btn-warning" *ngIf="!isFiltering" (click)="pop.hide()">Hide</button>
|
||||
<button type="button" class="btn btn-dark" *ngIf="isFiltering" (click)="clearFilter()">Clear</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</ng-template>
|
||||
|
||||
<button [popover]="popTemplate" class="btn btn-default" [(isOpen)]="filterIsOpenned" [outsideClick]="true" #pop="bs-popover">
|
||||
+6
-1
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { IDataSource} from '@poweredsoft/data';
|
||||
import { ISimpleFilter } from '../../models/IFilter';
|
||||
import { PopoverDirective } from 'ngx-bootstrap/popover';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -32,6 +33,7 @@ export class TextFilterComponent implements OnInit {
|
||||
}
|
||||
|
||||
clearFilter() {
|
||||
this.filterValue = '';
|
||||
this.isFiltering = false;
|
||||
const existingFilter = this.dataSource.filters.find(t => (t as ISimpleFilter).path == this.path) as ISimpleFilter;
|
||||
if (existingFilter) {
|
||||
@@ -42,7 +44,7 @@ export class TextFilterComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
applyFilter(){
|
||||
applyFilter(pop: PopoverDirective = null){
|
||||
this.isFiltering = true;
|
||||
const filters = this.dataSource.filters;
|
||||
const existingFilter = filters.find(t => (t as ISimpleFilter).path == this.path) as ISimpleFilter;
|
||||
@@ -62,6 +64,9 @@ export class TextFilterComponent implements OnInit {
|
||||
filters: filters,
|
||||
page: 1
|
||||
})
|
||||
|
||||
if (pop)
|
||||
pop.hide();
|
||||
}
|
||||
|
||||
showTooltip(){
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { GridSortingComponent } from './grid-sorting/grid-sorting.component';
|
||||
import { DataSourceSortingComponent } from './ds-sorting/ds-sorting.component';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [GridSortingComponent],
|
||||
declarations: [DataSourceSortingComponent],
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
exports:[GridSortingComponent]
|
||||
exports:[DataSourceSortingComponent]
|
||||
})
|
||||
export class GridSortingModule { }
|
||||
+5
-5
@@ -2,11 +2,11 @@ import { Component, OnInit, Input } from '@angular/core';
|
||||
import { IDataSource } from '@poweredsoft/data';
|
||||
|
||||
@Component({
|
||||
selector: 'psbx-grid-sorting',
|
||||
templateUrl: './grid-sorting.component.html',
|
||||
styleUrls: ['./grid-sorting.component.scss']
|
||||
selector: 'psbx-ds-sorting',
|
||||
templateUrl: './ds-sorting.component.html',
|
||||
styleUrls: ['./ds-sorting.component.scss']
|
||||
})
|
||||
export class GridSortingComponent implements OnInit {
|
||||
export class DataSourceSortingComponent implements OnInit {
|
||||
|
||||
@Input() dataSource : IDataSource<any>;
|
||||
@Input() path:string;
|
||||
@@ -16,7 +16,7 @@ export class GridSortingComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
||||
sorting(){
|
||||
this.isSorting = true;
|
||||
this.isAscending = !this.isAscending;
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
<ng-template #popTemplate>
|
||||
<div class="container" >
|
||||
<div class="row">
|
||||
<select class="custom-select" title="Choose one of the following..." [(ngModel)]="filterType">
|
||||
<option *ngFor="let filter of filterTypes" [value]="filter.value">{{filter.key}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row mt-1 mb-1">
|
||||
<input type="text" class="form-control" placeholder="column value" aria-label="Username"
|
||||
aria-describedby="basic-addon1" [(ngModel)]="filterValue">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary mr-1" (click)="applyFilter()">Filter</button>
|
||||
<button type="button" class="btn btn-warning" *ngIf="!isFiltering" (click)="pop.hide()">Hide</button>
|
||||
<button type="button" class="btn btn-dark" *ngIf="isFiltering" (click)="clearFilter()">Clear</button>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<button [popover]="popTemplate" class="btn btn-default" [(isOpen)]="filterIsOpenned" [outsideClick]="true" #pop="bs-popover">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 477.875 477.875" style="enable-background:new 0 0 477.875 477.875;" xml:space="preserve" fill-opacity="0.5" [tooltip]="showTooltip()" [tooltipEnable]="!filterIsOpenned" width="13px" height="13px" [ngStyle]="{'fill': isFiltering ? 'red': 'black', 'fill-opacity': isFiltering ? '1': '0.5'}">
|
||||
<g>
|
||||
<g>
|
||||
<path d="M460.804,0H17.071C7.645,0,0.004,7.641,0.004,17.067V102.4c-0.004,4.842,2.05,9.458,5.649,12.698l165.018,148.514V460.8
|
||||
c-0.004,9.426,7.633,17.07,17.059,17.075c2.651,0.001,5.266-0.615,7.637-1.8l102.4-51.2c5.786-2.891,9.441-8.806,9.438-15.275
|
||||
V263.612l165.018-148.48c3.608-3.247,5.662-7.878,5.649-12.732V17.067C477.871,7.641,470.23,0,460.804,0z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
</button>
|
||||
@@ -13,9 +13,9 @@ export * from './lib/confirm-modal/confirm-modal.service';
|
||||
export * from './lib/confirm-modal/confirm-modal.directive';
|
||||
export * from './lib/spinner/spinner.module';
|
||||
export * from './lib/spinner/spinner/spinner.component';
|
||||
export * from './lib/grid-filter/grid-filter.module';
|
||||
export * from './lib/grid-filter/text-filter/text-filter.component';
|
||||
export * from './lib/grid-filter/number-filter/number-filter.component';
|
||||
export * from './lib/grid-filter/datetime-filter/datetime-filter.component';
|
||||
export * from './lib/grid-sorting/grid-sorting.module';
|
||||
export * from './lib/grid-sorting/grid-sorting/grid-sorting.component';
|
||||
export * from './lib/dataSource-filter/grid-filter.module';
|
||||
export * from './lib/dataSource-filter/text-filter/text-filter.component';
|
||||
export * from './lib/dataSource-filter/number-filter/number-filter.component';
|
||||
export * from './lib/dataSource-filter/datetime-filter/datetime-filter.component';
|
||||
export * from './lib/dataSource-sorting/ds-sorting.module';
|
||||
export * from './lib/dataSource-sorting/ds-sorting/ds-sorting.component';
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
<table [ngClass]="tableClasses" style="min-height: 300px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngFor="let header of gridHeaders" [attr.colspan]="columns.length">
|
||||
<tr *ngFor="let header of gridHeaders" >
|
||||
<th [attr.colspan]="columns.length">
|
||||
<ng-container [ngTemplateOutlet]="header.template"></ng-container>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user