@acorex/data-grid 6.5.28 → 6.5.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/README.md +2 -2
  2. package/acorex-data-grid.d.ts +5 -0
  3. package/esm2020/acorex-data-grid.mjs +5 -0
  4. package/esm2020/lib/data-grid/columns/check-column.component.mjs +117 -0
  5. package/esm2020/lib/data-grid/columns/column.component.mjs +164 -0
  6. package/esm2020/lib/data-grid/columns/command-column.component.mjs +115 -0
  7. package/esm2020/lib/data-grid/columns/date-column.component.mjs +111 -0
  8. package/esm2020/lib/data-grid/columns/row-number-column.component.mjs +37 -0
  9. package/esm2020/lib/data-grid/columns/selection-column.component.mjs +42 -0
  10. package/esm2020/lib/data-grid/columns/text-column.component.mjs +89 -0
  11. package/esm2020/lib/data-grid/datagrid.component.mjs +667 -0
  12. package/esm2020/lib/data-grid/datagrid.events.mjs +2 -0
  13. package/esm2020/lib/data-grid/datagrid.module.mjs +145 -0
  14. package/esm2020/lib/data-grid/filters/filter.component.mjs +39 -0
  15. package/esm2020/lib/data-grid/templates/cell-template.component.mjs +53 -0
  16. package/esm2020/lib/data-grid/templates/detail-template.component.mjs +46 -0
  17. package/esm2020/lib/data-grid/templates/row-template.component.mjs +43 -0
  18. package/esm2020/lib/data-lov/data-lov-popup/data-lov-popup.component.mjs +114 -0
  19. package/esm2020/lib/data-lov/data-lov.component.mjs +165 -0
  20. package/esm2020/lib/data-lov/data-lov.module.mjs +23 -0
  21. package/esm2020/public-api.mjs +18 -0
  22. package/fesm2015/acorex-data-grid.mjs +1881 -0
  23. package/fesm2015/acorex-data-grid.mjs.map +1 -0
  24. package/fesm2020/acorex-data-grid.mjs +1881 -0
  25. package/fesm2020/acorex-data-grid.mjs.map +1 -0
  26. package/lib/data-grid/columns/check-column.component.d.ts +37 -0
  27. package/lib/data-grid/columns/column.component.d.ts +32 -0
  28. package/lib/data-grid/columns/command-column.component.d.ts +27 -0
  29. package/lib/data-grid/columns/date-column.component.d.ts +32 -0
  30. package/lib/data-grid/columns/row-number-column.component.d.ts +10 -0
  31. package/lib/data-grid/columns/selection-column.component.d.ts +12 -0
  32. package/lib/data-grid/columns/text-column.component.d.ts +25 -0
  33. package/lib/data-grid/datagrid.component.d.ts +142 -0
  34. package/{src/lib/data-grid/datagrid.events.ts → lib/data-grid/datagrid.events.d.ts} +20 -23
  35. package/lib/data-grid/datagrid.module.d.ts +23 -0
  36. package/lib/data-grid/filters/filter.component.d.ts +5 -0
  37. package/lib/data-grid/templates/cell-template.component.d.ts +22 -0
  38. package/lib/data-grid/templates/detail-template.component.d.ts +21 -0
  39. package/lib/data-grid/templates/row-template.component.d.ts +20 -0
  40. package/lib/data-lov/data-lov-popup/data-lov-popup.component.d.ts +33 -0
  41. package/lib/data-lov/data-lov.component.d.ts +43 -0
  42. package/lib/data-lov/data-lov.module.d.ts +12 -0
  43. package/package.json +36 -16
  44. package/{src/public-api.ts → public-api.d.ts} +17 -20
  45. package/karma.conf.js +0 -32
  46. package/ng-package.json +0 -12
  47. package/src/lib/data-grid/columns/check-column.component.ts +0 -113
  48. package/src/lib/data-grid/columns/column.component.ts +0 -182
  49. package/src/lib/data-grid/columns/command-column.component.ts +0 -101
  50. package/src/lib/data-grid/columns/date-column.component.ts +0 -118
  51. package/src/lib/data-grid/columns/row-number-column.component.ts +0 -36
  52. package/src/lib/data-grid/columns/selection-column.component.ts +0 -39
  53. package/src/lib/data-grid/columns/text-column.component.ts +0 -92
  54. package/src/lib/data-grid/datagrid.component.html +0 -27
  55. package/src/lib/data-grid/datagrid.component.ts +0 -769
  56. package/src/lib/data-grid/datagrid.module.ts +0 -81
  57. package/src/lib/data-grid/filters/filter.component.ts +0 -21
  58. package/src/lib/data-grid/templates/cell-template.component.ts +0 -47
  59. package/src/lib/data-grid/templates/detail-template.component.ts +0 -43
  60. package/src/lib/data-grid/templates/row-template.component.ts +0 -41
  61. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.html +0 -16
  62. package/src/lib/data-lov/data-lov-popup/data-lov-popup.component.ts +0 -130
  63. package/src/lib/data-lov/data-lov.component.html +0 -61
  64. package/src/lib/data-lov/data-lov.component.ts +0 -184
  65. package/src/lib/data-lov/data-lov.module.ts +0 -16
  66. package/src/test.ts +0 -28
  67. package/tsconfig.lib.json +0 -23
  68. package/tsconfig.lib.prod.json +0 -6
  69. package/tsconfig.spec.json +0 -17
  70. package/tslint.json +0 -17
