@acorex/data-grid 3.0.65 → 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 +3 -0
  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 -2261
  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 -734
  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 -792
  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 -1939
  85. package/fesm2015/acorex-data-grid.js.map +0 -1
  86. package/fesm5/acorex-data-grid.js +0 -2017
  87. package/fesm5/acorex-data-grid.js.map +0 -1
@@ -1,1939 +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
- // @Input()
830
- // takeCount: number;
831
- this.autoGroupColumnDef = {};
832
- this.selectionMode = 'single';
833
- // @Input()
834
- // allowFiltering: boolean = false;
835
- this.selectRow = [];
836
- this.rowGroupPanelShow = 'never';
837
- this.loadOnInit = true;
838
- // @Input()
839
- // groupDefaultExpanded: number = 0;
840
- this.keyField = 'null';
841
- this.hasChildField = 'null';
842
- this.columnsChange = new EventEmitter();
843
- this._columns = [];
844
- this.defaultColDef = {
845
- filter: true,
846
- floatingFilter: true
847
- };
848
- this.groupHideOpenParents = false;
849
- this.cellClick = new EventEmitter();
850
- this.cellDbClick = new EventEmitter();
851
- this.cellFocuse = new EventEmitter();
852
- this.rowClick = new EventEmitter();
853
- this.rowDbClick = new EventEmitter();
854
- this.selectionChanged = new EventEmitter();
855
- this.rowSelectionChange = new EventEmitter();
856
- this.onRowSelectionChanged = new EventEmitter();
857
- this.rtl = AXConfig.get('layout.rtl');
858
- this.isServerSideGroup = (e) => {
859
- return e[this.hasChildField];
860
- };
861
- this.getColumnDefs = () => {
862
- return this.gridApi.getColumnDefs();
863
- };
864
- this.getCurrentPageNumber = () => {
865
- return {
866
- current: this.gridApi.paginationGetCurrentPage() + 1,
867
- total: this.gridApi.paginationGetTotalPages()
868
- };
869
- };
870
- this.getServerSideGroupKey = (e) => {
871
- return e[this.keyField];
872
- };
873
- this.internalGetRowClass = (p) => {
874
- if (this.rowClass) {
875
- if (this.rowClass instanceof Function) {
876
- return this.rowClass({
877
- rowIndex: p.node.rowIndex,
878
- rowLevel: p.node.level,
879
- data: p.data
880
- });
881
- }
882
- else {
883
- return this.rowClass;
884
- }
885
- }
886
- };
887
- this.localeText = AXTranslator.get('dataGrid');
888
- }
889
- get searchText() {
890
- return this._searchText;
891
- }
892
- set searchText(v) {
893
- if (v !== this._searchText) {
894
- this._searchText = v;
895
- if (this.gridApi) {
896
- this.refresh();
897
- this.gridApi.setQuickFilter(this.searchText);
898
- }
899
- }
900
- }
901
- get filter() {
902
- return this._filter;
903
- }
904
- set filter(v) {
905
- if (v !== this._filter) {
906
- this._filter = v;
907
- this._filter.forEach((f) => {
908
- const fc = this.gridApi.getFilterInstance(f.field);
909
- if (fc) {
910
- const ff = fc.getFrameworkComponentInstance();
911
- ff.setModel(f);
912
- }
913
- });
914
- }
915
- }
916
- get columns() {
917
- return this._inlineColumns ? [...this._columns, ...this._inlineColumns.toArray()] : this._columns;
918
- }
919
- set columns(val) {
920
- if (val && val.length) {
921
- let old = this._columns;
922
- this._columns = val;
923
- this.columnsChange.emit({ component: this, value: val, oldValue: old, htmlElement: this.ref.nativeElement });
924
- }
925
- }
926
- get dataSource() {
927
- return this._dataSource ? this._dataSource : this._contentDataSource;
928
- }
929
- set dataSource(v) {
930
- this._dataSource = v;
931
- }
932
- getRowHeight(param) {
933
- if (param.data && param.data.rowHeight && param.node.level == 0) {
934
- return param.data.rowHeight;
935
- }
936
- else if (this.masterDetail == true && param.node.level == 1) {
937
- return this.detailRowHeight;
938
- }
939
- else if (this.masterDetail == false && param.data && param.data.rowHeight) {
940
- return param.data.rowHeight;
941
- }
942
- else {
943
- return null;
944
- }
945
- }
946
- calcHeight() {
947
- if (this.toolbar) {
948
- this.internalHeight = `calc(100% - ${40}px)`;
949
- }
950
- else {
951
- this.internalHeight = '100%';
952
- }
953
- }
954
- get intenalGridDataSource() {
955
- const that = this;
956
- return {
957
- rowCount: null,
958
- getRows: (params) => {
959
- // that.gridApi.gridOptionsWrapper.setProperty('cacheBlockSize', this.takeCount ? this.takeCount : params.api.paginationGetPageSize());
960
- that.dataSourceSuccessCallback = params.successCallback;
961
- const loadParams = {};
962
- loadParams.searchText = that.searchText;
963
- loadParams.skip = params.request.startRow;
964
- // loadParams.take = params.request.endRow - params.request.startRow;
965
- //// loadParams.take = that.takeCount ? that.takeCount : params.api.paginationGetPageSize() * 2;
966
- loadParams.take = params.request.endRow - params.request.startRow;
967
- loadParams.sort = params.request.sortModel.map((c) => {
968
- return {
969
- field: c.colId,
970
- dir: c.sort
971
- };
972
- });
973
- // loadParams.groups = params.request.rowGroupCols.map(r => r.field);
974
- // loadParams.groupKeys = params.request.groupKeys;
975
- // loadParams.data = params.parentNode.data;
976
- loadParams.group = {
977
- fields: params.request.rowGroupCols.map((r) => r.field),
978
- keys: params.request.groupKeys,
979
- parentData: params.parentNode.data
980
- };
981
- loadParams.filter = params.request.filterModel;
982
- debugger;
983
- /// setTimeout(() => {
984
- that.dataSource.fetch(loadParams);
985
- // }, 5000);
986
- }
987
- };
988
- }
989
- getMainMenuItems(e) {
990
- return ['pinSubMenu', 'separator'];
991
- }
992
- ngOnDestroy() {
993
- this.gridApi.destroy();
994
- }
995
- paginationGoToPage(number) {
996
- this.gridApi.paginationGoToPage(number - 1);
997
- }
998
- // todo gridOptions: GridOptions
999
- internalGridReady(gridOptions) {
1000
- //// gridOptions.api.checkGridSize();
1001
- //// this.takeCount = this.takeCount ? this.takeCount : gridOptions.api.paginationGetPageSize() * 2;
1002
- // this.takeCount = this.takeCount < 20 ? 20 : this.takeCount;
1003
- //// gridOptions.api.gridOptionsWrapper.setProperty('cacheBlockSize', this.takeCount);
1004
- this.gridApi = gridOptions.api;
1005
- this.mapColumns();
1006
- this.calcHeight();
1007
- if (!this.loadOnInit) {
1008
- this.loadOnInit = true;
1009
- return;
1010
- }
1011
- if (this.remoteOperation) {
1012
- this.gridApi.setServerSideDatasource(this.intenalGridDataSource);
1013
- }
1014
- if (!this.remoteOperation) {
1015
- this.refresh();
1016
- }
1017
- }
1018
- ngAfterContentInit() {
1019
- const that = this;
1020
- if (this.rowTemplate) {
1021
- this.fullWidthCellRendererFramework = this.rowTemplate.renderer;
1022
- this.fullWidthCellRendererParams = this.rowTemplate.params;
1023
- }
1024
- this.frameworkComponents.agDateInput = AXDatePickerFilterComponent;
1025
- if (this.gridDetailTemplate) {
1026
- this.masterDetail = true;
1027
- this.detailCellRendererParams = this.gridDetailTemplate.params;
1028
- this.detailCellRenderer = 'detailRendererFramework';
1029
- this.frameworkComponents.detailRendererFramework = this.gridDetailTemplate.renderer;
1030
- this.detailRowHeight = this.gridDetailTemplate.height;
1031
- }
1032
- this.isFullWidthCell = () => {
1033
- return that.rowTemplate != null;
1034
- };
1035
- //this.cdr
1036
- }
1037
- ngOnInit() {
1038
- // if (this.takeCount && this.takeCount > 0) {
1039
- // this.paginationPageSize = this.takeCount;
1040
- // this.paginationAutoPageSize = false;
1041
- // this.cacheBlockSize = this.takeCount;
1042
- // }
1043
- if (this.selectionMode === 'single') {
1044
- this.groupSelectsChildren = false;
1045
- }
1046
- if (this.keyField !== 'null' && this.hasChildField !== 'null') {
1047
- this.rowGroupPanelShow = 'never';
1048
- this.treeData = true;
1049
- }
1050
- if (this.remoteOperation) {
1051
- this.rowModelType = 'serverSide';
1052
- }
1053
- //
1054
- if (this.rtl == null) {
1055
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1056
- }
1057
- //
1058
- }
1059
- gridSelectRow() {
1060
- if (this.gridApi) {
1061
- if (this.selectRow && this.selectRow.length > 0 && this.gridApi !== undefined && typeof this.selectRow[0] != 'object') {
1062
- this.gridApi.forEachNode((node) => {
1063
- if (node.data !== undefined) {
1064
- let select = false;
1065
- this.selectRow.forEach((id) => {
1066
- if (node.data[this.keyField] === id) {
1067
- select = true;
1068
- node.setSelected(select);
1069
- }
1070
- });
1071
- }
1072
- });
1073
- }
1074
- else {
1075
- this.gridApi.forEachNode((node) => {
1076
- if (node.data !== undefined) {
1077
- let select = false;
1078
- this.selectRow.forEach((item) => {
1079
- if (item.rowIndex != undefined && item.rowLevel != undefined) {
1080
- if (node.data[this.keyField] === item.data[this.keyField]) {
1081
- select = true;
1082
- }
1083
- }
1084
- else {
1085
- if (node.data[this.keyField] === item[this.keyField]) {
1086
- select = true;
1087
- }
1088
- }
1089
- });
1090
- node.setSelected(select);
1091
- }
1092
- });
1093
- }
1094
- }
1095
- }
1096
- // ngAfterViewChecked(): void {
1097
- // //Called after every check of the component's view. Applies to components only.
1098
- // //Add 'implements AfterViewChecked' to the class.
1099
- // // this.selectByValues();
1100
- // this.enabelSelect = false;
1101
- // }
1102
- rebuildGrid() {
1103
- this.mapColumns();
1104
- setTimeout(() => {
1105
- if (this.sizeColumnsToFit) {
1106
- this.gridApi.sizeColumnsToFit();
1107
- }
1108
- }, 10);
1109
- }
1110
- ngAfterViewInit() {
1111
- if (this.treeData === true) {
1112
- this.columnDefs = this.columns.map((c) => c.render());
1113
- const groupColumn = this.columnDefs.find((c) => c.rowGroupIndex == '0' && c.field !== '');
1114
- this.autoGroupColumnDef = {
1115
- headerName: groupColumn.headerName,
1116
- width: groupColumn.width,
1117
- cellRendererParams: { checkbox: this.showCheckBox },
1118
- field: groupColumn.field
1119
- };
1120
- this.columnDefs.forEach((elm) => {
1121
- if (elm.rowGroupIndex > -1) {
1122
- elm.hide = true;
1123
- }
1124
- });
1125
- }
1126
- //setTimeout(() => {
1127
- this.gridView = true;
1128
- //});
1129
- this.enabelSelect = true;
1130
- this.dataSource.onDataReceived.subscribe((_data) => {
1131
- debugger;
1132
- const result = _data.data.result;
1133
- this.hideLoading();
1134
- let items;
1135
- let totalCount;
1136
- if (Array.isArray(result)) {
1137
- items = result;
1138
- totalCount = result.length;
1139
- }
1140
- else {
1141
- items = result.items;
1142
- totalCount = result.totalCount;
1143
- }
1144
- if (this.dataSourceSuccessCallback) {
1145
- if (!this.loadOnInit) {
1146
- this.dataSourceSuccessCallback([], 0);
1147
- }
1148
- else {
1149
- this.dataSourceSuccessCallback(items, totalCount);
1150
- }
1151
- }
1152
- else {
1153
- if (!this.loadOnInit && this.gridApi !== undefined) {
1154
- this.gridApi.setRowData([]);
1155
- }
1156
- else if (this.gridApi !== undefined) {
1157
- this.gridApi.setRowData(items);
1158
- }
1159
- }
1160
- this.gridSelectRow();
1161
- });
1162
- this.dataSource.onFetchStart.subscribe(() => {
1163
- this.showLoading();
1164
- });
1165
- if (this.searchInput) {
1166
- this.searchInput.onValueChanged.subscribe((c) => {
1167
- this.searchText = c.value;
1168
- });
1169
- }
1170
- //
1171
- this.cdr.detectChanges();
1172
- }
1173
- mapColumns() {
1174
- this.columnDefs = this.columns.map((c) => c.render());
1175
- // if (this.showRowNumber) {
1176
- // this.columnDefs.push({
1177
- // headerName: AXConfig.get('layout.rtl') ? 'ردیف' : 'Row',
1178
- // valueGetter: 'node.rowIndex + 1',
1179
- // pinned: AXConfig.get('layout.rtl') ? 'right' : 'left'
1180
- // });
1181
- // }
1182
- if (this.gridDetailTemplate) {
1183
- if (this.columnDefs[0].checkboxSelection === true && this.columnDefs[0].field === '') {
1184
- this.columnDefs[1].cellRenderer = 'agGroupCellRenderer';
1185
- }
1186
- else {
1187
- this.columnDefs[0].cellRenderer = 'agGroupCellRenderer';
1188
- }
1189
- }
1190
- if (this.hasChildField === 'null') {
1191
- const groupColumn = this.columnDefs.find((c) => c.rowGroupIndex === undefined && c.field !== '');
1192
- if (groupColumn && this.groupHideOpenParents == false) {
1193
- this.autoGroupColumnDef = {
1194
- headerName: groupColumn.headerName,
1195
- width: groupColumn.width,
1196
- cellRendererParams: { checkbox: this.showCheckBox },
1197
- field: groupColumn.field
1198
- };
1199
- // groupColumn.hide = true;
1200
- }
1201
- }
1202
- this.columnDefs.forEach((elm) => {
1203
- if (elm.rowGroupIndex > -1) {
1204
- elm.hide = true;
1205
- }
1206
- });
1207
- }
1208
- displayedColumnsChanged(e) {
1209
- if (this.hasChildField === 'null') {
1210
- const ee = e.columnApi.getAllDisplayedColumnGroups();
1211
- const eee = ee.find((c) => c.colId !== 'ag-Grid-AutoColumn' && c.colId !== '0');
1212
- if (eee && eee.colId) {
1213
- this.autoGroupColumnDef = {
1214
- headerName: eee.colDef.headerName,
1215
- width: eee.colDef.width,
1216
- cellRendererParams: { checkbox: this.showCheckBox },
1217
- field: eee.colDef.field
1218
- };
1219
- }
1220
- // eee.hide = true;
1221
- }
1222
- }
1223
- refresh(route = []) {
1224
- if (this.remoteOperation && this.gridApi !== undefined) {
1225
- // this.gridApi.purgeServerSideCache(route);
1226
- this.gridApi.setServerSideDatasource(this.intenalGridDataSource);
1227
- }
1228
- else {
1229
- // TODO : check fetch param
1230
- this.dataSource.fetch(null);
1231
- }
1232
- }
1233
- internalGridCellClicked(e) {
1234
- this.cellClick.emit({ data: this.mapCellEvent(e), component: this, htmlElement: this.ref.nativeElement });
1235
- }
1236
- internalGridCellDoubleClicked(e) {
1237
- this.cellDbClick.emit({ data: this.mapCellEvent(e), component: this, htmlElement: this.ref.nativeElement });
1238
- }
1239
- internalGridCellFocused(e) {
1240
- this.cellFocuse.emit({ data: this.mapCellEvent(e), htmlElement: this.ref.nativeElement, component: this });
1241
- }
1242
- internalGridRowClicked(e) {
1243
- if (!e.node.group) {
1244
- this.rowClick.emit({ data: this.mapRowEvent(e), component: this, htmlElement: this.ref.nativeElement });
1245
- }
1246
- }
1247
- internalGridRowDoubleClicked(e) {
1248
- if (!e.node.group) {
1249
- this.rowDbClick.emit({ data: this.mapRowEvent(e), htmlElement: this.ref.nativeElement, component: this });
1250
- }
1251
- }
1252
- differenceOf2Arrays(array1, array2) {
1253
- const temp = [];
1254
- for (const i in array1) {
1255
- if (array2.indexOf(array1[i]) === -1) {
1256
- temp.push(array1[i]);
1257
- }
1258
- }
1259
- for (const i in array2) {
1260
- if (array1.indexOf(array2[i]) === -1) {
1261
- temp.push(array2[i]);
1262
- }
1263
- }
1264
- return temp.sort((a, b) => a - b);
1265
- }
1266
- rowSelectionChanged(e) {
1267
- // this.gridApi.forEachNode((node) => {
1268
- // if (node.data[this.keyField] == e.node.data[this.keyField]) {
1269
- // node.setSelected(e.node.selected);
1270
- // }
1271
- // });
1272
- if (e.node.selected == true) {
1273
- this.selectRow = this.selectRow.filter((c) => c[this.keyField] != e.data[this.keyField]);
1274
- this.selectRow.push(e.data);
1275
- }
1276
- else {
1277
- this.selectRow = this.selectRow.filter((c) => c[this.keyField] != e.data[this.keyField]);
1278
- }
1279
- this.rowSelectionChange.emit({ component: this, data: e, htmlElement: this.ref.nativeElement });
1280
- // console.log('e', e);
1281
- // console.log('select', e.node.selected);
1282
- // console.log('index', e.rowIndex);
1283
- }
1284
- internalGridSelectionChanged(e) {
1285
- const args = { items: [] };
1286
- const oldNodes = this.oldSelectionNodes;
1287
- const nodes = this.gridApi.getSelectedNodes();
1288
- nodes.forEach((i) => {
1289
- args.items.push({
1290
- rowLevel: i.level,
1291
- rowIndex: i.rowIndex,
1292
- data: i.data
1293
- });
1294
- });
1295
- this.selectionChanged.emit({ data: args, component: this, htmlElement: this.ref.nativeElement });
1296
- let action = nodes.length > oldNodes.length ? true : false;
1297
- const node = this.differenceOf2Arrays(nodes, oldNodes);
1298
- this.onRowSelectionChanged.emit({ component: this, selected: action, data: node, htmlElement: this.ref.nativeElement });
1299
- this.oldSelectionNodes = nodes;
1300
- }
1301
- mapCellEvent(e) {
1302
- return {
1303
- rowLevel: 0,
1304
- column: e.column,
1305
- data: e.data,
1306
- rowIndex: e.rowIndex,
1307
- value: e.value
1308
- };
1309
- }
1310
- mapRowEvent(e) {
1311
- return {
1312
- rowLevel: 0,
1313
- data: e.data,
1314
- rowIndex: e.rowIndex
1315
- };
1316
- }
1317
- deselectAll() {
1318
- this.gridApi.deselectAll();
1319
- }
1320
- showLoading() {
1321
- if (this.gridApi) {
1322
- this.gridApi.showLoadingOverlay();
1323
- }
1324
- }
1325
- hideLoading() {
1326
- if (this.gridApi) {
1327
- this.gridApi.hideOverlay();
1328
- }
1329
- }
1330
- internalGridSizeChanged(e) {
1331
- if (e.clientWidth > 0 && e.clientHeight > 0) {
1332
- this.performSizeColumnsToFit(e.api);
1333
- }
1334
- // this.refresh();
1335
- // this.gridApi.paginationGoToFirstPage();
1336
- }
1337
- internalGridFirstDataRendered(e) {
1338
- this.performSizeColumnsToFit(e.api);
1339
- }
1340
- performSizeColumnsToFit(api) {
1341
- if (this.sizeColumnsToFit) {
1342
- api.sizeColumnsToFit();
1343
- }
1344
- }
1345
- };
1346
- AXDataGridComponent.ctorParameters = () => [
1347
- { type: ElementRef },
1348
- { type: ChangeDetectorRef }
1349
- ];
1350
- __decorate([
1351
- Input(),
1352
- __metadata("design:type", Boolean)
1353
- ], AXDataGridComponent.prototype, "remoteOperation", void 0);
1354
- __decorate([
1355
- Input(),
1356
- __metadata("design:type", Boolean)
1357
- ], AXDataGridComponent.prototype, "rowMultiSelectWithClick", void 0);
1358
- __decorate([
1359
- Input(),
1360
- __metadata("design:type", Boolean)
1361
- ], AXDataGridComponent.prototype, "suppressRowClickSelection", void 0);
1362
- __decorate([
1363
- Input(),
1364
- __metadata("design:type", Boolean)
1365
- ], AXDataGridComponent.prototype, "suppressCellSelection", void 0);
1366
- __decorate([
1367
- Input(),
1368
- __metadata("design:type", Boolean)
1369
- ], AXDataGridComponent.prototype, "sizeColumnsToFit", void 0);
1370
- __decorate([
1371
- Input(),
1372
- __metadata("design:type", Boolean)
1373
- ], AXDataGridComponent.prototype, "showCheckBox", void 0);
1374
- __decorate([
1375
- Input(),
1376
- __metadata("design:type", Boolean)
1377
- ], AXDataGridComponent.prototype, "floatingFilter", void 0);
1378
- __decorate([
1379
- Input(),
1380
- __metadata("design:type", String)
1381
- ], AXDataGridComponent.prototype, "selectionMode", void 0);
1382
- __decorate([
1383
- Input(),
1384
- __metadata("design:type", Array)
1385
- ], AXDataGridComponent.prototype, "selectRow", void 0);
1386
- __decorate([
1387
- Input(),
1388
- __metadata("design:type", String)
1389
- ], AXDataGridComponent.prototype, "rowGroupPanelShow", void 0);
1390
- __decorate([
1391
- Input(),
1392
- __metadata("design:type", Boolean)
1393
- ], AXDataGridComponent.prototype, "loadOnInit", void 0);
1394
- __decorate([
1395
- Input(),
1396
- __metadata("design:type", String)
1397
- ], AXDataGridComponent.prototype, "keyField", void 0);
1398
- __decorate([
1399
- Input(),
1400
- __metadata("design:type", String)
1401
- ], AXDataGridComponent.prototype, "hasChildField", void 0);
1402
- __decorate([
1403
- Input(),
1404
- __metadata("design:type", String),
1405
- __metadata("design:paramtypes", [String])
1406
- ], AXDataGridComponent.prototype, "searchText", null);
1407
- __decorate([
1408
- Input(),
1409
- __metadata("design:type", Array),
1410
- __metadata("design:paramtypes", [Array])
1411
- ], AXDataGridComponent.prototype, "filter", null);
1412
- __decorate([
1413
- ContentChildren(AXGridDataColumn),
1414
- __metadata("design:type", QueryList)
1415
- ], AXDataGridComponent.prototype, "_inlineColumns", void 0);
1416
- __decorate([
1417
- Output(),
1418
- __metadata("design:type", EventEmitter)
1419
- ], AXDataGridComponent.prototype, "columnsChange", void 0);
1420
- __decorate([
1421
- Input(),
1422
- __metadata("design:type", Array),
1423
- __metadata("design:paramtypes", [Array])
1424
- ], AXDataGridComponent.prototype, "columns", null);
1425
- __decorate([
1426
- Input(),
1427
- __metadata("design:type", Object)
1428
- ], AXDataGridComponent.prototype, "rowHeight", void 0);
1429
- __decorate([
1430
- ContentChild(AXToolbarSearchComponent, { static: true }),
1431
- __metadata("design:type", AXToolbarSearchComponent)
1432
- ], AXDataGridComponent.prototype, "searchInput", void 0);
1433
- __decorate([
1434
- ContentChild(AXToolbarComponent, { static: true }),
1435
- __metadata("design:type", AXToolbarComponent)
1436
- ], AXDataGridComponent.prototype, "toolbar", void 0);
1437
- __decorate([
1438
- ContentChild(AXDataGridRowTemplateComponent, { static: true }),
1439
- __metadata("design:type", AXDataGridRowTemplateComponent)
1440
- ], AXDataGridComponent.prototype, "rowTemplate", void 0);
1441
- __decorate([
1442
- ContentChild(AXDataGridDetailTemplateComponent, { static: true }),
1443
- __metadata("design:type", AXDataGridDetailTemplateComponent)
1444
- ], AXDataGridComponent.prototype, "gridDetailTemplate", void 0);
1445
- __decorate([
1446
- ContentChild(AXDataSourceComponent, { static: true }),
1447
- __metadata("design:type", AXDataSourceComponent)
1448
- ], AXDataGridComponent.prototype, "_contentDataSource", void 0);
1449
- __decorate([
1450
- Input(),
1451
- __metadata("design:type", AXDataSourceComponent),
1452
- __metadata("design:paramtypes", [AXDataSourceComponent])
1453
- ], AXDataGridComponent.prototype, "dataSource", null);
1454
- __decorate([
1455
- Input(),
1456
- __metadata("design:type", Boolean)
1457
- ], AXDataGridComponent.prototype, "groupHideOpenParents", void 0);
1458
- __decorate([
1459
- Output(),
1460
- __metadata("design:type", EventEmitter)
1461
- ], AXDataGridComponent.prototype, "cellClick", void 0);
1462
- __decorate([
1463
- Output(),
1464
- __metadata("design:type", EventEmitter)
1465
- ], AXDataGridComponent.prototype, "cellDbClick", void 0);
1466
- __decorate([
1467
- Output(),
1468
- __metadata("design:type", EventEmitter)
1469
- ], AXDataGridComponent.prototype, "cellFocuse", void 0);
1470
- __decorate([
1471
- Output(),
1472
- __metadata("design:type", EventEmitter)
1473
- ], AXDataGridComponent.prototype, "rowClick", void 0);
1474
- __decorate([
1475
- Output(),
1476
- __metadata("design:type", EventEmitter)
1477
- ], AXDataGridComponent.prototype, "rowDbClick", void 0);
1478
- __decorate([
1479
- Output(),
1480
- __metadata("design:type", EventEmitter)
1481
- ], AXDataGridComponent.prototype, "selectionChanged", void 0);
1482
- __decorate([
1483
- Output(),
1484
- __metadata("design:type", EventEmitter)
1485
- ], AXDataGridComponent.prototype, "rowSelectionChange", void 0);
1486
- __decorate([
1487
- Output(),
1488
- __metadata("design:type", EventEmitter)
1489
- ], AXDataGridComponent.prototype, "onRowSelectionChanged", void 0);
1490
- __decorate([
1491
- Input(),
1492
- __metadata("design:type", Function)
1493
- ], AXDataGridComponent.prototype, "rowClass", void 0);
1494
- __decorate([
1495
- Input(),
1496
- __metadata("design:type", Boolean)
1497
- ], AXDataGridComponent.prototype, "rtl", void 0);
1498
- AXDataGridComponent = __decorate([
1499
- Component({
1500
- selector: 'ax-data-grid',
1501
- 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)\" -->",
1502
- encapsulation: ViewEncapsulation.None
1503
- // changeDetection: ChangeDetectionStrategy.OnPush
1504
- }),
1505
- __metadata("design:paramtypes", [ElementRef, ChangeDetectorRef])
1506
- ], AXDataGridComponent);
1507
-
1508
- let AXDataGridFilterComponent = class AXDataGridFilterComponent {
1509
- };
1510
- AXDataGridFilterComponent = __decorate([
1511
- Component({
1512
- selector: 'ax-data-grid-filter',
1513
- template: `
1514
- <div class='ax-grid-filter-container'>
1515
- <ng-content></ng-content>
1516
- <div class='btn-group' role='group'>
1517
- <button type='button' class='btn btn-primary btn-sm'>
1518
- <i class='fas fa-filter'></i>
1519
- </button>
1520
- <button type='button' class='btn btn-danger btn-sm'>
1521
- <i class='fas fa-trash-alt'></i>
1522
- </button>
1523
- </div>
1524
- </div>
1525
- `,
1526
- encapsulation: ViewEncapsulation.None
1527
- })
1528
- ], AXDataGridFilterComponent);
1529
-
1530
- let AXDataGridModule = class AXDataGridModule {
1531
- };
1532
- AXDataGridModule = __decorate([
1533
- NgModule({
1534
- declarations: [
1535
- AXDataGridComponent,
1536
- AXGridTextColumn,
1537
- AXGridCheckColumn,
1538
- AXGridSelectionColumn,
1539
- AXGridDateColumn,
1540
- AXGridRowNumberColumn,
1541
- AXGridCommandColumn,
1542
- BooleanRenderer,
1543
- BooleanFilterRenderer,
1544
- TextFilterRenderer,
1545
- AXDataGridFilterComponent,
1546
- AXDataGridRowTemplateComponent,
1547
- AXDataGridDetailTemplateComponent,
1548
- AXDataGridRowTemplateRenderer,
1549
- AXDataGridDetailTemplateRenderer,
1550
- AXDataGridCellTemplateComponent,
1551
- AXDataGridCellTemplateRenderer,
1552
- AXDatePickerFilterComponent,
1553
- CommandRenderer
1554
- ],
1555
- imports: [
1556
- CommonModule,
1557
- AXCoreModule,
1558
- FormsModule,
1559
- //AgGridModule,
1560
- AXTextBoxModule,
1561
- AXCheckBoxModule,
1562
- AXSelectBoxModule,
1563
- AXDataSourceModule,
1564
- AXButtonModule,
1565
- AXDatePickerModule,
1566
- AgGridModule.withComponents([AXDatePickerFilterComponent])
1567
- ],
1568
- exports: [
1569
- AXDataGridComponent,
1570
- AXDataGridFilterComponent,
1571
- AXDataGridRowTemplateComponent,
1572
- AXDataGridDetailTemplateComponent,
1573
- AXDataGridRowTemplateRenderer,
1574
- AXDataGridDetailTemplateRenderer,
1575
- AXDataGridCellTemplateComponent,
1576
- AXDataGridCellTemplateRenderer,
1577
- AXGridTextColumn,
1578
- AXGridRowNumberColumn,
1579
- AXGridCheckColumn,
1580
- AXGridDateColumn,
1581
- AXGridSelectionColumn,
1582
- AXGridCommandColumn,
1583
- BooleanRenderer,
1584
- BooleanFilterRenderer,
1585
- CommandRenderer
1586
- ],
1587
- entryComponents: [
1588
- BooleanRenderer,
1589
- BooleanFilterRenderer,
1590
- CommandRenderer,
1591
- TextFilterRenderer,
1592
- AXDataGridRowTemplateComponent,
1593
- AXDataGridDetailTemplateComponent,
1594
- AXDataGridRowTemplateRenderer,
1595
- AXDataGridDetailTemplateRenderer,
1596
- AXDataGridCellTemplateComponent,
1597
- AXDataGridCellTemplateRenderer
1598
- ],
1599
- providers: []
1600
- })
1601
- ], AXDataGridModule);
1602
-
1603
- let AXDataLovPopupComponent = class AXDataLovPopupComponent extends AXBasePopupPageComponent {
1604
- constructor(cdr, ref) {
1605
- super();
1606
- this.cdr = cdr;
1607
- this.ref = ref;
1608
- this.columns = [];
1609
- this.selectedItems = [];
1610
- this.keyField = '';
1611
- this.allowNull = true;
1612
- this.rtl = AXConfig.get('layout.rtl');
1613
- this.selectedRows = [];
1614
- }
1615
- ngOnInit() {
1616
- if (this.rtl == null) {
1617
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1618
- }
1619
- }
1620
- onDoneClick() {
1621
- if (this.selectedItems) {
1622
- this.close(this.selectedItems);
1623
- }
1624
- else {
1625
- this.close();
1626
- }
1627
- }
1628
- rowDoubleClicked(e) {
1629
- console.log('s', e.data.data);
1630
- if (this.selectionMode == 'single') {
1631
- this.selectedItems = [];
1632
- }
1633
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.data[this.keyField]);
1634
- this.selectedItems.push(e.data.data);
1635
- this.onDoneClick();
1636
- }
1637
- onCancelClick() {
1638
- this.close();
1639
- }
1640
- rowSelectionChange(e) {
1641
- if (e.data.node.selected == true) {
1642
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
1643
- this.selectedItems.push(e.data.node.data);
1644
- }
1645
- else {
1646
- if (this.allowNull == true || (this.allowNull == false && this.selectedItems.length > 1)) {
1647
- this.selectedItems = this.selectedItems.filter((c) => c[this.keyField] != e.data.node.data[this.keyField]);
1648
- }
1649
- }
1650
- // console.log('ee', e)
1651
- // // console.log('e', e);
1652
- // console.log('select', e.data.node.selected);
1653
- // console.log('index', e.data.rowIndex);
1654
- }
1655
- ngAfterViewInit() {
1656
- this.selectedItems.forEach((ele) => {
1657
- this.selectedRows.push(ele);
1658
- });
1659
- this.searchBox.focus();
1660
- if (this.dataSource.onDataReceived) {
1661
- this.dataSource.onDataReceived.subscribe((arg) => {
1662
- this.cdr.markForCheck();
1663
- this.cdr.detectChanges();
1664
- });
1665
- }
1666
- }
1667
- // onValueSearchChanged(e) {
1668
- // const params: AXDataSourceReadParams = {}
1669
- // params.searchText = e.value;
1670
- // // params.take = 100;
1671
- // // params.skip = 0
1672
- // this.dataSource.fetch(params);
1673
- // }
1674
- getFooterButtons() {
1675
- return [
1676
- {
1677
- text: AXTranslator.get('common.confirm'),
1678
- name: 'confirm',
1679
- style: 'ax primary',
1680
- icon: 'far fa-check-circle'
1681
- },
1682
- {
1683
- text: AXTranslator.get('common.cancel'),
1684
- name: 'cancel',
1685
- style: 'ax light',
1686
- icon: 'far fa-times-circle'
1687
- }
1688
- ];
1689
- }
1690
- onFooterButtonClick(e) {
1691
- if (e.name === 'confirm') {
1692
- this.onDoneClick();
1693
- }
1694
- if (e.name === 'cancel') {
1695
- this.onCancelClick();
1696
- }
1697
- }
1698
- };
1699
- AXDataLovPopupComponent.ctorParameters = () => [
1700
- { type: ChangeDetectorRef },
1701
- { type: ElementRef }
1702
- ];
1703
- __decorate([
1704
- ViewChild('grid', { static: true }),
1705
- __metadata("design:type", AXDataGridComponent)
1706
- ], AXDataLovPopupComponent.prototype, "grid", void 0);
1707
- __decorate([
1708
- ViewChild('searchBox'),
1709
- __metadata("design:type", AXToolbarSearchComponent)
1710
- ], AXDataLovPopupComponent.prototype, "searchBox", void 0);
1711
- AXDataLovPopupComponent = __decorate([
1712
- Component({
1713
- 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>"
1714
- }),
1715
- __metadata("design:paramtypes", [ChangeDetectorRef, ElementRef])
1716
- ], AXDataLovPopupComponent);
1717
-
1718
- var AXLOVComponent_1;
1719
- let AXLOVComponent = AXLOVComponent_1 = class AXLOVComponent extends AXValidatableComponent {
1720
- constructor(popup, ref) {
1721
- super();
1722
- this.popup = popup;
1723
- this.ref = ref;
1724
- this.textField = '';
1725
- this.allowSearch = true;
1726
- this.valueField = '';
1727
- this.hasChildField = 'null';
1728
- this.allowNull = true;
1729
- this.popupSize = 'md';
1730
- this.selectedItems = [];
1731
- // @Input()
1732
- // selectedValues: any[] = [];
1733
- this.readonly = false;
1734
- this.disabled = false;
1735
- this.chipsWidth = '';
1736
- this.size = 'md';
1737
- this.mode = 'single';
1738
- this.onSelectionChange = new EventEmitter();
1739
- this.rtl = AXConfig.get('layout.rtl');
1740
- }
1741
- get validation() {
1742
- return this._validation ? this._validation : this._contentValidation;
1743
- }
1744
- set validation(v) {
1745
- this._validation = v;
1746
- }
1747
- focus() {
1748
- this.selectBox.focus();
1749
- }
1750
- refresh() {
1751
- this.selectBox.refresh();
1752
- }
1753
- handleButtonClick() {
1754
- this.open();
1755
- }
1756
- ngOnInit() {
1757
- if (this.rtl == null) {
1758
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
1759
- }
1760
- // this.selectVal = this.selectedValues;
1761
- this.onSelectionChange.subscribe((c) => {
1762
- this.clearValidationStyle(this.ref.nativeElement);
1763
- });
1764
- }
1765
- ngAfterContentInit() {
1766
- this.initValidation(this.ref, 'selectedItems', this.validation);
1767
- }
1768
- handleSelectChange(e) {
1769
- // console.log('se' + JSON.stringify(e));
1770
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
1771
- }
1772
- open() {
1773
- return new Promise((resolve) => {
1774
- this.selectBox.dropdown.close();
1775
- this.popup
1776
- .open(AXDataLovPopupComponent, {
1777
- size: this.popupSize,
1778
- // closable: false,
1779
- data: {
1780
- dataSource: this.dataSource,
1781
- selectionMode: this.mode,
1782
- columns: this.columns.toArray(),
1783
- // selectedItems: this.selectedValues,
1784
- selectedItems: this.selectedItems,
1785
- keyField: this.valueField,
1786
- allowNull: this.allowNull,
1787
- hasChildField: this.hasChildField,
1788
- rtl: this.rtl
1789
- },
1790
- title: this.caption
1791
- // size: this.size,
1792
- })
1793
- .then((c) => {
1794
- if (c.data) {
1795
- // this.selectedValues = [];
1796
- this.selectedItems = [];
1797
- c.data.forEach((elm) => {
1798
- this.selectedItems.push(elm);
1799
- });
1800
- // this.selectedItems = c.data;
1801
- // this.selectBox.refresh();
1802
- // console.log('se' + JSON.stringify(this.selectedItems));
1803
- this.onSelectionChange.emit({ data: this.selectedItems, component: this, htmlElement: this.ref.nativeElement });
1804
- if (resolve) {
1805
- resolve(c.data);
1806
- }
1807
- }
1808
- else {
1809
- if (resolve) {
1810
- resolve(this.selectedItems);
1811
- }
1812
- }
1813
- this.selectBox.refresh();
1814
- });
1815
- });
1816
- }
1817
- };
1818
- AXLOVComponent.ctorParameters = () => [
1819
- { type: AXPopupService },
1820
- { type: ElementRef }
1821
- ];
1822
- __decorate([
1823
- ContentChild(AXValidation, { static: true }),
1824
- __metadata("design:type", AXValidation)
1825
- ], AXLOVComponent.prototype, "_contentValidation", void 0);
1826
- __decorate([
1827
- Input(),
1828
- __metadata("design:type", AXValidation),
1829
- __metadata("design:paramtypes", [AXValidation])
1830
- ], AXLOVComponent.prototype, "validation", null);
1831
- __decorate([
1832
- ViewChild('selectBox', { static: true }),
1833
- __metadata("design:type", AXSelectBoxComponent)
1834
- ], AXLOVComponent.prototype, "selectBox", void 0);
1835
- __decorate([
1836
- ContentChild(AXDataSourceComponent, { static: true }),
1837
- __metadata("design:type", AXDataSourceComponent)
1838
- ], AXLOVComponent.prototype, "dataSource", void 0);
1839
- __decorate([
1840
- ContentChildren(AXGridDataColumn),
1841
- __metadata("design:type", QueryList)
1842
- ], AXLOVComponent.prototype, "columns", void 0);
1843
- __decorate([
1844
- ContentChild('itemTemplate', { static: true }),
1845
- __metadata("design:type", TemplateRef)
1846
- ], AXLOVComponent.prototype, "rowTemplate", void 0);
1847
- __decorate([
1848
- Input(),
1849
- __metadata("design:type", String)
1850
- ], AXLOVComponent.prototype, "textField", void 0);
1851
- __decorate([
1852
- Input(),
1853
- __metadata("design:type", Boolean)
1854
- ], AXLOVComponent.prototype, "allowSearch", void 0);
1855
- __decorate([
1856
- Input(),
1857
- __metadata("design:type", String)
1858
- ], AXLOVComponent.prototype, "valueField", void 0);
1859
- __decorate([
1860
- Input(),
1861
- __metadata("design:type", String)
1862
- ], AXLOVComponent.prototype, "hasChildField", void 0);
1863
- __decorate([
1864
- Input(),
1865
- __metadata("design:type", Boolean)
1866
- ], AXLOVComponent.prototype, "allowNull", void 0);
1867
- __decorate([
1868
- Input(),
1869
- __metadata("design:type", String)
1870
- ], AXLOVComponent.prototype, "popupSize", void 0);
1871
- __decorate([
1872
- Input(),
1873
- __metadata("design:type", Array)
1874
- ], AXLOVComponent.prototype, "selectedItems", void 0);
1875
- __decorate([
1876
- Input(),
1877
- __metadata("design:type", Boolean)
1878
- ], AXLOVComponent.prototype, "readonly", void 0);
1879
- __decorate([
1880
- Input(),
1881
- __metadata("design:type", Boolean)
1882
- ], AXLOVComponent.prototype, "disabled", void 0);
1883
- __decorate([
1884
- Input(),
1885
- __metadata("design:type", String)
1886
- ], AXLOVComponent.prototype, "chipsWidth", void 0);
1887
- __decorate([
1888
- Input(),
1889
- __metadata("design:type", String)
1890
- ], AXLOVComponent.prototype, "size", void 0);
1891
- __decorate([
1892
- Input(),
1893
- __metadata("design:type", String)
1894
- ], AXLOVComponent.prototype, "caption", void 0);
1895
- __decorate([
1896
- Input(),
1897
- __metadata("design:type", String)
1898
- ], AXLOVComponent.prototype, "mode", void 0);
1899
- __decorate([
1900
- Input(),
1901
- __metadata("design:type", String)
1902
- ], AXLOVComponent.prototype, "placeholder", void 0);
1903
- __decorate([
1904
- Output(),
1905
- __metadata("design:type", EventEmitter)
1906
- ], AXLOVComponent.prototype, "onSelectionChange", void 0);
1907
- __decorate([
1908
- Input(),
1909
- __metadata("design:type", Boolean)
1910
- ], AXLOVComponent.prototype, "rtl", void 0);
1911
- AXLOVComponent = AXLOVComponent_1 = __decorate([
1912
- Component({
1913
- selector: 'ax-lov',
1914
- 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> -->",
1915
- encapsulation: ViewEncapsulation.None,
1916
- host: { style: 'width: 100%' },
1917
- providers: [{ provide: AXValidatableComponent, useExisting: AXLOVComponent_1 }]
1918
- }),
1919
- __metadata("design:paramtypes", [AXPopupService, ElementRef])
1920
- ], AXLOVComponent);
1921
-
1922
- let AXLOVModule = class AXLOVModule {
1923
- };
1924
- AXLOVModule = __decorate([
1925
- NgModule({
1926
- declarations: [AXLOVComponent, AXDataLovPopupComponent],
1927
- imports: [CommonModule, FormsModule, AXDataGridModule, AXDataSourceModule, AXButtonModule, AXToolbarModule, AXSelectBoxModule, AXSearchBoxModule],
1928
- exports: [AXLOVComponent, AXDataLovPopupComponent],
1929
- providers: [],
1930
- entryComponents: [AXDataLovPopupComponent]
1931
- })
1932
- ], AXLOVModule);
1933
-
1934
- /**
1935
- * Generated bundle index. Do not edit.
1936
- */
1937
-
1938
- 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 };
1939
- //# sourceMappingURL=acorex-data-grid.js.map