@cauca-911/datagrid 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/assets/i18n/en-datagrid.json +19 -0
- package/assets/i18n/fr-datagrid.json +19 -0
- package/fesm2022/cauca-911-datagrid.mjs +1333 -0
- package/fesm2022/cauca-911-datagrid.mjs.map +1 -0
- package/index.d.ts +397 -0
- package/package.json +34 -0
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ViewChild, HostBinding, Input, Optional, ViewEncapsulation, Component, EventEmitter, Output, Injectable, input, signal, ContentChild, ContentChildren, ChangeDetectionStrategy, QueryList, output, effect, TemplateRef, inject, forwardRef, computed, model } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/table';
|
|
4
|
+
import { MatColumnDef, MatCellDef, MatHeaderCellDef, MatFooterCellDef, MatTable, MatHeaderRowDef, MatFooterRowDef, MatNoDataRow, MatRowDef, MatTableDataSource, MatHeaderCell, MatFooterCell, MatRow, MatHeaderRow, MatFooterRow, MatCell } from '@angular/material/table';
|
|
5
|
+
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
6
|
+
import * as i1$5 from '@cauca-911/core';
|
|
7
|
+
import { toLowerCaseAndWithoutDiacritics, CaucaCoreService } from '@cauca-911/core';
|
|
8
|
+
import * as i4$1 from '@angular/material/paginator';
|
|
9
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
10
|
+
import * as i3 from '@angular/forms';
|
|
11
|
+
import { FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
12
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
13
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
+
import * as i2 from '@angular/material/input';
|
|
15
|
+
import { MatInputModule } from '@angular/material/input';
|
|
16
|
+
import { IconButtonComponent, RaisedButtonComponent, BasicButtonComponent, StrokedButtonComponent, MenuItemComponent, IconComponent } from '@cauca-911/material';
|
|
17
|
+
import * as i1$2 from '@ngx-translate/core';
|
|
18
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
19
|
+
import { Subject, debounceTime, takeUntil, BehaviorSubject, of, distinctUntilChanged } from 'rxjs';
|
|
20
|
+
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
|
21
|
+
import { trigger, state, transition, style, animate } from '@angular/animations';
|
|
22
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
23
|
+
import * as i2$1 from '@angular/material/card';
|
|
24
|
+
import { MatCardModule } from '@angular/material/card';
|
|
25
|
+
import * as i3$1 from '@angular/material/checkbox';
|
|
26
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
27
|
+
import * as i4 from '@angular/material/menu';
|
|
28
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
29
|
+
import { MatIcon } from '@angular/material/icon';
|
|
30
|
+
import { NgTemplateOutlet, NgStyle, NgClass, DatePipe } from '@angular/common';
|
|
31
|
+
import * as i1$3 from '@angular/material/progress-spinner';
|
|
32
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
33
|
+
import { ODataDataSource } from 'odata-data-source';
|
|
34
|
+
import * as i1$4 from '@angular/common/http';
|
|
35
|
+
import { MatTooltip } from '@angular/material/tooltip';
|
|
36
|
+
import { RouterLink } from '@angular/router';
|
|
37
|
+
import dayjs from 'dayjs';
|
|
38
|
+
|
|
39
|
+
class DataGridRowDropEvent {
|
|
40
|
+
constructor(data) {
|
|
41
|
+
Object.assign(this, data);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class BaseGridColumnComponent {
|
|
46
|
+
constructor(table) {
|
|
47
|
+
this.table = table;
|
|
48
|
+
this.prop = '';
|
|
49
|
+
this.showLabel = true;
|
|
50
|
+
this.isInColumnChooser = true;
|
|
51
|
+
this.width = "";
|
|
52
|
+
this.showToolTip = false;
|
|
53
|
+
this.selected = true;
|
|
54
|
+
}
|
|
55
|
+
ngOnInit() {
|
|
56
|
+
if (this.columnDef) {
|
|
57
|
+
if (!this.columnDef.name) {
|
|
58
|
+
this.columnDef.name = this.prop;
|
|
59
|
+
}
|
|
60
|
+
this.columnDef.cell = this.cellDef;
|
|
61
|
+
this.columnDef.headerCell = this.headerCellDef;
|
|
62
|
+
this.columnDef.footerCell = this.footerCellDef;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ngOnDestroy() {
|
|
66
|
+
if (this.table) {
|
|
67
|
+
this.table.removeColumnDef(this.columnDef);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
capitalize(value) {
|
|
71
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
72
|
+
}
|
|
73
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseGridColumnComponent, deps: [{ token: i1.MatTable, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
74
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: BaseGridColumnComponent, isStandalone: true, selector: "ng-component", inputs: { prop: "prop", showLabel: "showLabel", label: "label", isInColumnChooser: "isInColumnChooser", width: "width", showToolTip: "showToolTip" }, host: { properties: { "attr.ariaHidden": "this.ariaHidden", "class": "this.classes" } }, viewQueries: [{ propertyName: "columnDef", first: true, predicate: MatColumnDef, descendants: true, static: true }, { propertyName: "cellDef", first: true, predicate: MatCellDef, descendants: true, static: true }, { propertyName: "headerCellDef", first: true, predicate: MatHeaderCellDef, descendants: true, static: true }, { propertyName: "footerCellDef", first: true, predicate: MatFooterCellDef, descendants: true, static: true }], ngImport: i0, template: '', isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
|
|
75
|
+
}
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseGridColumnComponent, decorators: [{
|
|
77
|
+
type: Component,
|
|
78
|
+
args: [{ template: '',
|
|
79
|
+
encapsulation: ViewEncapsulation.None
|
|
80
|
+
}]
|
|
81
|
+
}], ctorParameters: () => [{ type: i1.MatTable, decorators: [{
|
|
82
|
+
type: Optional
|
|
83
|
+
}] }], propDecorators: { prop: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], showLabel: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], label: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], isInColumnChooser: [{
|
|
90
|
+
type: Input
|
|
91
|
+
}], width: [{
|
|
92
|
+
type: Input
|
|
93
|
+
}], showToolTip: [{
|
|
94
|
+
type: Input
|
|
95
|
+
}], ariaHidden: [{
|
|
96
|
+
type: HostBinding,
|
|
97
|
+
args: ['attr.ariaHidden']
|
|
98
|
+
}], classes: [{
|
|
99
|
+
type: HostBinding,
|
|
100
|
+
args: ['class']
|
|
101
|
+
}], columnDef: [{
|
|
102
|
+
type: ViewChild,
|
|
103
|
+
args: [MatColumnDef, { static: true }]
|
|
104
|
+
}], cellDef: [{
|
|
105
|
+
type: ViewChild,
|
|
106
|
+
args: [MatCellDef, { static: true }]
|
|
107
|
+
}], headerCellDef: [{
|
|
108
|
+
type: ViewChild,
|
|
109
|
+
args: [MatHeaderCellDef, { static: true }]
|
|
110
|
+
}], footerCellDef: [{
|
|
111
|
+
type: ViewChild,
|
|
112
|
+
args: [MatFooterCellDef, { static: true }]
|
|
113
|
+
}] } });
|
|
114
|
+
|
|
115
|
+
class DataGridHeaderComponent {
|
|
116
|
+
constructor() {
|
|
117
|
+
this.filterControl = new FormControl('');
|
|
118
|
+
this.showAddButton = false;
|
|
119
|
+
this.showRefreshButton = false;
|
|
120
|
+
this.addButtonLabel = '';
|
|
121
|
+
this.filterChange = new EventEmitter();
|
|
122
|
+
this.addButtonClick = new EventEmitter();
|
|
123
|
+
this.refreshRequest = new EventEmitter();
|
|
124
|
+
this._onDestroy = new Subject();
|
|
125
|
+
}
|
|
126
|
+
ngOnInit() {
|
|
127
|
+
this.filterControl.valueChanges
|
|
128
|
+
.pipe(debounceTime(500), takeUntil(this._onDestroy))
|
|
129
|
+
.subscribe((filter) => {
|
|
130
|
+
this.filterChange.emit(filter);
|
|
131
|
+
this.showClearButton = !!filter;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
ngOnDestroy() {
|
|
135
|
+
this._onDestroy.next();
|
|
136
|
+
this._onDestroy.complete();
|
|
137
|
+
}
|
|
138
|
+
onRefresh() {
|
|
139
|
+
this.refreshRequest.emit();
|
|
140
|
+
}
|
|
141
|
+
clearSearchValue() {
|
|
142
|
+
this.filterControl.setValue('');
|
|
143
|
+
}
|
|
144
|
+
onAddButtonClick() {
|
|
145
|
+
this.addButtonClick.emit(null);
|
|
146
|
+
}
|
|
147
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
148
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridHeaderComponent, isStandalone: true, selector: "cauca-data-grid-header", inputs: { showAddButton: "showAddButton", showRefreshButton: "showRefreshButton", addButtonLabel: "addButtonLabel" }, outputs: { filterChange: "filterChange", addButtonClick: "addButtonClick", refreshRequest: "refreshRequest" }, ngImport: i0, template: "<div class=\"grid-header\">\n\n <mat-form-field appearance=\"outline\" class=\"full-width-field grid-search-box\" subscriptSizing=\"dynamic\">\n @if (showClearButton) { <cauca-icon-button matPrefix (buttonClick)=\"clearSearchValue()\" icon=\"close\" /> }\n <mat-label>{{ 'dataGrid.keywordsLabel' | translate}}</mat-label>\n <input matInput [formControl]=\"filterControl\">\n <mat-icon matSuffix>search</mat-icon>\n </mat-form-field>\n\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n\n @if (showRefreshButton) { <cauca-icon-button (buttonClick)=\"onRefresh()\" icon=\"refresh\" class=\"grid-refresh-button\" /> }\n\n @if (showAddButton) { <cauca-raised-button icon=\"add\" color=\"primary\" [label]=\"addButtonLabel\" [translateLabel]=\"false\" class=\"grid-new-button\" (buttonClick)=\"onAddButtonClick()\" /> }\n</div>", styles: [".grid-header{display:flex;justify-content:space-between;gap:16px;align-items:center;align-content:normal;padding:0 16px}@media (max-width: 500px){.grid-header{flex-wrap:wrap;justify-content:flex-end}}.grid-search-box{display:block;flex-grow:1;flex-basis:auto;align-self:auto}.grid-new-button{display:block;flex-shrink:0;flex-basis:auto;align-self:auto}.grid-new-button>mat-icon{color:inherit}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "component", type: RaisedButtonComponent, selector: "cauca-raised-button" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }] }); }
|
|
149
|
+
}
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridHeaderComponent, decorators: [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{ selector: 'cauca-data-grid-header', imports: [MatFormFieldModule, IconButtonComponent, RaisedButtonComponent, MatInputModule, ReactiveFormsModule, TranslateModule], template: "<div class=\"grid-header\">\n\n <mat-form-field appearance=\"outline\" class=\"full-width-field grid-search-box\" subscriptSizing=\"dynamic\">\n @if (showClearButton) { <cauca-icon-button matPrefix (buttonClick)=\"clearSearchValue()\" icon=\"close\" /> }\n <mat-label>{{ 'dataGrid.keywordsLabel' | translate}}</mat-label>\n <input matInput [formControl]=\"filterControl\">\n <mat-icon matSuffix>search</mat-icon>\n </mat-form-field>\n\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n\n @if (showRefreshButton) { <cauca-icon-button (buttonClick)=\"onRefresh()\" icon=\"refresh\" class=\"grid-refresh-button\" /> }\n\n @if (showAddButton) { <cauca-raised-button icon=\"add\" color=\"primary\" [label]=\"addButtonLabel\" [translateLabel]=\"false\" class=\"grid-new-button\" (buttonClick)=\"onAddButtonClick()\" /> }\n</div>", styles: [".grid-header{display:flex;justify-content:space-between;gap:16px;align-items:center;align-content:normal;padding:0 16px}@media (max-width: 500px){.grid-header{flex-wrap:wrap;justify-content:flex-end}}.grid-search-box{display:block;flex-grow:1;flex-basis:auto;align-self:auto}.grid-new-button{display:block;flex-shrink:0;flex-basis:auto;align-self:auto}.grid-new-button>mat-icon{color:inherit}\n"] }]
|
|
153
|
+
}], propDecorators: { showAddButton: [{
|
|
154
|
+
type: Input
|
|
155
|
+
}], showRefreshButton: [{
|
|
156
|
+
type: Input
|
|
157
|
+
}], addButtonLabel: [{
|
|
158
|
+
type: Input
|
|
159
|
+
}], filterChange: [{
|
|
160
|
+
type: Output
|
|
161
|
+
}], addButtonClick: [{
|
|
162
|
+
type: Output
|
|
163
|
+
}], refreshRequest: [{
|
|
164
|
+
type: Output
|
|
165
|
+
}] } });
|
|
166
|
+
|
|
167
|
+
var Density;
|
|
168
|
+
(function (Density) {
|
|
169
|
+
Density["Compact"] = "compact";
|
|
170
|
+
Density["Standard"] = "standard";
|
|
171
|
+
Density["Comfortable"] = "comfortable";
|
|
172
|
+
})(Density || (Density = {}));
|
|
173
|
+
|
|
174
|
+
class Preference {
|
|
175
|
+
}
|
|
176
|
+
class GridConfiguration {
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
class PreferenceService {
|
|
180
|
+
constructor() {
|
|
181
|
+
this.preference = new BehaviorSubject(new Preference());
|
|
182
|
+
this.gridConfiguration = [];
|
|
183
|
+
const data = localStorage.getItem('GridPreference');
|
|
184
|
+
const configuration = localStorage.getItem('GridConfiguration');
|
|
185
|
+
if (data) {
|
|
186
|
+
this.preference.next(JSON.parse(data));
|
|
187
|
+
}
|
|
188
|
+
if (configuration) {
|
|
189
|
+
this.gridConfiguration = JSON.parse(configuration);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
getPreference() {
|
|
193
|
+
return this.preference.value;
|
|
194
|
+
}
|
|
195
|
+
setPreferenceDensity(density) {
|
|
196
|
+
const preference = this.getPreference();
|
|
197
|
+
if (density === preference.gridDensity)
|
|
198
|
+
return;
|
|
199
|
+
preference.gridDensity = density;
|
|
200
|
+
this.preference.next(preference);
|
|
201
|
+
this.addOrUpdatePreference();
|
|
202
|
+
}
|
|
203
|
+
addOrUpdatePreference() {
|
|
204
|
+
localStorage.setItem('GridPreference', JSON.stringify(this.getPreference()));
|
|
205
|
+
}
|
|
206
|
+
getPreferenceForGrid(gridName) {
|
|
207
|
+
return of(this.getPreferenceForGridNotObservable(gridName));
|
|
208
|
+
}
|
|
209
|
+
addOrUpdateGridPreference(gridName, visibleColumns) {
|
|
210
|
+
const configuration = this.getPreferenceForGridNotObservable(gridName);
|
|
211
|
+
configuration.visibleColumns = visibleColumns || [];
|
|
212
|
+
localStorage.setItem('GridConfiguration', JSON.stringify(this.gridConfiguration));
|
|
213
|
+
return of();
|
|
214
|
+
}
|
|
215
|
+
getPreferenceForGridNotObservable(gridName) {
|
|
216
|
+
const configuration = this.gridConfiguration.find(g => g.name == gridName);
|
|
217
|
+
if (configuration) {
|
|
218
|
+
return configuration;
|
|
219
|
+
}
|
|
220
|
+
const newConfiguration = new GridConfiguration();
|
|
221
|
+
newConfiguration.name = gridName;
|
|
222
|
+
this.gridConfiguration.push(newConfiguration);
|
|
223
|
+
return newConfiguration;
|
|
224
|
+
}
|
|
225
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PreferenceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
226
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PreferenceService, providedIn: 'root' }); }
|
|
227
|
+
}
|
|
228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PreferenceService, decorators: [{
|
|
229
|
+
type: Injectable,
|
|
230
|
+
args: [{
|
|
231
|
+
providedIn: 'root'
|
|
232
|
+
}]
|
|
233
|
+
}], ctorParameters: () => [] });
|
|
234
|
+
|
|
235
|
+
class BaseDataGridComponent {
|
|
236
|
+
get density() {
|
|
237
|
+
return Density;
|
|
238
|
+
}
|
|
239
|
+
constructor(translateService, preferenceService) {
|
|
240
|
+
this.preferenceService = preferenceService;
|
|
241
|
+
this.displayedColumns = [];
|
|
242
|
+
this.showAddButton = false;
|
|
243
|
+
this.addButtonLabel = '';
|
|
244
|
+
this.showTableOptions = false;
|
|
245
|
+
this.showColumnViewer = true;
|
|
246
|
+
this.addButtonClick = new EventEmitter();
|
|
247
|
+
this.showPaginator = input(false, ...(ngDevMode ? [{ debugName: "showPaginator" }] : []));
|
|
248
|
+
this.hidePageSize = input(false, ...(ngDevMode ? [{ debugName: "hidePageSize" }] : []));
|
|
249
|
+
this.showExpandButton = input(false, ...(ngDevMode ? [{ debugName: "showExpandButton" }] : []));
|
|
250
|
+
this.expandedElement = signal(null, ...(ngDevMode ? [{ debugName: "expandedElement" }] : []));
|
|
251
|
+
this.defaultAddButtonLabel = '';
|
|
252
|
+
this.allDisplayedColumns = signal([], ...(ngDevMode ? [{ debugName: "allDisplayedColumns" }] : []));
|
|
253
|
+
this.sort = null;
|
|
254
|
+
this.defaultAddButtonLabel = translateService.instant('add');
|
|
255
|
+
}
|
|
256
|
+
ngAfterContentInit() {
|
|
257
|
+
this.setUpPaginator(this.paginator, this.showPaginator());
|
|
258
|
+
this.setUpFilterPredicate();
|
|
259
|
+
if (this.table && this.regularColumns && this.rowDefs && this.columnDefs) {
|
|
260
|
+
this.applyColumns();
|
|
261
|
+
}
|
|
262
|
+
if (this.showTableOptions) {
|
|
263
|
+
this.preferenceService.preference.subscribe((preference) => {
|
|
264
|
+
this.preference = preference;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.showColumnsWhenTableOptionsIsFalse();
|
|
269
|
+
this.preference = new Preference();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
ngOnChanges(changes) {
|
|
273
|
+
this.updateDataWhenNeeded(changes);
|
|
274
|
+
this.updateColumnsWhenNeeded(changes);
|
|
275
|
+
}
|
|
276
|
+
onExpand(element) {
|
|
277
|
+
if (this.expandedElement() === element) {
|
|
278
|
+
this.expandedElement.set(null);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
this.expandedElement.set(element);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
clearFilter() {
|
|
285
|
+
this.header?.clearSearchValue();
|
|
286
|
+
}
|
|
287
|
+
renderRows() {
|
|
288
|
+
this.forceReloadFilter();
|
|
289
|
+
this.applyColumns();
|
|
290
|
+
this.table.renderRows();
|
|
291
|
+
}
|
|
292
|
+
onDensityChanged(density) {
|
|
293
|
+
this.preferenceService.setPreferenceDensity(density);
|
|
294
|
+
}
|
|
295
|
+
setUpPaginator(_paginator, _showPaginator) {
|
|
296
|
+
// nothing
|
|
297
|
+
}
|
|
298
|
+
onColumnsChanged(columns) {
|
|
299
|
+
this.allDisplayedColumns.set([...columns]);
|
|
300
|
+
const columnsToSave = this.removeMandatoryColumns([...columns]);
|
|
301
|
+
this.preferenceService.addOrUpdateGridPreference(this.resourceName, columnsToSave).subscribe();
|
|
302
|
+
}
|
|
303
|
+
applyColumns() {
|
|
304
|
+
this.regularColumns.forEach(dynColumn => this.table.addColumnDef(dynColumn.columnDef));
|
|
305
|
+
this.rowDefs.forEach(rowDef => this.table.addRowDef(rowDef));
|
|
306
|
+
this.table.setNoDataRow(this.noDataRow);
|
|
307
|
+
this.columnDefs.forEach(columnDef => {
|
|
308
|
+
this.table.addColumnDef(columnDef);
|
|
309
|
+
this.sort.register({ id: columnDef.name, start: 'desc', disableClear: false });
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
updateColumnsWhenNeeded(changes) {
|
|
313
|
+
if (changes.displayedColumns) {
|
|
314
|
+
this.allDisplayedColumns.set([...this.displayedColumns]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
removeMandatoryColumns(columns) {
|
|
318
|
+
let index = columns.indexOf("");
|
|
319
|
+
if (index > -1) {
|
|
320
|
+
columns.splice(index, 1);
|
|
321
|
+
}
|
|
322
|
+
index = columns.indexOf("position");
|
|
323
|
+
if (index > -1) {
|
|
324
|
+
columns.splice(index, 1);
|
|
325
|
+
}
|
|
326
|
+
index = columns.indexOf("buttons");
|
|
327
|
+
if (index > -1) {
|
|
328
|
+
columns.splice(index, 1);
|
|
329
|
+
}
|
|
330
|
+
index = columns.indexOf("menu");
|
|
331
|
+
if (index > -1) {
|
|
332
|
+
columns.splice(index, 1);
|
|
333
|
+
}
|
|
334
|
+
index = columns.indexOf("expand");
|
|
335
|
+
if (index > -1) {
|
|
336
|
+
columns.splice(index, 1);
|
|
337
|
+
}
|
|
338
|
+
return columns;
|
|
339
|
+
}
|
|
340
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseDataGridComponent, deps: [{ token: i1$2.TranslateService }, { token: PreferenceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
341
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: BaseDataGridComponent, isStandalone: true, selector: "ng-component", inputs: { resourceName: { classPropertyName: "resourceName", publicName: "resourceName", isSignal: false, isRequired: true, transformFunction: null }, displayedColumns: { classPropertyName: "displayedColumns", publicName: "displayedColumns", isSignal: false, isRequired: false, transformFunction: null }, showAddButton: { classPropertyName: "showAddButton", publicName: "showAddButton", isSignal: false, isRequired: false, transformFunction: null }, addButtonLabel: { classPropertyName: "addButtonLabel", publicName: "addButtonLabel", isSignal: false, isRequired: false, transformFunction: null }, searchableColumns: { classPropertyName: "searchableColumns", publicName: "searchableColumns", isSignal: false, isRequired: false, transformFunction: null }, showTableOptions: { classPropertyName: "showTableOptions", publicName: "showTableOptions", isSignal: false, isRequired: false, transformFunction: null }, showColumnViewer: { classPropertyName: "showColumnViewer", publicName: "showColumnViewer", isSignal: false, isRequired: false, transformFunction: null }, showPaginator: { classPropertyName: "showPaginator", publicName: "showPaginator", isSignal: true, isRequired: false, transformFunction: null }, hidePageSize: { classPropertyName: "hidePageSize", publicName: "hidePageSize", isSignal: true, isRequired: false, transformFunction: null }, showExpandButton: { classPropertyName: "showExpandButton", publicName: "showExpandButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { addButtonClick: "addButtonClick" }, queries: [{ propertyName: "headerRowDef", first: true, predicate: MatHeaderRowDef, descendants: true }, { propertyName: "footerRowDef", first: true, predicate: MatFooterRowDef, descendants: true }, { propertyName: "noDataRow", first: true, predicate: MatNoDataRow, descendants: true }, { propertyName: "regularColumns", predicate: BaseGridColumnComponent }, { propertyName: "columnDefs", predicate: MatColumnDef }, { propertyName: "rowDefs", predicate: MatRowDef }], viewQueries: [{ propertyName: "header", first: true, predicate: DataGridHeaderComponent, descendants: true }, { propertyName: "table", first: true, predicate: MatTable, descendants: true, static: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
|
|
342
|
+
}
|
|
343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseDataGridComponent, decorators: [{
|
|
344
|
+
type: Component,
|
|
345
|
+
args: [{ template: '' }]
|
|
346
|
+
}], ctorParameters: () => [{ type: i1$2.TranslateService }, { type: PreferenceService }], propDecorators: { resourceName: [{
|
|
347
|
+
type: Input,
|
|
348
|
+
args: [{ required: true }]
|
|
349
|
+
}], displayedColumns: [{
|
|
350
|
+
type: Input
|
|
351
|
+
}], showAddButton: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}], addButtonLabel: [{
|
|
354
|
+
type: Input
|
|
355
|
+
}], searchableColumns: [{
|
|
356
|
+
type: Input
|
|
357
|
+
}], showTableOptions: [{
|
|
358
|
+
type: Input
|
|
359
|
+
}], showColumnViewer: [{
|
|
360
|
+
type: Input
|
|
361
|
+
}], addButtonClick: [{
|
|
362
|
+
type: Output
|
|
363
|
+
}], header: [{
|
|
364
|
+
type: ViewChild,
|
|
365
|
+
args: [DataGridHeaderComponent]
|
|
366
|
+
}], table: [{
|
|
367
|
+
type: ViewChild,
|
|
368
|
+
args: [MatTable, { static: true }]
|
|
369
|
+
}], regularColumns: [{
|
|
370
|
+
type: ContentChildren,
|
|
371
|
+
args: [BaseGridColumnComponent]
|
|
372
|
+
}], columnDefs: [{
|
|
373
|
+
type: ContentChildren,
|
|
374
|
+
args: [MatColumnDef]
|
|
375
|
+
}], headerRowDef: [{
|
|
376
|
+
type: ContentChild,
|
|
377
|
+
args: [MatHeaderRowDef]
|
|
378
|
+
}], footerRowDef: [{
|
|
379
|
+
type: ContentChild,
|
|
380
|
+
args: [MatFooterRowDef]
|
|
381
|
+
}], rowDefs: [{
|
|
382
|
+
type: ContentChildren,
|
|
383
|
+
args: [MatRowDef]
|
|
384
|
+
}], noDataRow: [{
|
|
385
|
+
type: ContentChild,
|
|
386
|
+
args: [MatNoDataRow]
|
|
387
|
+
}], paginator: [{
|
|
388
|
+
type: ViewChild,
|
|
389
|
+
args: [MatPaginator]
|
|
390
|
+
}] } });
|
|
391
|
+
|
|
392
|
+
class ButtonPopoverComponent {
|
|
393
|
+
constructor() {
|
|
394
|
+
this.buttonLabel = input(null, ...(ngDevMode ? [{ debugName: "buttonLabel" }] : []));
|
|
395
|
+
this.buttonIcon = input('', ...(ngDevMode ? [{ debugName: "buttonIcon" }] : []));
|
|
396
|
+
this.color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
397
|
+
this.isActive = signal(false, ...(ngDevMode ? [{ debugName: "isActive" }] : []));
|
|
398
|
+
}
|
|
399
|
+
;
|
|
400
|
+
toggle() {
|
|
401
|
+
this.isActive.set(!this.isActive());
|
|
402
|
+
}
|
|
403
|
+
close() {
|
|
404
|
+
if (this.isActive()) {
|
|
405
|
+
this.isActive.set(false);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ButtonPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
409
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: ButtonPopoverComponent, isStandalone: true, selector: "cauca-button-popover", inputs: { buttonLabel: { classPropertyName: "buttonLabel", publicName: "buttonLabel", isSignal: true, isRequired: false, transformFunction: null }, buttonIcon: { classPropertyName: "buttonIcon", publicName: "buttonIcon", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<cauca-basic-button [icon]=\"buttonIcon()\" [color]=\"color()\" [label]=\"buttonLabel()\" [translateLabel]=\"false\" (buttonClick)=\"toggle()\" cdkOverlayOrigin #popoverTrigger=\"cdkOverlayOrigin\" />\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"popoverTrigger\"\n [cdkConnectedOverlayOpen]=\"isActive()\"\n [cdkConnectedOverlayHasBackdrop]=\"isActive()\"\n [cdkConnectedOverlayBackdropClass]=\"'cdk-overlay-transparent-backdrop-cs'\"\n (backdropClick)=\"toggle()\">\n <ng-content></ng-content>\n</ng-template>", styles: [".popover{background-color:#fff;border:1px solid #DDD;pointer-events:none;opacity:0;position:absolute;transition:all .5s ease 0s}.active{opacity:1;pointer-events:auto}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "component", type: BasicButtonComponent, selector: "cauca-basic-button" }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
410
|
+
}
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ButtonPopoverComponent, decorators: [{
|
|
412
|
+
type: Component,
|
|
413
|
+
args: [{ selector: 'cauca-button-popover', imports: [CdkConnectedOverlay, BasicButtonComponent, CdkOverlayOrigin], changeDetection: ChangeDetectionStrategy.OnPush, template: "<cauca-basic-button [icon]=\"buttonIcon()\" [color]=\"color()\" [label]=\"buttonLabel()\" [translateLabel]=\"false\" (buttonClick)=\"toggle()\" cdkOverlayOrigin #popoverTrigger=\"cdkOverlayOrigin\" />\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"popoverTrigger\"\n [cdkConnectedOverlayOpen]=\"isActive()\"\n [cdkConnectedOverlayHasBackdrop]=\"isActive()\"\n [cdkConnectedOverlayBackdropClass]=\"'cdk-overlay-transparent-backdrop-cs'\"\n (backdropClick)=\"toggle()\">\n <ng-content></ng-content>\n</ng-template>", styles: [".popover{background-color:#fff;border:1px solid #DDD;pointer-events:none;opacity:0;position:absolute;transition:all .5s ease 0s}.active{opacity:1;pointer-events:auto}\n"] }]
|
|
414
|
+
}] });
|
|
415
|
+
|
|
416
|
+
class DataGridTableOptionsComponent {
|
|
417
|
+
get density() {
|
|
418
|
+
return Density;
|
|
419
|
+
}
|
|
420
|
+
get columns() {
|
|
421
|
+
return this.allColumns.filter(c => c.prop !== 'buttons' && c.prop !== 'menu' && c.prop !== '' && c.isInColumnChooser);
|
|
422
|
+
}
|
|
423
|
+
get currentDensityIcon() {
|
|
424
|
+
const currentDensity = this.preferenceService.getPreference()?.gridDensity;
|
|
425
|
+
if (currentDensity === Density.Compact) {
|
|
426
|
+
return 'density_small';
|
|
427
|
+
}
|
|
428
|
+
if (currentDensity === Density.Comfortable) {
|
|
429
|
+
return 'density_large';
|
|
430
|
+
}
|
|
431
|
+
return 'density_medium';
|
|
432
|
+
}
|
|
433
|
+
constructor(preferenceService) {
|
|
434
|
+
this.preferenceService = preferenceService;
|
|
435
|
+
this.showColumnViewer = true;
|
|
436
|
+
this.densityChanged = new EventEmitter();
|
|
437
|
+
this.allColumns = new QueryList();
|
|
438
|
+
this.columnsChanged = new EventEmitter();
|
|
439
|
+
this.columnsSearch = '';
|
|
440
|
+
}
|
|
441
|
+
ngOnInit() {
|
|
442
|
+
this.preferenceService.getPreferenceForGrid(this.gridName).subscribe({
|
|
443
|
+
next: configuration => {
|
|
444
|
+
if (configuration?.visibleColumns) {
|
|
445
|
+
this.selectOnlyUserColumns(configuration.visibleColumns);
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
this.selectAllColumns();
|
|
449
|
+
}
|
|
450
|
+
this.onColumnsChanged();
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
closeColumnViewer() {
|
|
455
|
+
if (this.columnViewer) {
|
|
456
|
+
this.columnViewer.close();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
changeDensity(newDensity) {
|
|
460
|
+
this.densityChanged.emit(newDensity);
|
|
461
|
+
}
|
|
462
|
+
onColumnsChanged() {
|
|
463
|
+
const newColumns = this.allColumns.filter(column => column.selected);
|
|
464
|
+
this.columnsChanged.emit(newColumns.map((column) => column.prop));
|
|
465
|
+
}
|
|
466
|
+
resetColumns() {
|
|
467
|
+
this.allColumns.forEach((column => column.selected = true));
|
|
468
|
+
this.columnsChanged.emit(this.allColumns.map((column) => column.prop));
|
|
469
|
+
}
|
|
470
|
+
selectOnlyUserColumns(configurationVisibleColumns) {
|
|
471
|
+
this.allColumns.forEach((column => {
|
|
472
|
+
const index = configurationVisibleColumns.findIndex(c => c === column.prop);
|
|
473
|
+
if (index === -1 && column.prop !== 'buttons' && column.prop !== 'menu' && column.prop !== '') {
|
|
474
|
+
column.selected = false;
|
|
475
|
+
}
|
|
476
|
+
}));
|
|
477
|
+
}
|
|
478
|
+
selectAllColumns() {
|
|
479
|
+
this.allColumns.forEach((column => {
|
|
480
|
+
column.selected = true;
|
|
481
|
+
}));
|
|
482
|
+
}
|
|
483
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridTableOptionsComponent, deps: [{ token: PreferenceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
484
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridTableOptionsComponent, isStandalone: true, selector: "cauca-data-grid-table-options", inputs: { gridName: "gridName", showColumnViewer: "showColumnViewer", allColumns: "allColumns" }, outputs: { densityChanged: "densityChanged", columnsChanged: "columnsChanged" }, viewQueries: [{ propertyName: "columnViewer", first: true, predicate: ButtonPopoverComponent, descendants: true, static: true }], ngImport: i0, template: "<div class=\"table-options-bar\">\n <div class=\"table-options\">\n @if (showColumnViewer) { <cauca-button-popover [buttonLabel]=\"'dataGrid.columns' | translate\" buttonIcon=\"view_column\">\n <mat-card>\n <mat-card-content>\n <div class=\"columns\">\n @for (column of columns; track column) {\n <mat-checkbox color=\"primary\" [(ngModel)]=\"column.selected\"\n (change)=\"onColumnsChanged()\">\n {{column.label}}\n </mat-checkbox>\n }\n </div>\n </mat-card-content>\n <mat-card-actions>\n <cauca-stroked-button [small]=\"true\" color=\"primary\" (buttonClick)=\"resetColumns()\" label=\"dataGrid.columnChooser.reset\" [translateLabel]=\"true\" />\n <cauca-raised-button [small]=\"true\" color=\"primary\" (buttonClick)=\"resetColumns()\" label=\"dataGrid.columnChooser.showAll\" [translateLabel]=\"true\" />\n </mat-card-actions>\n </mat-card>\n </cauca-button-popover> }\n <cauca-basic-button color=\"primary\" [matMenuTriggerFor]=\"densityMenu\" class=\"open-menu-button\" [icon]=\"currentDensityIcon\" label=\"dataGrid.density.title\" [translateLabel]=\"true\" />\n </div>\n\n <ng-content select=\"[customFilter]\"> </ng-content>\n</div>\n\n<mat-menu #densityMenu=\"matMenu\">\n <cauca-menu-item label=\"dataGrid.density.compact\" [translateLabel]=\"true\" icon=\"density_small\" (buttonClick)=\"changeDensity(density.Compact)\" class=\"density-compact\" />\n <cauca-menu-item label=\"dataGrid.density.standard\" [translateLabel]=\"true\" icon=\"density_medium\" (buttonClick)=\"changeDensity(density.Standard)\" class=\"density-standard\" />\n <cauca-menu-item label=\"dataGrid.density.comfortable\" [translateLabel]=\"true\" icon=\"density_large\" (buttonClick)=\"changeDensity(density.Comfortable)\" class=\"density-comfortable\" />\n</mat-menu>", styles: [".table-options-bar{display:flex;padding:8px 16px;align-items:center;align-self:stretch}.table-options{flex:1 0 0;display:flex;gap:8px;align-items:center;align-content:normal;text-transform:capitalize}.columns{display:flex;flex-direction:column;max-height:650px}mat-card{box-shadow:0 8px 10px 1px #00000024}mat-card>mat-card-actions{gap:32px;padding:16px;justify-content:space-between}.column-viewer-header{display:flex;flex-direction:row-reverse;padding:4px 4px 0px px 0px}.mat-mdc-icon-button.mat-mdc-button-base{height:24px}mat-card-content{padding:0 8px}.button-small{height:32px;line-height:18px}.small-icon-button{height:24px;width:24px;padding:0}.small-icon-button>span{height:24px!important;width:24px!important}.small-icon-button>.mat-mdc-icon-button .mat-mdc-button-touch-target{display:none;height:24px!important;width:24px!important}.small-icon{font-size:18px;height:unset;width:unset}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i2$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i2$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i2$1.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: ButtonPopoverComponent, selector: "cauca-button-popover", inputs: ["buttonLabel", "buttonIcon", "color"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: StrokedButtonComponent, selector: "cauca-stroked-button" }, { kind: "component", type: RaisedButtonComponent, selector: "cauca-raised-button" }, { kind: "component", type: BasicButtonComponent, selector: "cauca-basic-button" }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i4.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i4.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: MenuItemComponent, selector: "cauca-menu-item", inputs: ["translateLabel", "trigger"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }] }); }
|
|
485
|
+
}
|
|
486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridTableOptionsComponent, decorators: [{
|
|
487
|
+
type: Component,
|
|
488
|
+
args: [{ selector: 'cauca-data-grid-table-options', imports: [MatCardModule, ButtonPopoverComponent, MatCheckboxModule, StrokedButtonComponent, RaisedButtonComponent, BasicButtonComponent, MatMenuModule, FormsModule, TranslateModule, MenuItemComponent], template: "<div class=\"table-options-bar\">\n <div class=\"table-options\">\n @if (showColumnViewer) { <cauca-button-popover [buttonLabel]=\"'dataGrid.columns' | translate\" buttonIcon=\"view_column\">\n <mat-card>\n <mat-card-content>\n <div class=\"columns\">\n @for (column of columns; track column) {\n <mat-checkbox color=\"primary\" [(ngModel)]=\"column.selected\"\n (change)=\"onColumnsChanged()\">\n {{column.label}}\n </mat-checkbox>\n }\n </div>\n </mat-card-content>\n <mat-card-actions>\n <cauca-stroked-button [small]=\"true\" color=\"primary\" (buttonClick)=\"resetColumns()\" label=\"dataGrid.columnChooser.reset\" [translateLabel]=\"true\" />\n <cauca-raised-button [small]=\"true\" color=\"primary\" (buttonClick)=\"resetColumns()\" label=\"dataGrid.columnChooser.showAll\" [translateLabel]=\"true\" />\n </mat-card-actions>\n </mat-card>\n </cauca-button-popover> }\n <cauca-basic-button color=\"primary\" [matMenuTriggerFor]=\"densityMenu\" class=\"open-menu-button\" [icon]=\"currentDensityIcon\" label=\"dataGrid.density.title\" [translateLabel]=\"true\" />\n </div>\n\n <ng-content select=\"[customFilter]\"> </ng-content>\n</div>\n\n<mat-menu #densityMenu=\"matMenu\">\n <cauca-menu-item label=\"dataGrid.density.compact\" [translateLabel]=\"true\" icon=\"density_small\" (buttonClick)=\"changeDensity(density.Compact)\" class=\"density-compact\" />\n <cauca-menu-item label=\"dataGrid.density.standard\" [translateLabel]=\"true\" icon=\"density_medium\" (buttonClick)=\"changeDensity(density.Standard)\" class=\"density-standard\" />\n <cauca-menu-item label=\"dataGrid.density.comfortable\" [translateLabel]=\"true\" icon=\"density_large\" (buttonClick)=\"changeDensity(density.Comfortable)\" class=\"density-comfortable\" />\n</mat-menu>", styles: [".table-options-bar{display:flex;padding:8px 16px;align-items:center;align-self:stretch}.table-options{flex:1 0 0;display:flex;gap:8px;align-items:center;align-content:normal;text-transform:capitalize}.columns{display:flex;flex-direction:column;max-height:650px}mat-card{box-shadow:0 8px 10px 1px #00000024}mat-card>mat-card-actions{gap:32px;padding:16px;justify-content:space-between}.column-viewer-header{display:flex;flex-direction:row-reverse;padding:4px 4px 0px px 0px}.mat-mdc-icon-button.mat-mdc-button-base{height:24px}mat-card-content{padding:0 8px}.button-small{height:32px;line-height:18px}.small-icon-button{height:24px;width:24px;padding:0}.small-icon-button>span{height:24px!important;width:24px!important}.small-icon-button>.mat-mdc-icon-button .mat-mdc-button-touch-target{display:none;height:24px!important;width:24px!important}.small-icon{font-size:18px;height:unset;width:unset}\n"] }]
|
|
489
|
+
}], ctorParameters: () => [{ type: PreferenceService }], propDecorators: { gridName: [{
|
|
490
|
+
type: Input,
|
|
491
|
+
args: [{ required: true }]
|
|
492
|
+
}], showColumnViewer: [{
|
|
493
|
+
type: Input
|
|
494
|
+
}], densityChanged: [{
|
|
495
|
+
type: Output
|
|
496
|
+
}], allColumns: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}], columnsChanged: [{
|
|
499
|
+
type: Output
|
|
500
|
+
}], columnViewer: [{
|
|
501
|
+
type: ViewChild,
|
|
502
|
+
args: [ButtonPopoverComponent, { static: true }]
|
|
503
|
+
}] } });
|
|
504
|
+
|
|
505
|
+
class DataGridProgressSpinerComponent {
|
|
506
|
+
constructor() {
|
|
507
|
+
this.isLoading = input(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
508
|
+
this.useBackground = input(true, ...(ngDevMode ? [{ debugName: "useBackground" }] : []));
|
|
509
|
+
}
|
|
510
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridProgressSpinerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
511
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridProgressSpinerComponent, isStandalone: true, selector: "cauca-data-grid-progress-spiner", inputs: { isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, useBackground: { classPropertyName: "useBackground", publicName: "useBackground", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (isLoading()) {\n <div class=\"spiner-container\" [class.use-background]=\"useBackground()\">\n <mat-progress-spinner\n color=\"primary\"\n mode=\"indeterminate\">\n </mat-progress-spinner>\n </div>\n}", styles: [".spiner-container{display:flex;justify-content:center;align-items:center}.use-background{background:#fff}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
512
|
+
}
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridProgressSpinerComponent, decorators: [{
|
|
514
|
+
type: Component,
|
|
515
|
+
args: [{ selector: 'cauca-data-grid-progress-spiner', imports: [MatProgressSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isLoading()) {\n <div class=\"spiner-container\" [class.use-background]=\"useBackground()\">\n <mat-progress-spinner\n color=\"primary\"\n mode=\"indeterminate\">\n </mat-progress-spinner>\n </div>\n}", styles: [".spiner-container{display:flex;justify-content:center;align-items:center}.use-background{background:#fff}\n"] }]
|
|
516
|
+
}] });
|
|
517
|
+
|
|
518
|
+
class DataGridComponent extends BaseDataGridComponent {
|
|
519
|
+
constructor(translateService, preferenceService) {
|
|
520
|
+
super(translateService, preferenceService);
|
|
521
|
+
this.data = [];
|
|
522
|
+
this.showLoadingError = false;
|
|
523
|
+
this.isLoading = false;
|
|
524
|
+
this.allowReordering = false;
|
|
525
|
+
this.rowDrop = new EventEmitter();
|
|
526
|
+
this.showPaginator = input(false, ...(ngDevMode ? [{ debugName: "showPaginator" }] : []));
|
|
527
|
+
this.showFooter = input(false, ...(ngDevMode ? [{ debugName: "showFooter" }] : []));
|
|
528
|
+
this.showHeader = input(true, ...(ngDevMode ? [{ debugName: "showHeader" }] : []));
|
|
529
|
+
this.headerColor = input(undefined, ...(ngDevMode ? [{ debugName: "headerColor" }] : []));
|
|
530
|
+
this.showRefreshButton = input(false, ...(ngDevMode ? [{ debugName: "showRefreshButton" }] : []));
|
|
531
|
+
this.refreshData = output();
|
|
532
|
+
this.dragDisabled = true;
|
|
533
|
+
this.currentFilter = '';
|
|
534
|
+
this.dataSource = new MatTableDataSource([]);
|
|
535
|
+
effect(() => {
|
|
536
|
+
this.setUpPaginator(this.paginator, this.showPaginator());
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
onRefreshData() {
|
|
540
|
+
this.dataSource.data = [];
|
|
541
|
+
this.refreshData.emit();
|
|
542
|
+
}
|
|
543
|
+
applyFilter(filter) {
|
|
544
|
+
if (this.paginator) {
|
|
545
|
+
this.paginator.firstPage();
|
|
546
|
+
}
|
|
547
|
+
this.dataSource.filter = toLowerCaseAndWithoutDiacritics(filter);
|
|
548
|
+
}
|
|
549
|
+
setUpSort(sort) {
|
|
550
|
+
this.sort = sort;
|
|
551
|
+
this.dataSource.sort = this.sort;
|
|
552
|
+
}
|
|
553
|
+
getData() {
|
|
554
|
+
return this.dataSource.data;
|
|
555
|
+
}
|
|
556
|
+
getFilteredData() {
|
|
557
|
+
return this.dataSource.filteredData;
|
|
558
|
+
}
|
|
559
|
+
refreshDisplayedColumns(columns) {
|
|
560
|
+
this.onColumnsChanged(columns);
|
|
561
|
+
}
|
|
562
|
+
rowDropped(event) {
|
|
563
|
+
const data = this.getData();
|
|
564
|
+
const filteredData = this.getFilteredData();
|
|
565
|
+
const fromIndex = data.findIndex((d) => d === filteredData[event.previousIndex]);
|
|
566
|
+
const toIndex = data.findIndex((d) => d === filteredData[event.currentIndex]);
|
|
567
|
+
if (fromIndex >= 0 && toIndex >= 0) {
|
|
568
|
+
moveItemInArray(data, fromIndex, toIndex);
|
|
569
|
+
this.renderRows();
|
|
570
|
+
this.rowDrop.emit(new DataGridRowDropEvent({
|
|
571
|
+
item: data[fromIndex],
|
|
572
|
+
data,
|
|
573
|
+
fromIndex,
|
|
574
|
+
toIndex,
|
|
575
|
+
}));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
setUpPaginator(paginator, showPaginator) {
|
|
579
|
+
this.dataSource.paginator = paginator && showPaginator ? paginator : null;
|
|
580
|
+
}
|
|
581
|
+
showColumnsWhenTableOptionsIsFalse() {
|
|
582
|
+
if (this.allowReordering) {
|
|
583
|
+
this.allDisplayedColumns.set(['position', ...this.displayedColumns]);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
this.allDisplayedColumns.set([...this.displayedColumns]);
|
|
587
|
+
}
|
|
588
|
+
if (this.showExpandButton() && !this.allDisplayedColumns().includes('expand')) {
|
|
589
|
+
this.allDisplayedColumns.set(['expand', ...this.displayedColumns]);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
updateColumnsWhenNeeded(changes) {
|
|
593
|
+
if (changes.displayedColumns || changes.allowReordering) {
|
|
594
|
+
if (this.allowReordering && !this.allDisplayedColumns().includes('position')) {
|
|
595
|
+
this.allDisplayedColumns.set(['position', ...this.allDisplayedColumns()]);
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
this.allDisplayedColumns.set([...this.allDisplayedColumns()]);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (this.showExpandButton() && !this.allDisplayedColumns().includes('expand')) {
|
|
602
|
+
this.allDisplayedColumns.set(['expand', ...this.displayedColumns]);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
onColumnsChanged(columns) {
|
|
606
|
+
super.onColumnsChanged(columns);
|
|
607
|
+
if (this.allowReordering && !columns.includes('position')) {
|
|
608
|
+
this.allDisplayedColumns.set(['position', ...columns]);
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
this.allDisplayedColumns.set([...columns]);
|
|
612
|
+
}
|
|
613
|
+
if (this.showExpandButton() && !this.allDisplayedColumns().includes('expand')) {
|
|
614
|
+
this.allDisplayedColumns.set(['expand', ...this.displayedColumns]);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
setUpFilterPredicate() {
|
|
618
|
+
if (this.filterPredicate) {
|
|
619
|
+
this.dataSource.filterPredicate = this.filterPredicate;
|
|
620
|
+
}
|
|
621
|
+
else if (this.searchableColumns?.length > 0) {
|
|
622
|
+
this.dataSource.filterPredicate = (data, filter) => {
|
|
623
|
+
return this.searchableColumns.some((column) => {
|
|
624
|
+
const value = data[column];
|
|
625
|
+
return value?.toString().toLowerCaseAndWithoutDiacritics().includes(filter);
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
forceReloadFilter() {
|
|
631
|
+
// eslint-disable-next-line no-self-assign
|
|
632
|
+
this.dataSource.filter = this.dataSource.filter;
|
|
633
|
+
}
|
|
634
|
+
updateDataWhenNeeded(changes) {
|
|
635
|
+
if (changes.data?.currentValue && this.data) {
|
|
636
|
+
this.setData(this.data);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
async setData(data) {
|
|
640
|
+
if (Array.isArray(data)) {
|
|
641
|
+
this.dataSource.data = data;
|
|
642
|
+
setTimeout(() => {
|
|
643
|
+
this.table.setNoDataRow(this.noDataRow);
|
|
644
|
+
this.table.renderRows();
|
|
645
|
+
}, 0);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridComponent, deps: [{ token: i1$2.TranslateService }, { token: PreferenceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
649
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridComponent, isStandalone: true, selector: "cauca-data-grid", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: false, isRequired: false, transformFunction: null }, showLoadingError: { classPropertyName: "showLoadingError", publicName: "showLoadingError", isSignal: false, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: false, isRequired: false, transformFunction: null }, allowReordering: { classPropertyName: "allowReordering", publicName: "allowReordering", isSignal: false, isRequired: false, transformFunction: null }, searchableColumns: { classPropertyName: "searchableColumns", publicName: "searchableColumns", isSignal: false, isRequired: false, transformFunction: null }, filterPredicate: { classPropertyName: "filterPredicate", publicName: "filterPredicate", isSignal: false, isRequired: false, transformFunction: null }, showPaginator: { classPropertyName: "showPaginator", publicName: "showPaginator", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, headerColor: { classPropertyName: "headerColor", publicName: "headerColor", isSignal: true, isRequired: false, transformFunction: null }, showRefreshButton: { classPropertyName: "showRefreshButton", publicName: "showRefreshButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowDrop: "rowDrop", refreshData: "refreshData" }, queries: [{ propertyName: "rowDetailTemplate", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: "@if (showHeader()) {\n <cauca-data-grid-header [showAddButton]=\"showAddButton\" [addButtonLabel]=\"addButtonLabel || defaultAddButtonLabel\"\n (addButtonClick)=\"addButtonClick.emit($event)\" (filterChange)=\"applyFilter($event)\"\n [showRefreshButton]=\"showRefreshButton()\" (refreshRequest)=\"onRefreshData()\">\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n </cauca-data-grid-header>\n}\n\n@if (showTableOptions) {\n <cauca-data-grid-table-options [showColumnViewer]=\"showColumnViewer\" [gridName]=\"resourceName\" (densityChanged)=\"onDensityChanged($event)\" (columnsChanged)=\"onColumnsChanged($event)\" [allColumns]=\"regularColumns\">\n <ng-content\n select=\"[customFilter]\"\n ngProjectAs=\"[customFilter]\">\n </ng-content>\n </cauca-data-grid-table-options>\n}\n\n<table matSort mat-table [dataSource]=\"dataSource\" cdkDropList [cdkDropListData]=\"dataSource\"\n (cdkDropListDropped)=\"rowDropped($event)\" aria-describedby=\"Data Grid\" multiTemplateDataRows>\n\n @if (showExpandButton()) {\n <ng-container matColumnDef=\"expand\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n <cauca-icon-button (buttonClick)=\"onExpand(row)\" color=\"primary\" class=\"button-icon\" [icon]=\"row === expandedElement() ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\" />\n </div>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n @if (allowReordering) {\n <ng-container matColumnDef=\"position\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell (mousedown)=\"dragDisabled = false\" (mouseup)=\"dragDisabled = true\" *matCellDef=\"let group\">\n <mat-icon class=\"reorder-icon\" cdkDragHandle>drag_indicator</mat-icon>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-content></ng-content>\n\n <tr class=\"grid-header\" [style.background-color]=\"headerColor()\" mat-header-row *matHeaderRowDef=\"allDisplayedColumns(); sticky: true\"></tr>\n\n <tr mat-row *matRowDef=\"let row; columns: allDisplayedColumns();\" cdkDrag [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"dragDisabled\" (cdkDragReleased)=\"dragDisabled = true\"\n [class.compact]=\"preference.gridDensity === density.Compact\" [class.standard]=\"preference.gridDensity === density.Standard\"\n [class.comfortable]=\"preference.gridDensity === density.Comfortable\"></tr>\n\n <ng-container matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"allDisplayedColumns().length\">\n @if (row === expandedElement()) {\n <div class=\"grid-element-detail\" [@detailExpand]=\"row === expandedElement() ? 'expanded' : 'collapsed'\">\n <template [ngTemplateOutlet]=\"rowDetailTemplate\" [ngTemplateOutletContext]=\"{ row: expandedElement() }\"></template>\n </div>\n }\n </td>\n </ng-container>\n\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n\n @if (showFooter()) {\n <tr mat-footer-row *matFooterRowDef=\"allDisplayedColumns(); sticky: false\"></tr>\n }\n\n @if (!isLoading) {\n <tr class=\"mat-row\" *matNoDataRow>\n @if (!showLoadingError && !isLoading) {\n <td class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>grid_off</mat-icon>\n <span>{{ 'dataGrid.noDataLabel' | translate }}</span>\n </div>\n </td>\n }\n @if (showLoadingError) {\n <td class=\"mat-cell data-grid-message error-message\" [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>error</mat-icon>\n <span>{{ 'dataGrid.errorLoadingDataLabel' | translate }}</span>\n </div>\n </td>\n }\n </tr>\n }\n\n</table>\n\n<cauca-data-grid-progress-spiner [isLoading]=\"isLoading\" />\n\n@if (showPaginator()) {\n <mat-paginator #paginator [hidePageSize]=\"hidePageSize()\" [pageSizeOptions]=\"[5, 10, 25, 50]\" [pageSize]=\"10\" />\n}", styles: ["table{width:100%;table-layout:fixed;--mat-table-header-container-height: 52px;--mat-table-footer-container-height: 48px;--mat-table-row-item-container-height: 48px}tr.mat-mdc-row:hover{background:#f5f5f5}.mat-column-position{cursor:move;width:40px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;background:#fff;opacity:1;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f;width:100%}.cdk-drag-preview tr,.cdk-drag-preview .mat-column-name{width:100%}.reorder-icon{vertical-align:middle;padding:0;color:#707070}.cdk-drag-placeholder{background:gray;opacity:.5}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drop-list-dragging .mat-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}cauca-data-grid-header{margin:16px}.compact{line-height:48px!important}.standard{line-height:56px!important}.comfortable{line-height:62px!important}.error-message{color:red;mat-icon-color:red}.mat-column-expand{width:72px}tr.grid-detail-row{height:0}.grid-element-row td{border-bottom-width:0;background-color:#fafafa}.mat-column-expandedDetail{background-color:#fafafa}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: // still needed
|
|
650
|
+
// Material Table structure:
|
|
651
|
+
MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "component", type: MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "directive", type:
|
|
652
|
+
// Drag and Drop:
|
|
653
|
+
CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type:
|
|
654
|
+
// Material extras:
|
|
655
|
+
MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type:
|
|
656
|
+
// ngx-translate:
|
|
657
|
+
TranslateModule }, { kind: "component", type:
|
|
658
|
+
// Custom Components:
|
|
659
|
+
DataGridHeaderComponent, selector: "cauca-data-grid-header", inputs: ["showAddButton", "showRefreshButton", "addButtonLabel"], outputs: ["filterChange", "addButtonClick", "refreshRequest"] }, { kind: "component", type: DataGridTableOptionsComponent, selector: "cauca-data-grid-table-options", inputs: ["gridName", "showColumnViewer", "allColumns"], outputs: ["densityChanged", "columnsChanged"] }, { kind: "component", type: DataGridProgressSpinerComponent, selector: "cauca-data-grid-progress-spiner", inputs: ["isLoading", "useBackground"] }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], animations: [
|
|
660
|
+
trigger('detailExpand', [
|
|
661
|
+
state('collapsed,void', style({ height: '0px', minHeight: '0' })),
|
|
662
|
+
state('expanded', style({ height: '*' })),
|
|
663
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
664
|
+
]),
|
|
665
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
666
|
+
}
|
|
667
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridComponent, decorators: [{
|
|
668
|
+
type: Component,
|
|
669
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cauca-data-grid', animations: [
|
|
670
|
+
trigger('detailExpand', [
|
|
671
|
+
state('collapsed,void', style({ height: '0px', minHeight: '0' })),
|
|
672
|
+
state('expanded', style({ height: '*' })),
|
|
673
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
674
|
+
]),
|
|
675
|
+
], imports: [
|
|
676
|
+
NgTemplateOutlet, // still needed
|
|
677
|
+
// Material Table structure:
|
|
678
|
+
MatTable, MatSort, MatColumnDef,
|
|
679
|
+
MatHeaderCell, MatHeaderCellDef, MatCellDef,
|
|
680
|
+
MatFooterCell, MatFooterCellDef,
|
|
681
|
+
MatRow, MatRowDef,
|
|
682
|
+
MatHeaderRow, MatHeaderRowDef,
|
|
683
|
+
MatFooterRow, MatFooterRowDef,
|
|
684
|
+
MatNoDataRow,
|
|
685
|
+
// Drag and Drop:
|
|
686
|
+
CdkDropList, CdkDrag, CdkDragHandle,
|
|
687
|
+
// Material extras:
|
|
688
|
+
MatIcon, MatPaginator,
|
|
689
|
+
// ngx-translate:
|
|
690
|
+
TranslateModule,
|
|
691
|
+
// Custom Components:
|
|
692
|
+
DataGridHeaderComponent,
|
|
693
|
+
DataGridTableOptionsComponent,
|
|
694
|
+
DataGridProgressSpinerComponent,
|
|
695
|
+
IconButtonComponent
|
|
696
|
+
], template: "@if (showHeader()) {\n <cauca-data-grid-header [showAddButton]=\"showAddButton\" [addButtonLabel]=\"addButtonLabel || defaultAddButtonLabel\"\n (addButtonClick)=\"addButtonClick.emit($event)\" (filterChange)=\"applyFilter($event)\"\n [showRefreshButton]=\"showRefreshButton()\" (refreshRequest)=\"onRefreshData()\">\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n </cauca-data-grid-header>\n}\n\n@if (showTableOptions) {\n <cauca-data-grid-table-options [showColumnViewer]=\"showColumnViewer\" [gridName]=\"resourceName\" (densityChanged)=\"onDensityChanged($event)\" (columnsChanged)=\"onColumnsChanged($event)\" [allColumns]=\"regularColumns\">\n <ng-content\n select=\"[customFilter]\"\n ngProjectAs=\"[customFilter]\">\n </ng-content>\n </cauca-data-grid-table-options>\n}\n\n<table matSort mat-table [dataSource]=\"dataSource\" cdkDropList [cdkDropListData]=\"dataSource\"\n (cdkDropListDropped)=\"rowDropped($event)\" aria-describedby=\"Data Grid\" multiTemplateDataRows>\n\n @if (showExpandButton()) {\n <ng-container matColumnDef=\"expand\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n <cauca-icon-button (buttonClick)=\"onExpand(row)\" color=\"primary\" class=\"button-icon\" [icon]=\"row === expandedElement() ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\" />\n </div>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n @if (allowReordering) {\n <ng-container matColumnDef=\"position\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell (mousedown)=\"dragDisabled = false\" (mouseup)=\"dragDisabled = true\" *matCellDef=\"let group\">\n <mat-icon class=\"reorder-icon\" cdkDragHandle>drag_indicator</mat-icon>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-content></ng-content>\n\n <tr class=\"grid-header\" [style.background-color]=\"headerColor()\" mat-header-row *matHeaderRowDef=\"allDisplayedColumns(); sticky: true\"></tr>\n\n <tr mat-row *matRowDef=\"let row; columns: allDisplayedColumns();\" cdkDrag [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"dragDisabled\" (cdkDragReleased)=\"dragDisabled = true\"\n [class.compact]=\"preference.gridDensity === density.Compact\" [class.standard]=\"preference.gridDensity === density.Standard\"\n [class.comfortable]=\"preference.gridDensity === density.Comfortable\"></tr>\n\n <ng-container matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"allDisplayedColumns().length\">\n @if (row === expandedElement()) {\n <div class=\"grid-element-detail\" [@detailExpand]=\"row === expandedElement() ? 'expanded' : 'collapsed'\">\n <template [ngTemplateOutlet]=\"rowDetailTemplate\" [ngTemplateOutletContext]=\"{ row: expandedElement() }\"></template>\n </div>\n }\n </td>\n </ng-container>\n\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n\n @if (showFooter()) {\n <tr mat-footer-row *matFooterRowDef=\"allDisplayedColumns(); sticky: false\"></tr>\n }\n\n @if (!isLoading) {\n <tr class=\"mat-row\" *matNoDataRow>\n @if (!showLoadingError && !isLoading) {\n <td class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>grid_off</mat-icon>\n <span>{{ 'dataGrid.noDataLabel' | translate }}</span>\n </div>\n </td>\n }\n @if (showLoadingError) {\n <td class=\"mat-cell data-grid-message error-message\" [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>error</mat-icon>\n <span>{{ 'dataGrid.errorLoadingDataLabel' | translate }}</span>\n </div>\n </td>\n }\n </tr>\n }\n\n</table>\n\n<cauca-data-grid-progress-spiner [isLoading]=\"isLoading\" />\n\n@if (showPaginator()) {\n <mat-paginator #paginator [hidePageSize]=\"hidePageSize()\" [pageSizeOptions]=\"[5, 10, 25, 50]\" [pageSize]=\"10\" />\n}", styles: ["table{width:100%;table-layout:fixed;--mat-table-header-container-height: 52px;--mat-table-footer-container-height: 48px;--mat-table-row-item-container-height: 48px}tr.mat-mdc-row:hover{background:#f5f5f5}.mat-column-position{cursor:move;width:40px}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;background:#fff;opacity:1;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f;width:100%}.cdk-drag-preview tr,.cdk-drag-preview .mat-column-name{width:100%}.reorder-icon{vertical-align:middle;padding:0;color:#707070}.cdk-drag-placeholder{background:gray;opacity:.5}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drop-list-dragging .mat-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}cauca-data-grid-header{margin:16px}.compact{line-height:48px!important}.standard{line-height:56px!important}.comfortable{line-height:62px!important}.error-message{color:red;mat-icon-color:red}.mat-column-expand{width:72px}tr.grid-detail-row{height:0}.grid-element-row td{border-bottom-width:0;background-color:#fafafa}.mat-column-expandedDetail{background-color:#fafafa}\n"] }]
|
|
697
|
+
}], ctorParameters: () => [{ type: i1$2.TranslateService }, { type: PreferenceService }], propDecorators: { data: [{
|
|
698
|
+
type: Input
|
|
699
|
+
}], showLoadingError: [{
|
|
700
|
+
type: Input
|
|
701
|
+
}], isLoading: [{
|
|
702
|
+
type: Input
|
|
703
|
+
}], allowReordering: [{
|
|
704
|
+
type: Input
|
|
705
|
+
}], searchableColumns: [{
|
|
706
|
+
type: Input
|
|
707
|
+
}], filterPredicate: [{
|
|
708
|
+
type: Input
|
|
709
|
+
}], rowDrop: [{
|
|
710
|
+
type: Output
|
|
711
|
+
}], rowDetailTemplate: [{
|
|
712
|
+
type: ContentChild,
|
|
713
|
+
args: [TemplateRef]
|
|
714
|
+
}] } });
|
|
715
|
+
|
|
716
|
+
class OdataListingService {
|
|
717
|
+
get data() {
|
|
718
|
+
return this.dataSource?.data ?? null;
|
|
719
|
+
}
|
|
720
|
+
constructor(httpClient) {
|
|
721
|
+
this.httpClient = httpClient;
|
|
722
|
+
this.dataSource = null;
|
|
723
|
+
this.error = signal(false, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
724
|
+
this.loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
725
|
+
this.errorSubscription = null;
|
|
726
|
+
this.loadingSubscription = null;
|
|
727
|
+
}
|
|
728
|
+
initialize({ baseUrl, resourceName, paginator, sort, initialSort, filters }) {
|
|
729
|
+
const newDataSource = new ODataDataSource(this.httpClient, `${baseUrl}odata/${resourceName}`);
|
|
730
|
+
newDataSource.filters = filters;
|
|
731
|
+
if (initialSort) {
|
|
732
|
+
newDataSource.initialSort = initialSort;
|
|
733
|
+
}
|
|
734
|
+
if (sort) {
|
|
735
|
+
newDataSource.sort = sort;
|
|
736
|
+
}
|
|
737
|
+
newDataSource.paginator = paginator;
|
|
738
|
+
this.dataSource = newDataSource;
|
|
739
|
+
this.dataSource.refresh();
|
|
740
|
+
this.errorSubscription = this.dataSource.errors.subscribe((errors) => this.error.set(!!errors));
|
|
741
|
+
this.loadingSubscription = this.dataSource.loading
|
|
742
|
+
.pipe(distinctUntilChanged())
|
|
743
|
+
.subscribe((isLoading) => {
|
|
744
|
+
if (isLoading) {
|
|
745
|
+
this.loading.set(false);
|
|
746
|
+
}
|
|
747
|
+
this.loading.set(isLoading);
|
|
748
|
+
});
|
|
749
|
+
return newDataSource;
|
|
750
|
+
}
|
|
751
|
+
updateFilters(filters) {
|
|
752
|
+
if (this.dataSource) {
|
|
753
|
+
this.dataSource.filters = filters;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
forceReloadFilter() {
|
|
757
|
+
if (this.dataSource) {
|
|
758
|
+
// eslint-disable-next-line no-self-assign
|
|
759
|
+
this.dataSource.filters = this.dataSource.filters;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
isInitialized() {
|
|
763
|
+
return this.dataSource !== null;
|
|
764
|
+
}
|
|
765
|
+
refresh() {
|
|
766
|
+
this.dataSource?.refresh();
|
|
767
|
+
}
|
|
768
|
+
destroy() {
|
|
769
|
+
this.errorSubscription?.unsubscribe();
|
|
770
|
+
this.loadingSubscription?.unsubscribe();
|
|
771
|
+
}
|
|
772
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: OdataListingService, deps: [{ token: i1$4.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
773
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: OdataListingService, providedIn: 'root' }); }
|
|
774
|
+
}
|
|
775
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: OdataListingService, decorators: [{
|
|
776
|
+
type: Injectable,
|
|
777
|
+
args: [{
|
|
778
|
+
providedIn: 'root',
|
|
779
|
+
}]
|
|
780
|
+
}], ctorParameters: () => [{ type: i1$4.HttpClient }] });
|
|
781
|
+
|
|
782
|
+
class OdataGridComponent extends BaseDataGridComponent {
|
|
783
|
+
constructor(translateService, preferenceService, listing) {
|
|
784
|
+
super(translateService, preferenceService);
|
|
785
|
+
this.listing = listing;
|
|
786
|
+
this.showTableHeader = input(true, ...(ngDevMode ? [{ debugName: "showTableHeader" }] : []));
|
|
787
|
+
this.showHeader = true;
|
|
788
|
+
this.idField = 'id';
|
|
789
|
+
this.itemClick = new EventEmitter();
|
|
790
|
+
this.refreshRequested = new EventEmitter();
|
|
791
|
+
this.showRefreshButton = false;
|
|
792
|
+
this.baseUrl = inject(CaucaCoreService).getConfig().apiUrl;
|
|
793
|
+
}
|
|
794
|
+
ngOnDestroy() {
|
|
795
|
+
this.listing.destroy();
|
|
796
|
+
}
|
|
797
|
+
refreshData() {
|
|
798
|
+
this.listing.refresh();
|
|
799
|
+
this.refreshRequested.emit();
|
|
800
|
+
}
|
|
801
|
+
ngOnChanges(changes) {
|
|
802
|
+
this.updateColumnsWhenNeeded(changes);
|
|
803
|
+
}
|
|
804
|
+
getData() {
|
|
805
|
+
return this.listing.data;
|
|
806
|
+
}
|
|
807
|
+
applyFilter(filter) {
|
|
808
|
+
if (this.filterPredicate) {
|
|
809
|
+
if (this.paginator) {
|
|
810
|
+
this.paginator.firstPage();
|
|
811
|
+
}
|
|
812
|
+
this.listing.updateFilters(this.filterPredicate(toLowerCaseAndWithoutDiacritics(filter)));
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
refreshFilter() {
|
|
816
|
+
if (this.filterPredicate) {
|
|
817
|
+
this.listing.updateFilters(this.filterPredicate(toLowerCaseAndWithoutDiacritics(this.header.filterControl?.value)));
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
setUpFilterPredicate() {
|
|
821
|
+
this.listing.initialize({
|
|
822
|
+
baseUrl: this.baseUrl,
|
|
823
|
+
resourceName: this.resourceName,
|
|
824
|
+
paginator: this.paginator,
|
|
825
|
+
sort: this.sort,
|
|
826
|
+
initialSort: this.baseSort,
|
|
827
|
+
filters: this.filterPredicate?.('') ?? [],
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
setUpSort(sort) {
|
|
831
|
+
this.sort = sort;
|
|
832
|
+
}
|
|
833
|
+
updateColumnsWhenNeeded(changes) {
|
|
834
|
+
if (changes.displayedColumns || changes.showExpandButton) {
|
|
835
|
+
let columns = [...this.displayedColumns];
|
|
836
|
+
if (this.showExpandButton()) {
|
|
837
|
+
columns = ['expand', ...columns];
|
|
838
|
+
}
|
|
839
|
+
this.allDisplayedColumns.set([...columns]);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
forceReloadFilter() {
|
|
843
|
+
this.listing.forceReloadFilter();
|
|
844
|
+
}
|
|
845
|
+
updateDataWhenNeeded(_changes) {
|
|
846
|
+
// not implemented
|
|
847
|
+
}
|
|
848
|
+
onColumnsChanged(columns) {
|
|
849
|
+
if (this.showExpandButton() && columns.indexOf('expand') === -1) {
|
|
850
|
+
columns = ['expand', ...columns];
|
|
851
|
+
}
|
|
852
|
+
super.onColumnsChanged(columns);
|
|
853
|
+
}
|
|
854
|
+
showColumnsWhenTableOptionsIsFalse() {
|
|
855
|
+
let columns = [...this.displayedColumns];
|
|
856
|
+
if (this.showExpandButton()) {
|
|
857
|
+
columns = ['expand', ...columns];
|
|
858
|
+
}
|
|
859
|
+
this.allDisplayedColumns.set([...columns]);
|
|
860
|
+
}
|
|
861
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: OdataGridComponent, deps: [{ token: i1$5.TranslateService }, { token: PreferenceService }, { token: OdataListingService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
862
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: OdataGridComponent, isStandalone: true, selector: "cauca-odata-grid", inputs: { showTableHeader: { classPropertyName: "showTableHeader", publicName: "showTableHeader", isSignal: true, isRequired: false, transformFunction: null }, baseSort: { classPropertyName: "baseSort", publicName: "baseSort", isSignal: false, isRequired: false, transformFunction: null }, filterPredicate: { classPropertyName: "filterPredicate", publicName: "filterPredicate", isSignal: false, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: false, isRequired: false, transformFunction: null }, selectedRowId: { classPropertyName: "selectedRowId", publicName: "selectedRowId", isSignal: false, isRequired: false, transformFunction: null }, idField: { classPropertyName: "idField", publicName: "idField", isSignal: false, isRequired: false, transformFunction: null }, showRefreshButton: { classPropertyName: "showRefreshButton", publicName: "showRefreshButton", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick", refreshRequested: "refreshRequested" }, providers: [OdataListingService], queries: [{ propertyName: "rowDetailTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if (showHeader) {\n <cauca-data-grid-header\n [showRefreshButton]=\"showRefreshButton\" (refreshRequest)=\"refreshData()\"\n [showAddButton]=\"showAddButton\"\n [addButtonLabel]=\"addButtonLabel || defaultAddButtonLabel\"\n (addButtonClick)=\"addButtonClick.emit($event)\" (filterChange)=\"applyFilter($event)\">\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n </cauca-data-grid-header>\n}\n\n<ng-content select=\"[customHeader]\" ngProjectAs=\"[customHeader]\" />\n\n@if (showTableOptions) {\n <cauca-data-grid-table-options [showColumnViewer]=\"showColumnViewer\" [gridName]=\"resourceName\" (densityChanged)=\"onDensityChanged($event)\" (columnsChanged)=\"onColumnsChanged($event)\" [allColumns]=\"regularColumns\">\n <ng-content select=\"[customFilter]\" ngProjectAs=\"[customFilter]\" />\n </cauca-data-grid-table-options>\n}\n\n<div class=\"relative\">\n <table mat-table [dataSource]=\"listing.dataSource\" aria-describedby=\"Data Grid\" multiTemplateDataRows>\n @if (showExpandButton()) {\n <ng-container matColumnDef=\"expand\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n <cauca-icon-button (buttonClick)=\"onExpand(row)\" color=\"primary\" class=\"button-icon\" [icon]=\"row === expandedElement() ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\" />\n </div>\n </td>\n </ng-container>\n }\n\n <ng-content></ng-content>\n @if(showTableHeader()) {\n <tr mat-header-row *matHeaderRowDef=\"allDisplayedColumns(); sticky: true\"></tr>\n }\n\n <tr mat-row *matRowDef=\"let row; columns: allDisplayedColumns()\"\n [class.showClick]=\"itemClick.observers.length > 0\"\n [class.compact]=\"preference.gridDensity === density.Compact\"\n [class.standard]=\"preference.gridDensity === density.Standard\"\n [class.comfortable]=\"preference.gridDensity === density.Comfortable\"\n [class.selected]=\"selectedRowId === row[idField]\"\n (click)=\"itemClick.emit(row)\"\n onkeypress=\"itemClick.emit(row)\">\n </tr>\n\n <ng-container matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"allDisplayedColumns().length\">\n @if (row === expandedElement()) {\n <div class=\"grid-element-detail\" [@detailExpand]=\"row === expandedElement() ? 'expanded' : 'collapsed'\">\n <template [ngTemplateOutlet]=\"rowDetailTemplate\" [ngTemplateOutletContext]=\"{ row: expandedElement() }\"></template>\n </div>\n }\n </td>\n </ng-container>\n\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n\n <ng-container *matNoDataRow>\n @if(listing.loading() === false) {\n <ng-container>\n <tr class=\"mat-row\">\n @if (listing.error() === false) {\n <th class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>grid_off</mat-icon>\n <span>{{ 'dataGrid.noDataLabel' | translate }}</span>\n </div>\n </th>\n } @else {\n <th class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>error</mat-icon>\n <span>{{ 'dataGrid.errorLoadingDataLabel' | translate }}</span>\n </div>\n </th>\n }\n </tr>\n </ng-container>\n }\n </ng-container>\n </table>\n\n <cauca-data-grid-progress-spiner [useBackground]=\"false\" [isLoading]=\"listing.loading()\" />\n\n</div>\n\n<mat-paginator [hidePageSize]=\"hidePageSize()\" [pageSizeOptions]=\"[5, 10, 25, 50]\" [pageSize]=\"10\" />\n", styles: ["table{width:100%;table-layout:fixed;--mat-table-header-container-height: 52px;--mat-table-footer-container-height: 48px;--mat-table-row-item-container-height: 48px}.relative{position:relative}.mat-column-expand{width:72px}cauca-data-grid-progress-spiner{left:50%;top:50%;transform:translate(-50%,-50%);position:absolute;z-index:101}tr.mat-mdc-row{transition:background-color .2s ease-out .1s}tr.mat-mdc-row:hover{background:#f5f5f5}tr.mat-mdc-row.selected{background:#249edb14}tr.mat-mdc-row.selected:hover{background:#249edb1a}cauca-data-grid-header{margin:16px}.compact{line-height:48px!important}.standard{line-height:56px!important}.comfortable{line-height:62px!important}.showClick{cursor:pointer}tr.grid-detail-row{height:0}.grid-element-row td{border-bottom-width:0;background-color:#fafafa}.mat-column-expandedDetail{background-color:#fafafa}\n"], dependencies: [{ kind: "component", type: DataGridHeaderComponent, selector: "cauca-data-grid-header", inputs: ["showAddButton", "showRefreshButton", "addButtonLabel"], outputs: ["filterChange", "addButtonClick", "refreshRequest"] }, { kind: "component", type: DataGridTableOptionsComponent, selector: "cauca-data-grid-table-options", inputs: ["gridName", "showColumnViewer", "allColumns"], outputs: ["densityChanged", "columnsChanged"] }, { kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "component", type: DataGridProgressSpinerComponent, selector: "cauca-data-grid-progress-spiner", inputs: ["isLoading", "useBackground"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i4$1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], animations: [
|
|
863
|
+
trigger('detailExpand', [
|
|
864
|
+
state('collapsed,void', style({ height: '0px', minHeight: '0' })),
|
|
865
|
+
state('expanded', style({ height: '*' })),
|
|
866
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
867
|
+
]),
|
|
868
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
869
|
+
}
|
|
870
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: OdataGridComponent, decorators: [{
|
|
871
|
+
type: Component,
|
|
872
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'cauca-odata-grid', providers: [OdataListingService], animations: [
|
|
873
|
+
trigger('detailExpand', [
|
|
874
|
+
state('collapsed,void', style({ height: '0px', minHeight: '0' })),
|
|
875
|
+
state('expanded', style({ height: '*' })),
|
|
876
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
877
|
+
]),
|
|
878
|
+
], imports: [
|
|
879
|
+
DataGridHeaderComponent, DataGridTableOptionsComponent,
|
|
880
|
+
MatTable, MatColumnDef, MatHeaderCell, MatHeaderCellDef, IconButtonComponent,
|
|
881
|
+
MatIcon, MatRow, MatRowDef, MatHeaderRow, MatHeaderRowDef, NgTemplateOutlet,
|
|
882
|
+
MatNoDataRow, DataGridProgressSpinerComponent, MatPaginatorModule, TranslateModule
|
|
883
|
+
], template: "@if (showHeader) {\n <cauca-data-grid-header\n [showRefreshButton]=\"showRefreshButton\" (refreshRequest)=\"refreshData()\"\n [showAddButton]=\"showAddButton\"\n [addButtonLabel]=\"addButtonLabel || defaultAddButtonLabel\"\n (addButtonClick)=\"addButtonClick.emit($event)\" (filterChange)=\"applyFilter($event)\">\n <ng-content select=\"[filterRow]\" ngProjectAs=\"[filterRow]\" />\n </cauca-data-grid-header>\n}\n\n<ng-content select=\"[customHeader]\" ngProjectAs=\"[customHeader]\" />\n\n@if (showTableOptions) {\n <cauca-data-grid-table-options [showColumnViewer]=\"showColumnViewer\" [gridName]=\"resourceName\" (densityChanged)=\"onDensityChanged($event)\" (columnsChanged)=\"onColumnsChanged($event)\" [allColumns]=\"regularColumns\">\n <ng-content select=\"[customFilter]\" ngProjectAs=\"[customFilter]\" />\n </cauca-data-grid-table-options>\n}\n\n<div class=\"relative\">\n <table mat-table [dataSource]=\"listing.dataSource\" aria-describedby=\"Data Grid\" multiTemplateDataRows>\n @if (showExpandButton()) {\n <ng-container matColumnDef=\"expand\">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n <cauca-icon-button (buttonClick)=\"onExpand(row)\" color=\"primary\" class=\"button-icon\" [icon]=\"row === expandedElement() ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\" />\n </div>\n </td>\n </ng-container>\n }\n\n <ng-content></ng-content>\n @if(showTableHeader()) {\n <tr mat-header-row *matHeaderRowDef=\"allDisplayedColumns(); sticky: true\"></tr>\n }\n\n <tr mat-row *matRowDef=\"let row; columns: allDisplayedColumns()\"\n [class.showClick]=\"itemClick.observers.length > 0\"\n [class.compact]=\"preference.gridDensity === density.Compact\"\n [class.standard]=\"preference.gridDensity === density.Standard\"\n [class.comfortable]=\"preference.gridDensity === density.Comfortable\"\n [class.selected]=\"selectedRowId === row[idField]\"\n (click)=\"itemClick.emit(row)\"\n onkeypress=\"itemClick.emit(row)\">\n </tr>\n\n <ng-container matColumnDef=\"expandedDetail\">\n <td mat-cell *matCellDef=\"let row\" [attr.colspan]=\"allDisplayedColumns().length\">\n @if (row === expandedElement()) {\n <div class=\"grid-element-detail\" [@detailExpand]=\"row === expandedElement() ? 'expanded' : 'collapsed'\">\n <template [ngTemplateOutlet]=\"rowDetailTemplate\" [ngTemplateOutletContext]=\"{ row: expandedElement() }\"></template>\n </div>\n }\n </td>\n </ng-container>\n\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"grid-detail-row\"></tr>\n\n <ng-container *matNoDataRow>\n @if(listing.loading() === false) {\n <ng-container>\n <tr class=\"mat-row\">\n @if (listing.error() === false) {\n <th class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>grid_off</mat-icon>\n <span>{{ 'dataGrid.noDataLabel' | translate }}</span>\n </div>\n </th>\n } @else {\n <th class=\"mat-cell data-grid-message\"\n [attr.colspan]=\"allDisplayedColumns().length\">\n <div class=\"icon-text\">\n <mat-icon>error</mat-icon>\n <span>{{ 'dataGrid.errorLoadingDataLabel' | translate }}</span>\n </div>\n </th>\n }\n </tr>\n </ng-container>\n }\n </ng-container>\n </table>\n\n <cauca-data-grid-progress-spiner [useBackground]=\"false\" [isLoading]=\"listing.loading()\" />\n\n</div>\n\n<mat-paginator [hidePageSize]=\"hidePageSize()\" [pageSizeOptions]=\"[5, 10, 25, 50]\" [pageSize]=\"10\" />\n", styles: ["table{width:100%;table-layout:fixed;--mat-table-header-container-height: 52px;--mat-table-footer-container-height: 48px;--mat-table-row-item-container-height: 48px}.relative{position:relative}.mat-column-expand{width:72px}cauca-data-grid-progress-spiner{left:50%;top:50%;transform:translate(-50%,-50%);position:absolute;z-index:101}tr.mat-mdc-row{transition:background-color .2s ease-out .1s}tr.mat-mdc-row:hover{background:#f5f5f5}tr.mat-mdc-row.selected{background:#249edb14}tr.mat-mdc-row.selected:hover{background:#249edb1a}cauca-data-grid-header{margin:16px}.compact{line-height:48px!important}.standard{line-height:56px!important}.comfortable{line-height:62px!important}.showClick{cursor:pointer}tr.grid-detail-row{height:0}.grid-element-row td{border-bottom-width:0;background-color:#fafafa}.mat-column-expandedDetail{background-color:#fafafa}\n"] }]
|
|
884
|
+
}], ctorParameters: () => [{ type: i1$5.TranslateService }, { type: PreferenceService }, { type: OdataListingService }], propDecorators: { baseSort: [{
|
|
885
|
+
type: Input
|
|
886
|
+
}], filterPredicate: [{
|
|
887
|
+
type: Input
|
|
888
|
+
}], showHeader: [{
|
|
889
|
+
type: Input
|
|
890
|
+
}], selectedRowId: [{
|
|
891
|
+
type: Input
|
|
892
|
+
}], idField: [{
|
|
893
|
+
type: Input
|
|
894
|
+
}], itemClick: [{
|
|
895
|
+
type: Output
|
|
896
|
+
}], refreshRequested: [{
|
|
897
|
+
type: Output
|
|
898
|
+
}], showRefreshButton: [{
|
|
899
|
+
type: Input
|
|
900
|
+
}], rowDetailTemplate: [{
|
|
901
|
+
type: ContentChild,
|
|
902
|
+
args: [TemplateRef]
|
|
903
|
+
}], paginator: [{
|
|
904
|
+
type: ViewChild,
|
|
905
|
+
args: [MatPaginator, { static: true }]
|
|
906
|
+
}] } });
|
|
907
|
+
|
|
908
|
+
class ColorDataGridColumnComponent extends BaseGridColumnComponent {
|
|
909
|
+
constructor(odata, grid) {
|
|
910
|
+
super((grid ?? odata)?.table);
|
|
911
|
+
this.odata = odata;
|
|
912
|
+
this.grid = grid;
|
|
913
|
+
}
|
|
914
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ColorDataGridColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
915
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: ColorDataGridColumnComponent, isStandalone: true, selector: "cauca-color-data-grid-column", providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => ColorDataGridColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\r\n\r\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\">\r\n {{ label ?? capitalize(prop) }}\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (row[prop]) {\r\n <div class=\"color-capsule\" [style.backgroundColor]=\"row[prop]\"></div>\r\n }\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n\r\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.mat-column-color{width:100px}.color-capsule{width:100%;height:25px;border-radius:4px;border:1px solid rgba(0,0,0,.12)}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
916
|
+
}
|
|
917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ColorDataGridColumnComponent, decorators: [{
|
|
918
|
+
type: Component,
|
|
919
|
+
args: [{ selector: 'cauca-color-data-grid-column', standalone: true, imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatCell, MatCellDef, NgStyle, MatFooterCellDef], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => ColorDataGridColumnComponent) }], template: "<ng-container matColumnDef=\"{{ prop }}\">\r\n\r\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\">\r\n {{ label ?? capitalize(prop) }}\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (row[prop]) {\r\n <div class=\"color-capsule\" [style.backgroundColor]=\"row[prop]\"></div>\r\n }\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n\r\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.mat-column-color{width:100px}.color-capsule{width:100%;height:25px;border-radius:4px;border:1px solid rgba(0,0,0,.12)}\n"] }]
|
|
920
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
921
|
+
type: Optional
|
|
922
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
923
|
+
type: Optional
|
|
924
|
+
}] }] });
|
|
925
|
+
|
|
926
|
+
class CheckIconComponent {
|
|
927
|
+
constructor() {
|
|
928
|
+
this.checkIcon = input('check', ...(ngDevMode ? [{ debugName: "checkIcon" }] : []));
|
|
929
|
+
this.uncheckIcon = input('block', ...(ngDevMode ? [{ debugName: "uncheckIcon" }] : []));
|
|
930
|
+
this.isChecked = input(false, ...(ngDevMode ? [{ debugName: "isChecked" }] : []));
|
|
931
|
+
this.icon = computed(() => (this.isChecked() ? this.checkIcon() : this.uncheckIcon()), ...(ngDevMode ? [{ debugName: "icon" }] : []));
|
|
932
|
+
this.checkMark = computed(() => this.isChecked() && this.checkIcon() === 'check', ...(ngDevMode ? [{ debugName: "checkMark" }] : []));
|
|
933
|
+
this.check = computed(() => this.isChecked() && this.checkIcon() !== 'check', ...(ngDevMode ? [{ debugName: "check" }] : []));
|
|
934
|
+
this.uncheck = computed(() => !this.isChecked(), ...(ngDevMode ? [{ debugName: "uncheck" }] : []));
|
|
935
|
+
}
|
|
936
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
937
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: CheckIconComponent, isStandalone: true, selector: "cauca-check-icon", inputs: { checkIcon: { classPropertyName: "checkIcon", publicName: "checkIcon", isSignal: true, isRequired: false, transformFunction: null }, uncheckIcon: { classPropertyName: "uncheckIcon", publicName: "uncheckIcon", isSignal: true, isRequired: false, transformFunction: null }, isChecked: { classPropertyName: "isChecked", publicName: "isChecked", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
938
|
+
<mat-icon
|
|
939
|
+
class="check-icon"
|
|
940
|
+
[class.check-mark]="checkMark()"
|
|
941
|
+
[class.check]="check()"
|
|
942
|
+
[class.uncheck]="uncheck()"
|
|
943
|
+
aria-hidden="false"
|
|
944
|
+
aria-label="State icon"
|
|
945
|
+
[fontIcon]="icon()" />
|
|
946
|
+
`, isInline: true, styles: [".check-mark{color:#2e7d32}.check{color:#006496}.uncheck{color:#12101461}.check-icon{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
947
|
+
}
|
|
948
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckIconComponent, decorators: [{
|
|
949
|
+
type: Component,
|
|
950
|
+
args: [{ selector: 'cauca-check-icon', template: `
|
|
951
|
+
<mat-icon
|
|
952
|
+
class="check-icon"
|
|
953
|
+
[class.check-mark]="checkMark()"
|
|
954
|
+
[class.check]="check()"
|
|
955
|
+
[class.uncheck]="uncheck()"
|
|
956
|
+
aria-hidden="false"
|
|
957
|
+
aria-label="State icon"
|
|
958
|
+
[fontIcon]="icon()" />
|
|
959
|
+
`, imports: [MatIcon], changeDetection: ChangeDetectionStrategy.OnPush, styles: [".check-mark{color:#2e7d32}.check{color:#006496}.uncheck{color:#12101461}.check-icon{vertical-align:middle}\n"] }]
|
|
960
|
+
}] });
|
|
961
|
+
|
|
962
|
+
class DataGridCheckColumnComponent extends BaseGridColumnComponent {
|
|
963
|
+
constructor(odata, grid) {
|
|
964
|
+
super((grid ?? odata)?.table);
|
|
965
|
+
this.odata = odata;
|
|
966
|
+
this.grid = grid;
|
|
967
|
+
this.checkIcon = 'check';
|
|
968
|
+
this.uncheckIcon = 'block';
|
|
969
|
+
}
|
|
970
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCheckColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
971
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: DataGridCheckColumnComponent, isStandalone: true, selector: "cauca-data-grid-check-column", inputs: { checkIcon: "checkIcon", uncheckIcon: "uncheckIcon" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCheckColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width, 'text-align': 'center'}\">\n {{ label ?? capitalize(prop) }}\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <cauca-check-icon [checkIcon]=\"checkIcon\" [uncheckIcon]=\"uncheckIcon\" [isChecked]=\"row[prop]\" />\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{width:120px;min-width:120px;text-align:center}\n"], dependencies: [{ kind: "component", type: CheckIconComponent, selector: "cauca-check-icon", inputs: ["checkIcon", "uncheckIcon", "isChecked"] }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }] }); }
|
|
972
|
+
}
|
|
973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCheckColumnComponent, decorators: [{
|
|
974
|
+
type: Component,
|
|
975
|
+
args: [{ selector: 'cauca-data-grid-check-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCheckColumnComponent) }], imports: [CheckIconComponent, MatColumnDef, MatHeaderCell, MatHeaderCellDef, NgStyle, MatCell, MatCellDef, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width, 'text-align': 'center'}\">\n {{ label ?? capitalize(prop) }}\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <cauca-check-icon [checkIcon]=\"checkIcon\" [uncheckIcon]=\"uncheckIcon\" [isChecked]=\"row[prop]\" />\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{width:120px;min-width:120px;text-align:center}\n"] }]
|
|
976
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
977
|
+
type: Optional
|
|
978
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
979
|
+
type: Optional
|
|
980
|
+
}] }], propDecorators: { checkIcon: [{
|
|
981
|
+
type: Input
|
|
982
|
+
}], uncheckIcon: [{
|
|
983
|
+
type: Input
|
|
984
|
+
}] } });
|
|
985
|
+
|
|
986
|
+
class DataGridColumnComponent extends BaseGridColumnComponent {
|
|
987
|
+
constructor(odata, grid) {
|
|
988
|
+
super((grid ?? odata)?.table);
|
|
989
|
+
this.showToolTip = false;
|
|
990
|
+
this.summaryType = input('none', ...(ngDevMode ? [{ debugName: "summaryType" }] : []));
|
|
991
|
+
this.summaryLabel = input('', ...(ngDevMode ? [{ debugName: "summaryLabel" }] : []));
|
|
992
|
+
this.format = input('none', ...(ngDevMode ? [{ debugName: "format" }] : []));
|
|
993
|
+
this.isInitialized = false;
|
|
994
|
+
this.grid = null;
|
|
995
|
+
this.grid = grid ?? odata;
|
|
996
|
+
this.isInitialized = true;
|
|
997
|
+
}
|
|
998
|
+
calculateSummary() {
|
|
999
|
+
if (this.isInitialized && this.grid?.data) {
|
|
1000
|
+
if (this.summaryType() === 'sum') {
|
|
1001
|
+
return this.summaryLabel() + this.grid.data.reduce((acc, row) => acc + row[this.prop], 0) + this.summaryLabel();
|
|
1002
|
+
}
|
|
1003
|
+
if (this.summaryType() === 'count') {
|
|
1004
|
+
return this.grid.data?.length + this.summaryLabel();
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return '';
|
|
1008
|
+
}
|
|
1009
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1010
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridColumnComponent, isStandalone: true, selector: "cauca-data-grid-column", inputs: { showToolTip: { classPropertyName: "showToolTip", publicName: "showToolTip", isSignal: false, isRequired: false, transformFunction: null }, summaryType: { classPropertyName: "summaryType", publicName: "summaryType", isSignal: true, isRequired: false, transformFunction: null }, summaryLabel: { classPropertyName: "summaryLabel", publicName: "summaryLabel", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n @if (showToolTip) {<span [matTooltip]=\"row[prop]\" >{{ row[prop] }}</span>}\n @else { <span>{{ row[prop] }}</span>}\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n @if (isInitialized) {\n {{calculateSummary()}}\n }\n </td>\n\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1011
|
+
}
|
|
1012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridColumnComponent, decorators: [{
|
|
1013
|
+
type: Component,
|
|
1014
|
+
args: [{ selector: 'cauca-data-grid-column', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, NgStyle, MatCell, MatCellDef, MatTooltip, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\n\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n @if (showToolTip) {<span [matTooltip]=\"row[prop]\" >{{ row[prop] }}</span>}\n @else { <span>{{ row[prop] }}</span>}\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n @if (isInitialized) {\n {{calculateSummary()}}\n }\n </td>\n\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
1015
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1016
|
+
type: Optional
|
|
1017
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1018
|
+
type: Optional
|
|
1019
|
+
}] }], propDecorators: { showToolTip: [{
|
|
1020
|
+
type: Input
|
|
1021
|
+
}] } });
|
|
1022
|
+
|
|
1023
|
+
class DataGridCommandIconColumnComponent extends BaseGridColumnComponent {
|
|
1024
|
+
constructor(odata, grid) {
|
|
1025
|
+
super((grid ?? odata)?.table);
|
|
1026
|
+
this.odata = odata;
|
|
1027
|
+
this.grid = grid;
|
|
1028
|
+
this.checkColor = '#F8B132';
|
|
1029
|
+
this.checkIcon = 'star';
|
|
1030
|
+
this.uncheckIcon = 'star_outline';
|
|
1031
|
+
this.uncheckColor = 'default';
|
|
1032
|
+
this.commandClick = new EventEmitter();
|
|
1033
|
+
}
|
|
1034
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCommandIconColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1035
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridCommandIconColumnComponent, isStandalone: true, selector: "cauca-data-grid-command-icon-column", inputs: { checkColor: "checkColor", checkIcon: "checkIcon", uncheckIcon: "uncheckIcon", uncheckColor: "uncheckColor" }, outputs: { commandClick: "commandClick" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCommandIconColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell mat-sort-header *matHeaderCellDef>\n <div>\n @if (label) {\n {{ label }}\n } @else {\n <mat-icon [style.color]=\"uncheckColor\" aria-hidden=\"false\" aria-label=\"State icon\" [fontIcon]=\"uncheckIcon\" />\n }\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <div>\n <cauca-icon-button (buttonClick)=\"commandClick.emit(row)\" [icon]=\"row[prop] ? checkIcon : uncheckIcon\" [color]=\"row[prop] ? checkColor : uncheckColor\" />\n </div>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["td{width:50px;min-width:50px;padding-left:0;padding-right:0}td>div{display:flex;justify-content:center}th{padding-left:23px;padding-right:0;width:70px;min-width:70px}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }] }); }
|
|
1036
|
+
}
|
|
1037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCommandIconColumnComponent, decorators: [{
|
|
1038
|
+
type: Component,
|
|
1039
|
+
args: [{ selector: 'cauca-data-grid-command-icon-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCommandIconColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatSortHeader, MatHeaderCellDef, MatIcon, MatCell, MatCellDef, IconButtonComponent, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell mat-sort-header *matHeaderCellDef>\n <div>\n @if (label) {\n {{ label }}\n } @else {\n <mat-icon [style.color]=\"uncheckColor\" aria-hidden=\"false\" aria-label=\"State icon\" [fontIcon]=\"uncheckIcon\" />\n }\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <div>\n <cauca-icon-button (buttonClick)=\"commandClick.emit(row)\" [icon]=\"row[prop] ? checkIcon : uncheckIcon\" [color]=\"row[prop] ? checkColor : uncheckColor\" />\n </div>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["td{width:50px;min-width:50px;padding-left:0;padding-right:0}td>div{display:flex;justify-content:center}th{padding-left:23px;padding-right:0;width:70px;min-width:70px}\n"] }]
|
|
1040
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1041
|
+
type: Optional
|
|
1042
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1043
|
+
type: Optional
|
|
1044
|
+
}] }], propDecorators: { checkColor: [{
|
|
1045
|
+
type: Input
|
|
1046
|
+
}], checkIcon: [{
|
|
1047
|
+
type: Input
|
|
1048
|
+
}], uncheckIcon: [{
|
|
1049
|
+
type: Input
|
|
1050
|
+
}], uncheckColor: [{
|
|
1051
|
+
type: Input
|
|
1052
|
+
}], commandClick: [{
|
|
1053
|
+
type: Output
|
|
1054
|
+
}] } });
|
|
1055
|
+
|
|
1056
|
+
class DataGridCommandsColumnComponent extends BaseGridColumnComponent {
|
|
1057
|
+
constructor(odata, grid) {
|
|
1058
|
+
super((grid ?? odata)?.table);
|
|
1059
|
+
this.odata = odata;
|
|
1060
|
+
this.grid = grid;
|
|
1061
|
+
this.canDelete = false;
|
|
1062
|
+
this.canEdit = false;
|
|
1063
|
+
this.canDuplicate = false;
|
|
1064
|
+
this.deleteClick = new EventEmitter();
|
|
1065
|
+
this.editClick = new EventEmitter();
|
|
1066
|
+
this.duplicateClick = new EventEmitter();
|
|
1067
|
+
}
|
|
1068
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCommandsColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1069
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridCommandsColumnComponent, isStandalone: true, selector: "cauca-data-grid-commands-column", inputs: { canDelete: "canDelete", canEdit: "canEdit", canDuplicate: "canDuplicate", editLinkField: "editLinkField" }, outputs: { deleteClick: "deleteClick", editClick: "editClick", duplicateClick: "duplicateClick" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCommandsColumnComponent) }], queries: [{ propertyName: "menuTemplate", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"buttons\">\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\"> {{ label }} </th>\n <td mat-cell *matCellDef=\"let row\">\n\n <div class=\"align-commands\">\n\n @if (canEdit) { <cauca-icon-button colorOnHover=\"var(--primary)\" color=\"grey\" icon=\"edit\" [routerLink]=\"editLinkField ? [row[editLinkField]] : null\" (buttonClick)=\"editClick?.emit(row)\" class=\"edit-button\" /> }\n\n @if (canDuplicate) { <cauca-icon-button color=\"grey\" icon=\"content_copy\" (buttonClick)=\"duplicateClick?.emit(row)\" class=\"duplicate-button\" /> }\n\n @if (canDelete) { <cauca-icon-button colorOnHover=\"var(--warn)\" color=\"grey\" icon=\"close\" (buttonClick)=\"deleteClick?.emit(row)\" class=\"delete-button\" /> }\n\n <template [ngTemplateOutlet]=\"menuTemplate\" [ngTemplateOutletContext]=\"{row:row}\"></template>\n\n </div>\n\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: [".mat-column-buttons{width:128px}.align-commands{display:flex;align-items:center}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1070
|
+
}
|
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridCommandsColumnComponent, decorators: [{
|
|
1072
|
+
type: Component,
|
|
1073
|
+
args: [{ selector: 'cauca-data-grid-commands-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridCommandsColumnComponent) }], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatCell, MatCellDef, IconButtonComponent, NgTemplateOutlet, MatFooterCell, MatFooterCellDef, NgStyle, RouterLink], template: "<ng-container matColumnDef=\"buttons\">\n <th mat-header-cell *matHeaderCellDef [ngStyle]=\"{'width': width}\"> {{ label }} </th>\n <td mat-cell *matCellDef=\"let row\">\n\n <div class=\"align-commands\">\n\n @if (canEdit) { <cauca-icon-button colorOnHover=\"var(--primary)\" color=\"grey\" icon=\"edit\" [routerLink]=\"editLinkField ? [row[editLinkField]] : null\" (buttonClick)=\"editClick?.emit(row)\" class=\"edit-button\" /> }\n\n @if (canDuplicate) { <cauca-icon-button color=\"grey\" icon=\"content_copy\" (buttonClick)=\"duplicateClick?.emit(row)\" class=\"duplicate-button\" /> }\n\n @if (canDelete) { <cauca-icon-button colorOnHover=\"var(--warn)\" color=\"grey\" icon=\"close\" (buttonClick)=\"deleteClick?.emit(row)\" class=\"delete-button\" /> }\n\n <template [ngTemplateOutlet]=\"menuTemplate\" [ngTemplateOutletContext]=\"{row:row}\"></template>\n\n </div>\n\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: [".mat-column-buttons{width:128px}.align-commands{display:flex;align-items:center}\n"] }]
|
|
1074
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1075
|
+
type: Optional
|
|
1076
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1077
|
+
type: Optional
|
|
1078
|
+
}] }], propDecorators: { canDelete: [{
|
|
1079
|
+
type: Input
|
|
1080
|
+
}], canEdit: [{
|
|
1081
|
+
type: Input
|
|
1082
|
+
}], canDuplicate: [{
|
|
1083
|
+
type: Input
|
|
1084
|
+
}], editLinkField: [{
|
|
1085
|
+
type: Input
|
|
1086
|
+
}], menuTemplate: [{
|
|
1087
|
+
type: ContentChild,
|
|
1088
|
+
args: [TemplateRef]
|
|
1089
|
+
}], deleteClick: [{
|
|
1090
|
+
type: Output
|
|
1091
|
+
}], editClick: [{
|
|
1092
|
+
type: Output
|
|
1093
|
+
}], duplicateClick: [{
|
|
1094
|
+
type: Output
|
|
1095
|
+
}] } });
|
|
1096
|
+
|
|
1097
|
+
class DataGridIconColumnComponent extends BaseGridColumnComponent {
|
|
1098
|
+
constructor(odata, grid) {
|
|
1099
|
+
super((grid ?? odata)?.table);
|
|
1100
|
+
this.odata = odata;
|
|
1101
|
+
this.grid = grid;
|
|
1102
|
+
this.alignRight = false;
|
|
1103
|
+
this.useMatIcon = false;
|
|
1104
|
+
this.icon = '';
|
|
1105
|
+
}
|
|
1106
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridIconColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1107
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridIconColumnComponent, isStandalone: true, selector: "cauca-data-grid-icon-column", inputs: { alignRight: "alignRight", useMatIcon: "useMatIcon", icon: "icon" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridIconColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef> {{ showLabel ? label ?? capitalize(prop) : '' }} </th>\n <td [ngClass]=\"alignRight ? 'td-right' : ''\" mat-cell *matCellDef=\"let row\">\n @if (useMatIcon) { <mat-icon>{{icon}}</mat-icon> }\n @else { <cauca-icon [icon]=\"row[prop]\" /> }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{width:180px;min-width:50px;padding:14px;text-align:center}.td-right{text-align:right}cauca-icon{font-size:32px}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "component", type: IconComponent, selector: "cauca-icon", inputs: ["icon"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
|
|
1108
|
+
}
|
|
1109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridIconColumnComponent, decorators: [{
|
|
1110
|
+
type: Component,
|
|
1111
|
+
args: [{ selector: 'cauca-data-grid-icon-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridIconColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatCell, MatCellDef, IconComponent, MatFooterCell, MatFooterCellDef, NgClass, MatIcon], template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef> {{ showLabel ? label ?? capitalize(prop) : '' }} </th>\n <td [ngClass]=\"alignRight ? 'td-right' : ''\" mat-cell *matCellDef=\"let row\">\n @if (useMatIcon) { <mat-icon>{{icon}}</mat-icon> }\n @else { <cauca-icon [icon]=\"row[prop]\" /> }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{width:180px;min-width:50px;padding:14px;text-align:center}.td-right{text-align:right}cauca-icon{font-size:32px}\n"] }]
|
|
1112
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1113
|
+
type: Optional
|
|
1114
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1115
|
+
type: Optional
|
|
1116
|
+
}] }], propDecorators: { alignRight: [{
|
|
1117
|
+
type: Input
|
|
1118
|
+
}], useMatIcon: [{
|
|
1119
|
+
type: Input
|
|
1120
|
+
}], icon: [{
|
|
1121
|
+
type: Input
|
|
1122
|
+
}] } });
|
|
1123
|
+
|
|
1124
|
+
class DataGridMenuColumnComponent extends BaseGridColumnComponent {
|
|
1125
|
+
constructor(odata, grid) {
|
|
1126
|
+
super((grid ?? odata)?.table);
|
|
1127
|
+
this.odata = odata;
|
|
1128
|
+
this.grid = grid;
|
|
1129
|
+
this.canDelete = model(false, ...(ngDevMode ? [{ debugName: "canDelete" }] : []));
|
|
1130
|
+
this.canDeleteByRow = null;
|
|
1131
|
+
this.canEdit = input(false, ...(ngDevMode ? [{ debugName: "canEdit" }] : []));
|
|
1132
|
+
this.canDuplicate = model(false, ...(ngDevMode ? [{ debugName: "canDuplicate" }] : []));
|
|
1133
|
+
this.canDuplicateByRow = null;
|
|
1134
|
+
this.editLinkField = input(...(ngDevMode ? [undefined, { debugName: "editLinkField" }] : []));
|
|
1135
|
+
this.duplicateLinkField = input(...(ngDevMode ? [undefined, { debugName: "duplicateLinkField" }] : []));
|
|
1136
|
+
this.deleteClick = output();
|
|
1137
|
+
this.editClick = output();
|
|
1138
|
+
this.duplicateClick = output();
|
|
1139
|
+
}
|
|
1140
|
+
menuOpened(row) {
|
|
1141
|
+
if (this.canDeleteByRow) {
|
|
1142
|
+
this.canDelete.set(this.canDeleteByRow(row));
|
|
1143
|
+
}
|
|
1144
|
+
if (this.canDuplicateByRow) {
|
|
1145
|
+
this.canDuplicate.set(this.canDuplicateByRow(row));
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridMenuColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1149
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataGridMenuColumnComponent, isStandalone: true, selector: "cauca-data-grid-menu-column", inputs: { canDelete: { classPropertyName: "canDelete", publicName: "canDelete", isSignal: true, isRequired: false, transformFunction: null }, canDeleteByRow: { classPropertyName: "canDeleteByRow", publicName: "canDeleteByRow", isSignal: false, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, canDuplicate: { classPropertyName: "canDuplicate", publicName: "canDuplicate", isSignal: true, isRequired: false, transformFunction: null }, canDuplicateByRow: { classPropertyName: "canDuplicateByRow", publicName: "canDuplicateByRow", isSignal: false, isRequired: false, transformFunction: null }, editLinkField: { classPropertyName: "editLinkField", publicName: "editLinkField", isSignal: true, isRequired: false, transformFunction: null }, duplicateLinkField: { classPropertyName: "duplicateLinkField", publicName: "duplicateLinkField", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { canDelete: "canDeleteChange", canDuplicate: "canDuplicateChange", deleteClick: "deleteClick", editClick: "editClick", duplicateClick: "duplicateClick" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridMenuColumnComponent) }], queries: [{ propertyName: "menuTemplate", first: true, predicate: TemplateRef, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"menu\">\n <th mat-header-cell *matHeaderCellDef> {{ label }} </th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n\n <cauca-icon-button colorOnHover=\"var(--primary)\" color=\"grey\" icon=\"more_horiz\" [matMenuTriggerFor]=\"actionMenu\" (menuOpened)=\"menuOpened(row)\" />\n\n <mat-menu #actionMenu=\"matMenu\" class=\"grid-menu\">\n @if (canEdit()) { <cauca-menu-item colorOnHover=\"var(--primary)\" icon=\"edit\" label=\"edit\" [translateLabel]=\"true\" [routerLink]=\"editLinkField() ? [row[editLinkField()]] : null\" (buttonClick)=\"editClick?.emit(row)\" class=\"edit-button\" /> }\n\n @if (canDuplicate()) { <cauca-menu-item icon=\"content_copy\" label=\"duplicate\" [translateLabel]=\"true\" [routerLink]=\"duplicateLinkField() ? [row[duplicateLinkField()]] : null\" [queryParams]=\"{ duplicate: true }\" (buttonClick)=\"duplicateClick?.emit(row)\" class=\"duplicate-button\" /> }\n\n @if (canDelete()) { <cauca-menu-item colorOnHover=\"var(--warn)\" icon=\"close\" label=\"delete\" [translateLabel]=\"true\" (buttonClick)=\"deleteClick?.emit(row)\" class=\"delete-button\" /> }\n <template [ngTemplateOutlet]=\"menuTemplate\" [ngTemplateOutletContext]=\"{row:row}\"></template>\n\n </mat-menu>\n\n </div>\n\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: [".mat-column-menu{width:80px}.align-commands{display:flex;align-items:center}.grid-menu{max-width:none}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "component", type: IconButtonComponent, selector: "cauca-icon-button" }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i4.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i4.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: MenuItemComponent, selector: "cauca-menu-item", inputs: ["translateLabel", "trigger"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1150
|
+
}
|
|
1151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataGridMenuColumnComponent, decorators: [{
|
|
1152
|
+
type: Component,
|
|
1153
|
+
args: [{ selector: 'cauca-data-grid-menu-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DataGridMenuColumnComponent) }], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, IconButtonComponent, MatMenuModule, MenuItemComponent, NgTemplateOutlet, MatFooterCell, MatFooterCellDef, RouterLink], template: "<ng-container matColumnDef=\"menu\">\n <th mat-header-cell *matHeaderCellDef> {{ label }} </th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"align-commands\">\n\n <cauca-icon-button colorOnHover=\"var(--primary)\" color=\"grey\" icon=\"more_horiz\" [matMenuTriggerFor]=\"actionMenu\" (menuOpened)=\"menuOpened(row)\" />\n\n <mat-menu #actionMenu=\"matMenu\" class=\"grid-menu\">\n @if (canEdit()) { <cauca-menu-item colorOnHover=\"var(--primary)\" icon=\"edit\" label=\"edit\" [translateLabel]=\"true\" [routerLink]=\"editLinkField() ? [row[editLinkField()]] : null\" (buttonClick)=\"editClick?.emit(row)\" class=\"edit-button\" /> }\n\n @if (canDuplicate()) { <cauca-menu-item icon=\"content_copy\" label=\"duplicate\" [translateLabel]=\"true\" [routerLink]=\"duplicateLinkField() ? [row[duplicateLinkField()]] : null\" [queryParams]=\"{ duplicate: true }\" (buttonClick)=\"duplicateClick?.emit(row)\" class=\"duplicate-button\" /> }\n\n @if (canDelete()) { <cauca-menu-item colorOnHover=\"var(--warn)\" icon=\"close\" label=\"delete\" [translateLabel]=\"true\" (buttonClick)=\"deleteClick?.emit(row)\" class=\"delete-button\" /> }\n <template [ngTemplateOutlet]=\"menuTemplate\" [ngTemplateOutletContext]=\"{row:row}\"></template>\n\n </mat-menu>\n\n </div>\n\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: [".mat-column-menu{width:80px}.align-commands{display:flex;align-items:center}.grid-menu{max-width:none}\n"] }]
|
|
1154
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1155
|
+
type: Optional
|
|
1156
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1157
|
+
type: Optional
|
|
1158
|
+
}] }], propDecorators: { canDeleteByRow: [{
|
|
1159
|
+
type: Input
|
|
1160
|
+
}], canDuplicateByRow: [{
|
|
1161
|
+
type: Input
|
|
1162
|
+
}], menuTemplate: [{
|
|
1163
|
+
type: ContentChild,
|
|
1164
|
+
args: [TemplateRef]
|
|
1165
|
+
}] } });
|
|
1166
|
+
|
|
1167
|
+
class TimeLabelComponent {
|
|
1168
|
+
constructor() {
|
|
1169
|
+
this.date = input.required(...(ngDevMode ? [{ debugName: "date" }] : []));
|
|
1170
|
+
this.minLimit = input(null, ...(ngDevMode ? [{ debugName: "minLimit" }] : []));
|
|
1171
|
+
this.maxLimit = input(null, ...(ngDevMode ? [{ debugName: "maxLimit" }] : []));
|
|
1172
|
+
this.showTime = input(true, ...(ngDevMode ? [{ debugName: "showTime" }] : []));
|
|
1173
|
+
this.displayDate = computed(() => {
|
|
1174
|
+
if (!this.date()) {
|
|
1175
|
+
return '';
|
|
1176
|
+
}
|
|
1177
|
+
const date = new Date(this.date());
|
|
1178
|
+
if (this.minLimit()) {
|
|
1179
|
+
const minLimit = new Date(this.minLimit());
|
|
1180
|
+
return date < minLimit ? minLimit : date;
|
|
1181
|
+
}
|
|
1182
|
+
else if (this.maxLimit()) {
|
|
1183
|
+
const maxLimit = dayjs(this.maxLimit()).add(-1, 'second').toDate();
|
|
1184
|
+
return date > maxLimit ? maxLimit : date;
|
|
1185
|
+
}
|
|
1186
|
+
else {
|
|
1187
|
+
return date;
|
|
1188
|
+
}
|
|
1189
|
+
}, ...(ngDevMode ? [{ debugName: "displayDate" }] : []));
|
|
1190
|
+
}
|
|
1191
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TimeLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1192
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: TimeLabelComponent, isStandalone: true, selector: "cauca-time-label", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null }, minLimit: { classPropertyName: "minLimit", publicName: "minLimit", isSignal: true, isRequired: false, transformFunction: null }, maxLimit: { classPropertyName: "maxLimit", publicName: "maxLimit", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (showTime())\r\n{\r\n <span [matTooltip]=\"displayDate() | date:'dd/MM/yyyy HH:mm:ss'\">{{ displayDate() | date:'dd/MM/yyyy HH:mm:ss' }}</span>\r\n}\r\n@else\r\n{\r\n <span [matTooltip]=\"displayDate() | date:'dd/MM/yyyy HH:mm:ss'\">{{ displayDate() | date:'dd/MM/yyyy' }}</span>\r\n}\r\n", styles: [""], dependencies: [{ kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1193
|
+
}
|
|
1194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TimeLabelComponent, decorators: [{
|
|
1195
|
+
type: Component,
|
|
1196
|
+
args: [{ selector: 'cauca-time-label', imports: [DatePipe, MatTooltip], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showTime())\r\n{\r\n <span [matTooltip]=\"displayDate() | date:'dd/MM/yyyy HH:mm:ss'\">{{ displayDate() | date:'dd/MM/yyyy HH:mm:ss' }}</span>\r\n}\r\n@else\r\n{\r\n <span [matTooltip]=\"displayDate() | date:'dd/MM/yyyy HH:mm:ss'\">{{ displayDate() | date:'dd/MM/yyyy' }}</span>\r\n}\r\n" }]
|
|
1197
|
+
}] });
|
|
1198
|
+
|
|
1199
|
+
class DateGridColumnComponent extends BaseGridColumnComponent {
|
|
1200
|
+
constructor(odata, grid) {
|
|
1201
|
+
super((grid ?? odata)?.table);
|
|
1202
|
+
this.odata = odata;
|
|
1203
|
+
this.grid = grid;
|
|
1204
|
+
this.showWithTime = false;
|
|
1205
|
+
this.maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
1206
|
+
this.minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
1207
|
+
}
|
|
1208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DateGridColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1209
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: DateGridColumnComponent, isStandalone: true, selector: "cauca-date-grid-column", inputs: { showWithTime: { classPropertyName: "showWithTime", publicName: "showWithTime", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DateGridColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n <cauca-time-label [date]=\"row[prop]\" [showTime]=\"showWithTime\" [minLimit]=\"minDate()\" [maxLimit]=\"maxDate()\" />\n </td>\n\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "component", type: TimeLabelComponent, selector: "cauca-time-label", inputs: ["date", "minLimit", "maxLimit", "showTime"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1210
|
+
}
|
|
1211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DateGridColumnComponent, decorators: [{
|
|
1212
|
+
type: Component,
|
|
1213
|
+
args: [{ selector: 'cauca-date-grid-column', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => DateGridColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatSortHeader, NgStyle, MatCell, MatCellDef, TimeLabelComponent, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\n\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n <cauca-time-label [date]=\"row[prop]\" [showTime]=\"showWithTime\" [minLimit]=\"minDate()\" [maxLimit]=\"maxDate()\" />\n </td>\n\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
1214
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1215
|
+
type: Optional
|
|
1216
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1217
|
+
type: Optional
|
|
1218
|
+
}] }], propDecorators: { showWithTime: [{
|
|
1219
|
+
type: Input
|
|
1220
|
+
}] } });
|
|
1221
|
+
|
|
1222
|
+
class SortableDataGridCheckColumnComponent extends BaseGridColumnComponent {
|
|
1223
|
+
constructor(odata, grid) {
|
|
1224
|
+
super((grid ?? odata)?.table);
|
|
1225
|
+
this.odata = odata;
|
|
1226
|
+
this.grid = grid;
|
|
1227
|
+
this.checkIcon = 'check';
|
|
1228
|
+
this.uncheckIcon = 'block';
|
|
1229
|
+
}
|
|
1230
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SortableDataGridCheckColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1231
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: SortableDataGridCheckColumnComponent, isStandalone: true, selector: "cauca-sortable-data-grid-check-column", inputs: { checkIcon: "checkIcon", uncheckIcon: "uncheckIcon" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => SortableDataGridCheckColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\" [matTooltip]=\"label ?? capitalize(prop)\">\n {{ label ?? capitalize(prop) }}\n </th>\n <td mat-cell *matCellDef=\"let row\" [ngStyle]=\"{'width': width}\">\n <cauca-check-icon [checkIcon]=\"checkIcon\" [uncheckIcon]=\"uncheckIcon\" [isChecked]=\"row[prop]\" />\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["::ng-deep .mat-column-isVisible>div,::ng-deep .mat-column-isRecurrent>div{justify-content:center}cauca-check-icon{display:flex;margin-right:18px;justify-content:center}th,td{width:120px;min-width:120px;text-align:center}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "component", type: CheckIconComponent, selector: "cauca-check-icon", inputs: ["checkIcon", "uncheckIcon", "isChecked"] }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }] }); }
|
|
1232
|
+
}
|
|
1233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SortableDataGridCheckColumnComponent, decorators: [{
|
|
1234
|
+
type: Component,
|
|
1235
|
+
args: [{ selector: 'cauca-sortable-data-grid-check-column', providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => SortableDataGridCheckColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, NgStyle, MatTooltip, MatCell, MatCellDef, CheckIconComponent, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\" [matTooltip]=\"label ?? capitalize(prop)\">\n {{ label ?? capitalize(prop) }}\n </th>\n <td mat-cell *matCellDef=\"let row\" [ngStyle]=\"{'width': width}\">\n <cauca-check-icon [checkIcon]=\"checkIcon\" [uncheckIcon]=\"uncheckIcon\" [isChecked]=\"row[prop]\" />\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n</ng-container>", styles: ["::ng-deep .mat-column-isVisible>div,::ng-deep .mat-column-isRecurrent>div{justify-content:center}cauca-check-icon{display:flex;margin-right:18px;justify-content:center}th,td{width:120px;min-width:120px;text-align:center}\n"] }]
|
|
1236
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1237
|
+
type: Optional
|
|
1238
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1239
|
+
type: Optional
|
|
1240
|
+
}] }], propDecorators: { checkIcon: [{
|
|
1241
|
+
type: Input
|
|
1242
|
+
}], uncheckIcon: [{
|
|
1243
|
+
type: Input
|
|
1244
|
+
}] } });
|
|
1245
|
+
|
|
1246
|
+
class ColumnLabelComponent {
|
|
1247
|
+
constructor() {
|
|
1248
|
+
this.value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1249
|
+
this.format = input('none', ...(ngDevMode ? [{ debugName: "format" }] : []));
|
|
1250
|
+
this.showToolTip = input(false, ...(ngDevMode ? [{ debugName: "showToolTip" }] : []));
|
|
1251
|
+
this.displayValue = computed(() => {
|
|
1252
|
+
if (this.format() === 'phone') {
|
|
1253
|
+
return this.value()?.toString().replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3');
|
|
1254
|
+
}
|
|
1255
|
+
return this.value();
|
|
1256
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
1257
|
+
}
|
|
1258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ColumnLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1259
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: ColumnLabelComponent, isStandalone: true, selector: "cauca-column-label", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showToolTip: { classPropertyName: "showToolTip", publicName: "showToolTip", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (showToolTip()) {<span [matTooltip]=\"displayValue()\" >{{ displayValue() }}</span>}\r\n@else { <span>{{displayValue()}}</span>}", styles: [""], dependencies: [{ kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1260
|
+
}
|
|
1261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ColumnLabelComponent, decorators: [{
|
|
1262
|
+
type: Component,
|
|
1263
|
+
args: [{ selector: 'cauca-column-label', imports: [MatTooltip], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showToolTip()) {<span [matTooltip]=\"displayValue()\" >{{ displayValue() }}</span>}\r\n@else { <span>{{displayValue()}}</span>}" }]
|
|
1264
|
+
}] });
|
|
1265
|
+
|
|
1266
|
+
class SortableDataGridColumnComponent extends BaseGridColumnComponent {
|
|
1267
|
+
constructor(odata, grid) {
|
|
1268
|
+
super((grid ?? odata)?.table);
|
|
1269
|
+
this.showToolTip = false;
|
|
1270
|
+
this.summaryType = input('none', ...(ngDevMode ? [{ debugName: "summaryType" }] : []));
|
|
1271
|
+
this.summaryLabel = input('', ...(ngDevMode ? [{ debugName: "summaryLabel" }] : []));
|
|
1272
|
+
this.format = input('none', ...(ngDevMode ? [{ debugName: "format" }] : []));
|
|
1273
|
+
this.isInitialized = false;
|
|
1274
|
+
this.grid = null;
|
|
1275
|
+
this.grid = grid ?? odata;
|
|
1276
|
+
this.isInitialized = true;
|
|
1277
|
+
}
|
|
1278
|
+
calculateSummary() {
|
|
1279
|
+
if (this.isInitialized && this.grid?.data) {
|
|
1280
|
+
if (this.summaryType() === 'sum') {
|
|
1281
|
+
return this.summaryLabel() + this.grid.data.reduce((acc, row) => acc + row[this.prop], 0) + this.summaryLabel();
|
|
1282
|
+
}
|
|
1283
|
+
if (this.summaryType() === 'count') {
|
|
1284
|
+
return this.grid.data?.length + this.summaryLabel();
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return '';
|
|
1288
|
+
}
|
|
1289
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SortableDataGridColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1290
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: SortableDataGridColumnComponent, isStandalone: true, selector: "cauca-sortable-data-grid-column", inputs: { showToolTip: { classPropertyName: "showToolTip", publicName: "showToolTip", isSignal: false, isRequired: false, transformFunction: null }, summaryType: { classPropertyName: "summaryType", publicName: "summaryType", isSignal: true, isRequired: false, transformFunction: null }, summaryLabel: { classPropertyName: "summaryLabel", publicName: "summaryLabel", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => SortableDataGridColumnComponent) }], usesInheritance: true, ngImport: i0, template: "\n<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\" [matTooltip]=\"label ?? capitalize(prop)\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n <cauca-column-label [value]=\"row[prop]\" [showToolTip]=\"showToolTip\" [format]=\"format()\" />\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n @if (isInitialized) {\n {{calculateSummary()}}\n }\n </td>\n</ng-container>\n", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-footer-cell{font-weight:700}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: ColumnLabelComponent, selector: "cauca-column-label", inputs: ["value", "format", "showToolTip"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1291
|
+
}
|
|
1292
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SortableDataGridColumnComponent, decorators: [{
|
|
1293
|
+
type: Component,
|
|
1294
|
+
args: [{ selector: 'cauca-sortable-data-grid-column', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => SortableDataGridColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatSortHeader, NgStyle, MatCell, MatCellDef, MatTooltip, ColumnLabelComponent], template: "\n<ng-container matColumnDef=\"{{ prop }}\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header [ngStyle]=\"{'width': width}\" [matTooltip]=\"label ?? capitalize(prop)\">\n {{ label ?? capitalize(prop) }}\n </th>\n\n <td mat-cell *matCellDef=\"let row\">\n <cauca-column-label [value]=\"row[prop]\" [showToolTip]=\"showToolTip\" [format]=\"format()\" />\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n @if (isInitialized) {\n {{calculateSummary()}}\n }\n </td>\n</ng-container>\n", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-footer-cell{font-weight:700}\n"] }]
|
|
1295
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1296
|
+
type: Optional
|
|
1297
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1298
|
+
type: Optional
|
|
1299
|
+
}] }], propDecorators: { showToolTip: [{
|
|
1300
|
+
type: Input
|
|
1301
|
+
}] } });
|
|
1302
|
+
|
|
1303
|
+
class TranslationGridColumnComponent extends BaseGridColumnComponent {
|
|
1304
|
+
constructor(odata, grid) {
|
|
1305
|
+
super((grid ?? odata)?.table);
|
|
1306
|
+
this.odata = odata;
|
|
1307
|
+
this.grid = grid;
|
|
1308
|
+
this.prefix = "";
|
|
1309
|
+
}
|
|
1310
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TranslationGridColumnComponent, deps: [{ token: OdataGridComponent, optional: true }, { token: DataGridComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1311
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: TranslationGridColumnComponent, isStandalone: true, selector: "cauca-translation-grid-column", inputs: { prefix: "prefix" }, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => TranslationGridColumnComponent) }], usesInheritance: true, ngImport: i0, template: "<ng-container matColumnDef=\"{{ prop }}\">\r\n\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{ label ?? capitalize(prop) }}\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (prefix && row[prop]) { <span>{{ prefix+'.'+row[prop] | translate }}</span> }\r\n @else if(row[prop]) { <span>{{ row[prop] | translate }}</span> }\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "directive", type: MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "directive", type: MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1312
|
+
}
|
|
1313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TranslationGridColumnComponent, decorators: [{
|
|
1314
|
+
type: Component,
|
|
1315
|
+
args: [{ selector: 'cauca-translation-grid-column', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [{ provide: BaseGridColumnComponent, useExisting: forwardRef(() => TranslationGridColumnComponent) }], imports: [MatColumnDef, MatHeaderCell, MatHeaderCellDef, MatCell, MatCellDef, TranslateModule, MatFooterCell, MatFooterCellDef], template: "<ng-container matColumnDef=\"{{ prop }}\">\r\n\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{ label ?? capitalize(prop) }}\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (prefix && row[prop]) { <span>{{ prefix+'.'+row[prop] | translate }}</span> }\r\n @else if(row[prop]) { <span>{{ row[prop] | translate }}</span> }\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n</ng-container>", styles: ["th,td{overflow:hidden;width:auto;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
1316
|
+
}], ctorParameters: () => [{ type: OdataGridComponent, decorators: [{
|
|
1317
|
+
type: Optional
|
|
1318
|
+
}] }, { type: DataGridComponent, decorators: [{
|
|
1319
|
+
type: Optional
|
|
1320
|
+
}] }], propDecorators: { prefix: [{
|
|
1321
|
+
type: Input
|
|
1322
|
+
}] } });
|
|
1323
|
+
|
|
1324
|
+
/*
|
|
1325
|
+
* Public API Surface of cauca-datagrid
|
|
1326
|
+
*/
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* Generated bundle index. Do not edit.
|
|
1330
|
+
*/
|
|
1331
|
+
|
|
1332
|
+
export { BaseGridColumnComponent, ColorDataGridColumnComponent, DataGridCheckColumnComponent, DataGridColumnComponent, DataGridCommandIconColumnComponent, DataGridCommandsColumnComponent, DataGridComponent, DataGridIconColumnComponent, DataGridMenuColumnComponent, DateGridColumnComponent, OdataGridComponent, SortableDataGridCheckColumnComponent, SortableDataGridColumnComponent, TranslationGridColumnComponent };
|
|
1333
|
+
//# sourceMappingURL=cauca-911-datagrid.mjs.map
|