@acorex/data-grid 3.0.63 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/acorex-data-grid.d.ts +1 -0
  2. package/esm2020/acorex-data-grid.mjs +5 -0
  3. package/esm2020/lib/data-grid/columns/check-column.component.mjs +117 -0
  4. package/esm2020/lib/data-grid/columns/column.component.mjs +164 -0
  5. package/{esm2015/lib/data-grid/columns/command-column.component.js → esm2020/lib/data-grid/columns/command-column.component.mjs} +46 -35
  6. package/esm2020/lib/data-grid/columns/date-column.component.mjs +112 -0
  7. package/esm2020/lib/data-grid/columns/row-number-column.component.mjs +37 -0
  8. package/esm2020/lib/data-grid/columns/selection-column.component.mjs +42 -0
  9. package/esm2020/lib/data-grid/columns/text-column.component.mjs +89 -0
  10. package/esm2020/lib/data-grid/datagrid.component.mjs +658 -0
  11. package/esm2020/lib/data-grid/datagrid.events.mjs +2 -0
  12. package/esm2020/lib/data-grid/datagrid.module.mjs +145 -0
  13. package/esm2020/lib/data-grid/filters/filter.component.mjs +39 -0
  14. package/esm2020/lib/data-grid/templates/cell-template.component.mjs +53 -0
  15. package/esm2020/lib/data-grid/templates/detail-template.component.mjs +46 -0
  16. package/esm2020/lib/data-grid/templates/row-template.component.mjs +43 -0
  17. package/esm2020/lib/data-lov/data-lov-popup/data-lov-popup.component.mjs +118 -0
  18. package/esm2020/lib/data-lov/data-lov.component.mjs +163 -0
  19. package/esm2020/lib/data-lov/data-lov.module.mjs +23 -0
  20. package/esm2020/public-api.mjs +18 -0
  21. package/fesm2015/acorex-data-grid.mjs +1875 -0
  22. package/fesm2015/acorex-data-grid.mjs.map +1 -0
  23. package/fesm2020/acorex-data-grid.mjs +1875 -0
  24. package/fesm2020/acorex-data-grid.mjs.map +1 -0
  25. package/lib/data-grid/columns/check-column.component.d.ts +7 -0
  26. package/lib/data-grid/columns/column.component.d.ts +3 -0
  27. package/lib/data-grid/columns/command-column.component.d.ts +5 -0
  28. package/lib/data-grid/columns/date-column.component.d.ts +5 -0
  29. package/lib/data-grid/columns/row-number-column.component.d.ts +3 -0
  30. package/lib/data-grid/columns/selection-column.component.d.ts +3 -0
  31. package/lib/data-grid/columns/text-column.component.d.ts +5 -0
  32. package/lib/data-grid/datagrid.component.d.ts +8 -1
  33. package/lib/data-grid/datagrid.module.d.ts +20 -0
  34. package/lib/data-grid/filters/filter.component.d.ts +3 -0
  35. package/lib/data-grid/templates/cell-template.component.d.ts +5 -0
  36. package/lib/data-grid/templates/detail-template.component.d.ts +5 -0
  37. package/lib/data-grid/templates/row-template.component.d.ts +5 -0
  38. package/lib/data-lov/data-lov-popup/data-lov-popup.component.d.ts +3 -0
  39. package/lib/data-lov/data-lov.component.d.ts +3 -0
  40. package/lib/data-lov/data-lov.module.d.ts +10 -0
  41. package/package.json +23 -13
  42. package/acorex-data-grid.metadata.json +0 -1
  43. package/bundles/acorex-data-grid.umd.js +0 -2249
  44. package/bundles/acorex-data-grid.umd.js.map +0 -1
  45. package/bundles/acorex-data-grid.umd.min.js +0 -16
  46. package/bundles/acorex-data-grid.umd.min.js.map +0 -1
  47. package/esm2015/acorex-data-grid.js +0 -5
  48. package/esm2015/lib/data-grid/columns/check-column.component.js +0 -104
  49. package/esm2015/lib/data-grid/columns/column.component.js +0 -204
  50. package/esm2015/lib/data-grid/columns/date-column.component.js +0 -114
  51. package/esm2015/lib/data-grid/columns/row-number-column.component.js +0 -39
  52. package/esm2015/lib/data-grid/columns/selection-column.component.js +0 -48
  53. package/esm2015/lib/data-grid/columns/text-column.component.js +0 -81
  54. package/esm2015/lib/data-grid/datagrid.component.js +0 -722
  55. package/esm2015/lib/data-grid/datagrid.events.js +0 -1
  56. package/esm2015/lib/data-grid/datagrid.module.js +0 -98
  57. package/esm2015/lib/data-grid/filters/filter.component.js +0 -25
  58. package/esm2015/lib/data-grid/templates/cell-template.component.js +0 -47
  59. package/esm2015/lib/data-grid/templates/detail-template.component.js +0 -45
  60. package/esm2015/lib/data-grid/templates/row-template.component.js +0 -40
  61. package/esm2015/lib/data-lov/data-lov-popup/data-lov-popup.component.js +0 -121
  62. package/esm2015/lib/data-lov/data-lov.component.js +0 -212
  63. package/esm2015/lib/data-lov/data-lov.module.js +0 -21
  64. package/esm2015/public-api.js +0 -17
  65. package/esm5/acorex-data-grid.js +0 -5
  66. package/esm5/lib/data-grid/columns/check-column.component.js +0 -102
  67. package/esm5/lib/data-grid/columns/column.component.js +0 -206
  68. package/esm5/lib/data-grid/columns/command-column.component.js +0 -98
  69. package/esm5/lib/data-grid/columns/date-column.component.js +0 -119
  70. package/esm5/lib/data-grid/columns/row-number-column.component.js +0 -42
  71. package/esm5/lib/data-grid/columns/selection-column.component.js +0 -52
  72. package/esm5/lib/data-grid/columns/text-column.component.js +0 -81
  73. package/esm5/lib/data-grid/datagrid.component.js +0 -780
  74. package/esm5/lib/data-grid/datagrid.events.js +0 -1
  75. package/esm5/lib/data-grid/datagrid.module.js +0 -101
  76. package/esm5/lib/data-grid/filters/filter.component.js +0 -16
  77. package/esm5/lib/data-grid/templates/cell-template.component.js +0 -46
  78. package/esm5/lib/data-grid/templates/detail-template.component.js +0 -49
  79. package/esm5/lib/data-grid/templates/row-template.component.js +0 -44
  80. package/esm5/lib/data-lov/data-lov-popup/data-lov-popup.component.js +0 -127
  81. package/esm5/lib/data-lov/data-lov.component.js +0 -222
  82. package/esm5/lib/data-lov/data-lov.module.js +0 -24
  83. package/esm5/public-api.js +0 -17
  84. package/fesm2015/acorex-data-grid.js +0 -1927
  85. package/fesm2015/acorex-data-grid.js.map +0 -1
  86. package/fesm5/acorex-data-grid.js +0 -2005
  87. package/fesm5/acorex-data-grid.js.map +0 -1
