@acorex/data-grid 6.5.27 → 6.5.29
Sign up to get free protection for your applications and to get access to all the features.
- package/acorex-data-grid.d.ts +5 -0
- package/esm2020/acorex-data-grid.mjs +5 -0
- package/esm2020/lib/data-grid/columns/check-column.component.mjs +117 -0
- package/esm2020/lib/data-grid/columns/column.component.mjs +164 -0
- package/esm2020/lib/data-grid/columns/command-column.component.mjs +115 -0
- package/esm2020/lib/data-grid/columns/date-column.component.mjs +111 -0
- package/esm2020/lib/data-grid/columns/row-number-column.component.mjs +37 -0
- package/esm2020/lib/data-grid/columns/selection-column.component.mjs +42 -0
- package/esm2020/lib/data-grid/columns/text-column.component.mjs +89 -0
- package/esm2020/lib/data-grid/datagrid.component.mjs +667 -0
- package/esm2020/lib/data-grid/datagrid.events.mjs +2 -0
- package/esm2020/lib/data-grid/datagrid.module.mjs +145 -0
- package/esm2020/lib/data-grid/filters/filter.component.mjs +39 -0
- package/esm2020/lib/data-grid/templates/cell-template.component.mjs +53 -0
- package/esm2020/lib/data-grid/templates/detail-template.component.mjs +46 -0
- package/esm2020/lib/data-grid/templates/row-template.component.mjs +43 -0
- package/esm2020/lib/data-lov/data-lov-popup/data-lov-popup.component.mjs +114 -0
- package/esm2020/lib/data-lov/data-lov.component.mjs +165 -0
- package/esm2020/lib/data-lov/data-lov.module.mjs +23 -0
- package/esm2020/public-api.mjs +18 -0
- package/fesm2015/acorex-data-grid.mjs +1881 -0
- package/fesm2015/acorex-data-grid.mjs.map +1 -0
- package/fesm2020/acorex-data-grid.mjs +1881 -0
- package/fesm2020/acorex-data-grid.mjs.map +1 -0
- package/lib/data-grid/columns/check-column.component.d.ts +37 -0
- package/lib/data-grid/columns/column.component.d.ts +32 -0
- package/lib/data-grid/columns/command-column.component.d.ts +27 -0
- package/lib/data-grid/columns/date-column.component.d.ts +32 -0
- package/lib/data-grid/columns/row-number-column.component.d.ts +10 -0
- package/lib/data-grid/columns/selection-column.component.d.ts +12 -0
- package/lib/data-grid/columns/text-column.component.d.ts +25 -0
- package/lib/data-grid/datagrid.component.d.ts +142 -0
- package/{src/lib/data-grid/datagrid.events.ts → lib/data-grid/datagrid.events.d.ts} +1 -4
- package/lib/data-grid/datagrid.module.d.ts +23 -0
- package/lib/data-grid/filters/filter.component.d.ts +5 -0
- package/lib/data-grid/templates/cell-template.component.d.ts +22 -0
- package/lib/data-grid/templates/detail-template.component.d.ts +21 -0
- package/lib/data-grid/templates/row-template.component.d.ts +20 -0
- package/lib/data-lov/data-lov-popup/data-lov-popup.component.d.ts +33 -0
- package/lib/data-lov/data-lov.component.d.ts +43 -0
- package/lib/data-lov/data-lov.module.d.ts +12 -0
- package/package.json +36 -16
- package/{src/public-api.ts → public-api.d.ts} +0 -3
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -12
- package/src/lib/data-grid/columns/check-column.component.ts +0 -113
- package/src/lib/data-grid/columns/column.component.ts +0 -182
- package/src/lib/data-grid/columns/command-column.component.ts +0 -101
- package/src/lib/data-grid/columns/date-column.component.ts +0 -118
- package/src/lib/data-grid/columns/row-number-column.component.ts +0 -36
- package/src/lib/data-grid/columns/selection-column.component.ts +0 -39
- package/src/lib/data-grid/columns/text-column.component.ts +0 -92
- package/src/lib/data-grid/datagrid.component.html +0 -27
- package/src/lib/data-grid/datagrid.component.ts +0 -769
- package/src/lib/data-grid/datagrid.module.ts +0 -81
- package/src/lib/data-grid/filters/filter.component.ts +0 -21
- package/src/lib/data-grid/templates/cell-template.component.ts +0 -47
- package/src/lib/data-grid/templates/detail-template.component.ts +0 -43
- package/src/lib/data-grid/templates/row-template.component.ts +0 -41
- package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.html +0 -16
- package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.ts +0 -130
- package/src/lib/data-lov/data-lov.component.html +0 -61
- package/src/lib/data-lov/data-lov.component.ts +0 -184
- package/src/lib/data-lov/data-lov.module.ts +0 -16
- package/src/test.ts +0 -28
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -6
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
@@ -1,182 +0,0 @@
|
|
1
|
-
import { AXConfig } from '@acorex/core';
|
2
|
-
import { Input, ContentChild, TemplateRef, Directive } from '@angular/core';
|
3
|
-
import { AXGridCellParams } from '../datagrid.events';
|
4
|
-
import { AXDataGridCellTemplateComponent } from '../templates/cell-template.component';
|
5
|
-
import { AXDatePickerFilterComponent } from './date-column.component';
|
6
|
-
|
7
|
-
|
8
|
-
@Directive()
|
9
|
-
export abstract class AXGridDataColumn {
|
10
|
-
|
11
|
-
|
12
|
-
@ContentChild(AXDataGridCellTemplateComponent)
|
13
|
-
cellTemplate: AXDataGridCellTemplateComponent;
|
14
|
-
|
15
|
-
@Input()
|
16
|
-
width: number = 100;
|
17
|
-
|
18
|
-
@Input()
|
19
|
-
maxWidth: number;
|
20
|
-
|
21
|
-
@Input()
|
22
|
-
minWidth: number;
|
23
|
-
|
24
|
-
@Input()
|
25
|
-
pinned: 'start' | 'end' | null = null;
|
26
|
-
|
27
|
-
@Input()
|
28
|
-
allowSorting: boolean = true;
|
29
|
-
|
30
|
-
@Input()
|
31
|
-
allowFiltering: boolean = AXConfig.get('datagrid.allowFiltering') || false;;
|
32
|
-
|
33
|
-
@Input()
|
34
|
-
cellClass: (params: AXGridCellParams) => (string | string[]) | (string | string[]);
|
35
|
-
|
36
|
-
@Input()
|
37
|
-
sort: 'asc' | 'desc' | null = null;
|
38
|
-
|
39
|
-
@Input()
|
40
|
-
field: string = '';
|
41
|
-
|
42
|
-
@Input()
|
43
|
-
caption: string = '';
|
44
|
-
|
45
|
-
@Input()
|
46
|
-
cellRendererParams: any;
|
47
|
-
|
48
|
-
@Input()
|
49
|
-
checkbox: boolean = false;
|
50
|
-
|
51
|
-
@Input()
|
52
|
-
headerCheckbox: boolean = false;
|
53
|
-
|
54
|
-
@Input()
|
55
|
-
groupIndex: number = -1;
|
56
|
-
|
57
|
-
@Input()
|
58
|
-
treeIndex: number = -1;
|
59
|
-
|
60
|
-
@Input()
|
61
|
-
enableRowGroup: boolean = false;
|
62
|
-
|
63
|
-
@Input()
|
64
|
-
hide: boolean = false;
|
65
|
-
|
66
|
-
@Input()
|
67
|
-
floatingFilter: boolean = AXConfig.get('datagrid.floatingFilter') || false;
|
68
|
-
|
69
|
-
@Input()
|
70
|
-
disableMenu: boolean = false;
|
71
|
-
|
72
|
-
@Input()
|
73
|
-
resizable: boolean = true;
|
74
|
-
|
75
|
-
@Input()
|
76
|
-
menuColumnDisable: boolean = false;
|
77
|
-
|
78
|
-
@Input()
|
79
|
-
menuItemDisable: boolean = false;
|
80
|
-
|
81
|
-
constructor() { }
|
82
|
-
|
83
|
-
render(): any {
|
84
|
-
const col: any = {
|
85
|
-
field: this.field,
|
86
|
-
width: this.width,
|
87
|
-
};
|
88
|
-
col.resizable = this.resizable;
|
89
|
-
col.suppressMenu = this.disableMenu;
|
90
|
-
col.menuTabs = ['filterMenuTab', 'columnsMenuTab', 'generalMenuTab']
|
91
|
-
col.floatingFilter = this.floatingFilter;
|
92
|
-
|
93
|
-
if (!this.allowFiltering) {
|
94
|
-
col.filter = false;
|
95
|
-
col.menuTabs = col.menuTabs.filter(c => c != 'filterMenuTab');
|
96
|
-
col.floatingFilter = false;
|
97
|
-
}
|
98
|
-
if (this.menuColumnDisable == true) {
|
99
|
-
col.menuTabs = col.menuTabs.filter(c => c != 'columnsMenuTab');
|
100
|
-
}
|
101
|
-
if (this.menuItemDisable == true) {
|
102
|
-
col.menuTabs = col.menuTabs.filter(c => c != 'generalMenuTab');
|
103
|
-
}
|
104
|
-
if (this.caption) {
|
105
|
-
col.headerName = this.caption;
|
106
|
-
}
|
107
|
-
if (this.minWidth) {
|
108
|
-
col.minWidth = this.minWidth;
|
109
|
-
}
|
110
|
-
if (this.maxWidth) {
|
111
|
-
col.maxWidth = this.maxWidth;
|
112
|
-
}
|
113
|
-
if (this.pinned) {
|
114
|
-
col.pinned = this.pinned === 'start' ? 'right' : 'left';
|
115
|
-
// TODO: Change based on layout
|
116
|
-
}
|
117
|
-
if (this.allowSorting) {
|
118
|
-
col.sortable = this.allowSorting;
|
119
|
-
}
|
120
|
-
if (this.sort) {
|
121
|
-
col.sort = this.sort;
|
122
|
-
}
|
123
|
-
|
124
|
-
if (this.groupIndex >= 0) {
|
125
|
-
col.rowGroupIndex = this.groupIndex;
|
126
|
-
col.rowGroup = true;
|
127
|
-
this.enableRowGroup = true;
|
128
|
-
}
|
129
|
-
|
130
|
-
if (this.treeIndex >= 0) {
|
131
|
-
col.rowGroupIndex = this.treeIndex;
|
132
|
-
col.rowGroup = false;
|
133
|
-
}
|
134
|
-
if (this.hide) {
|
135
|
-
col.hide = true;
|
136
|
-
|
137
|
-
}
|
138
|
-
if (this.enableRowGroup) {
|
139
|
-
col.enableRowGroup = this.enableRowGroup;
|
140
|
-
}
|
141
|
-
|
142
|
-
if (this.cellClass) {
|
143
|
-
const THAT = this;
|
144
|
-
if (this.cellClass instanceof Function) {
|
145
|
-
col.cellClass = (p) => {
|
146
|
-
return THAT.cellClass({
|
147
|
-
column: THAT,
|
148
|
-
rowIndex: p.node.rowIndex,
|
149
|
-
rowLevel: p.node.level,
|
150
|
-
data: p.data,
|
151
|
-
value: p.value
|
152
|
-
});
|
153
|
-
};
|
154
|
-
}
|
155
|
-
else {
|
156
|
-
col.cellClass = this.cellClass;
|
157
|
-
|
158
|
-
}
|
159
|
-
}
|
160
|
-
//
|
161
|
-
if (this.cellTemplate != null) {
|
162
|
-
col.cellRendererFramework = this.cellTemplate.renderer;
|
163
|
-
col.cellRendererParams = this.cellTemplate.params;
|
164
|
-
}
|
165
|
-
|
166
|
-
if (this.checkbox) {
|
167
|
-
col.checkboxSelection = (params) => {
|
168
|
-
return true;
|
169
|
-
};
|
170
|
-
// col.headerCheckboxSelection = this.headerCheckbox;
|
171
|
-
}
|
172
|
-
return col;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
@@ -1,101 +0,0 @@
|
|
1
|
-
import { AXGridDataColumn } from './column.component';
|
2
|
-
import { ChangeDetectionStrategy, Component, Input, EventEmitter, ViewEncapsulation, Output, ChangeDetectorRef } from '@angular/core';
|
3
|
-
import { ICellRendererParams } from 'ag-grid-community';
|
4
|
-
import { AXGridRowCommandEvent } from '../datagrid.events';
|
5
|
-
import { AXMenuItem } from '@acorex/core';
|
6
|
-
import { ICellRendererAngularComp } from 'ag-grid-angular';
|
7
|
-
|
8
|
-
export type AXGridRowCommandFunction = (row: any) => AXMenuItem[];
|
9
|
-
|
10
|
-
@Component({
|
11
|
-
selector: 'ax-command-column',
|
12
|
-
template: '',
|
13
|
-
providers: [{ provide: AXGridDataColumn, useExisting: AXGridCommandColumn }],
|
14
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
15
|
-
encapsulation: ViewEncapsulation.None
|
16
|
-
})
|
17
|
-
export class AXGridCommandColumn extends AXGridDataColumn {
|
18
|
-
@Input()
|
19
|
-
items: AXMenuItem[] | AXGridRowCommandFunction = [];
|
20
|
-
|
21
|
-
@Output()
|
22
|
-
onItemClick: EventEmitter<AXGridRowCommandEvent> = new EventEmitter<AXGridRowCommandEvent>();
|
23
|
-
|
24
|
-
render() {
|
25
|
-
const col = super.render();
|
26
|
-
if (!col.cellRendererFramework) {
|
27
|
-
col.cellRendererFramework = CommandRenderer;
|
28
|
-
}
|
29
|
-
col.cellRendererParams = {
|
30
|
-
items: this.items,
|
31
|
-
onClick: (e) => {
|
32
|
-
this.onItemClick.emit({
|
33
|
-
command: e.name,
|
34
|
-
data: e.data,
|
35
|
-
rowIndex: e.rowIndex,
|
36
|
-
rowLevel: e.rowLevel,
|
37
|
-
htmlEvent: e.htmlEvent
|
38
|
-
});
|
39
|
-
}
|
40
|
-
};
|
41
|
-
col.sortable = false;
|
42
|
-
col.filter = false;
|
43
|
-
col.valueGetter = (params) => {
|
44
|
-
return this.items;
|
45
|
-
};
|
46
|
-
return col;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
@Component({
|
51
|
-
selector: 'ax-command-cell',
|
52
|
-
template: `
|
53
|
-
<button
|
54
|
-
*ngFor="let item of items; let i = index"
|
55
|
-
class="ax button md ax-grid-command-button {{ item.style || 'ax primary blank' }}"
|
56
|
-
[class.disabled]="item.disable"
|
57
|
-
type="button"
|
58
|
-
[title]="item.tooltip"
|
59
|
-
[attr.tabindex]="i"
|
60
|
-
(click)="onClick(item, $event)"
|
61
|
-
>
|
62
|
-
<i [ngClass]="item.icon"></i>{{ item.text }}
|
63
|
-
</button>
|
64
|
-
`,
|
65
|
-
encapsulation: ViewEncapsulation.None,
|
66
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
67
|
-
})
|
68
|
-
export class CommandRenderer implements ICellRendererAngularComp {
|
69
|
-
items: AXMenuItem[] | AXGridRowCommandFunction = [];
|
70
|
-
node: any;
|
71
|
-
private clickCallback: Function;
|
72
|
-
|
73
|
-
constructor() {}
|
74
|
-
|
75
|
-
agInit(params: ICellRendererParams): void {
|
76
|
-
this.mapParams(params);
|
77
|
-
}
|
78
|
-
|
79
|
-
refresh(params: ICellRendererParams): boolean {
|
80
|
-
this.mapParams(params);
|
81
|
-
return true;
|
82
|
-
}
|
83
|
-
|
84
|
-
private mapParams(params: any) {
|
85
|
-
this.node = params.node;
|
86
|
-
this.items = typeof params.items == 'function' ? params.items({ data: this.node.data }) : Array.isArray(params.items) ? params.items : [];
|
87
|
-
this.clickCallback = params.onClick;
|
88
|
-
}
|
89
|
-
|
90
|
-
onClick(item: AXMenuItem, e: MouseEvent) {
|
91
|
-
if (this.clickCallback && !item.disable) {
|
92
|
-
this.clickCallback({
|
93
|
-
name: item.name,
|
94
|
-
rowLevel: this.node.level,
|
95
|
-
rowIndex: this.node.rowIndex,
|
96
|
-
data: this.node.data,
|
97
|
-
htmlEvent: e
|
98
|
-
});
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
@@ -1,118 +0,0 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
Component,
|
4
|
-
ChangeDetectionStrategy,
|
5
|
-
Input,
|
6
|
-
ViewEncapsulation,
|
7
|
-
ViewChild,
|
8
|
-
ElementRef
|
9
|
-
} from '@angular/core';
|
10
|
-
import { AXGridDataColumn } from './column.component';
|
11
|
-
import { AXDateTime, AXConfig, AXCalendarType } from '@acorex/core';
|
12
|
-
import { AXDatePickerComponent } from '@acorex/components';
|
13
|
-
@Component({
|
14
|
-
selector: 'ax-date-column',
|
15
|
-
template: '',
|
16
|
-
providers: [{ provide: AXGridDataColumn, useExisting: AXGridDateColumn }],
|
17
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
18
|
-
})
|
19
|
-
export class AXGridDateColumn extends AXGridDataColumn {
|
20
|
-
constructor() {
|
21
|
-
super();
|
22
|
-
}
|
23
|
-
|
24
|
-
@Input()
|
25
|
-
format: string;
|
26
|
-
|
27
|
-
@Input()
|
28
|
-
type: AXCalendarType = AXConfig.get('dateTime.type');
|
29
|
-
|
30
|
-
render() {
|
31
|
-
const col = super.render();
|
32
|
-
col.cellRendererParams = {
|
33
|
-
format: this.format,
|
34
|
-
};
|
35
|
-
|
36
|
-
col.comparator = (valueA: any, valueB: any) => {
|
37
|
-
const date1 = AXDateTime.convert(valueA);
|
38
|
-
const date2 = AXDateTime.convert(valueB);
|
39
|
-
//
|
40
|
-
if (date1 === null && date2 === null) {
|
41
|
-
return 0;
|
42
|
-
}
|
43
|
-
if (date1 === null) {
|
44
|
-
return -1;
|
45
|
-
}
|
46
|
-
if (date2 === null) {
|
47
|
-
return 1;
|
48
|
-
}
|
49
|
-
return (date1.date.getTime() - date2.date.getTime());
|
50
|
-
};
|
51
|
-
|
52
|
-
col.valueFormatter = (params) => {
|
53
|
-
const date: AXDateTime = AXDateTime.convert(params.value, this.type);
|
54
|
-
if (date) {
|
55
|
-
return date.format(this.format);
|
56
|
-
}
|
57
|
-
else {
|
58
|
-
return null;
|
59
|
-
}
|
60
|
-
};
|
61
|
-
col.filter = 'agDateColumnFilter';
|
62
|
-
// col.floatingFilter = true;
|
63
|
-
return col;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
@Component({
|
68
|
-
selector: 'ax-data-picker-filter',
|
69
|
-
template: `<ax-date-picker [selectableHoliday]="selectableHoliday" [allowClear]="true" (onValueChanged)="onValueChanged($event)" size="sm">
|
70
|
-
</ax-date-picker>`,
|
71
|
-
host: { },
|
72
|
-
encapsulation: ViewEncapsulation.None
|
73
|
-
})
|
74
|
-
export class AXDatePickerFilterComponent {
|
75
|
-
@ViewChild(AXDatePickerComponent)
|
76
|
-
datePicker: AXDatePickerComponent;
|
77
|
-
@ViewChild('div', { read: ElementRef }) div: ElementRef;
|
78
|
-
selectableHoliday: boolean = false;
|
79
|
-
type: string = 'jalali';
|
80
|
-
date: Date;
|
81
|
-
params: any;
|
82
|
-
picker: any;
|
83
|
-
|
84
|
-
|
85
|
-
agInit(params: any): void {
|
86
|
-
this.params = params;
|
87
|
-
}
|
88
|
-
|
89
|
-
ngAfterViewInit() {
|
90
|
-
|
91
|
-
}
|
92
|
-
ngOnDestroy() {
|
93
|
-
}
|
94
|
-
|
95
|
-
onDateChanged(selectedDates) {
|
96
|
-
//this.date = selectedDates[0] || null;
|
97
|
-
this.params.onDateChanged();
|
98
|
-
}
|
99
|
-
|
100
|
-
getDate(): Date {
|
101
|
-
return this.date;
|
102
|
-
}
|
103
|
-
|
104
|
-
setDate(date: Date): void {
|
105
|
-
this.date = date || null;
|
106
|
-
//this.picker.setDate(date);
|
107
|
-
}
|
108
|
-
|
109
|
-
setInputPlaceholder(placeholder: string): void {
|
110
|
-
//this.div.nativeElement.setAttribute('placeholder', placeholder);
|
111
|
-
}
|
112
|
-
onValueChanged(e) {
|
113
|
-
|
114
|
-
this.setDate(e.value);
|
115
|
-
this.onDateChanged(e.value);
|
116
|
-
}
|
117
|
-
|
118
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { AXGridDataColumn } from './column.component';
|
2
|
-
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
3
|
-
import { AXConfig } from '@acorex/core';
|
4
|
-
|
5
|
-
@Component({
|
6
|
-
selector: 'ax-row-number-column',
|
7
|
-
template: '',
|
8
|
-
providers: [{ provide: AXGridDataColumn, useExisting: AXGridRowNumberColumn }],
|
9
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
10
|
-
})
|
11
|
-
export class AXGridRowNumberColumn extends AXGridDataColumn {
|
12
|
-
constructor() {
|
13
|
-
super();
|
14
|
-
}
|
15
|
-
|
16
|
-
ngOnInit(): void {}
|
17
|
-
|
18
|
-
@Input()
|
19
|
-
condition: (params) => boolean;
|
20
|
-
|
21
|
-
render() {
|
22
|
-
const col = super.render();
|
23
|
-
// col.checkboxSelection = this.condition ? this.condition : true;
|
24
|
-
// col.headerCheckboxSelection = true;
|
25
|
-
|
26
|
-
(col.headerName = this.caption ? this.caption : AXConfig.get('layout.rtl') ? 'ردیف' : 'Row'),
|
27
|
-
(col.valueGetter = 'node.rowIndex + 1'),
|
28
|
-
(col.pinned = this.pinned == null ? null : this.pinned === 'start' ? 'right' : 'left'),
|
29
|
-
(col.filter = false);
|
30
|
-
col.resizable = true;
|
31
|
-
col.sortable = false;
|
32
|
-
col.width = this.width;
|
33
|
-
|
34
|
-
return col;
|
35
|
-
}
|
36
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { AXGridDataColumn } from './column.component';
|
2
|
-
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
3
|
-
|
4
|
-
@Component({
|
5
|
-
selector: 'ax-selection-column',
|
6
|
-
template: '',
|
7
|
-
providers: [{ provide: AXGridDataColumn, useExisting: AXGridSelectionColumn }],
|
8
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
9
|
-
})
|
10
|
-
export class AXGridSelectionColumn extends AXGridDataColumn {
|
11
|
-
constructor() {
|
12
|
-
super();
|
13
|
-
}
|
14
|
-
|
15
|
-
ngOnInit(): void {}
|
16
|
-
|
17
|
-
@Input()
|
18
|
-
condition: (params) => boolean;
|
19
|
-
|
20
|
-
@Input()
|
21
|
-
pinned: 'start' | 'end' = 'start';
|
22
|
-
|
23
|
-
@Input()
|
24
|
-
width: number = 40;
|
25
|
-
|
26
|
-
render() {
|
27
|
-
const col = super.render();
|
28
|
-
col.checkboxSelection = this.condition ? this.condition : true;
|
29
|
-
// col.headerCheckboxSelection = true;
|
30
|
-
col.pinned = this.pinned === 'start' ? 'right' : 'left';
|
31
|
-
col.filter = false;
|
32
|
-
col.resizable = true;
|
33
|
-
col.sortable = false;
|
34
|
-
col.minWidth = 5;
|
35
|
-
col.width = this.width;
|
36
|
-
col.floatingFilter = false;
|
37
|
-
return col;
|
38
|
-
}
|
39
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
import { AXGridDataColumn } from './column.component';
|
2
|
-
import {
|
3
|
-
ChangeDetectionStrategy,
|
4
|
-
Component,
|
5
|
-
ViewContainerRef,
|
6
|
-
ViewChild
|
7
|
-
} from '@angular/core';
|
8
|
-
import {
|
9
|
-
IFilterParams,
|
10
|
-
RowNode,
|
11
|
-
IDoesFilterPassParams,
|
12
|
-
IAfterGuiAttachedParams
|
13
|
-
} from 'ag-grid-community';
|
14
|
-
import { IFilterAngularComp } from 'ag-grid-angular';
|
15
|
-
import { AXTextBoxComponent } from '@acorex/components';
|
16
|
-
|
17
|
-
|
18
|
-
@Component({
|
19
|
-
selector: 'ax-text-column',
|
20
|
-
template: '',
|
21
|
-
providers: [{ provide: AXGridDataColumn, useExisting: AXGridTextColumn }],
|
22
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
23
|
-
})
|
24
|
-
export class AXGridTextColumn extends AXGridDataColumn {
|
25
|
-
constructor() {
|
26
|
-
super();
|
27
|
-
}
|
28
|
-
|
29
|
-
render() {
|
30
|
-
const col = super.render();
|
31
|
-
// if (this.allowFiltering) {
|
32
|
-
// col.filterFramework = TextFilterRenderer;
|
33
|
-
// }
|
34
|
-
col.filter = 'agTextColumnFilter';
|
35
|
-
return col;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
@Component({
|
40
|
-
template: `
|
41
|
-
<ax-data-grid-filter>
|
42
|
-
<ax-text-box label='Filter' allowClear='true' (textChange)='onChange($event)'>
|
43
|
-
</ax-text-box>
|
44
|
-
</ax-data-grid-filter>
|
45
|
-
`,
|
46
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
47
|
-
})
|
48
|
-
export class TextFilterRenderer implements IFilterAngularComp {
|
49
|
-
public value?: string = null;
|
50
|
-
private params: IFilterParams;
|
51
|
-
private valueGetter: (rowNode: RowNode) => any;
|
52
|
-
@ViewChild(AXTextBoxComponent, { static: true })
|
53
|
-
private input: AXTextBoxComponent;
|
54
|
-
|
55
|
-
agInit(params: IFilterParams): void {
|
56
|
-
this.params = params;
|
57
|
-
this.valueGetter = (params.valueGetter) as any;
|
58
|
-
}
|
59
|
-
|
60
|
-
isFilterActive(): boolean {
|
61
|
-
return this.value !== null && this.value !== undefined;
|
62
|
-
}
|
63
|
-
|
64
|
-
doesFilterPass(params: IDoesFilterPassParams): boolean {
|
65
|
-
return this.value === this.valueGetter(params.node);
|
66
|
-
}
|
67
|
-
|
68
|
-
getModel(): any {
|
69
|
-
return { value: this.value };
|
70
|
-
}
|
71
|
-
|
72
|
-
setModel(model: any): void {
|
73
|
-
;
|
74
|
-
this.onChange(model ? model.value : null);
|
75
|
-
}
|
76
|
-
|
77
|
-
ngAfterViewInit(params: IAfterGuiAttachedParams): void {
|
78
|
-
window.setTimeout(() => {
|
79
|
-
this.input.focus();
|
80
|
-
});
|
81
|
-
}
|
82
|
-
|
83
|
-
onChange(newValue): void {
|
84
|
-
if (this.value !== newValue) {
|
85
|
-
this.value = newValue;
|
86
|
-
if (this.value === '') {
|
87
|
-
this.value = null;
|
88
|
-
}
|
89
|
-
this.params.filterChangedCallback();
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<div class="ax-grid-toolbar" *ngIf="toolbar">
|
2
|
-
<ng-content select="ax-toolbar"></ng-content>
|
3
|
-
</div>
|
4
|
-
<!-- [enableSorting]="true" [enableColResize]="true" [enableFilter]="allowFiltering" -->
|
5
|
-
<ag-grid-angular *ngIf="gridView" class="ag-theme-balham" [getRowClass]="internalGetRowClass"
|
6
|
-
[style.height]="internalHeight" [columnDefs]="columnDefs" [enableRtl]="rtl" [pagination]="pagination"
|
7
|
-
[rowGroupPanelShow]="rowGroupPanelShow" [rowModelType]="rowModelType" [detailRowHeight]="detailRowHeight"
|
8
|
-
[getRowHeight]="getRowHeight" [paginationAutoPageSize]="paginationAutoPageSize"
|
9
|
-
[paginationPageSize]="paginationPageSize" [suppressMenuHide]="true" [frameworkComponents]="frameworkComponents"
|
10
|
-
[isFullWidthCell]="isFullWidthCell" [rowSelection]="selectionMode" [rowMultiSelectWithClick]="rowMultiSelectWithClick"
|
11
|
-
[fullWidthCellRendererFramework]="fullWidthCellRendererFramework"
|
12
|
-
[fullWidthCellRendererParams]="fullWidthCellRendererParams" (cellClicked)="internalGridCellClicked($event)"
|
13
|
-
(cellDoubleClicked)="internalGridCellDoubleClicked($event)" (cellFocused)="internalGridCellFocused($event)"
|
14
|
-
(rowClicked)="internalGridRowClicked($event)" (selectionChanged)="internalGridSelectionChanged($event)"
|
15
|
-
(rowSelected)="rowSelectionChanged($event)" (rowDoubleClicked)="internalGridRowDoubleClicked($event)"
|
16
|
-
(gridReady)="internalGridReady($event)" [groupSelectsChildren]="groupSelectsChildren"
|
17
|
-
[suppressRowClickSelection]="suppressRowClickSelection" [groupSelectsFiltered]="true"
|
18
|
-
[suppressCellSelection]="suppressCellSelection" [autoGroupColumnDef]="autoGroupColumnDef"
|
19
|
-
[suppressAggFuncInHeader]="true" [treeData]="treeData" [animateRows]="true" [isServerSideGroup]="isServerSideGroup"
|
20
|
-
[getServerSideGroupKey]="getServerSideGroupKey" [masterDetail]="masterDetail"
|
21
|
-
[detailCellRendererParams]="detailCellRendererParams" [detailCellRenderer]="detailCellRenderer"
|
22
|
-
(gridSizeChanged)="internalGridSizeChanged($event)" (firstDataRendered)="internalGridFirstDataRendered($event)"
|
23
|
-
[localeText]="localeText" [groupHideOpenParents]="groupHideOpenParents" [enableRangeSelection]="true"
|
24
|
-
[enableRangeSelection]="false" [allowContextMenuWithControlKey]="false" [getMainMenuItems]="getMainMenuItems">
|
25
|
-
</ag-grid-angular>
|
26
|
-
|
27
|
-
<!-- (displayedColumnsChanged)="displayedColumnsChanged($event)" -->
|