@acorex/data-grid 6.5.23 → 6.5.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +12 -0
  3. package/package.json +16 -36
  4. package/src/lib/data-grid/columns/check-column.component.ts +113 -0
  5. package/src/lib/data-grid/columns/column.component.ts +182 -0
  6. package/src/lib/data-grid/columns/command-column.component.ts +101 -0
  7. package/src/lib/data-grid/columns/date-column.component.ts +118 -0
  8. package/src/lib/data-grid/columns/row-number-column.component.ts +36 -0
  9. package/src/lib/data-grid/columns/selection-column.component.ts +39 -0
  10. package/src/lib/data-grid/columns/text-column.component.ts +92 -0
  11. package/src/lib/data-grid/datagrid.component.html +27 -0
  12. package/src/lib/data-grid/datagrid.component.ts +769 -0
  13. package/{lib/data-grid/datagrid.events.d.ts → src/lib/data-grid/datagrid.events.ts} +4 -1
  14. package/src/lib/data-grid/datagrid.module.ts +81 -0
  15. package/src/lib/data-grid/filters/filter.component.ts +21 -0
  16. package/src/lib/data-grid/templates/cell-template.component.ts +47 -0
  17. package/src/lib/data-grid/templates/detail-template.component.ts +43 -0
  18. package/src/lib/data-grid/templates/row-template.component.ts +41 -0
  19. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.html +16 -0
  20. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.ts +130 -0
  21. package/src/lib/data-lov/data-lov.component.html +61 -0
  22. package/src/lib/data-lov/data-lov.component.ts +184 -0
  23. package/src/lib/data-lov/data-lov.module.ts +16 -0
  24. package/{public-api.d.ts → src/public-api.ts} +3 -0
  25. package/src/test.ts +28 -0
  26. package/tsconfig.lib.json +23 -0
  27. package/tsconfig.lib.prod.json +6 -0
  28. package/tsconfig.spec.json +17 -0
  29. package/tslint.json +17 -0
  30. package/acorex-data-grid.d.ts +0 -5
  31. package/esm2020/acorex-data-grid.mjs +0 -5
  32. package/esm2020/lib/data-grid/columns/check-column.component.mjs +0 -117
  33. package/esm2020/lib/data-grid/columns/column.component.mjs +0 -164
  34. package/esm2020/lib/data-grid/columns/command-column.component.mjs +0 -115
  35. package/esm2020/lib/data-grid/columns/date-column.component.mjs +0 -111
  36. package/esm2020/lib/data-grid/columns/row-number-column.component.mjs +0 -37
  37. package/esm2020/lib/data-grid/columns/selection-column.component.mjs +0 -42
  38. package/esm2020/lib/data-grid/columns/text-column.component.mjs +0 -89
  39. package/esm2020/lib/data-grid/datagrid.component.mjs +0 -667
  40. package/esm2020/lib/data-grid/datagrid.events.mjs +0 -2
  41. package/esm2020/lib/data-grid/datagrid.module.mjs +0 -145
  42. package/esm2020/lib/data-grid/filters/filter.component.mjs +0 -39
  43. package/esm2020/lib/data-grid/templates/cell-template.component.mjs +0 -53
  44. package/esm2020/lib/data-grid/templates/detail-template.component.mjs +0 -46
  45. package/esm2020/lib/data-grid/templates/row-template.component.mjs +0 -43
  46. package/esm2020/lib/data-lov/data-lov-popup/data-lov-popup.component.mjs +0 -114
  47. package/esm2020/lib/data-lov/data-lov.component.mjs +0 -165
  48. package/esm2020/lib/data-lov/data-lov.module.mjs +0 -23
  49. package/esm2020/public-api.mjs +0 -18
  50. package/fesm2015/acorex-data-grid.mjs +0 -1881
  51. package/fesm2015/acorex-data-grid.mjs.map +0 -1
  52. package/fesm2020/acorex-data-grid.mjs +0 -1881
  53. package/fesm2020/acorex-data-grid.mjs.map +0 -1
  54. package/lib/data-grid/columns/check-column.component.d.ts +0 -37
  55. package/lib/data-grid/columns/column.component.d.ts +0 -32
  56. package/lib/data-grid/columns/command-column.component.d.ts +0 -27
  57. package/lib/data-grid/columns/date-column.component.d.ts +0 -32
  58. package/lib/data-grid/columns/row-number-column.component.d.ts +0 -10
  59. package/lib/data-grid/columns/selection-column.component.d.ts +0 -12
  60. package/lib/data-grid/columns/text-column.component.d.ts +0 -25
  61. package/lib/data-grid/datagrid.component.d.ts +0 -142
  62. package/lib/data-grid/datagrid.module.d.ts +0 -23
  63. package/lib/data-grid/filters/filter.component.d.ts +0 -5
  64. package/lib/data-grid/templates/cell-template.component.d.ts +0 -22
  65. package/lib/data-grid/templates/detail-template.component.d.ts +0 -21
  66. package/lib/data-grid/templates/row-template.component.d.ts +0 -20
  67. package/lib/data-lov/data-lov-popup/data-lov-popup.component.d.ts +0 -33
  68. package/lib/data-lov/data-lov.component.d.ts +0 -43
  69. package/lib/data-lov/data-lov.module.d.ts +0 -12