@@ -1,81 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { AXDataGridComponent } from './datagrid.component';
4
- import { FormsModule } from '@angular/forms';
5
- import { AgGridModule } from 'ag-grid-angular';
6
- import { AXDataSourceModule } from '@acorex/components';
7
- import { AXGridTextColumn, TextFilterRenderer } from './columns/text-column.component';
8
- import { AXGridCheckColumn, BooleanRenderer, BooleanFilterRenderer } from './columns/check-column.component';
9
- import { AXCoreModule } from '@acorex/core';
10
- import { AXGridSelectionColumn } from './columns/selection-column.component';
11
- import { CommandRenderer, AXGridCommandColumn } from './columns/command-column.component';
12
- import { AXDataGridFilterComponent } from './filters/filter.component';
13
- import { AXGridDateColumn, AXDatePickerFilterComponent } from './columns/date-column.component';
14
- import { AXDataGridRowTemplateComponent, AXDataGridRowTemplateRenderer } from './templates/row-template.component';
15
- import { AXDataGridCellTemplateComponent, AXDataGridCellTemplateRenderer } from './templates/cell-template.component';
16
- import { AXDataGridDetailTemplateComponent, AXDataGridDetailTemplateRenderer } from './templates/detail-template.component';
17
- import { AXTextBoxModule } from '@acorex/components';
18
- import { AXCheckBoxModule } from '@acorex/components';
19
- import { AXSelectBoxModule } from '@acorex/components';
20
- import { AXButtonModule } from '@acorex/components';
21
- import { AXDatePickerModule } from '@acorex/components';
22
- import 'ag-grid-enterprise';
23
- import { AXGridRowNumberColumn } from './columns/row-number-column.component';
24
-
25
- @NgModule({
26
- declarations: [
27
- AXDataGridComponent,
28
- AXGridTextColumn,
29
- AXGridCheckColumn,
30
- AXGridSelectionColumn,
31
- AXGridDateColumn,
32
- AXGridRowNumberColumn,
33
- AXGridCommandColumn,
34
- BooleanRenderer,
35
- BooleanFilterRenderer,
36
- TextFilterRenderer,
37
- AXDataGridFilterComponent,
38
- AXDataGridRowTemplateComponent,
39
- AXDataGridDetailTemplateComponent,
40
- AXDataGridRowTemplateRenderer,
41
- AXDataGridDetailTemplateRenderer,
42
- AXDataGridCellTemplateComponent,
43
- AXDataGridCellTemplateRenderer,
44
- AXDatePickerFilterComponent,
45
- CommandRenderer
46
- ],
47
- imports: [
48
- CommonModule,
49
- AXCoreModule,
50
- FormsModule,
51
- //AgGridModule,
52
- AXTextBoxModule,
53
- AXCheckBoxModule,
54
- AXSelectBoxModule,
55
- AXDataSourceModule,
56
- AXButtonModule,
57
- AXDatePickerModule,
58
- AgGridModule.withComponents([AXDatePickerFilterComponent])
59
- ],
60
- exports: [
61
- AXDataGridComponent,
62
- AXDataGridFilterComponent,
63
- AXDataGridRowTemplateComponent,
64
- AXDataGridDetailTemplateComponent,
65
- AXDataGridRowTemplateRenderer,
66
- AXDataGridDetailTemplateRenderer,
67
- AXDataGridCellTemplateComponent,
68
- AXDataGridCellTemplateRenderer,
69
- AXGridTextColumn,
70
- AXGridRowNumberColumn,
71
- AXGridCheckColumn,
72
- AXGridDateColumn,
73
- AXGridSelectionColumn,
74
- AXGridCommandColumn,
75
- BooleanRenderer,
76
- BooleanFilterRenderer,
77
- CommandRenderer
78
- ],
79
- providers: []
80
- })
81
- export class AXDataGridModule {}
@@ -1,21 +0,0 @@
1
- import { Component, ViewEncapsulation } from '@angular/core';
2
-
3
-
4
- @Component({
5
- selector: 'ax-data-grid-filter',
6
- template: `
7
- <div class='ax-grid-filter-container'>
8
- <ng-content></ng-content>
9
- <div class='btn-group' role='group'>
10
- <button type='button' class='btn btn-primary btn-sm'>
11
- <i class='fas fa-filter'></i>
12
- </button>
13
- <button type='button' class='btn btn-danger btn-sm'>
14
- <i class='fas fa-trash-alt'></i>
15
- </button>
16
- </div>
17
- </div>
18
- `,
19
- encapsulation: ViewEncapsulation.None
20
- })
21
- export class AXDataGridFilterComponent {}
@@ -1,47 +0,0 @@
1
- import { Component, ContentChild, TemplateRef, ChangeDetectionStrategy } from '@angular/core';
2
- import { ICellRendererAngularComp } from 'ag-grid-angular';
3
- import { ICellRendererParams } from 'ag-grid-community';
4
-
5
- @Component({
6
- selector: 'ax-cell-template',
7
- template: `<ng-content></ng-content>
8
- `
9
- })
10
-
11
- export class AXDataGridCellTemplateComponent {
12
- @ContentChild(TemplateRef, { static: true }) templateRef: TemplateRef<any>;
13
- renderer: any;
14
- params: any;
15
- constructor() {
16
- this.renderer = AXDataGridCellTemplateRenderer;
17
- }
18
- ngOnInit(): void {
19
- this.params = {
20
- templateRef: this.templateRef
21
- }
22
- }
23
- }
24
-
25
- @Component({
26
- template: `
27
- <ng-container *ngTemplateOutlet='templateRef; context: { $implicit: rowData }'>
28
- </ng-container>
29
- `
30
- })
31
-
32
- export class AXDataGridCellTemplateRenderer implements ICellRendererAngularComp {
33
- rowData: any;
34
- templateRef: TemplateRef<any>;
35
-
36
- constructor() { }
37
-
38
- agInit(params: ICellRendererParams): void {
39
- this.rowData = params.data;
40
- this.templateRef = (params as any).templateRef;
41
- }
42
-
43
- refresh(params: ICellRendererParams): boolean {
44
- this.rowData = params.data;
45
- return true;
46
- }
47
- }
@@ -1,43 +0,0 @@
1
- import { Component, ContentChild, TemplateRef, Input, ChangeDetectorRef } from '@angular/core';
2
- import { ICellRendererAngularComp } from 'ag-grid-angular';
3
-
4
- @Component({
5
- selector: 'ax-grid-detail-template',
6
- template: `<ng-content></ng-content>`
7
- })
8
-
9
- export class AXDataGridDetailTemplateComponent {
10
- @ContentChild(TemplateRef, { static: true }) templateRef: TemplateRef<any>;
11
- renderer: any;
12
- params: any;
13
- constructor() {
14
- this.renderer = AXDataGridDetailTemplateRenderer;
15
- }
16
- ngOnInit(): void {
17
- this.params = {
18
- templateRef: this.templateRef
19
- }
20
- }
21
-
22
- @Input()
23
- height: number = 100;
24
- }
25
-
26
- @Component({
27
- template: `<ng-container *ngTemplateOutlet='templateRef; context: { $implicit: data }'></ng-container>`
28
- })
29
-
30
- export class AXDataGridDetailTemplateRenderer implements ICellRendererAngularComp {
31
-
32
- refresh(params: any): boolean {
33
- return false;
34
- }
35
-
36
- templateRef: TemplateRef<any>;
37
- data: any;
38
-
39
- agInit(params: any): void {
40
- this.data = params.data;
41
- this.templateRef = params.templateRef;
42
- }
43
- }
@@ -1,41 +0,0 @@
1
- import { Component, ContentChild, TemplateRef, Input } from '@angular/core';
2
- import { ICellRendererAngularComp } from 'ag-grid-angular';
3
-
4
- @Component({
5
- selector: 'ax-row-template',
6
- template: `<ng-content></ng-content>`
7
- })
8
-
9
- export class AXDataGridRowTemplateComponent {
10
- @ContentChild(TemplateRef, { static: true }) templateRef: TemplateRef<any>;
11
- renderer: any;
12
- params: any;
13
- constructor() {
14
- this.renderer = AXDataGridRowTemplateRenderer;
15
- }
16
- ngOnInit(): void {
17
- this.params = {
18
- templateRef: this.templateRef
19
- }
20
- }
21
- }
22
-
23
- @Component({
24
- template: `<ng-container *ngTemplateOutlet='templateRef; context: { $implicit: data }'></ng-container>`
25
- })
26
-
27
- export class AXDataGridRowTemplateRenderer implements ICellRendererAngularComp {
28
-
29
- templateRef: TemplateRef<any>;
30
-
31
- data: any;
32
-
33
- refresh(params: any): boolean {
34
- return false;
35
- }
36
-
37
- agInit(params: any): void {
38
- this.data = params.data.callRecords;
39
- this.templateRef = params.templateRef;
40
- }
41
- }
@@ -1,16 +0,0 @@
1
- <div style="height: 70vh; padding: 0.5em;">
2
- <div style="height: calc(100%);">
3
-
4
- <ax-data-grid [pagination]="pagination" [rtl]="rtl" [suppressRowClickSelection]="false" [keyField]="keyField"
5
- [hasChildField]="hasChildField" [selectRow]="selectedItems" #grid [columns]="columns"
6
- [remoteOperation]="true" [selectionMode]="selectionMode" (rowDbClick)="rowDoubleClicked($event)"
7
- (rowSelectionChange)="rowSelectionChange($event)" [dataSource]="dataSource">
8
- <ax-toolbar>
9
- <ax-toolbar-search #searchBox style="width: 100%;"></ax-toolbar-search>
10
- </ax-toolbar>
11
- <ax-selection-column *ngIf="selectionMode== 'single'? false : true"></ax-selection-column>
12
- <!-- <ax-data-source [provideData]="dataSource.provideData">
13
- </ax-data-source> -->
14
- </ax-data-grid>
15
- </div>
16
- </div>
@@ -1,130 +0,0 @@
1
- import { Component, ViewChild, ChangeDetectorRef, ElementRef } from '@angular/core';
2
- import { AXDataGridComponent, AXDataGridSelectionChangeEvent } from '../../data-grid/datagrid.component';
3
- import { AXGridDataColumn } from '../../data-grid/columns/column.component';
4
- import { AXTranslator, AXButtonItem, AXConfig } from '@acorex/core';
5
- import {
6
- AXToolbarSearchComponent,
7
- AXBasePopupPageComponent,
8
- AXMenuItemClickEvent,
9
- AXDataSourceComponent,
10
- AXDataSourceReadParams
11
- } from '@acorex/components';
12
-
13
- @Component({
14
- templateUrl: './data-lov-popup.component.html'
15
- })
16
- export class AXDataLovPopupComponent extends AXBasePopupPageComponent {
17
- @ViewChild('grid', { static: true })
18
- grid: AXDataGridComponent;
19
-
20
- @ViewChild('searchBox')
21
- searchBox: AXToolbarSearchComponent;
22
-
23
- columns: AXGridDataColumn[] = [];
24
-
25
- selectedItems: any[] = [];
26
-
27
- keyField: string = '';
28
- allowNull: boolean = true;
29
-
30
- hasChildField: string;
31
- rtl: boolean = AXConfig.get('layout.rtl');
32
-
33
- selectedRows: any[] = [];
34
- pagination:boolean =true;
35
- constructor(private cdr: ChangeDetectorRef, private ref: ElementRef) {
36
- super();
37
- }
38
-
39
- dataSource: AXDataSourceComponent;
40
-
41
- selectionMode: string;
42
-
43
- ngOnInit(): void {
44
- if (this.rtl == null) {
45
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
46
- }
47
- }
48
-
49
- onDoneClick() {
50
- if (this.selectedItems) {
51
- this.close(this.selectedItems);
52
- } else {
53
- this.close();
54
- }
55
- }
56
-
57
- rowDoubleClicked(e) {
58
- if (this.selectionMode == 'single') {
59
- this.selectedItems = [];
60
- }
61
-
62
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.data[this.keyField]);
63
- this.selectedItems.push(e.data.data);
64
-
65
- this.onDoneClick();
66
- }
67
-
68
- onCancelClick() {
69
- this.close();
70
- }
71
-
72
- rowSelectionChange(e) {
73
- if (e.data.node.selected == true) {
74
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
75
- this.selectedItems.push(e.data.node.data);
76
- } else {
77
- if (this.allowNull == true || (this.allowNull == false && this.selectedItems.length > 1)) {
78
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
79
- }
80
- }
81
- }
82
-
83
- ngAfterViewInit() {
84
- this.selectedItems.forEach((ele) => {
85
- this.selectedRows.push(ele);
86
- });
87
- this.searchBox.focus();
88
- if (this.dataSource.onDataReceived) {
89
- this.dataSource.onDataReceived.subscribe((arg) => {
90
- this.cdr.markForCheck();
91
- this.cdr.detectChanges();
92
- });
93
- }
94
- }
95
-
96
- // onValueSearchChanged(e) {
97
-
98
- // const params: AXDataSourceReadParams = {}
99
- // params.searchText = e.value;
100
- // // params.take = 100;
101
- // // params.skip = 0
102
- // this.dataSource.fetch(params);
103
- // }
104
-
105
- getFooterButtons(): AXButtonItem[] {
106
- return [
107
- {
108
- text: AXTranslator.get('common.confirm'),
109
- name: 'confirm',
110
- style: 'ax primary',
111
- icon: 'far fa-check-circle'
112
- },
113
- {
114
- text: AXTranslator.get('common.cancel'),
115
- name: 'cancel',
116
- style: 'ax light',
117
- icon: 'far fa-times'
118
- }
119
- ];
120
- }
121
-
122
- onFooterButtonClick(e: AXMenuItemClickEvent) {
123
- if (e.name === 'confirm') {
124
- this.onDoneClick();
125
- }
126
- if (e.name === 'cancel') {
127
- this.onCancelClick();
128
- }
129
- }
130
- }
@@ -1,61 +0,0 @@
1
- <ax-select-box [rowInputTemplate]="rowTemplate" [rtl]="rtl" [allowSearch]="allowSearch" #selectBox [showDropDownButton]="false" [allowNull]="allowNull"
2
- [remoteOperation]="true" [placeholder]="placeholder" [size]="size" [textField]="textField" [valueField]="valueField"
3
- [disabled]="disabled" [mode]="mode" [(selectedItems)]="selectedItems"
4
- (selectionChanged)="handleSelectChange($event)" [dataSource]="dataSource">
5
- <ng-container start>
6
- <ng-content select="[start]">
7
- </ng-content>
8
- </ng-container>
9
- <ng-container end>
10
- <ax-button icon="far fa-bars icon" [disabled]="disabled" type="light blank" (click)="handleButtonClick()" end
11
- [tabIndex]="-1">
12
- </ax-button>
13
- <ng-content select="[end]">
14
- </ng-content>
15
- </ng-container>
16
- </ax-select-box>
17
-
18
-
19
- <!-- <ax-select-box2 [rtl]="rtl" [allowSearch]="allowSearch" #selectBox [showDropDownButton]="false" [allowNull]="allowNull"
20
- [remoteOperation]="true" [placeholder]="placeholder" [size]="size" [textField]="textField" [valueField]="valueField"
21
- [disabled]="disabled" [selectionMode]="mode" (onValueChanged)="handleSelectChange($event)" [dataSource]="dataSource"
22
- [(value)]="selectedItems" selectionDataMode="item">
23
- <ng-container start>
24
- <ng-content select="[start]">
25
- </ng-content>
26
- </ng-container>
27
- <ng-container end>
28
- <ax-button icon="far fa-bars icon" [disabled]="disabled" type="primary blank" (click)="handleButtonClick()" end
29
- [tabIndex]="-1">
30
- </ax-button>
31
- <ng-content select="[end]">
32
- </ng-content>
33
- </ng-container>
34
- </ax-select-box2> -->
35
-
36
-
37
- <!-- <div class="ax-lov-box" [style.display]="mode=='hidden' ? 'none':'unset'">
38
- <div class="ax-field-set">
39
- <div class="ax-field-set-wrapper" [ngClass]="{ 'no-label': !label }">
40
- <fieldset [ngClass]="{ 'input-focused': isFocused, 'input-error': errorText }">
41
- <legend *ngIf="label">
42
- {{ label }}
43
- </legend>
44
- </fieldset>
45
- <input type="text" [(ngModel)]="text" [placeholder]="placeholder" (keyup)="handleKeyEvent($event)"
46
- (blur)="handleBlurEvent($event)" (focus)="handleFocusEvent($event)" class="ax-text-box" disabled />
47
- <div class="ax-field-set-button">
48
- <button *ngIf="text && allowClear" type="button" class="btn btn-light" (click)="clearText()">
49
- <i class="far fa-times"></i>
50
- </button>
51
- <button type="button" class=" btn btn-primary" (click)="handleButtonClick($event)">
52
- <i class="far fa-check-circle"></i>
53
- </button>
54
- </div>
55
- </div>
56
- </div>
57
- <div class="validation-text" *ngIf="errorText">
58
- {{ errorText }}
59
- </div>
60
-
61
- </div> -->
@@ -1,184 +0,0 @@
1
- import {
2
- Component,
3
- Input,
4
- ContentChildren,
5
- QueryList,
6
- Output,
7
- EventEmitter,
8
- ContentChild,
9
- ViewChild,
10
- ViewEncapsulation,
11
- ElementRef,
12
- TemplateRef
13
- } from '@angular/core';
14
- import { AXPopupService, AXBaseInputComponent, AXBaseSizableComponent, AXElementSize, AXValidation } from '@acorex/components';
15
- import { AXDataSourceComponent, AXSelectBoxComponent, AXDataEvent, AXValidatableComponent } from '@acorex/components';
16
- import { AXDataLovPopupComponent } from './data-lov-popup/data-lov-popup.component';
17
- import { AXGridDataColumn } from '../data-grid/columns/column.component';
18
- import { AXConfig } from '@acorex/core';
19
-
20
- @Component({
21
- selector: 'ax-lov',
22
- templateUrl: './data-lov.component.html',
23
- encapsulation: ViewEncapsulation.None,
24
- host: { style: 'width: 100%' },
25
- providers: [{ provide: AXValidatableComponent, useExisting: AXLOVComponent }]
26
- })
27
- export class AXLOVComponent extends AXValidatableComponent implements AXBaseSizableComponent, AXBaseInputComponent {
28
- @ContentChild(AXValidation, { static: true })
29
- private _contentValidation: AXValidation;
30
- private _validation: AXValidation;
31
-
32
- @Input()
33
- public get validation(): AXValidation {
34
- return this._validation ? this._validation : this._contentValidation;
35
- }
36
- public set validation(v: AXValidation) {
37
- this._validation = v;
38
- }
39
-
40
- constructor(private popup: AXPopupService, private ref: ElementRef) {
41
- super();
42
- }
43
-
44
- @ViewChild('selectBox', { static: true })
45
- selectBox: AXSelectBoxComponent;
46
-
47
- @ContentChild(AXDataSourceComponent, { static: true })
48
- dataSource: AXDataSourceComponent;
49
-
50
- @ContentChildren(AXGridDataColumn)
51
- private columns: QueryList<AXGridDataColumn>;
52
-
53
- @ContentChild('itemTemplate', { static: true })
54
- rowTemplate: TemplateRef<any>;
55
-
56
- @Input()
57
- textField: string = '';
58
-
59
- @Input()
60
- allowSearch: boolean = true;
61
-
62
- @Input()
63
- valueField: string = '';
64
-
65
- @Input()
66
- hasChildField: string = 'null';
67
-
68
- @Input()
69
- allowNull: boolean = true;
70
-
71
- @Input()
72
- popupSize: 'sm' | 'md' | 'lg' | 'full' = 'md';
73
-
74
- @Input()
75
- pagination:boolean =true;
76
- @Input()
77
- selectedItems: any[] = [];
78
-
79
- // @Input()
80
- // selectedValues: any[] = [];
81
-
82
- @Input()
83
- readonly: boolean = false;
84
-
85
- @Input()
86
- disabled: boolean = false;
87
-
88
- @Input()
89
- chipsWidth: string = '';
90
-
91
- @Input()
92
- size: AXElementSize = 'md';
93
-
94
- @Input()
95
- caption: string;
96
-
97
- @Input()
98
- mode: 'single' | 'multiple' = 'single';
99
-
100
- @Input()
101
- placeholder: string;
102
-
103
- @Output()
104
- onSelectionChange: EventEmitter<AXDataEvent<any>> = new EventEmitter<AXDataEvent<any>>();
105
-
106
- @Input()
107
- rtl: boolean = AXConfig.get('layout.rtl');
108
-
109
- focus(): void {
110
- this.selectBox.focus();
111
- }
112
-
113
- refresh() {
114
- this.selectBox.refresh();
115
- }
116
-
117
- handleButtonClick() {
118
- this.open();
119
- }
120
-
121
- ngOnInit(): void {
122
- if (this.rtl == null) {
123
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
124
- }
125
- // this.selectVal = this.selectedValues;
126
- this.onSelectionChange.subscribe((c) => {
127
- this.clearValidationStyle(this.ref.nativeElement);
128
- });
129
- }
130
-
131
- ngAfterContentInit(): void {
132
- this.initValidation(this.ref, 'selectedItems', this.validation);
133
- }
134
-
135
- handleSelectChange(e) {
136
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
137
- }
138
-
139
- public open(): Promise<any> {
140
- return new Promise((resolve) => {
141
- this.selectBox.dropdown.close();
142
- this.popup
143
- .open(AXDataLovPopupComponent, {
144
- size: this.popupSize,
145
- // closable: false,
146
- data: {
147
- dataSource: this.dataSource,
148
- selectionMode: this.mode,
149
- columns: this.columns.toArray(),
150
- // selectedItems: this.selectedValues,
151
- selectedItems: this.selectedItems,
152
- keyField: this.valueField,
153
- allowNull: this.allowNull,
154
- hasChildField: this.hasChildField,
155
- rtl: this.rtl,
156
- pagination:this.pagination
157
- },
158
- title: this.caption
159
- // size: this.size,
160
- })
161
- .then((c) => {
162
- if (c.data) {
163
- // this.selectedValues = [];
164
- this.selectedItems = [];
165
- c.data.forEach((elm) => {
166
- this.selectedItems.push(elm);
167
- });
168
- // this.selectedItems = c.data;
169
- // this.selectBox.refresh();
170
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
171
- if (resolve) {
172
- resolve(c.data);
173
- }
174
- } else {
175
- if (resolve) {
176
- resolve(this.selectedItems);
177
- }
178
- }
179
-
180
- this.selectBox.refresh();
181
- });
182
- });
183
- }
184
- }
@@ -1,16 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { AXLOVComponent } from './data-lov.component';
4
- import { FormsModule } from '@angular/forms';
5
- import { AXDataLovPopupComponent } from './data-lov-popup/data-lov-popup.component';
6
- import { AXDataGridModule } from '../data-grid/datagrid.module';
7
- import { AXDataSourceModule, AXButtonModule, AXToolbarModule, AXSearchBoxModule, AXSelectBoxModule } from '@acorex/components';
8
-
9
-
10
- @NgModule({
11
- declarations: [AXLOVComponent, AXDataLovPopupComponent],
12
- imports: [CommonModule, FormsModule, AXDataGridModule, AXDataSourceModule, AXButtonModule, AXToolbarModule, AXSelectBoxModule, AXSearchBoxModule],
13
- exports: [AXLOVComponent, AXDataLovPopupComponent],
14
- providers: []
15
- })
16
- export class AXLOVModule { }
package/src/test.ts DELETED
@@ -1,28 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- keys(): string[];
14
- <T>(id: string): T;
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(), {
22
- teardown: { destroyAfterEach: false }
23
- }
24
- );
25
- // Then we find all the tests.
26
- const context = require.context('./', true, /\.spec\.ts$/);
27
- // And load the modules.
28
- context.keys().map(context);