@acorex/data-grid 3.0.21 → 3.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/acorex-data-grid.d.ts +4 -0
  2. package/acorex-data-grid.metadata.json +1 -0
  3. package/bundles/acorex-data-grid.umd.js +2224 -0
  4. package/bundles/acorex-data-grid.umd.js.map +1 -0
  5. package/bundles/acorex-data-grid.umd.min.js +16 -0
  6. package/bundles/acorex-data-grid.umd.min.js.map +1 -0
  7. package/esm2015/acorex-data-grid.js +5 -0
  8. package/esm2015/lib/data-grid/columns/check-column.component.js +104 -0
  9. package/esm2015/lib/data-grid/columns/column.component.js +204 -0
  10. package/esm2015/lib/data-grid/columns/command-column.component.js +103 -0
  11. package/esm2015/lib/data-grid/columns/date-column.component.js +114 -0
  12. package/esm2015/lib/data-grid/columns/row-number-column.component.js +39 -0
  13. package/esm2015/lib/data-grid/columns/selection-column.component.js +42 -0
  14. package/esm2015/lib/data-grid/columns/text-column.component.js +81 -0
  15. package/esm2015/lib/data-grid/datagrid.component.js +709 -0
  16. package/esm2015/lib/data-grid/datagrid.events.js +1 -0
  17. package/esm2015/lib/data-grid/datagrid.module.js +98 -0
  18. package/esm2015/lib/data-grid/filters/filter.component.js +25 -0
  19. package/esm2015/lib/data-grid/templates/cell-template.component.js +47 -0
  20. package/esm2015/lib/data-grid/templates/detail-template.component.js +45 -0
  21. package/esm2015/lib/data-grid/templates/row-template.component.js +40 -0
  22. package/esm2015/lib/data-lov/data-lov-popup/data-lov-popup.component.js +121 -0
  23. package/esm2015/lib/data-lov/data-lov.component.js +206 -0
  24. package/esm2015/lib/data-lov/data-lov.module.js +21 -0
  25. package/esm2015/public-api.js +17 -0
  26. package/esm5/acorex-data-grid.js +5 -0
  27. package/esm5/lib/data-grid/columns/check-column.component.js +102 -0
  28. package/esm5/lib/data-grid/columns/column.component.js +206 -0
  29. package/esm5/lib/data-grid/columns/command-column.component.js +98 -0
  30. package/esm5/lib/data-grid/columns/date-column.component.js +119 -0
  31. package/esm5/lib/data-grid/columns/row-number-column.component.js +42 -0
  32. package/esm5/lib/data-grid/columns/selection-column.component.js +46 -0
  33. package/esm5/lib/data-grid/columns/text-column.component.js +81 -0
  34. package/esm5/lib/data-grid/datagrid.component.js +767 -0
  35. package/esm5/lib/data-grid/datagrid.events.js +1 -0
  36. package/esm5/lib/data-grid/datagrid.module.js +101 -0
  37. package/esm5/lib/data-grid/filters/filter.component.js +16 -0
  38. package/esm5/lib/data-grid/templates/cell-template.component.js +46 -0
  39. package/esm5/lib/data-grid/templates/detail-template.component.js +49 -0
  40. package/esm5/lib/data-grid/templates/row-template.component.js +44 -0
  41. package/esm5/lib/data-lov/data-lov-popup/data-lov-popup.component.js +127 -0
  42. package/esm5/lib/data-lov/data-lov.component.js +216 -0
  43. package/esm5/lib/data-lov/data-lov.module.js +24 -0
  44. package/esm5/public-api.js +17 -0
  45. package/fesm2015/acorex-data-grid.js +1901 -0
  46. package/fesm2015/acorex-data-grid.js.map +1 -0
  47. package/fesm5/acorex-data-grid.js +1980 -0
  48. package/fesm5/acorex-data-grid.js.map +1 -0
  49. package/lib/data-grid/columns/check-column.component.d.ts +30 -0
  50. package/lib/data-grid/columns/column.component.d.ts +29 -0
  51. package/lib/data-grid/columns/command-column.component.d.ts +22 -0
  52. package/lib/data-grid/columns/date-column.component.d.ts +27 -0
  53. package/lib/data-grid/columns/row-number-column.component.d.ts +7 -0
  54. package/lib/data-grid/columns/selection-column.component.d.ts +8 -0
  55. package/lib/data-grid/columns/text-column.component.d.ts +20 -0
  56. package/lib/data-grid/datagrid.component.d.ts +129 -0
  57. package/{src/lib/data-grid/datagrid.events.ts → lib/data-grid/datagrid.events.d.ts} +1 -4
  58. package/lib/data-grid/datagrid.module.d.ts +3 -0
  59. package/lib/data-grid/filters/filter.component.d.ts +2 -0
  60. package/lib/data-grid/templates/cell-template.component.d.ts +17 -0
  61. package/lib/data-grid/templates/detail-template.component.d.ts +16 -0
  62. package/lib/data-grid/templates/row-template.component.d.ts +15 -0
  63. package/lib/data-lov/data-lov-popup/data-lov-popup.component.d.ts +29 -0
  64. package/lib/data-lov/data-lov.component.d.ts +39 -0
  65. package/lib/data-lov/data-lov.module.d.ts +2 -0
  66. package/package.json +27 -17
  67. package/{src/public-api.ts → public-api.d.ts} +0 -3
  68. package/karma.conf.js +0 -32
  69. package/ng-package.json +0 -12
  70. package/src/lib/data-grid/columns/check-column.component.ts +0 -113
  71. package/src/lib/data-grid/columns/column.component.ts +0 -181
  72. package/src/lib/data-grid/columns/command-column.component.ts +0 -102
  73. package/src/lib/data-grid/columns/date-column.component.ts +0 -119
  74. package/src/lib/data-grid/columns/row-number-column.component.ts +0 -36
  75. package/src/lib/data-grid/columns/selection-column.component.ts +0 -37
  76. package/src/lib/data-grid/columns/text-column.component.ts +0 -92
  77. package/src/lib/data-grid/datagrid.component.html +0 -26
  78. package/src/lib/data-grid/datagrid.component.ts +0 -724
  79. package/src/lib/data-grid/datagrid.module.ts +0 -93
  80. package/src/lib/data-grid/filters/filter.component.ts +0 -21
  81. package/src/lib/data-grid/templates/cell-template.component.ts +0 -47
  82. package/src/lib/data-grid/templates/detail-template.component.ts +0 -43
  83. package/src/lib/data-grid/templates/row-template.component.ts +0 -41
  84. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.html +0 -16
  85. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.ts +0 -135
  86. package/src/lib/data-lov/data-lov.component.html +0 -61
  87. package/src/lib/data-lov/data-lov.component.ts +0 -177
  88. package/src/lib/data-lov/data-lov.module.ts +0 -17
  89. package/src/test.ts +0 -26
  90. package/tsconfig.lib.json +0 -23
  91. package/tsconfig.lib.prod.json +0 -6
  92. package/tsconfig.spec.json +0 -17
  93. package/tslint.json +0 -17