package/karma.conf.js ADDED
@@ -0,0 +1,32 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ coverageIstanbulReporter: {
19
+ dir: require('path').join(__dirname, '../../../coverage/acorex/data-grid'),
20
+ reports: ['html', 'lcovonly', 'text-summary'],
21
+ fixWebpackSourcePaths: true
22
+ },
23
+ reporters: ['progress', 'kjhtml'],
24
+ port: 9876,
25
+ colors: true,
26
+ logLevel: config.LOG_INFO,
27
+ autoWatch: true,
28
+ browsers: ['Chrome'],
29
+ singleRun: false,
30
+ restartOnFileChange: true
31
+ });
32
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/acorex/data-grid",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "allowedNonPeerDependencies": [
8
+ "ag-grid-community",
9
+ "ag-grid-angular",
10
+ "ag-grid-enterprise"
11
+ ]
12
+ }
package/package.json CHANGED
@@ -1,37 +1,17 @@
1
- {
2
- "name": "@acorex/data-grid",
3
- "version": "6.5.23",
4
- "peerDependencies": {
5
- "@angular/common": "^13.3.8",
6
- "@angular/core": "^13.3.8",
7
- "ag-grid-angular": "^24.0.0",
8
- "ag-grid-community": "^24.0.0",
9
- "ag-grid-enterprise": "^24.0.0"
10
- },
11
- "dependencies": {
12
- "ag-grid-angular": "^24.0.0",
13
- "ag-grid-community": "^24.0.0",
14
- "ag-grid-enterprise": "^24.0.0",
15
- "tslib": "^2.0.0"
16
- },
17
- "module": "fesm2015/acorex-data-grid.mjs",
18
- "es2020": "fesm2020/acorex-data-grid.mjs",
19
- "esm2020": "esm2020/acorex-data-grid.mjs",
20
- "fesm2020": "fesm2020/acorex-data-grid.mjs",
21
- "fesm2015": "fesm2015/acorex-data-grid.mjs",
22
- "typings": "acorex-data-grid.d.ts",
23
- "exports": {
24
- "./package.json": {
25
- "default": "./package.json"
26
- },
27
- ".": {
28
- "types": "./acorex-data-grid.d.ts",
29
- "esm2020": "./esm2020/acorex-data-grid.mjs",
30
- "es2020": "./fesm2020/acorex-data-grid.mjs",
31
- "es2015": "./fesm2015/acorex-data-grid.mjs",
32
- "node": "./fesm2015/acorex-data-grid.mjs",
33
- "default": "./fesm2020/acorex-data-grid.mjs"
34
- }
35
- },
36
- "sideEffects": false
1
+ {
2
+ "name": "@acorex/data-grid",
3
+ "version": "6.5.27",
4
+ "peerDependencies": {
5
+ "@angular/common": "^13.3.8",
6
+ "@angular/core": "^13.3.8",
7
+ "ag-grid-angular": "^24.0.0",
8
+ "ag-grid-community": "^24.0.0",
9
+ "ag-grid-enterprise": "^24.0.0"
10
+ },
11
+ "dependencies": {
12
+ "ag-grid-angular": "^24.0.0",
13
+ "ag-grid-community": "^24.0.0",
14
+ "ag-grid-enterprise": "^24.0.0",
15
+ "tslib": "^2.0.0"
16
+ }
37
17
  }
@@ -0,0 +1,113 @@
1
+ import {
2
+ Component,
3
+ ChangeDetectionStrategy,
4
+ ViewChild,
5
+ ViewContainerRef
6
+ } from '@angular/core';
7
+ import { AXGridDataColumn } from './column.component';
8
+ import { ICellRendererAngularComp, IFilterAngularComp } from 'ag-grid-angular';
9
+ import {
10
+ ICellRendererParams,
11
+ IFilterParams,
12
+ RowNode,
13
+ IDoesFilterPassParams,
14
+ IAfterGuiAttachedParams
15
+ } from 'ag-grid-community';
16
+
17
+ @Component({
18
+ selector: 'ax-check-column',
19
+ template: '',
20
+ providers: [{ provide: AXGridDataColumn, useExisting: AXGridCheckColumn }],
21
+ changeDetection: ChangeDetectionStrategy.OnPush
22
+ })
23
+
24
+ export class AXGridCheckColumn extends AXGridDataColumn {
25
+ constructor() {
26
+ super();
27
+ }
28
+
29
+ render() {
30
+ const col = super.render();
31
+ if (!col.cellRendererFramework) {
32
+ col.cellRendererFramework = BooleanRenderer;
33
+ }
34
+ if (this.allowFiltering) {
35
+ col.filterFramework = BooleanFilterRenderer;
36
+ }
37
+ return col;
38
+ }
39
+ }
40
+
41
+ @Component({
42
+ template: `
43
+ <ax-check-box [value]='value' readonly='true'></ax-check-box>
44
+ `,
45
+ changeDetection: ChangeDetectionStrategy.OnPush
46
+ })
47
+ export class BooleanRenderer implements ICellRendererAngularComp {
48
+ value: boolean;
49
+ constructor() { }
50
+ agInit(params: ICellRendererParams): void {
51
+ this.value = params.value;
52
+ }
53
+ refresh(params: ICellRendererParams): boolean {
54
+ this.value = params.value;
55
+ return true;
56
+ }
57
+ }
58
+
59
+ @Component({
60
+ template: `
61
+ <ax-data-grid-filter>
62
+ <ax-select-box
63
+ label='Select Box'
64
+ [items]='selectItem'
65
+ ></ax-select-box>
66
+ </ax-data-grid-filter>
67
+ `,
68
+ changeDetection: ChangeDetectionStrategy.OnPush
69
+ })
70
+ export class BooleanFilterRenderer implements IFilterAngularComp {
71
+ public value?: boolean = null;
72
+ private params: IFilterParams;
73
+ private valueGetter: (rowNode: RowNode) => any;
74
+ @ViewChild('input', { static: true, read: ViewContainerRef }) public input;
75
+
76
+ selectItem = [
77
+ { value: 0, label: 'True' },
78
+ { value: 1, label: 'False' },
79
+ ];
80
+ agInit(params: IFilterParams): void {
81
+ this.params = params;
82
+ this.valueGetter = (params.valueGetter) as any;
83
+ }
84
+
85
+ isFilterActive(): boolean {
86
+ return this.value !== null && this.value !== undefined;
87
+ }
88
+
89
+ doesFilterPass(params: IDoesFilterPassParams): boolean {
90
+ return this.value === this.valueGetter(params.node);
91
+ }
92
+
93
+ getModel(): any {
94
+ return { value: this.value };
95
+ }
96
+
97
+ setModel(model: any): void {
98
+ this.value = model ? model.value : null;
99
+ }
100
+
101
+ ngAfterViewInit(params: IAfterGuiAttachedParams): void {
102
+ window.setTimeout(() => {
103
+ this.input.element.nativeElement.focus();
104
+ });
105
+ }
106
+
107
+ onChange(newValue): void {
108
+ if (this.value !== newValue) {
109
+ this.value = newValue;
110
+ this.params.filterChangedCallback();
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,182 @@
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
+
@@ -0,0 +1,101 @@
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
+ }
@@ -0,0 +1,118 @@
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
+ }
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,39 @@
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
+ }