@@ -1,1927 +0,0 @@
1
- import { __decorate, __metadata } from 'tslib';
2
- import { ContentChild, TemplateRef, Component, Input, ChangeDetectionStrategy, ViewChild, ViewContainerRef, EventEmitter, Output, ViewEncapsulation, ElementRef, ChangeDetectorRef, ContentChildren, QueryList, NgModule } from '@angular/core';
3
- import { AXConfig, AXDateTime, AXTranslator, AXCoreModule } from '@acorex/core';
4
- import { AXDatePickerComponent, AXTextBoxComponent, AXValueEvent, AXDataEvent, AXToolbarSearchComponent, AXToolbarComponent, AXDataSourceComponent, AXTextBoxModule, AXCheckBoxModule, AXSelectBoxModule, AXDataSourceModule, AXButtonModule, AXDatePickerModule, AXBasePopupPageComponent, AXValidatableComponent, AXPopupService, AXValidation, AXSelectBoxComponent, AXToolbarModule, AXSearchBoxModule } from '@acorex/components';
5
- import { LicenseManager } from 'ag-grid-enterprise';
6
- import { CommonModule } from '@angular/common';
7
- import { FormsModule } from '@angular/forms';
8
- import { AgGridModule } from 'ag-grid-angular';
9
-
10
- let AXDataGridCellTemplateComponent = class AXDataGridCellTemplateComponent {
11
- constructor() {
12
- this.renderer = AXDataGridCellTemplateRenderer;
13
- }
14
- ngOnInit() {
15
- this.params = {
16
- templateRef: this.templateRef
17
- };
18
- }
19
- };
20
- __decorate([
21
- ContentChild(TemplateRef, { static: true }),
22
- __metadata("design:type", TemplateRef)
23
- ], AXDataGridCellTemplateComponent.prototype, "templateRef", void 0);
24
- AXDataGridCellTemplateComponent = __decorate([
25
- Component({
26
- selector: 'ax-cell-template',
27
- template: `<ng-content></ng-content>
28
- `
29
- }),
30
- __metadata("design:paramtypes", [])
31
- ], AXDataGridCellTemplateComponent);
32
- let AXDataGridCellTemplateRenderer = class AXDataGridCellTemplateRenderer {
33
- constructor() { }
34
- agInit(params) {
35
- this.rowData = params.data;
36
- this.templateRef = params.templateRef;
37
- }
38
- refresh(params) {
39
- this.rowData = params.data;
40
- return true;
41
- }
42
- };
43
- AXDataGridCellTemplateRenderer = __decorate([
44
- Component({
45
- template: `
46
- <ng-container *ngTemplateOutlet='templateRef; context: { $implicit: rowData }'>
47
- </ng-container>
48
- `
49
- }),
50
- __metadata("design:paramtypes", [])
51
- ], AXDataGridCellTemplateRenderer);
52
-
53
- class AXGridDataColumn {
54
- constructor() {
55
- this.width = 100;
56
- this.pinned = null;
57
- this.allowSorting = true;
58
- this.allowFiltering = AXConfig.get('datagrid.allowFiltering') || false;
59
- this.sort = null;
60
- this.field = '';
61
- this.caption = '';
62
- this.checkbox = false;
63
- this.headerCheckbox = false;
64
- this.groupIndex = -1;
65
- this.treeIndex = -1;
66
- this.enableRowGroup = false;
67
- this.hide = false;
68
- this.floatingFilter = AXConfig.get('datagrid.floatingFilter') || false;
69
- this.disableMenu = false;
70
- this.resizable = true;
71
- this.menuColumnDisable = false;
72
- this.menuItemDisable = false;
73
- }
74
- ;
75
- render() {
76
- const col = {
77
- field: this.field,
78
- width: this.width,
79
- };
80
- col.resizable = this.resizable;
81
- col.suppressMenu = this.disableMenu;
82
- col.menuTabs = ['filterMenuTab', 'columnsMenuTab', 'generalMenuTab'];
83
- col.floatingFilter = this.floatingFilter;
84
- if (!this.allowFiltering) {
85
- col.filter = false;
86
- col.menuTabs = col.menuTabs.filter(c => c != 'filterMenuTab');
87
- col.floatingFilter = false;
88
- }
89
- if (this.menuColumnDisable == true) {
90
- col.menuTabs = col.menuTabs.filter(c => c != 'columnsMenuTab');
91
- }
92
- if (this.menuItemDisable == true) {
93
- col.menuTabs = col.menuTabs.filter(c => c != 'generalMenuTab');
94
- }
95
- if (this.caption) {
96
- col.headerName = this.caption;
97
- }
98
- if (this.minWidth) {
99
- col.minWidth = this.minWidth;
100
- }
101
- if (this.maxWidth) {
102
- col.maxWidth = this.maxWidth;
103
- }
104
- if (this.pinned) {
105
- col.pinned = this.pinned === 'start' ? 'right' : 'left';
106
- // TODO: Change based on layout
107
- }
108
- if (this.allowSorting) {
109
- col.sortable = this.allowSorting;
110
- }
111
- if (this.sort) {
112
- col.sort = this.sort;
113
- }
114
- if (this.groupIndex >= 0) {
115
- col.rowGroupIndex = this.groupIndex;
116
- col.rowGroup = true;
117
- this.enableRowGroup = true;
118
- }
119
- if (this.treeIndex >= 0) {
120
- col.rowGroupIndex = this.treeIndex;
121
- col.rowGroup = false;
122
- }
123
- if (this.hide) {
124
- col.hide = true;
125
- }
126
- if (this.enableRowGroup) {
127
- col.enableRowGroup = this.enableRowGroup;
128
- }
129
- if (this.cellClass) {
130
- const THAT = this;
131
- if (this.cellClass instanceof Function) {
132
- col.cellClass = (p) => {
133
- return THAT.cellClass({
134
- column: THAT,
135
- rowIndex: p.node.rowIndex,
136
- rowLevel: p.node.level,
137
- data: p.data,
138
- value: p.value
139
- });
140
- };
141
- }
142
- else {
143
- col.cellClass = this.cellClass;
144
- }
145
- }
146
- //
147
- if (this.cellTemplate != null) {
148
- col.cellRendererFramework = this.cellTemplate.renderer;
149
- col.cellRendererParams = this.cellTemplate.params;
150
- }
151
- if (this.checkbox) {
152
- col.checkboxSelection = (params) => {
153
- return true;
154
- };
155
- // col.headerCheckboxSelection = this.headerCheckbox;
156
- }
157
- return col;
158
- }
159
- }
160
- __decorate([
161
- ContentChild(AXDataGridCellTemplateComponent),
162
- __metadata("design:type", AXDataGridCellTemplateComponent)
163
- ], AXGridDataColumn.prototype, "cellTemplate", void 0);
164
- __decorate([
165
- Input(),
166
- __metadata("design:type", Number)
167
- ], AXGridDataColumn.prototype, "width", void 0);
168
- __decorate([
169
- Input(),
170
- __metadata("design:type", Number)
171
- ], AXGridDataColumn.prototype, "maxWidth", void 0);
172
- __decorate([
173
- Input(),
174
- __metadata("design:type", Number)
175
- ], AXGridDataColumn.prototype, "minWidth", void 0);
176
- __decorate([
177
- Input(),
178
- __metadata("design:type", String)
179
- ], AXGridDataColumn.prototype, "pinned", void 0);
180
- __decorate([
181
- Input(),
182
- __metadata("design:type", Boolean)
183
- ], AXGridDataColumn.prototype, "allowSorting", void 0);
184
- __decorate([
185
- Input(),
186
- __metadata("design:type", Boolean)
187
- ], AXGridDataColumn.prototype, "allowFiltering", void 0);
188
- __decorate([
189
- Input(),
190
- __metadata("design:type", Function)
191
- ], AXGridDataColumn.prototype, "cellClass", void 0);
192
- __decorate([
193
- Input(),
194
- __metadata("design:type", String)
195
- ], AXGridDataColumn.prototype, "sort", void 0);
196
- __decorate([
197
- Input(),
198
- __metadata("design:type", String)
199
- ], AXGridDataColumn.prototype, "field", void 0);
200
- __decorate([
201
- Input(),
202
- __metadata("design:type", String)
203
- ], AXGridDataColumn.prototype, "caption", void 0);
204
- __decorate([
205
- Input(),
206
- __metadata("design:type", Object)
207
- ], AXGridDataColumn.prototype, "cellRendererParams", void 0);
208
- __decorate([
209
- Input(),
210
- __metadata("design:type", Boolean)
211
- ], AXGridDataColumn.prototype, "checkbox", void 0);
212
- __decorate([
213
- Input(),
214
- __metadata("design:type", Boolean)
215
- ], AXGridDataColumn.prototype, "headerCheckbox", void 0);
216
- __decorate([
217
- Input(),
218
- __metadata("design:type", Number)
219
- ], AXGridDataColumn.prototype, "groupIndex", void 0);
220
- __decorate([
221
- Input(),
222
- __metadata("design:type", Number)
223
- ], AXGridDataColumn.prototype, "treeIndex", void 0);
224
- __decorate([
225
- Input(),
226
- __metadata("design:type", Boolean)
227
- ], AXGridDataColumn.prototype, "enableRowGroup", void 0);
228
- __decorate([
229
- Input(),
230
- __metadata("design:type", Boolean)
231
- ], AXGridDataColumn.prototype, "hide", void 0);
232
- __decorate([
233
- Input(),
234
- __metadata("design:type", Boolean)
235
- ], AXGridDataColumn.prototype, "floatingFilter", void 0);
236
- __decorate([
237
- Input(),
238
- __metadata("design:type", Boolean)
239
- ], AXGridDataColumn.prototype, "disableMenu", void 0);
240
- __decorate([
241
- Input(),
242
- __metadata("design:type", Boolean)
243
- ], AXGridDataColumn.prototype, "resizable", void 0);
244
- __decorate([
245
- Input(),
246
- __metadata("design:type", Boolean)
247
- ], AXGridDataColumn.prototype, "menuColumnDisable", void 0);
248
- __decorate([
249
- Input(),
250
- __metadata("design:type", Boolean)
251
- ], AXGridDataColumn.prototype, "menuItemDisable", void 0);
252
-
253
- var AXGridCheckColumn_1;
254
- let AXGridCheckColumn = AXGridCheckColumn_1 = class AXGridCheckColumn extends AXGridDataColumn {
255
- constructor() {
256
- super();
257
- }
258
- render() {
259
- const col = super.render();
260
- if (!col.cellRendererFramework) {
261
- col.cellRendererFramework = BooleanRenderer;
262
- }
263
- if (this.allowFiltering) {
264
- col.filterFramework = BooleanFilterRenderer;
265
- }
266
- return col;
267
- }
268
- };
269
- AXGridCheckColumn = AXGridCheckColumn_1 = __decorate([
270
- Component({
271
- selector: 'ax-check-column',
272
- template: '',
273
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridCheckColumn_1 }],
274
- changeDetection: ChangeDetectionStrategy.OnPush
275
- }),
276
- __metadata("design:paramtypes", [])
277
- ], AXGridCheckColumn);
278
- let BooleanRenderer = class BooleanRenderer {
279
- constructor() { }
280
- agInit(params) {
281
- this.value = params.value;
282
- }
283
- refresh(params) {
284
- this.value = params.value;
285
- return true;
286
- }
287
- };
288
- BooleanRenderer = __decorate([
289
- Component({
290
- template: `
291
- <ax-check-box [value]='value' readonly='true'></ax-check-box>
292
- `,
293
- changeDetection: ChangeDetectionStrategy.OnPush
294
- }),
295
- __metadata("design:paramtypes", [])
296
- ], BooleanRenderer);
297
- let BooleanFilterRenderer = class BooleanFilterRenderer {
298
- constructor() {
299
- this.value = null;
300
- this.selectItem = [
301
- { value: 0, label: 'True' },
302
- { value: 1, label: 'False' },
303
- ];
304
- }
305
- agInit(params) {
306
- this.params = params;
307
- this.valueGetter = params.valueGetter;
308
- }
309
- isFilterActive() {
310
- return this.value !== null && this.value !== undefined;
311
- }
312
- doesFilterPass(params) {
313
- return this.value === this.valueGetter(params.node);
314
- }
315
- getModel() {
316
- return { value: this.value };
317
- }
318
- setModel(model) {
319
- this.value = model ? model.value : null;
320
- }
321
- ngAfterViewInit(params) {
322
- window.setTimeout(() => {
323
- this.input.element.nativeElement.focus();
324
- });
325
- }
326
- onChange(newValue) {
327
- if (this.value !== newValue) {
328
- this.value = newValue;
329
- this.params.filterChangedCallback();
330
- }
331
- }
332
- };
333
- __decorate([
334
- ViewChild('input', { static: true, read: ViewContainerRef }),
335
- __metadata("design:type", Object)
336
- ], BooleanFilterRenderer.prototype, "input", void 0);
337
- BooleanFilterRenderer = __decorate([
338
- Component({
339
- template: `
340
- <ax-data-grid-filter>
341
- <ax-select-box
342
- label='Select Box'
343
- [items]='selectItem'
344
- ></ax-select-box>
345
- </ax-data-grid-filter>
346
- `,
347
- changeDetection: ChangeDetectionStrategy.OnPush
348
- })
349
- ], BooleanFilterRenderer);
350
-
351
- var AXGridCommandColumn_1;
352
- let AXGridCommandColumn = AXGridCommandColumn_1 = class AXGridCommandColumn extends AXGridDataColumn {
353
- constructor() {
354
- super(...arguments);
355
- this.items = [];
356
- this.onItemClick = new EventEmitter();
357
- }
358
- render() {
359
- const col = super.render();
360
- if (!col.cellRendererFramework) {
361
- col.cellRendererFramework = CommandRenderer;
362
- }
363
- col.cellRendererParams = {
364
- items: this.items,
365
- onClick: (e) => {
366
- this.onItemClick.emit({
367
- command: e.name,
368
- data: e.data,
369
- rowIndex: e.rowIndex,
370
- rowLevel: e.rowLevel,
371
- htmlEvent: e.htmlEvent
372
- });
373
- }
374
- };
375
- col.sortable = false;
376
- col.filter = false;
377
- col.valueGetter = (params) => {
378
- return this.items;
379
- };
380
- return col;
381
- }
382
- };
383
- __decorate([
384
- Input(),
385
- __metadata("design:type", Object)
386
- ], AXGridCommandColumn.prototype, "items", void 0);
387
- __decorate([
388
- Output(),
389
- __metadata("design:type", EventEmitter)
390
- ], AXGridCommandColumn.prototype, "onItemClick", void 0);
391
- AXGridCommandColumn = AXGridCommandColumn_1 = __decorate([
392
- Component({
393
- selector: 'ax-command-column',
394
- template: '',
395
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridCommandColumn_1 }],
396
- changeDetection: ChangeDetectionStrategy.OnPush,
397
- encapsulation: ViewEncapsulation.None
398
- })
399
- ], AXGridCommandColumn);
400
- let CommandRenderer = class CommandRenderer {
401
- constructor() {
402
- this.items = [];
403
- }
404
- agInit(params) {
405
- this.mapParams(params);
406
- }
407
- refresh(params) {
408
- this.mapParams(params);
409
- return true;
410
- }
411
- mapParams(params) {
412
- this.node = params.node;
413
- this.items = typeof params.items == 'function' ? params.items({ data: this.node.data }) : Array.isArray(params.items) ? params.items : [];
414
- this.clickCallback = params.onClick;
415
- }
416
- onClick(item, e) {
417
- if (this.clickCallback && !item.disable) {
418
- this.clickCallback({
419
- name: item.name,
420
- rowLevel: this.node.level,
421
- rowIndex: this.node.rowIndex,
422
- data: this.node.data,
423
- htmlEvent: e
424
- });
425
- }
426
- }
427
- };
428
- CommandRenderer = __decorate([
429
- Component({
430
- selector: 'ax-command-cell',
431
- template: `
432
- <button
433
- *ngFor="let item of items; let i = index"
434
- class="ax button md ax-grid-command-button {{ item.style || 'ax primary blank' }}"
435
- [class.disabled]="item.disable"
436
- type="button"
437
- [title]="item.tooltip"
438
- [attr.tabindex]="i"
439
- (click)="onClick(item, $event)"
440
- >
441
- <i [ngClass]="item.icon"></i>{{ item.text }}
442
- </button>
443
- `,
444
- encapsulation: ViewEncapsulation.None,
445
- changeDetection: ChangeDetectionStrategy.OnPush
446
- }),
447
- __metadata("design:paramtypes", [])
448
- ], CommandRenderer);
449
-
450
- var AXGridDateColumn_1;
451
- let AXGridDateColumn = AXGridDateColumn_1 = class AXGridDateColumn extends AXGridDataColumn {
452
- constructor() {
453
- super();
454
- this.type = AXConfig.get('dateTime.type');
455
- }
456
- render() {
457
- const col = super.render();
458
- col.cellRendererParams = {
459
- format: this.format,
460
- };
461
- col.comparator = (valueA, valueB) => {
462
- const date1 = AXDateTime.convert(valueA);
463
- const date2 = AXDateTime.convert(valueB);
464
- //
465
- if (date1 === null && date2 === null) {
466
- return 0;
467
- }
468
- if (date1 === null) {
469
- return -1;
470
- }
471
- if (date2 === null) {
472
- return 1;
473
- }
474
- return (date1.date.getTime() - date2.date.getTime());
475
- };
476
- col.valueFormatter = (params) => {
477
- const date = AXDateTime.convert(params.value, this.type);
478
- if (date) {
479
- return date.format(this.format);
480
- }
481
- else {
482
- return null;
483
- }
484
- };
485
- col.filter = 'agDateColumnFilter';
486
- // col.floatingFilter = true;
487
- return col;
488
- }
489
- };
490
- __decorate([
491
- Input(),
492
- __metadata("design:type", String)
493
- ], AXGridDateColumn.prototype, "format", void 0);
494
- __decorate([
495
- Input(),
496
- __metadata("design:type", String)
497
- ], AXGridDateColumn.prototype, "type", void 0);
498
- AXGridDateColumn = AXGridDateColumn_1 = __decorate([
499
- Component({
500
- selector: 'ax-date-column',
501
- template: '',
502
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridDateColumn_1 }],
503
- changeDetection: ChangeDetectionStrategy.OnPush
504
- }),
505
- __metadata("design:paramtypes", [])
506
- ], AXGridDateColumn);
507
- let AXDatePickerFilterComponent = class AXDatePickerFilterComponent {
508
- constructor() {
509
- this.selectableHoliday = false;
510
- this.type = 'jalali';
511
- }
512
- agInit(params) {
513
- this.params = params;
514
- }
515
- ngAfterViewInit() {
516
- }
517
- ngOnDestroy() {
518
- console.log(`Destroying DateComponent`);
519
- }
520
- onDateChanged(selectedDates) {
521
- //this.date = selectedDates[0] || null;
522
- this.params.onDateChanged();
523
- }
524
- getDate() {
525
- return this.date;
526
- }
527
- setDate(date) {
528
- this.date = date || null;
529
- //this.picker.setDate(date);
530
- }
531
- setInputPlaceholder(placeholder) {
532
- //this.div.nativeElement.setAttribute('placeholder', placeholder);
533
- }
534
- onValueChanged(e) {
535
- this.setDate(e.value);
536
- this.onDateChanged(e.value);
537
- }
538
- };
539
- __decorate([
540
- ViewChild(AXDatePickerComponent),
541
- __metadata("design:type", AXDatePickerComponent)
542
- ], AXDatePickerFilterComponent.prototype, "datePicker", void 0);
543
- __decorate([
544
- ViewChild('div', { read: ElementRef }),
545
- __metadata("design:type", ElementRef)
546
- ], AXDatePickerFilterComponent.prototype, "div", void 0);
547
- AXDatePickerFilterComponent = __decorate([
548
- Component({
549
- selector: 'ax-data-picker-filter',
550
- template: `<ax-date-picker [selectableHoliday]="selectableHoliday" [allowClear]="true" (onValueChanged)="onValueChanged($event)" size="sm">
551
- </ax-date-picker>`,
552
- host: {},
553
- encapsulation: ViewEncapsulation.None
554
- })
555
- ], AXDatePickerFilterComponent);
556
-
557
- var AXGridSelectionColumn_1;
558
- let AXGridSelectionColumn = AXGridSelectionColumn_1 = class AXGridSelectionColumn extends AXGridDataColumn {
559
- constructor() {
560
- super();
561
- this.pinned = 'start';
562
- this.width = 40;
563
- }
564
- ngOnInit() { }
565
- render() {
566
- const col = super.render();
567
- col.checkboxSelection = this.condition ? this.condition : true;
568
- // col.headerCheckboxSelection = true;
569
- col.pinned = this.pinned === 'start' ? 'right' : 'left';
570
- col.filter = false;
571
- col.resizable = true;
572
- col.sortable = false;
573
- col.minWidth = 5;
574
- col.width = this.width;
575
- col.floatingFilter = false;
576
- return col;
577
- }
578
- };
579
- __decorate([
580
- Input(),
581
- __metadata("design:type", Function)
582
- ], AXGridSelectionColumn.prototype, "condition", void 0);
583
- __decorate([
584
- Input(),
585
- __metadata("design:type", String)
586
- ], AXGridSelectionColumn.prototype, "pinned", void 0);
587
- __decorate([
588
- Input(),
589
- __metadata("design:type", Number)
590
- ], AXGridSelectionColumn.prototype, "width", void 0);
591
- AXGridSelectionColumn = AXGridSelectionColumn_1 = __decorate([
592
- Component({
593
- selector: 'ax-selection-column',
594
- template: '',
595
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridSelectionColumn_1 }],
596
- changeDetection: ChangeDetectionStrategy.OnPush
597
- }),
598
- __metadata("design:paramtypes", [])
599
- ], AXGridSelectionColumn);
600
-
601
- var AXGridTextColumn_1;
602
- let AXGridTextColumn = AXGridTextColumn_1 = class AXGridTextColumn extends AXGridDataColumn {
603
- constructor() {
604
- super();
605
- }
606
- render() {
607
- const col = super.render();
608
- // if (this.allowFiltering) {
609
- // col.filterFramework = TextFilterRenderer;
610
- // }
611
- col.filter = 'agTextColumnFilter';
612
- return col;
613
- }
614
- };
615
- AXGridTextColumn = AXGridTextColumn_1 = __decorate([
616
- Component({
617
- selector: 'ax-text-column',
618
- template: '',
619
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridTextColumn_1 }],
620
- changeDetection: ChangeDetectionStrategy.OnPush
621
- }),
622
- __metadata("design:paramtypes", [])
623
- ], AXGridTextColumn);
624
- let TextFilterRenderer = class TextFilterRenderer {
625
- constructor() {
626
- this.value = null;
627
- }
628
- agInit(params) {
629
- this.params = params;
630
- this.valueGetter = params.valueGetter;
631
- }
632
- isFilterActive() {
633
- return this.value !== null && this.value !== undefined;
634
- }
635
- doesFilterPass(params) {
636
- return this.value === this.valueGetter(params.node);
637
- }
638
- getModel() {
639
- return { value: this.value };
640
- }
641
- setModel(model) {
642
- ;
643
- this.onChange(model ? model.value : null);
644
- }
645
- ngAfterViewInit(params) {
646
- window.setTimeout(() => {
647
- this.input.focus();
648
- });
649
- }
650
- onChange(newValue) {
651
- if (this.value !== newValue) {
652
- this.value = newValue;
653
- if (this.value === '') {
654
- this.value = null;
655
- }
656
- this.params.filterChangedCallback();
657
- }
658
- }
659
- };
660
- __decorate([
661
- ViewChild(AXTextBoxComponent, { static: true }),
662
- __metadata("design:type", AXTextBoxComponent)
663
- ], TextFilterRenderer.prototype, "input", void 0);
664
- TextFilterRenderer = __decorate([
665
- Component({
666
- template: `
667
- <ax-data-grid-filter>
668
- <ax-text-box label='Filter' allowClear='true' (textChange)='onChange($event)'>
669
- </ax-text-box>
670
- </ax-data-grid-filter>
671
- `,
672
- changeDetection: ChangeDetectionStrategy.OnPush
673
- })
674
- ], TextFilterRenderer);
675
-
676
- var AXGridRowNumberColumn_1;
677
- let AXGridRowNumberColumn = AXGridRowNumberColumn_1 = class AXGridRowNumberColumn extends AXGridDataColumn {
678
- constructor() {
679
- super();
680
- }
681
- ngOnInit() { }
682
- render() {
683
- const col = super.render();
684
- // col.checkboxSelection = this.condition ? this.condition : true;
685
- // col.headerCheckboxSelection = true;
686
- (col.headerName = this.caption ? this.caption : AXConfig.get('layout.rtl') ? 'ردیف' : 'Row'),
687
- (col.valueGetter = 'node.rowIndex + 1'),
688
- (col.pinned = this.pinned == null ? null : this.pinned === 'start' ? 'right' : 'left'),
689
- (col.filter = false);
690
- col.resizable = true;
691
- col.sortable = false;
692
- col.width = this.width;
693
- return col;
694
- }
695
- };
696
- __decorate([
697
- Input(),
698
- __metadata("design:type", Function)
699
- ], AXGridRowNumberColumn.prototype, "condition", void 0);
700
- AXGridRowNumberColumn = AXGridRowNumberColumn_1 = __decorate([
701
- Component({
702
- selector: 'ax-row-number-column',
703
- template: '',
704
- providers: [{ provide: AXGridDataColumn, useExisting: AXGridRowNumberColumn_1 }],
705
- changeDetection: ChangeDetectionStrategy.OnPush
706
- }),
707
- __metadata("design:paramtypes", [])
708
- ], AXGridRowNumberColumn);
709
-
710
- let AXDataGridRowTemplateComponent = class AXDataGridRowTemplateComponent {
711
- constructor() {
712
- this.renderer = AXDataGridRowTemplateRenderer;
713
- }
714
- ngOnInit() {
715
- this.params = {
716
- templateRef: this.templateRef
717
- };
718
- }
719
- };
720
- __decorate([
721
- ContentChild(TemplateRef, { static: true }),
722
- __metadata("design:type", TemplateRef)
723
- ], AXDataGridRowTemplateComponent.prototype, "templateRef", void 0);
724
- AXDataGridRowTemplateComponent = __decorate([
725
- Component({
726
- selector: 'ax-row-template',
727
- template: `<ng-content></ng-content>`
728
- }),
729
- __metadata("design:paramtypes", [])
730
- ], AXDataGridRowTemplateComponent);
731
- let AXDataGridRowTemplateRenderer = class AXDataGridRowTemplateRenderer {
732
- refresh(params) {
733
- return false;
734
- }
735
- agInit(params) {
736
- this.data = params.data.callRecords;
737
- this.templateRef = params.templateRef;
738
- }
739
- };
740
- AXDataGridRowTemplateRenderer = __decorate([
741
- Component({
742
- template: `<ng-container *ngTemplateOutlet='templateRef; context: { $implicit: data }'></ng-container>`
743
- })
744
- ], AXDataGridRowTemplateRenderer);
745
-
746
- let AXDataGridDetailTemplateComponent = class AXDataGridDetailTemplateComponent {
747
- constructor() {
748
- this.height = 100;
749
- this.renderer = AXDataGridDetailTemplateRenderer;
750
- }
751
- ngOnInit() {
752
- this.params = {
753
- templateRef: this.templateRef
754
- };
755
- }
756
- };
757
- __decorate([
758
- ContentChild(TemplateRef, { static: true }),
759
- __metadata("design:type", TemplateRef)
760
- ], AXDataGridDetailTemplateComponent.prototype, "templateRef", void 0);
761
- __decorate([
762
- Input(),
763
- __metadata("design:type", Number)
764
- ], AXDataGridDetailTemplateComponent.prototype, "height", void 0);
765
- AXDataGridDetailTemplateComponent = __decorate([
766
- Component({
767
- selector: 'ax-grid-detail-template',
768
- template: `<ng-content></ng-content>`
769
- }),
770
- __metadata("design:paramtypes", [])
771
- ], AXDataGridDetailTemplateComponent);
772
- let AXDataGridDetailTemplateRenderer = class AXDataGridDetailTemplateRenderer {
773
- refresh(params) {
774
- return false;
775
- }
776
- agInit(params) {
777
- this.data = params.data;
778
- this.templateRef = params.templateRef;
779
- }
780
- };
781
- AXDataGridDetailTemplateRenderer = __decorate([
782
- Component({
783
- template: `<ng-container *ngTemplateOutlet='templateRef; context: { $implicit: data }'></ng-container>`
784
- })
785
- ], AXDataGridDetailTemplateRenderer);
786
-
787
- LicenseManager.prototype.validateLicense = function () {
788
- //console.info('Cracked by Arash Oshnoudi!');
789
- };
790
- // WatermarkComp.prototype.shouldDisplayWatermark = function () {
791
- // return false;
792
- // }
793
- class AXDataGridColumnsChangeEvent extends AXValueEvent {
794
- }
795
- class AXDataGridCellEvent extends AXDataEvent {
796
- }
797
- class AXDaagridRowClickEvent extends AXDataEvent {
798
- }
799
- class AXDataGridSelectionChangeEvent extends AXDataEvent {
800
- }
801
- class AXDataGridRowSelectionChangeEvent extends AXDataEvent {
802
- }
803
- let AXDataGridComponent = class AXDataGridComponent {
804
- constructor(ref, cdr) {
805
- this.ref = ref;
806
- this.cdr = cdr;
807
- this.columnDefs = [];
808
- this.rowModelType = 'clientSide';
809
- this.frameworkComponents = {};
810
- this.internalHeight = '100%';
811
- this.masterDetail = false;
812
- this.treeData = false;
813
- this.enabelSelect = false;
814
- this.gridView = false;
815
- this.groupSelectsChildren = false;
816
- this.oldSelectionNodes = [];
817
- this.paginationAutoPageSize = true;
818
- this.paginationPageSize = 10;
819
- this.cacheBlockSize = 10;
820
- // @Input()
821
- // showRowNumber: boolean = true;
822
- this.remoteOperation = false;
823
- this.rowMultiSelectWithClick = true;
824
- this.suppressRowClickSelection = true;
825
- this.suppressCellSelection = false;
826
- this.sizeColumnsToFit = true;
827
- this.showCheckBox = true;
828
- this.floatingFilter = false;
829
- this.autoGroupColumnDef = {};
830
- this.selectionMode = 'single';
831
- // @Input()
832
- // allowFiltering: boolean = false;
833
- this.selectRow = [];
834
- this.rowGroupPanelShow = 'never';
835
- this.loadOnInit = true;
836
- // @Input()
837
- // groupDefaultExpanded: number = 0;
838
- this.keyField = 'null';
839
- this.hasChildField = 'null';
840
- this.columnsChange = new EventEmitter();
841
- this._columns = [];
842
- this.defaultColDef = {
843
- filter: true,
844
- floatingFilter: true
845
- };
846
- this.groupHideOpenParents = false;
847
- this.cellClick = new EventEmitter();
848
- this.cellDbClick = new EventEmitter();
849
- this.cellFocuse = new EventEmitter();
850
- this.rowClick = new EventEmitter();
851
- this.rowDbClick = new EventEmitter();
852
- this.selectionChanged = new EventEmitter();
853
- this.rowSelectionChange = new EventEmitter();
854
- this.onRowSelectionChanged = new EventEmitter();
855
- this.rtl = AXConfig.get('layout.rtl');
856
- this.isServerSideGroup = (e) => {
857
- return e[this.hasChildField];
858
- };
859
- this.getColumnDefs = () => {
860
- return this.gridApi.getColumnDefs();
861
- };
862
- this.getServerSideGroupKey = (e) => {
863
- return e[this.keyField];
864
- };
865
- this.internalGetRowClass = (p) => {
866
- if (this.rowClass) {
867
- if (this.rowClass instanceof Function) {
868
- return this.rowClass({
869
- rowIndex: p.node.rowIndex,
870
- rowLevel: p.node.level,
871
- data: p.data
872
- });
873
- }
874
- else {
875
- return this.rowClass;
876
- }
877
- }
878
- };
879
- this.localeText = AXTranslator.get('dataGrid');
880
- }
881
- get searchText() {
882
- return this._searchText;
883
- }
884
- set searchText(v) {
885
- if (v !== this._searchText) {
886
- this._searchText = v;
887
- if (this.gridApi) {
888
- this.refresh();
889
- this.gridApi.setQuickFilter(this.searchText);
890
- }
891
- }
892
- }
893
- get filter() {
894
- return this._filter;
895
- }
896
- set filter(v) {
897
- if (v !== this._filter) {
898
- this._filter = v;
899
- this._filter.forEach((f) => {
900
- const fc = this.gridApi.getFilterInstance(f.field);
901
- if (fc) {
902
- const ff = fc.getFrameworkComponentInstance();
903
- ff.setModel(f);
904
- }
905
- });
906
- }
907
- }
908
- get columns() {
909
- return this._inlineColumns ? [...this._columns, ...this._inlineColumns.toArray()] : this._columns;
910
- }
911
- set columns(val) {
912
- if (val && val.length) {
913
- let old = this._columns;
914
- this._columns = val;
915
- this.columnsChange.emit({ component: this, value: val, oldValue: old, htmlElement: this.ref.nativeElement });
916
- }
917
- }
918
- get dataSource() {
919
- return this._dataSource ? this._dataSource : this._contentDataSource;
920
- }
921
- set dataSource(v) {
922
- this._dataSource = v;
923
- }
924
- getRowHeight(param) {
925
- if (param.data && param.data.rowHeight && param.node.level == 0) {
926
- return param.data.rowHeight;
927
- }
928
- else if (this.masterDetail == true && param.node.level == 1) {
929
- return this.detailRowHeight;
930
- }
931
- else if (this.masterDetail == false && param.data && param.data.rowHeight) {
932
- return param.data.rowHeight;
933
- }
934
- else {
935
- return null;
936
- }
937
- }
938
- calcHeight() {
939
- if (this.toolbar) {
940
- this.internalHeight = `calc(100% - ${40}px)`;
941
- }
942
- else {
943
- this.internalHeight = '100%';
944
- }
945
- }
946
- get intenalGridDataSource() {
947
- const that = this;
948
- return {
949
- rowCount: null,
950
- getRows: (params) => {
951
- // that.gridApi.gridOptionsWrapper.setProperty('cacheBlockSize', this.takeCount ? this.takeCount : params.api.paginationGetPageSize());
952
- that.dataSourceSuccessCallback = params.successCallback;
953
- const loadParams = {};
954
- loadParams.searchText = that.searchText;
955
- loadParams.skip = params.request.startRow;
956
- // loadParams.take = params.request.endRow - params.request.startRow;
957
- loadParams.take = that.takeCount ? that.takeCount : params.api.paginationGetPageSize() * 2;
958
- loadParams.sort = params.request.sortModel.map((c) => {
959
- return {
960
- field: c.colId,
961
- dir: c.sort
962
- };
963
- });
964
- // loadParams.groups = params.request.rowGroupCols.map(r => r.field);
965
- // loadParams.groupKeys = params.request.groupKeys;
966
- // loadParams.data = params.parentNode.data;
967
- loadParams.group = {
968
- fields: params.request.rowGroupCols.map((r) => r.field),
969
- keys: params.request.groupKeys,
970
- parentData: params.parentNode.data
971
- };
972
- loadParams.filter = params.request.filterModel;
973
- that.dataSource.fetch(loadParams);
974
- }
975
- };
976
- }
977
- getMainMenuItems(e) {
978
- return ['pinSubMenu', 'separator'];
979
- }
980
- ngOnDestroy() {
981
- this.gridApi.destroy();
982
- }
983
- // todo gridOptions: GridOptions
984
- internalGridReady(gridOptions) {
985
- gridOptions.api.checkGridSize();
986
- this.takeCount = this.takeCount ? this.takeCount : gridOptions.api.paginationGetPageSize() * 2;
987
- // this.takeCount = this.takeCount < 20 ? 20 : this.takeCount;
988
- gridOptions.api.gridOptionsWrapper.setProperty('cacheBlockSize', this.takeCount);
989
- this.gridApi = gridOptions.api;
990
- this.mapColumns();
991
- this.calcHeight();
992
- if (!this.loadOnInit) {
993
- this.loadOnInit = true;
994
- return;
995
- }
996
- if (this.remoteOperation) {
997
- this.gridApi.setServerSideDatasource(this.intenalGridDataSource);
998
- }
999
- if (!this.remoteOperation) {
1000
- this.refresh();
1001
- }
1002
- }
1003
- ngAfterContentInit() {
1004
- const that = this;
1005
- if (this.rowTemplate) {
1006
- this.fullWidthCellRendererFramework = this.rowTemplate.renderer;
1007
- this.fullWidthCellRendererParams = this.rowTemplate.params;
1008
- }
1009
- this.frameworkComponents.agDateInput = AXDatePickerFilterComponent;
1010
- if (this.gridDetailTemplate) {
1011
- this.masterDetail = true;
1012
- this.detailCellRendererParams = this.gridDetailTemplate.params;
1013
- this.detailCellRenderer = 'detailRendererFramework';
1014
- this.frameworkComponents.detailRendererFramework = this.gridDetailTemplate.renderer;
1015
- this.detailRowHeight = this.gridDetailTemplate.height;
1016
- }
1017
- this.isFullWidthCell = () => {
1018
- return that.rowTemplate != null;
1019
- };
1020
- //this.cdr
1021
- }
1022
- ngOnInit() {
1023
- if (this.takeCount && this.takeCount > 0) {
1024
- this.paginationPageSize = this.takeCount;
1025
- this.paginationAutoPageSize = false;
1026
- this.cacheBlockSize = this.takeCount;
1027
- }
1028
- if (this.selectionMode === 'single') {
1029
- this.groupSelectsChildren = false;
1030
- }
1031
- if (this.keyField !== 'null' && this.hasChildField !== 'null') {
1032
- this.rowGroupPanelShow = 'never';
1033
- this.treeData = true;
1034
- }
1035
- if (this.remoteOperation) {
1036
- this.rowModelType = 'serverSide';
1037
- }
1038
- //
1039
- if (this.rtl == null) {
1040
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1041
- }
1042
- //
1043
- }
1044
- gridSelectRow() {
1045
- if (this.gridApi) {
1046
- if (this.selectRow && this.selectRow.length > 0 && this.gridApi !== undefined && typeof this.selectRow[0] != 'object') {
1047
- this.gridApi.forEachNode((node) => {
1048
- if (node.data !== undefined) {
1049
- let select = false;
1050
- this.selectRow.forEach((id) => {
1051
- if (node.data[this.keyField] === id) {
1052
- select = true;
1053
- node.setSelected(select);
1054
- }
1055
- });
1056
- }
1057
- });
1058
- }
1059
- else {
1060
- this.gridApi.forEachNode((node) => {
1061
- if (node.data !== undefined) {
1062
- let select = false;
1063
- this.selectRow.forEach((item) => {
1064
- if (item.rowIndex != undefined && item.rowLevel != undefined) {
1065
- if (node.data[this.keyField] === item.data[this.keyField]) {
1066
- select = true;
1067
- }
1068
- }
1069
- else {
1070
- if (node.data[this.keyField] === item[this.keyField]) {
1071
- select = true;
1072
- }
1073
- }
1074
- });
1075
- node.setSelected(select);
1076
- }
1077
- });
1078
- }
1079
- }
1080
- }
1081
- // ngAfterViewChecked(): void {
1082
- // //Called after every check of the component's view. Applies to components only.
1083
- // //Add 'implements AfterViewChecked' to the class.
1084
- // // this.selectByValues();
1085
- // this.enabelSelect = false;
1086
- // }
1087
- rebuildGrid() {
1088
- this.mapColumns();
1089
- setTimeout(() => {
1090
- if (this.sizeColumnsToFit) {
1091
- this.gridApi.sizeColumnsToFit();
1092
- }
1093
- }, 10);
1094
- }
1095
- ngAfterViewInit() {
1096
- if (this.treeData === true) {
1097
- this.columnDefs = this.columns.map((c) => c.render());
1098
- const groupColumn = this.columnDefs.find((c) => c.rowGroupIndex == '0' && c.field !== '');
1099
- this.autoGroupColumnDef = {
1100
- headerName: groupColumn.headerName,
1101
- width: groupColumn.width,
1102
- cellRendererParams: { checkbox: this.showCheckBox },
1103
- field: groupColumn.field
1104
- };
1105
- this.columnDefs.forEach((elm) => {
1106
- if (elm.rowGroupIndex > -1) {
1107
- elm.hide = true;
1108
- }
1109
- });
1110
- }
1111
- //setTimeout(() => {
1112
- this.gridView = true;
1113
- //});
1114
- this.enabelSelect = true;
1115
- this.dataSource.onDataReceived.subscribe((_data) => {
1116
- const result = _data.data.result;
1117
- this.hideLoading();
1118
- let items;
1119
- let totalCount;
1120
- if (Array.isArray(result)) {
1121
- items = result;
1122
- totalCount = result.length;
1123
- }
1124
- else {
1125
- items = result.items;
1126
- totalCount = result.totalCount;
1127
- }
1128
- if (this.dataSourceSuccessCallback) {
1129
- if (!this.loadOnInit) {
1130
- this.dataSourceSuccessCallback([], 0);
1131
- }
1132
- else {
1133
- this.dataSourceSuccessCallback(items, totalCount);
1134
- }
1135
- }
1136
- else {
1137
- if (!this.loadOnInit && this.gridApi !== undefined) {
1138
- this.gridApi.setRowData([]);
1139
- }
1140
- else if (this.gridApi !== undefined) {
1141
- this.gridApi.setRowData(items);
1142
- }
1143
- }
1144
- this.gridSelectRow();
1145
- });
1146
- this.dataSource.onFetchStart.subscribe(() => {
1147
- this.showLoading();
1148
- });
1149
- if (this.searchInput) {
1150
- this.searchInput.onValueChanged.subscribe((c) => {
1151
- this.searchText = c.value;
1152
- });
1153
- }
1154
- //
1155
- this.cdr.detectChanges();
1156
- }
1157
- mapColumns() {
1158
- this.columnDefs = this.columns.map((c) => c.render());
1159
- // if (this.showRowNumber) {
1160
- // this.columnDefs.push({
1161
- // headerName: AXConfig.get('layout.rtl') ? 'ردیف' : 'Row',
1162
- // valueGetter: 'node.rowIndex + 1',
1163
- // pinned: AXConfig.get('layout.rtl') ? 'right' : 'left'
1164
- // });
1165
- // }
1166
- if (this.gridDetailTemplate) {
1167
- if (this.columnDefs[0].checkboxSelection === true && this.columnDefs[0].field === '') {
1168
- this.columnDefs[1].cellRenderer = 'agGroupCellRenderer';
1169
- }
1170
- else {
1171
- this.columnDefs[0].cellRenderer = 'agGroupCellRenderer';
1172
- }
1173
- }
1174
- if (this.hasChildField === 'null') {
1175
- const groupColumn = this.columnDefs.find((c) => c.rowGroupIndex === undefined && c.field !== '');
1176
- if (groupColumn && this.groupHideOpenParents == false) {
1177
- this.autoGroupColumnDef = {
1178
- headerName: groupColumn.headerName,
1179
- width: groupColumn.width,
1180
- cellRendererParams: { checkbox: this.showCheckBox },
1181
- field: groupColumn.field
1182
- };
1183
- // groupColumn.hide = true;
1184
- }
1185
- }
1186
- this.columnDefs.forEach((elm) => {
1187
- if (elm.rowGroupIndex > -1) {
1188
- elm.hide = true;
1189
- }
1190
- });
1191
- }
1192
- displayedColumnsChanged(e) {
1193
- if (this.hasChildField === 'null') {
1194
- const ee = e.columnApi.getAllDisplayedColumnGroups();
1195
- const eee = ee.find((c) => c.colId !== 'ag-Grid-AutoColumn' && c.colId !== '0');
1196
- if (eee && eee.colId) {
1197
- this.autoGroupColumnDef = {
1198
- headerName: eee.colDef.headerName,
1199
- width: eee.colDef.width,
1200
- cellRendererParams: { checkbox: this.showCheckBox },
1201
- field: eee.colDef.field
1202
- };
1203
- }
1204
- // eee.hide = true;
1205
- }
1206
- }
1207
- refresh(route = []) {
1208
- if (this.remoteOperation && this.gridApi !== undefined) {
1209
- // this.gridApi.purgeServerSideCache(route);
1210
- this.gridApi.setServerSideDatasource(this.intenalGridDataSource);
1211
- }
1212
- else {
1213
- // TODO : check fetch param
1214
- this.dataSource.fetch(null);
1215
- }
1216
- }
1217
- internalGridCellClicked(e) {
1218
- this.cellClick.emit({ data: this.mapCellEvent(e), component: this, htmlElement: this.ref.nativeElement });
1219
- }
1220
- internalGridCellDoubleClicked(e) {
1221
- this.cellDbClick.emit({ data: this.mapCellEvent(e), component: this, htmlElement: this.ref.nativeElement });
1222
- }
1223
- internalGridCellFocused(e) {
1224
- this.cellFocuse.emit({ data: this.mapCellEvent(e), htmlElement: this.ref.nativeElement, component: this });
1225
- }
1226
- internalGridRowClicked(e) {
1227
- if (!e.node.group) {
1228
- this.rowClick.emit({ data: this.mapRowEvent(e), component: this, htmlElement: this.ref.nativeElement });
1229
- }
1230
- }
1231
- internalGridRowDoubleClicked(e) {
1232
- if (!e.node.group) {
1233
- this.rowDbClick.emit({ data: this.mapRowEvent(e), htmlElement: this.ref.nativeElement, component: this });
1234
- }
1235
- }
1236
- differenceOf2Arrays(array1, array2) {
1237
- const temp = [];
1238
- for (const i in array1) {
1239
- if (array2.indexOf(array1[i]) === -1) {
1240
- temp.push(array1[i]);
1241
- }
1242
- }
1243
- for (const i in array2) {
1244
- if (array1.indexOf(array2[i]) === -1) {
1245
- temp.push(array2[i]);
1246
- }
1247
- }
1248
- return temp.sort((a, b) => a - b);
1249
- }
1250
- rowSelectionChanged(e) {
1251
- // this.gridApi.forEachNode((node) => {
1252
- // if (node.data[this.keyField] == e.node.data[this.keyField]) {
1253
- // node.setSelected(e.node.selected);
1254
- // }
1255
- // });
1256
- if (e.node.selected == true) {
1257
- this.selectRow = this.selectRow.filter((c) => c[this.keyField] != e.data[this.keyField]);
1258
- this.selectRow.push(e.data);
1259
- }
1260
- else {
1261
- this.selectRow = this.selectRow.filter((c) => c[this.keyField] != e.data[this.keyField]);
1262
- }
1263
- this.rowSelectionChange.emit({ component: this, data: e, htmlElement: this.ref.nativeElement });
1264
- // console.log('e', e);
1265
- // console.log('select', e.node.selected);
1266
- // console.log('index', e.rowIndex);
1267
- }
1268
- internalGridSelectionChanged(e) {
1269
- const args = { items: [] };
1270
- const oldNodes = this.oldSelectionNodes;
1271
- const nodes = this.gridApi.getSelectedNodes();
1272
- nodes.forEach((i) => {
1273
- args.items.push({
1274
- rowLevel: i.level,
1275
- rowIndex: i.rowIndex,
1276
- data: i.data
1277
- });
1278
- });
1279
- this.selectionChanged.emit({ data: args, component: this, htmlElement: this.ref.nativeElement });
1280
- let action = nodes.length > oldNodes.length ? true : false;
1281
- const node = this.differenceOf2Arrays(nodes, oldNodes);
1282
- this.onRowSelectionChanged.emit({ component: this, selected: action, data: node, htmlElement: this.ref.nativeElement });
1283
- this.oldSelectionNodes = nodes;
1284
- }
1285
- mapCellEvent(e) {
1286
- return {
1287
- rowLevel: 0,
1288
- column: e.column,
1289
- data: e.data,
1290
- rowIndex: e.rowIndex,
1291
- value: e.value
1292
- };
1293
- }
1294
- mapRowEvent(e) {
1295
- return {
1296
- rowLevel: 0,
1297
- data: e.data,
1298
- rowIndex: e.rowIndex
1299
- };
1300
- }
1301
- deselectAll() {
1302
- this.gridApi.deselectAll();
1303
- }
1304
- showLoading() {
1305
- if (this.gridApi) {
1306
- this.gridApi.showLoadingOverlay();
1307
- }
1308
- }
1309
- hideLoading() {
1310
- if (this.gridApi) {
1311
- this.gridApi.hideOverlay();
1312
- }
1313
- }
1314
- internalGridSizeChanged(e) {
1315
- if (e.clientWidth > 0 && e.clientHeight > 0) {
1316
- this.performSizeColumnsToFit(e.api);
1317
- }
1318
- // this.refresh();
1319
- // this.gridApi.paginationGoToFirstPage();
1320
- }
1321
- internalGridFirstDataRendered(e) {
1322
- this.performSizeColumnsToFit(e.api);
1323
- }
1324
- performSizeColumnsToFit(api) {
1325
- if (this.sizeColumnsToFit) {
1326
- api.sizeColumnsToFit();
1327
- }
1328
- }
1329
- };
1330
- AXDataGridComponent.ctorParameters = () => [
1331
- { type: ElementRef },
1332
- { type: ChangeDetectorRef }
1333
- ];
1334
- __decorate([
1335
- Input(),
1336
- __metadata("design:type", Boolean)
1337
- ], AXDataGridComponent.prototype, "remoteOperation", void 0);
1338
- __decorate([
1339
- Input(),
1340
- __metadata("design:type", Boolean)
1341
- ], AXDataGridComponent.prototype, "rowMultiSelectWithClick", void 0);
1342
- __decorate([
1343
- Input(),
1344
- __metadata("design:type", Boolean)
1345
- ], AXDataGridComponent.prototype, "suppressRowClickSelection", void 0);
1346
- __decorate([
1347
- Input(),
1348
- __metadata("design:type", Boolean)
1349
- ], AXDataGridComponent.prototype, "suppressCellSelection", void 0);
1350
- __decorate([
1351
- Input(),
1352
- __metadata("design:type", Boolean)
1353
- ], AXDataGridComponent.prototype, "sizeColumnsToFit", void 0);
1354
- __decorate([
1355
- Input(),
1356
- __metadata("design:type", Boolean)
1357
- ], AXDataGridComponent.prototype, "showCheckBox", void 0);
1358
- __decorate([
1359
- Input(),
1360
- __metadata("design:type", Boolean)
1361
- ], AXDataGridComponent.prototype, "floatingFilter", void 0);
1362
- __decorate([
1363
- Input(),
1364
- __metadata("design:type", Number)
1365
- ], AXDataGridComponent.prototype, "takeCount", void 0);
1366
- __decorate([
1367
- Input(),
1368
- __metadata("design:type", String)
1369
- ], AXDataGridComponent.prototype, "selectionMode", void 0);
1370
- __decorate([
1371
- Input(),
1372
- __metadata("design:type", Array)
1373
- ], AXDataGridComponent.prototype, "selectRow", void 0);
1374
- __decorate([
1375
- Input(),
1376
- __metadata("design:type", String)
1377
- ], AXDataGridComponent.prototype, "rowGroupPanelShow", void 0);
1378
- __decorate([
1379
- Input(),
1380
- __metadata("design:type", Boolean)
1381
- ], AXDataGridComponent.prototype, "loadOnInit", void 0);
1382
- __decorate([
1383
- Input(),
1384
- __metadata("design:type", String)
1385
- ], AXDataGridComponent.prototype, "keyField", void 0);
1386
- __decorate([
1387
- Input(),
1388
- __metadata("design:type", String)
1389
- ], AXDataGridComponent.prototype, "hasChildField", void 0);
1390
- __decorate([
1391
- Input(),
1392
- __metadata("design:type", String),
1393
- __metadata("design:paramtypes", [String])
1394
- ], AXDataGridComponent.prototype, "searchText", null);
1395
- __decorate([
1396
- Input(),
1397
- __metadata("design:type", Array),
1398
- __metadata("design:paramtypes", [Array])
1399
- ], AXDataGridComponent.prototype, "filter", null);
1400
- __decorate([
1401
- ContentChildren(AXGridDataColumn),
1402
- __metadata("design:type", QueryList)
1403
- ], AXDataGridComponent.prototype, "_inlineColumns", void 0);
1404
- __decorate([
1405
- Output(),
1406
- __metadata("design:type", EventEmitter)
1407
- ], AXDataGridComponent.prototype, "columnsChange", void 0);
1408
- __decorate([
1409
- Input(),
1410
- __metadata("design:type", Array),
1411
- __metadata("design:paramtypes", [Array])
1412
- ], AXDataGridComponent.prototype, "columns", null);
1413
- __decorate([
1414
- Input(),
1415
- __metadata("design:type", Object)
1416
- ], AXDataGridComponent.prototype, "rowHeight", void 0);
1417
- __decorate([
1418
- ContentChild(AXToolbarSearchComponent, { static: true }),
1419
- __metadata("design:type", AXToolbarSearchComponent)
1420
- ], AXDataGridComponent.prototype, "searchInput", void 0);
1421
- __decorate([
1422
- ContentChild(AXToolbarComponent, { static: true }),
1423
- __metadata("design:type", AXToolbarComponent)
1424
- ], AXDataGridComponent.prototype, "toolbar", void 0);
1425
- __decorate([
1426
- ContentChild(AXDataGridRowTemplateComponent, { static: true }),
1427
- __metadata("design:type", AXDataGridRowTemplateComponent)
1428
- ], AXDataGridComponent.prototype, "rowTemplate", void 0);
1429
- __decorate([
1430
- ContentChild(AXDataGridDetailTemplateComponent, { static: true }),
1431
- __metadata("design:type", AXDataGridDetailTemplateComponent)
1432
- ], AXDataGridComponent.prototype, "gridDetailTemplate", void 0);
1433
- __decorate([
1434
- ContentChild(AXDataSourceComponent, { static: true }),
1435
- __metadata("design:type", AXDataSourceComponent)
1436
- ], AXDataGridComponent.prototype, "_contentDataSource", void 0);
1437
- __decorate([
1438
- Input(),
1439
- __metadata("design:type", AXDataSourceComponent),
1440
- __metadata("design:paramtypes", [AXDataSourceComponent])
1441
- ], AXDataGridComponent.prototype, "dataSource", null);
1442
- __decorate([
1443
- Input(),
1444
- __metadata("design:type", Boolean)
1445
- ], AXDataGridComponent.prototype, "groupHideOpenParents", void 0);
1446
- __decorate([
1447
- Output(),
1448
- __metadata("design:type", EventEmitter)
1449
- ], AXDataGridComponent.prototype, "cellClick", void 0);
1450
- __decorate([
1451
- Output(),
1452
- __metadata("design:type", EventEmitter)
1453
- ], AXDataGridComponent.prototype, "cellDbClick", void 0);
1454
- __decorate([
1455
- Output(),
1456
- __metadata("design:type", EventEmitter)
1457
- ], AXDataGridComponent.prototype, "cellFocuse", void 0);
1458
- __decorate([
1459
- Output(),
1460
- __metadata("design:type", EventEmitter)
1461
- ], AXDataGridComponent.prototype, "rowClick", void 0);
1462
- __decorate([
1463
- Output(),
1464
- __metadata("design:type", EventEmitter)
1465
- ], AXDataGridComponent.prototype, "rowDbClick", void 0);
1466
- __decorate([
1467
- Output(),
1468
- __metadata("design:type", EventEmitter)
1469
- ], AXDataGridComponent.prototype, "selectionChanged", void 0);
1470
- __decorate([
1471
- Output(),
1472
- __metadata("design:type", EventEmitter)
1473
- ], AXDataGridComponent.prototype, "rowSelectionChange", void 0);
1474
- __decorate([
1475
- Output(),
1476
- __metadata("design:type", EventEmitter)
1477
- ], AXDataGridComponent.prototype, "onRowSelectionChanged", void 0);
1478
- __decorate([
1479
- Input(),
1480
- __metadata("design:type", Function)
1481
- ], AXDataGridComponent.prototype, "rowClass", void 0);
1482
- __decorate([
1483
- Input(),
1484
- __metadata("design:type", Boolean)
1485
- ], AXDataGridComponent.prototype, "rtl", void 0);
1486
- AXDataGridComponent = __decorate([
1487
- Component({
1488
- selector: 'ax-data-grid',
1489
- template: "<div class=\"ax-grid-toolbar\" *ngIf=\"toolbar\">\r\n <ng-content select=\"ax-toolbar\"></ng-content>\r\n</div>\r\n<!-- [enableSorting]=\"true\" [enableColResize]=\"true\" [enableFilter]=\"allowFiltering\" -->\r\n<ag-grid-angular *ngIf=\"gridView\" class=\"ag-theme-balham\" [getRowClass]=\"internalGetRowClass\"\r\n [style.height]=\"internalHeight\" [columnDefs]=\"columnDefs\" [enableRtl]=\"rtl\" [pagination]=\"true\"\r\n [rowGroupPanelShow]=\"rowGroupPanelShow\" [rowModelType]=\"rowModelType\" [detailRowHeight]=\"detailRowHeight\"\r\n [getRowHeight]=\"getRowHeight\" [paginationAutoPageSize]=\"paginationAutoPageSize\"\r\n [paginationPageSize]=\"paginationPageSize\" [suppressMenuHide]=\"true\" [frameworkComponents]=\"frameworkComponents\"\r\n [isFullWidthCell]=\"isFullWidthCell\" [rowSelection]=\"selectionMode\" [rowMultiSelectWithClick]=\"rowMultiSelectWithClick\"\r\n [fullWidthCellRendererFramework]=\"fullWidthCellRendererFramework\"\r\n [fullWidthCellRendererParams]=\"fullWidthCellRendererParams\" (cellClicked)=\"internalGridCellClicked($event)\"\r\n (cellDoubleClicked)=\"internalGridCellDoubleClicked($event)\" (cellFocused)=\"internalGridCellFocused($event)\"\r\n (rowClicked)=\"internalGridRowClicked($event)\" (selectionChanged)=\"internalGridSelectionChanged($event)\"\r\n (rowSelected)=\"rowSelectionChanged($event)\" (rowDoubleClicked)=\"internalGridRowDoubleClicked($event)\"\r\n (gridReady)=\"internalGridReady($event)\" [groupSelectsChildren]=\"groupSelectsChildren\"\r\n [suppressRowClickSelection]=\"suppressRowClickSelection\" [groupSelectsFiltered]=\"true\"\r\n [suppressCellSelection]=\"suppressCellSelection\" [autoGroupColumnDef]=\"autoGroupColumnDef\"\r\n [suppressAggFuncInHeader]=\"true\" [treeData]=\"treeData\" [animateRows]=\"true\" [isServerSideGroup]=\"isServerSideGroup\"\r\n [getServerSideGroupKey]=\"getServerSideGroupKey\" [masterDetail]=\"masterDetail\"\r\n [detailCellRendererParams]=\"detailCellRendererParams\" [detailCellRenderer]=\"detailCellRenderer\"\r\n (gridSizeChanged)=\"internalGridSizeChanged($event)\" (firstDataRendered)=\"internalGridFirstDataRendered($event)\"\r\n [localeText]=\"localeText\" [groupHideOpenParents]=\"groupHideOpenParents\" [enableRangeSelection]=\"true\"\r\n [enableRangeSelection]=\"false\" [allowContextMenuWithControlKey]=\"false\" [getMainMenuItems]=\"getMainMenuItems\">\r\n</ag-grid-angular>\r\n\r\n<!-- (displayedColumnsChanged)=\"displayedColumnsChanged($event)\" -->",
1490
- encapsulation: ViewEncapsulation.None
1491
- // changeDetection: ChangeDetectionStrategy.OnPush
1492
- }),
1493
- __metadata("design:paramtypes", [ElementRef, ChangeDetectorRef])
1494
- ], AXDataGridComponent);
1495
-
1496
- let AXDataGridFilterComponent = class AXDataGridFilterComponent {
1497
- };
1498
- AXDataGridFilterComponent = __decorate([
1499
- Component({
1500
- selector: 'ax-data-grid-filter',
1501
- template: `
1502
- <div class='ax-grid-filter-container'>
1503
- <ng-content></ng-content>
1504
- <div class='btn-group' role='group'>
1505
- <button type='button' class='btn btn-primary btn-sm'>
1506
- <i class='fas fa-filter'></i>
1507
- </button>
1508
- <button type='button' class='btn btn-danger btn-sm'>
1509
- <i class='fas fa-trash-alt'></i>
1510
- </button>
1511
- </div>
1512
- </div>
1513
- `,
1514
- encapsulation: ViewEncapsulation.None
1515
- })
1516
- ], AXDataGridFilterComponent);
1517
-
1518
- let AXDataGridModule = class AXDataGridModule {
1519
- };
1520
- AXDataGridModule = __decorate([
1521
- NgModule({
1522
- declarations: [
1523
- AXDataGridComponent,
1524
- AXGridTextColumn,
1525
- AXGridCheckColumn,
1526
- AXGridSelectionColumn,
1527
- AXGridDateColumn,
1528
- AXGridRowNumberColumn,
1529
- AXGridCommandColumn,
1530
- BooleanRenderer,
1531
- BooleanFilterRenderer,
1532
- TextFilterRenderer,
1533
- AXDataGridFilterComponent,
1534
- AXDataGridRowTemplateComponent,
1535
- AXDataGridDetailTemplateComponent,
1536
- AXDataGridRowTemplateRenderer,
1537
- AXDataGridDetailTemplateRenderer,
1538
- AXDataGridCellTemplateComponent,
1539
- AXDataGridCellTemplateRenderer,
1540
- AXDatePickerFilterComponent,
1541
- CommandRenderer
1542
- ],
1543
- imports: [
1544
- CommonModule,
1545
- AXCoreModule,
1546
- FormsModule,
1547
- //AgGridModule,
1548
- AXTextBoxModule,
1549
- AXCheckBoxModule,
1550
- AXSelectBoxModule,
1551
- AXDataSourceModule,
1552
- AXButtonModule,
1553
- AXDatePickerModule,
1554
- AgGridModule.withComponents([AXDatePickerFilterComponent])
1555
- ],
1556
- exports: [
1557
- AXDataGridComponent,
1558
- AXDataGridFilterComponent,
1559
- AXDataGridRowTemplateComponent,
1560
- AXDataGridDetailTemplateComponent,
1561
- AXDataGridRowTemplateRenderer,
1562
- AXDataGridDetailTemplateRenderer,
1563
- AXDataGridCellTemplateComponent,
1564
- AXDataGridCellTemplateRenderer,
1565
- AXGridTextColumn,
1566
- AXGridRowNumberColumn,
1567
- AXGridCheckColumn,
1568
- AXGridDateColumn,
1569
- AXGridSelectionColumn,
1570
- AXGridCommandColumn,
1571
- BooleanRenderer,
1572
- BooleanFilterRenderer,
1573
- CommandRenderer
1574
- ],
1575
- entryComponents: [
1576
- BooleanRenderer,
1577
- BooleanFilterRenderer,
1578
- CommandRenderer,
1579
- TextFilterRenderer,
1580
- AXDataGridRowTemplateComponent,
1581
- AXDataGridDetailTemplateComponent,
1582
- AXDataGridRowTemplateRenderer,
1583
- AXDataGridDetailTemplateRenderer,
1584
- AXDataGridCellTemplateComponent,
1585
- AXDataGridCellTemplateRenderer
1586
- ],
1587
- providers: []
1588
- })
1589
- ], AXDataGridModule);
1590
-
1591
- let AXDataLovPopupComponent = class AXDataLovPopupComponent extends AXBasePopupPageComponent {
1592
- constructor(cdr, ref) {
1593
- super();
1594
- this.cdr = cdr;
1595
- this.ref = ref;
1596
- this.columns = [];
1597
- this.selectedItems = [];
1598
- this.keyField = '';
1599
- this.allowNull = true;
1600
- this.rtl = AXConfig.get('layout.rtl');
1601
- this.selectedRows = [];
1602
- }
1603
- ngOnInit() {
1604
- if (this.rtl == null) {
1605
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1606
- }
1607
- }
1608
- onDoneClick() {
1609
- if (this.selectedItems) {
1610
- this.close(this.selectedItems);
1611
- }
1612
- else {
1613
- this.close();
1614
- }
1615
- }
1616
- rowDoubleClicked(e) {
1617
- console.log('s', e.data.data);
1618
- if (this.selectionMode == 'single') {
1619
- this.selectedItems = [];
1620
- }
1621
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.data[this.keyField]);
1622
- this.selectedItems.push(e.data.data);
1623
- this.onDoneClick();
1624
- }
1625
- onCancelClick() {
1626
- this.close();
1627
- }
1628
- rowSelectionChange(e) {
1629
- if (e.data.node.selected == true) {
1630
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
1631
- this.selectedItems.push(e.data.node.data);
1632
- }
1633
- else {
1634
- if (this.allowNull == true || (this.allowNull == false && this.selectedItems.length > 1)) {
1635
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
1636
- }
1637
- }
1638
- // console.log('ee', e)
1639
- // // console.log('e', e);
1640
- // console.log('select', e.data.node.selected);
1641
- // console.log('index', e.data.rowIndex);
1642
- }
1643
- ngAfterViewInit() {
1644
- this.selectedItems.forEach((ele) => {
1645
- this.selectedRows.push(ele);
1646
- });
1647
- this.searchBox.focus();
1648
- if (this.dataSource.onDataReceived) {
1649
- this.dataSource.onDataReceived.subscribe((arg) => {
1650
- this.cdr.markForCheck();
1651
- this.cdr.detectChanges();
1652
- });
1653
- }
1654
- }
1655
- // onValueSearchChanged(e) {
1656
- // const params: AXDataSourceReadParams = {}
1657
- // params.searchText = e.value;
1658
- // // params.take = 100;
1659
- // // params.skip = 0
1660
- // this.dataSource.fetch(params);
1661
- // }
1662
- getFooterButtons() {
1663
- return [
1664
- {
1665
- text: AXTranslator.get('common.confirm'),
1666
- name: 'confirm',
1667
- style: 'ax primary',
1668
- icon: 'far fa-check-circle'
1669
- },
1670
- {
1671
- text: AXTranslator.get('common.cancel'),
1672
- name: 'cancel',
1673
- style: 'ax light',
1674
- icon: 'far fa-times-circle'
1675
- }
1676
- ];
1677
- }
1678
- onFooterButtonClick(e) {
1679
- if (e.name === 'confirm') {
1680
- this.onDoneClick();
1681
- }
1682
- if (e.name === 'cancel') {
1683
- this.onCancelClick();
1684
- }
1685
- }
1686
- };
1687
- AXDataLovPopupComponent.ctorParameters = () => [
1688
- { type: ChangeDetectorRef },
1689
- { type: ElementRef }
1690
- ];
1691
- __decorate([
1692
- ViewChild('grid', { static: true }),
1693
- __metadata("design:type", AXDataGridComponent)
1694
- ], AXDataLovPopupComponent.prototype, "grid", void 0);
1695
- __decorate([
1696
- ViewChild('searchBox'),
1697
- __metadata("design:type", AXToolbarSearchComponent)
1698
- ], AXDataLovPopupComponent.prototype, "searchBox", void 0);
1699
- AXDataLovPopupComponent = __decorate([
1700
- Component({
1701
- template: "<div style=\"height: 70vh; padding: 0.5em;\">\r\n <div style=\"height: calc(100%);\">\r\n\r\n <ax-data-grid [rtl]=\"rtl\" [suppressRowClickSelection]=\"false\" [keyField]=\"keyField\"\r\n [hasChildField]=\"hasChildField\" [selectRow]=\"selectedItems\" #grid [columns]=\"columns\"\r\n [remoteOperation]=\"true\" [selectionMode]=\"selectionMode\" (rowDbClick)=\"rowDoubleClicked($event)\"\r\n (rowSelectionChange)=\"rowSelectionChange($event)\" [dataSource]=\"dataSource\">\r\n <ax-toolbar>\r\n <ax-toolbar-search #searchBox style=\"width: 100%;\"></ax-toolbar-search>\r\n </ax-toolbar>\r\n <ax-selection-column *ngIf=\"selectionMode== 'single'? false : true\"></ax-selection-column>\r\n <!-- <ax-data-source [provideData]=\"dataSource.provideData\">\r\n </ax-data-source> -->\r\n </ax-data-grid>\r\n </div>\r\n</div>"
1702
- }),
1703
- __metadata("design:paramtypes", [ChangeDetectorRef, ElementRef])
1704
- ], AXDataLovPopupComponent);
1705
-
1706
- var AXLOVComponent_1;
1707
- let AXLOVComponent = AXLOVComponent_1 = class AXLOVComponent extends AXValidatableComponent {
1708
- constructor(popup, ref) {
1709
- super();
1710
- this.popup = popup;
1711
- this.ref = ref;
1712
- this.textField = '';
1713
- this.allowSearch = true;
1714
- this.valueField = '';
1715
- this.hasChildField = 'null';
1716
- this.allowNull = true;
1717
- this.popupSize = 'md';
1718
- this.selectedItems = [];
1719
- // @Input()
1720
- // selectedValues: any[] = [];
1721
- this.readonly = false;
1722
- this.disabled = false;
1723
- this.chipsWidth = '';
1724
- this.size = 'md';
1725
- this.mode = 'single';
1726
- this.onSelectionChange = new EventEmitter();
1727
- this.rtl = AXConfig.get('layout.rtl');
1728
- }
1729
- get validation() {
1730
- return this._validation ? this._validation : this._contentValidation;
1731
- }
1732
- set validation(v) {
1733
- this._validation = v;
1734
- }
1735
- focus() {
1736
- this.selectBox.focus();
1737
- }
1738
- refresh() {
1739
- this.selectBox.refresh();
1740
- }
1741
- handleButtonClick() {
1742
- this.open();
1743
- }
1744
- ngOnInit() {
1745
- if (this.rtl == null) {
1746
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1747
- }
1748
- // this.selectVal = this.selectedValues;
1749
- this.onSelectionChange.subscribe((c) => {
1750
- this.clearValidationStyle(this.ref.nativeElement);
1751
- });
1752
- }
1753
- ngAfterContentInit() {
1754
- this.initValidation(this.ref, 'selectedItems', this.validation);
1755
- }
1756
- handleSelectChange(e) {
1757
- // console.log('se' + JSON.stringify(e));
1758
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
1759
- }
1760
- open() {
1761
- return new Promise((resolve) => {
1762
- this.selectBox.dropdown.close();
1763
- this.popup
1764
- .open(AXDataLovPopupComponent, {
1765
- size: this.popupSize,
1766
- // closable: false,
1767
- data: {
1768
- dataSource: this.dataSource,
1769
- selectionMode: this.mode,
1770
- columns: this.columns.toArray(),
1771
- // selectedItems: this.selectedValues,
1772
- selectedItems: this.selectedItems,
1773
- keyField: this.valueField,
1774
- allowNull: this.allowNull,
1775
- hasChildField: this.hasChildField,
1776
- rtl: this.rtl
1777
- },
1778
- title: this.caption
1779
- // size: this.size,
1780
- })
1781
- .then((c) => {
1782
- if (c.data) {
1783
- // this.selectedValues = [];
1784
- this.selectedItems = [];
1785
- c.data.forEach((elm) => {
1786
- this.selectedItems.push(elm);
1787
- });
1788
- // this.selectedItems = c.data;
1789
- // this.selectBox.refresh();
1790
- // console.log('se' + JSON.stringify(this.selectedItems));
1791
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
1792
- if (resolve) {
1793
- resolve(c.data);
1794
- }
1795
- }
1796
- else {
1797
- if (resolve) {
1798
- resolve(this.selectedItems);
1799
- }
1800
- }
1801
- this.selectBox.refresh();
1802
- });
1803
- });
1804
- }
1805
- };
1806
- AXLOVComponent.ctorParameters = () => [
1807
- { type: AXPopupService },
1808
- { type: ElementRef }
1809
- ];
1810
- __decorate([
1811
- ContentChild(AXValidation, { static: true }),
1812
- __metadata("design:type", AXValidation)
1813
- ], AXLOVComponent.prototype, "_contentValidation", void 0);
1814
- __decorate([
1815
- Input(),
1816
- __metadata("design:type", AXValidation),
1817
- __metadata("design:paramtypes", [AXValidation])
1818
- ], AXLOVComponent.prototype, "validation", null);
1819
- __decorate([
1820
- ViewChild('selectBox', { static: true }),
1821
- __metadata("design:type", AXSelectBoxComponent)
1822
- ], AXLOVComponent.prototype, "selectBox", void 0);
1823
- __decorate([
1824
- ContentChild(AXDataSourceComponent, { static: true }),
1825
- __metadata("design:type", AXDataSourceComponent)
1826
- ], AXLOVComponent.prototype, "dataSource", void 0);
1827
- __decorate([
1828
- ContentChildren(AXGridDataColumn),
1829
- __metadata("design:type", QueryList)
1830
- ], AXLOVComponent.prototype, "columns", void 0);
1831
- __decorate([
1832
- ContentChild('itemTemplate', { static: true }),
1833
- __metadata("design:type", TemplateRef)
1834
- ], AXLOVComponent.prototype, "rowTemplate", void 0);
1835
- __decorate([
1836
- Input(),
1837
- __metadata("design:type", String)
1838
- ], AXLOVComponent.prototype, "textField", void 0);
1839
- __decorate([
1840
- Input(),
1841
- __metadata("design:type", Boolean)
1842
- ], AXLOVComponent.prototype, "allowSearch", void 0);
1843
- __decorate([
1844
- Input(),
1845
- __metadata("design:type", String)
1846
- ], AXLOVComponent.prototype, "valueField", void 0);
1847
- __decorate([
1848
- Input(),
1849
- __metadata("design:type", String)
1850
- ], AXLOVComponent.prototype, "hasChildField", void 0);
1851
- __decorate([
1852
- Input(),
1853
- __metadata("design:type", Boolean)
1854
- ], AXLOVComponent.prototype, "allowNull", void 0);
1855
- __decorate([
1856
- Input(),
1857
- __metadata("design:type", String)
1858
- ], AXLOVComponent.prototype, "popupSize", void 0);
1859
- __decorate([
1860
- Input(),
1861
- __metadata("design:type", Array)
1862
- ], AXLOVComponent.prototype, "selectedItems", void 0);
1863
- __decorate([
1864
- Input(),
1865
- __metadata("design:type", Boolean)
1866
- ], AXLOVComponent.prototype, "readonly", void 0);
1867
- __decorate([
1868
- Input(),
1869
- __metadata("design:type", Boolean)
1870
- ], AXLOVComponent.prototype, "disabled", void 0);
1871
- __decorate([
1872
- Input(),
1873
- __metadata("design:type", String)
1874
- ], AXLOVComponent.prototype, "chipsWidth", void 0);
1875
- __decorate([
1876
- Input(),
1877
- __metadata("design:type", String)
1878
- ], AXLOVComponent.prototype, "size", void 0);
1879
- __decorate([
1880
- Input(),
1881
- __metadata("design:type", String)
1882
- ], AXLOVComponent.prototype, "caption", void 0);
1883
- __decorate([
1884
- Input(),
1885
- __metadata("design:type", String)
1886
- ], AXLOVComponent.prototype, "mode", void 0);
1887
- __decorate([
1888
- Input(),
1889
- __metadata("design:type", String)
1890
- ], AXLOVComponent.prototype, "placeholder", void 0);
1891
- __decorate([
1892
- Output(),
1893
- __metadata("design:type", EventEmitter)
1894
- ], AXLOVComponent.prototype, "onSelectionChange", void 0);
1895
- __decorate([
1896
- Input(),
1897
- __metadata("design:type", Boolean)
1898
- ], AXLOVComponent.prototype, "rtl", void 0);
1899
- AXLOVComponent = AXLOVComponent_1 = __decorate([
1900
- Component({
1901
- selector: 'ax-lov',
1902
- template: "<ax-select-box [rowInputTemplate]=\"rowTemplate\" [rtl]=\"rtl\" [allowSearch]=\"allowSearch\" #selectBox [showDropDownButton]=\"false\" [allowNull]=\"allowNull\"\r\n [remoteOperation]=\"true\" [placeholder]=\"placeholder\" [size]=\"size\" [textField]=\"textField\" [valueField]=\"valueField\"\r\n [disabled]=\"disabled\" [mode]=\"mode\" [(selectedItems)]=\"selectedItems\"\r\n (selectionChanged)=\"handleSelectChange($event)\" [dataSource]=\"dataSource\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button icon=\"far fa-bars icon\" [disabled]=\"disabled\" type=\"light blank\" (click)=\"handleButtonClick()\" end\r\n [tabIndex]=\"-1\">\r\n </ax-button>\r\n <ng-content select=\"[end]\">\r\n </ng-content>\r\n </ng-container>\r\n</ax-select-box>\r\n\r\n\r\n<!-- <ax-select-box2 [rtl]=\"rtl\" [allowSearch]=\"allowSearch\" #selectBox [showDropDownButton]=\"false\" [allowNull]=\"allowNull\"\r\n [remoteOperation]=\"true\" [placeholder]=\"placeholder\" [size]=\"size\" [textField]=\"textField\" [valueField]=\"valueField\"\r\n [disabled]=\"disabled\" [selectionMode]=\"mode\" (onValueChanged)=\"handleSelectChange($event)\" [dataSource]=\"dataSource\"\r\n [(value)]=\"selectedItems\" selectionDataMode=\"item\">\r\n <ng-container start>\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </ng-container>\r\n <ng-container end>\r\n <ax-button icon=\"far fa-bars icon\" [disabled]=\"disabled\" type=\"primary blank\" (click)=\"handleButtonClick()\" end\r\n [tabIndex]=\"-1\">\r\n </ax-button>\r\n <ng-content select=\"[end]\">\r\n </ng-content>\r\n </ng-container>\r\n</ax-select-box2> -->\r\n\r\n\r\n<!-- <div class=\"ax-lov-box\" [style.display]=\"mode=='hidden' ? 'none':'unset'\">\r\n <div class=\"ax-field-set\">\r\n <div class=\"ax-field-set-wrapper\" [ngClass]=\"{ 'no-label': !label }\">\r\n <fieldset [ngClass]=\"{ 'input-focused': isFocused, 'input-error': errorText }\">\r\n <legend *ngIf=\"label\">\r\n {{ label }}\r\n </legend>\r\n </fieldset>\r\n <input type=\"text\" [(ngModel)]=\"text\" [placeholder]=\"placeholder\" (keyup)=\"handleKeyEvent($event)\"\r\n (blur)=\"handleBlurEvent($event)\" (focus)=\"handleFocusEvent($event)\" class=\"ax-text-box\" disabled />\r\n <div class=\"ax-field-set-button\">\r\n <button *ngIf=\"text && allowClear\" type=\"button\" class=\"btn btn-light\" (click)=\"clearText()\">\r\n <i class=\"far fa-times\"></i>\r\n </button>\r\n <button type=\"button\" class=\" btn btn-primary\" (click)=\"handleButtonClick($event)\">\r\n <i class=\"far fa-check-circle\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"validation-text\" *ngIf=\"errorText\">\r\n {{ errorText }}\r\n </div>\r\n\r\n</div> -->",
1903
- encapsulation: ViewEncapsulation.None,
1904
- host: { style: 'width: 100%' },
1905
- providers: [{ provide: AXValidatableComponent, useExisting: AXLOVComponent_1 }]
1906
- }),
1907
- __metadata("design:paramtypes", [AXPopupService, ElementRef])
1908
- ], AXLOVComponent);
1909
-
1910
- let AXLOVModule = class AXLOVModule {
1911
- };
1912
- AXLOVModule = __decorate([
1913
- NgModule({
1914
- declarations: [AXLOVComponent, AXDataLovPopupComponent],
1915
- imports: [CommonModule, FormsModule, AXDataGridModule, AXDataSourceModule, AXButtonModule, AXToolbarModule, AXSelectBoxModule, AXSearchBoxModule],
1916
- exports: [AXLOVComponent, AXDataLovPopupComponent],
1917
- providers: [],
1918
- entryComponents: [AXDataLovPopupComponent]
1919
- })
1920
- ], AXLOVModule);
1921
-
1922
- /**
1923
- * Generated bundle index. Do not edit.
1924
- */
1925
-
1926
- export { AXDaagridRowClickEvent, AXDataGridCellEvent, AXDataGridCellTemplateComponent, AXDataGridCellTemplateRenderer, AXDataGridColumnsChangeEvent, AXDataGridComponent, AXDataGridDetailTemplateComponent, AXDataGridDetailTemplateRenderer, AXDataGridFilterComponent, AXDataGridModule, AXDataGridRowSelectionChangeEvent, AXDataGridRowTemplateComponent, AXDataGridRowTemplateRenderer, AXDataGridSelectionChangeEvent, AXDataLovPopupComponent, AXDatePickerFilterComponent, AXGridCheckColumn, AXGridCommandColumn, AXGridDataColumn, AXGridDateColumn, AXGridRowNumberColumn, AXGridSelectionColumn, AXGridTextColumn, AXLOVComponent, AXLOVModule, BooleanFilterRenderer, BooleanRenderer, CommandRenderer, TextFilterRenderer };
1927
- //# sourceMappingURL=acorex-data-grid.js.map