@@ -0,0 +1,29 @@
1
+ import { ChangeDetectorRef, ElementRef } from '@angular/core';
2
+ import { AXDataGridComponent } from '../../data-grid/datagrid.component';
3
+ import { AXGridDataColumn } from '../../data-grid/columns/column.component';
4
+ import { AXButtonItem } from '@acorex/core';
5
+ import { AXToolbarSearchComponent, AXBasePopupPageComponent, AXMenuItemClickEvent, AXDataSourceComponent } from '@acorex/components';
6
+ export declare class AXDataLovPopupComponent extends AXBasePopupPageComponent {
7
+ private cdr;
8
+ private ref;
9
+ grid: AXDataGridComponent;
10
+ searchBox: AXToolbarSearchComponent;
11
+ columns: AXGridDataColumn[];
12
+ selectedItems: any[];
13
+ keyField: string;
14
+ allowNull: boolean;
15
+ hasChildField: string;
16
+ rtl: boolean;
17
+ selectedRows: any[];
18
+ constructor(cdr: ChangeDetectorRef, ref: ElementRef);
19
+ dataSource: AXDataSourceComponent;
20
+ selectionMode: string;
21
+ ngOnInit(): void;
22
+ onDoneClick(): void;
23
+ rowDoubleClicked(e: any): void;
24
+ onCancelClick(): void;
25
+ rowSelectionChange(e: any): void;
26
+ ngAfterViewInit(): void;
27
+ getFooterButtons(): AXButtonItem[];
28
+ onFooterButtonClick(e: AXMenuItemClickEvent): void;
29
+ }
@@ -0,0 +1,39 @@
1
+ import { EventEmitter, ElementRef, TemplateRef } from '@angular/core';
2
+ import { AXPopupService, AXBaseInputComponent, AXBaseSizableComponent, AXElementSize, AXValidation } from '@acorex/components';
3
+ import { AXDataSourceComponent, AXSelectBoxComponent, AXDataEvent, AXValidatableComponent } from '@acorex/components';
4
+ export declare class AXLOVComponent extends AXValidatableComponent implements AXBaseSizableComponent, AXBaseInputComponent {
5
+ private popup;
6
+ private ref;
7
+ private _contentValidation;
8
+ private _validation;
9
+ get validation(): AXValidation;
10
+ set validation(v: AXValidation);
11
+ constructor(popup: AXPopupService, ref: ElementRef);
12
+ selectBox: AXSelectBoxComponent;
13
+ dataSource: AXDataSourceComponent;
14
+ private columns;
15
+ rowTemplate: TemplateRef<any>;
16
+ textField: string;
17
+ allowSearch: boolean;
18
+ valueField: string;
19
+ hasChildField: string;
20
+ allowNull: boolean;
21
+ popupSize: 'sm' | 'md' | 'lg' | 'full';
22
+ selectedItems: any[];
23
+ readonly: boolean;
24
+ disabled: boolean;
25
+ chipsWidth: string;
26
+ size: AXElementSize;
27
+ caption: string;
28
+ mode: 'single' | 'multiple';
29
+ placeholder: string;
30
+ onSelectionChange: EventEmitter<AXDataEvent<any>>;
31
+ rtl: boolean;
32
+ focus(): void;
33
+ refresh(): void;
34
+ handleButtonClick(): void;
35
+ ngOnInit(): void;
36
+ ngAfterContentInit(): void;
37
+ handleSelectChange(e: any): void;
38
+ open(): Promise<any>;
39
+ }
@@ -0,0 +1,2 @@
1
+ export declare class AXLOVModule {
2
+ }
package/package.json CHANGED
@@ -1,17 +1,27 @@
1
- {
2
- "name": "@acorex/data-grid",
3
- "version": "3.0.21",
4
- "peerDependencies": {
5
- "@angular/common": "^9.0.6",
6
- "@angular/core": "^9.0.6",
7
- "ag-grid-angular": "^24.0.0",
8
- "ag-grid-community": "^24.0.0",
9
- "ag-grid-enterprise": "^24.0.0",
10
- "tslib": "^1.10.0"
11
- },
12
- "dependencies": {
13
- "ag-grid-angular": "^24.0.0",
14
- "ag-grid-community": "^24.0.0",
15
- "ag-grid-enterprise": "^24.0.0"
16
- }
17
- }
1
+ {
2
+ "name": "@acorex/data-grid",
3
+ "version": "3.0.25",
4
+ "peerDependencies": {
5
+ "@angular/common": "^9.0.6",
6
+ "@angular/core": "^9.0.6",
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": "^1.10.0"
16
+ },
17
+ "main": "bundles/acorex-data-grid.umd.js",
18
+ "module": "fesm5/acorex-data-grid.js",
19
+ "es2015": "fesm2015/acorex-data-grid.js",
20
+ "esm5": "esm5/acorex-data-grid.js",
21
+ "esm2015": "esm2015/acorex-data-grid.js",
22
+ "fesm5": "fesm5/acorex-data-grid.js",
23
+ "fesm2015": "fesm2015/acorex-data-grid.js",
24
+ "typings": "acorex-data-grid.d.ts",
25
+ "metadata": "acorex-data-grid.metadata.json",
26
+ "sideEffects": false
27
+ }
@@ -5,16 +5,13 @@ export * from './lib/data-grid/columns/date-column.component';
5
5
  export * from './lib/data-grid/columns/selection-column.component';
6
6
  export * from './lib/data-grid/columns/text-column.component';
7
7
  export * from './lib/data-grid/columns/row-number-column.component';
8
-
9
8
  export * from './lib/data-grid/datagrid.component';
10
9
  export * from './lib/data-grid/datagrid.events';
11
10
  export * from './lib/data-grid/datagrid.module';
12
-
13
11
  export * from './lib/data-grid/filters/filter.component';
14
12
  export * from './lib/data-grid/templates/cell-template.component';
15
13
  export * from './lib/data-grid/templates/row-template.component';
16
14
  export * from './lib/data-grid/templates/detail-template.component';
17
-
18
15
  export * from './lib/data-lov/data-lov-popup/data-lov-popup.component';
19
16
  export * from './lib/data-lov/data-lov.component';
20
17
  export * from './lib/data-lov/data-lov.module';
package/karma.conf.js DELETED
@@ -1,32 +0,0 @@
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
- };
package/ng-package.json DELETED
@@ -1,12 +0,0 @@
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
- "whitelistedNonPeerDependencies": [
8
- "ag-grid-community",
9
- "ag-grid-angular",
10
- "ag-grid-enterprise"
11
- ]
12
- }
@@ -1,113 +0,0 @@
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;
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
- }
@@ -1,181 +0,0 @@
1
- import { AXConfig } from '@acorex/core';
2
- import { Input, ContentChild, TemplateRef } 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
- export abstract class AXGridDataColumn {
9
-
10
-
11
- @ContentChild(AXDataGridCellTemplateComponent)
12
- cellTemplate: AXDataGridCellTemplateComponent;
13
-
14
- @Input()
15
- width: number = 100;
16
-
17
- @Input()
18
- maxWidth: number;
19
-
20
- @Input()
21
- minWidth: number;
22
-
23
- @Input()
24
- pinned: 'start' | 'end' | null = null;
25
-
26
- @Input()
27
- allowSorting: boolean = true;
28
-
29
- @Input()
30
- allowFiltering: boolean = AXConfig.get('datagrid.allowFiltering') || false;;
31
-
32
- @Input()
33
- cellClass: (params: AXGridCellParams) => (string | string[]) | (string | string[]);
34
-
35
- @Input()
36
- sort: 'asc' | 'desc' | null = null;
37
-
38
- @Input()
39
- field: string = '';
40
-
41
- @Input()
42
- caption: string = '';
43
-
44
- @Input()
45
- cellRendererParams: any;
46
-
47
- @Input()
48
- checkbox: boolean = false;
49
-
50
- @Input()
51
- headerCheckbox: boolean = false;
52
-
53
- @Input()
54
- groupIndex: number = -1;
55
-
56
- @Input()
57
- treeIndex: number = -1;
58
-
59
- @Input()
60
- enableRowGroup: boolean = false;
61
-
62
- @Input()
63
- hide: boolean = false;
64
-
65
- @Input()
66
- floatingFilter: boolean = AXConfig.get('datagrid.floatingFilter') || false;
67
-
68
- @Input()
69
- disableMenu: boolean = false;
70
-
71
- @Input()
72
- resizable: boolean = true;
73
-
74
- @Input()
75
- menuColumnDisable: boolean = false;
76
-
77
- @Input()
78
- menuItemDisable: boolean = false;
79
-
80
- constructor() { }
81
-
82
- render(): any {
83
- const col: any = {
84
- field: this.field,
85
- width: this.width,
86
- };
87
- col.resizable = this.resizable;
88
- col.suppressMenu = this.disableMenu;
89
- col.menuTabs = ['filterMenuTab', 'columnsMenuTab', 'generalMenuTab']
90
- col.floatingFilter = this.floatingFilter;
91
-
92
- if (!this.allowFiltering) {
93
- col.filter = false;
94
- col.menuTabs = col.menuTabs.filter(c => c != 'filterMenuTab');
95
- col.floatingFilter = false;
96
- }
97
- if (this.menuColumnDisable == true) {
98
- col.menuTabs = col.menuTabs.filter(c => c != 'columnsMenuTab');
99
- }
100
- if (this.menuItemDisable == true) {
101
- col.menuTabs = col.menuTabs.filter(c => c != 'generalMenuTab');
102
- }
103
- if (this.caption) {
104
- col.headerName = this.caption;
105
- }
106
- if (this.minWidth) {
107
- col.minWidth = this.minWidth;
108
- }
109
- if (this.maxWidth) {
110
- col.maxWidth = this.maxWidth;
111
- }
112
- if (this.pinned) {
113
- col.pinned = this.pinned === 'start' ? 'right' : 'left';
114
- // TODO: Change based on layout
115
- }
116
- if (this.allowSorting) {
117
- col.sortable = this.allowSorting;
118
- }
119
- if (this.sort) {
120
- col.sort = this.sort;
121
- }
122
-
123
- if (this.groupIndex >= 0) {
124
- col.rowGroupIndex = this.groupIndex;
125
- col.rowGroup = true;
126
- this.enableRowGroup = true;
127
- }
128
-
129
- if (this.treeIndex >= 0) {
130
- col.rowGroupIndex = this.treeIndex;
131
- col.rowGroup = false;
132
- }
133
- if (this.hide) {
134
- col.hide = true;
135
-
136
- }
137
- if (this.enableRowGroup) {
138
- col.enableRowGroup = this.enableRowGroup;
139
- }
140
-
141
- if (this.cellClass) {
142
- const THAT = this;
143
- if (this.cellClass instanceof Function) {
144
- col.cellClass = (p) => {
145
- return THAT.cellClass({
146
- column: THAT,
147
- rowIndex: p.node.rowIndex,
148
- rowLevel: p.node.level,
149
- data: p.data,
150
- value: p.value
151
- });
152
- };
153
- }
154
- else {
155
- col.cellClass = this.cellClass;
156
-
157
- }
158
- }
159
- //
160
- if (this.cellTemplate != null) {
161
- col.cellRendererFramework = this.cellTemplate.renderer;
162
- col.cellRendererParams = this.cellTemplate.params;
163
- }
164
-
165
- if (this.checkbox) {
166
- col.checkboxSelection = (params) => {
167
- return true;
168
- };
169
- // col.headerCheckboxSelection = this.headerCheckbox;
170
- }
171
- return col;
172
- }
173
- }
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
@@ -1,102 +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
-
19
-
20
- @Input()
21
- items: AXMenuItem[] | AXGridRowCommandFunction = [];
22
-
23
- @Output()
24
- onItemClick: EventEmitter<AXGridRowCommandEvent> = new EventEmitter<AXGridRowCommandEvent>();
25
-
26
- render() {
27
- const col = super.render();
28
- if (!col.cellRendererFramework) {
29
- col.cellRendererFramework = CommandRenderer;
30
- }
31
- col.cellRendererParams = {
32
- items: this.items,
33
- onClick: (e) => {
34
- this.onItemClick.emit({
35
- command: e.name,
36
- data: e.data,
37
- rowIndex: e.rowIndex,
38
- rowLevel: e.rowLevel,
39
- htmlEvent:e.htmlEvent
40
- });
41
- }
42
- };
43
- col.sortable = false;
44
- col.filter = false;
45
- col.valueGetter = (params) => {
46
- return this.items;
47
- };
48
- return col;
49
- }
50
- }
51
-
52
- @Component({
53
- selector: 'ax-command-cell',
54
- template: `
55
- <button
56
- *ngFor="let item of items"
57
- class="ax button md ax-grid-command-button {{ item.style || 'ax primary blank' }}"
58
- [class.disabled]="item.disable"
59
- type="button"
60
- [title]="item.tooltip"
61
- (click)="onClick(item,$event)"
62
- >
63
- <i [ngClass]="item.icon"></i>{{ item.text }}
64
- </button>
65
- `,
66
- encapsulation: ViewEncapsulation.None,
67
- changeDetection: ChangeDetectionStrategy.OnPush
68
- })
69
- export class CommandRenderer implements ICellRendererAngularComp {
70
- items: AXMenuItem[] | AXGridRowCommandFunction = [];
71
- node: any;
72
- private clickCallback: Function;
73
-
74
- constructor() { }
75
-
76
- agInit(params: ICellRendererParams): void {
77
- this.mapParams(params);
78
- }
79
-
80
- refresh(params: ICellRendererParams): boolean {
81
- this.mapParams(params);
82
- return true;
83
- }
84
-
85
- private mapParams(params: any) {
86
- this.node = params.node;
87
- this.items = typeof params.items == 'function' ? params.items({ data: this.node.data }) : Array.isArray(params.items) ? params.items : [];
88
- this.clickCallback = params.onClick;
89
- }
90
-
91
- onClick(item: AXMenuItem,e:MouseEvent) {
92
- if (this.clickCallback && !item.disable) {
93
- this.clickCallback({
94
- name: item.name,
95
- rowLevel: this.node.level,
96
- rowIndex: this.node.rowIndex,
97
- data: this.node.data,
98
- htmlEvent:e
99
- });
100
- }
101
- }
102
- }
@@ -1,119 +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: { style: 'display: contents;' },
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
- console.log(`Destroying DateComponent`);
94
- }
95
-
96
- onDateChanged(selectedDates) {
97
- //this.date = selectedDates[0] || null;
98
- this.params.onDateChanged();
99
- }
100
-
101
- getDate(): Date {
102
- return this.date;
103
- }
104
-
105
- setDate(date: Date): void {
106
- this.date = date || null;
107
- //this.picker.setDate(date);
108
- }
109
-
110
- setInputPlaceholder(placeholder: string): void {
111
- //this.div.nativeElement.setAttribute('placeholder', placeholder);
112
- }
113
- onValueChanged(e) {
114
-
115
- this.setDate(e.value);
116
- this.onDateChanged(e.value);
117
- }
118
-
119
- }