@sankhyalabs/ezui 4.17.0 → 4.18.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/dist/cjs/ez-grid.cjs.entry.js +85 -21
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +72 -12
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +11 -7
- package/dist/collection/components/ez-grid/ez-grid.js +10 -4
- package/dist/custom-elements/index.js +85 -21
- package/dist/esm/ez-grid.entry.js +85 -21
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-37b4aa8b.entry.js → p-9334e296.entry.js} +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
- package/dist/types/components.d.ts +3 -3
- package/package.json +1 -1
|
@@ -119100,8 +119100,8 @@ class EzGridCustomHeader {
|
|
|
119100
119100
|
</div>
|
|
119101
119101
|
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
119102
119102
|
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
119103
|
-
<i id='ez-grid-sort-icon-
|
|
119104
|
-
<i id='ez-grid-sort-icon-
|
|
119103
|
+
<i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
119104
|
+
<i id='ez-grid-sort-icon-up' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
119105
119105
|
</div>
|
|
119106
119106
|
`;
|
|
119107
119107
|
this.configMenuClick();
|
|
@@ -119112,6 +119112,7 @@ class EzGridCustomHeader {
|
|
|
119112
119112
|
refresh(agParams) {
|
|
119113
119113
|
this.params = agParams;
|
|
119114
119114
|
this.configFilterButton();
|
|
119115
|
+
this.configSortIcon();
|
|
119115
119116
|
}
|
|
119116
119117
|
configFilterButton() {
|
|
119117
119118
|
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
@@ -119119,7 +119120,7 @@ class EzGridCustomHeader {
|
|
|
119119
119120
|
this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
|
|
119120
119121
|
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
119121
119122
|
}
|
|
119122
|
-
|
|
119123
|
+
configSortIcon() {
|
|
119123
119124
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
119124
119125
|
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
119125
119126
|
}
|
|
@@ -119127,17 +119128,20 @@ class EzGridCustomHeader {
|
|
|
119127
119128
|
if (this.params.enableSorting) {
|
|
119128
119129
|
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
|
|
119129
119130
|
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
|
|
119130
|
-
this.onSortChangedListener = this.
|
|
119131
|
+
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
119131
119132
|
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
119133
|
+
this.configSortIcon();
|
|
119132
119134
|
}
|
|
119133
119135
|
}
|
|
119134
119136
|
onSortClick(event) {
|
|
119135
119137
|
this.params.progressSort(event.shiftKey);
|
|
119136
119138
|
}
|
|
119137
119139
|
configSortClick() {
|
|
119138
|
-
|
|
119139
|
-
|
|
119140
|
-
|
|
119140
|
+
if (this.params.column.getColDef().sortable) {
|
|
119141
|
+
this.headerContainer = this.element.querySelector('#ez-header-container');
|
|
119142
|
+
this.onSortClickListener = this.onSortClick.bind(this);
|
|
119143
|
+
this.headerContainer.addEventListener('click', this.onSortClickListener);
|
|
119144
|
+
}
|
|
119141
119145
|
}
|
|
119142
119146
|
onMenuClick() {
|
|
119143
119147
|
this.params.showColumnMenu(this.menuButton);
|
|
@@ -119218,15 +119222,7 @@ class AgGridController {
|
|
|
119218
119222
|
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
119219
119223
|
navigateToNextCell: this.navigateToNextCell.bind(this),
|
|
119220
119224
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
119221
|
-
getMainMenuItems: (params) =>
|
|
119222
|
-
const column = params.column;
|
|
119223
|
-
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
119224
|
-
this._menuItems.forEach(m => items.push({
|
|
119225
|
-
name: m.label,
|
|
119226
|
-
action: () => m.action(column.getColId(), m.name)
|
|
119227
|
-
}));
|
|
119228
|
-
return items;
|
|
119229
|
-
},
|
|
119225
|
+
getMainMenuItems: (params) => this.buildMenuItemOptions(params),
|
|
119230
119226
|
getRowHeight: this.getRowHeight.bind(this),
|
|
119231
119227
|
defaultColDef: {
|
|
119232
119228
|
headerClass: "ez-grid__cell-header",
|
|
@@ -119260,6 +119256,69 @@ class AgGridController {
|
|
|
119260
119256
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
119261
119257
|
}
|
|
119262
119258
|
}
|
|
119259
|
+
buildMenuItemOptions(params) {
|
|
119260
|
+
const col = params.column;
|
|
119261
|
+
const items = [];
|
|
119262
|
+
if (col.getColDef().sortable) {
|
|
119263
|
+
items.push(this.buildMenuItemOptionSort(params, 'asc'));
|
|
119264
|
+
items.push(this.buildMenuItemOptionSort(params, 'desc'));
|
|
119265
|
+
}
|
|
119266
|
+
/*
|
|
119267
|
+
TODO: Adicionar quando filtro de colunar estiver finalizado.
|
|
119268
|
+
items.push(this.buildMenuItemFilterColumn(params));
|
|
119269
|
+
*/
|
|
119270
|
+
this._menuItems.forEach(m => items.push({
|
|
119271
|
+
icon: m.icon,
|
|
119272
|
+
name: m.label,
|
|
119273
|
+
action: () => m.action(params),
|
|
119274
|
+
}));
|
|
119275
|
+
items.push(this.buildMenuItemOptionPin(params));
|
|
119276
|
+
return items;
|
|
119277
|
+
}
|
|
119278
|
+
buildMenuItemOptionSort(params, sortOrder) {
|
|
119279
|
+
return {
|
|
119280
|
+
icon: `<div style="${sortOrder === "asc" ? 'transform: rotate(180deg); position: relative; top: -4px;' : ''}"><i class='ez-icon-arrow_downward'></i></div>`,
|
|
119281
|
+
name: sortOrder === "asc" ? "Ordenar Ascendente" : "Ordenar Descendente",
|
|
119282
|
+
action: () => this.sortDataByColumn(params, sortOrder)
|
|
119283
|
+
};
|
|
119284
|
+
}
|
|
119285
|
+
/*
|
|
119286
|
+
TODO: Voltar função quando for implementado o filtro de coluna
|
|
119287
|
+
private buildMenuItemFilterColumn( _params: GetMainMenuItemsParams): MenuItemDef{
|
|
119288
|
+
return {
|
|
119289
|
+
icon: `<i class='ez-icon-filter'></i>`,
|
|
119290
|
+
name: "Filtrar",
|
|
119291
|
+
action: () => window.alert("Abrir popover de filtro")
|
|
119292
|
+
}
|
|
119293
|
+
}*/
|
|
119294
|
+
buildMenuItemOptionPin(params) {
|
|
119295
|
+
const { column, columnApi } = params;
|
|
119296
|
+
const isPinned = params.column.isPinned();
|
|
119297
|
+
return {
|
|
119298
|
+
icon: `<i class='ez-icon-${isPinned ? 'un-pin' : 'push-pin'}'></i>`,
|
|
119299
|
+
name: isPinned ? "Desafixar coluna" : "Fixar coluna",
|
|
119300
|
+
action: () => {
|
|
119301
|
+
columnApi.applyColumnState({
|
|
119302
|
+
state: [{ colId: column.getColId(), pinned: column.isPinned() ? null : 'left' }],
|
|
119303
|
+
});
|
|
119304
|
+
}
|
|
119305
|
+
};
|
|
119306
|
+
}
|
|
119307
|
+
sortDataByColumn(params, order) {
|
|
119308
|
+
const col = params.column;
|
|
119309
|
+
const colApi = params.columnApi;
|
|
119310
|
+
if (col.getSort() === order) {
|
|
119311
|
+
colApi.applyColumnState({
|
|
119312
|
+
defaultState: { sort: null },
|
|
119313
|
+
});
|
|
119314
|
+
}
|
|
119315
|
+
else {
|
|
119316
|
+
colApi.applyColumnState({
|
|
119317
|
+
state: [{ colId: col.getColId(), sort: order }],
|
|
119318
|
+
defaultState: { sort: null },
|
|
119319
|
+
});
|
|
119320
|
+
}
|
|
119321
|
+
}
|
|
119263
119322
|
getRowHeight() {
|
|
119264
119323
|
return this.DEFAULT_ROW_HEIGHT;
|
|
119265
119324
|
}
|
|
@@ -119580,7 +119639,10 @@ class AgGridController {
|
|
|
119580
119639
|
return this._gridOptions.api.getSelectedRows();
|
|
119581
119640
|
}
|
|
119582
119641
|
addColumnMenuItem(item) {
|
|
119583
|
-
this._menuItems.
|
|
119642
|
+
const itemsNames = this._menuItems.map(i => i.name);
|
|
119643
|
+
if (!itemsNames.includes(item.name)) {
|
|
119644
|
+
this._menuItems.push(item);
|
|
119645
|
+
}
|
|
119584
119646
|
}
|
|
119585
119647
|
quickFilter(term) {
|
|
119586
119648
|
if (term) {
|
|
@@ -119602,10 +119664,12 @@ class AgGridController {
|
|
|
119602
119664
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
119603
119665
|
}
|
|
119604
119666
|
hasFilterColumn(_columnName) {
|
|
119605
|
-
return false;
|
|
119667
|
+
return false; //TODO: substituir pelo state dos filtros de colunas
|
|
119606
119668
|
}
|
|
119607
119669
|
showColumnFilter() {
|
|
119608
|
-
|
|
119670
|
+
/*
|
|
119671
|
+
TODO: Implementar chamada para apresentar filtro de coluna na grid
|
|
119672
|
+
*/
|
|
119609
119673
|
}
|
|
119610
119674
|
buildColDef(source) {
|
|
119611
119675
|
var _a, _b, _c;
|
|
@@ -119847,8 +119911,8 @@ const EzGrid = class {
|
|
|
119847
119911
|
/**
|
|
119848
119912
|
* Adiciona item de menu nas colunas.
|
|
119849
119913
|
*/
|
|
119850
|
-
async addColumnMenuItem(label, name, action) {
|
|
119851
|
-
this._gridController.addColumnMenuItem({ label, name, action });
|
|
119914
|
+
async addColumnMenuItem(label, name, action, icon) {
|
|
119915
|
+
this._gridController.addColumnMenuItem({ label, name, action, icon });
|
|
119852
119916
|
}
|
|
119853
119917
|
/**
|
|
119854
119918
|
* Aplica o estado das colunas.
|
|
@@ -60,15 +60,7 @@ export default class AgGridController {
|
|
|
60
60
|
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
61
61
|
navigateToNextCell: this.navigateToNextCell.bind(this),
|
|
62
62
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
63
|
-
getMainMenuItems: (params) =>
|
|
64
|
-
const column = params.column;
|
|
65
|
-
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
66
|
-
this._menuItems.forEach(m => items.push({
|
|
67
|
-
name: m.label,
|
|
68
|
-
action: () => m.action(column.getColId(), m.name)
|
|
69
|
-
}));
|
|
70
|
-
return items;
|
|
71
|
-
},
|
|
63
|
+
getMainMenuItems: (params) => this.buildMenuItemOptions(params),
|
|
72
64
|
getRowHeight: this.getRowHeight.bind(this),
|
|
73
65
|
defaultColDef: {
|
|
74
66
|
headerClass: "ez-grid__cell-header",
|
|
@@ -102,6 +94,69 @@ export default class AgGridController {
|
|
|
102
94
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
103
95
|
}
|
|
104
96
|
}
|
|
97
|
+
buildMenuItemOptions(params) {
|
|
98
|
+
const col = params.column;
|
|
99
|
+
const items = [];
|
|
100
|
+
if (col.getColDef().sortable) {
|
|
101
|
+
items.push(this.buildMenuItemOptionSort(params, 'asc'));
|
|
102
|
+
items.push(this.buildMenuItemOptionSort(params, 'desc'));
|
|
103
|
+
}
|
|
104
|
+
/*
|
|
105
|
+
TODO: Adicionar quando filtro de colunar estiver finalizado.
|
|
106
|
+
items.push(this.buildMenuItemFilterColumn(params));
|
|
107
|
+
*/
|
|
108
|
+
this._menuItems.forEach(m => items.push({
|
|
109
|
+
icon: m.icon,
|
|
110
|
+
name: m.label,
|
|
111
|
+
action: () => m.action(params),
|
|
112
|
+
}));
|
|
113
|
+
items.push(this.buildMenuItemOptionPin(params));
|
|
114
|
+
return items;
|
|
115
|
+
}
|
|
116
|
+
buildMenuItemOptionSort(params, sortOrder) {
|
|
117
|
+
return {
|
|
118
|
+
icon: `<div style="${sortOrder === "asc" ? 'transform: rotate(180deg); position: relative; top: -4px;' : ''}"><i class='ez-icon-arrow_downward'></i></div>`,
|
|
119
|
+
name: sortOrder === "asc" ? "Ordenar Ascendente" : "Ordenar Descendente",
|
|
120
|
+
action: () => this.sortDataByColumn(params, sortOrder)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/*
|
|
124
|
+
TODO: Voltar função quando for implementado o filtro de coluna
|
|
125
|
+
private buildMenuItemFilterColumn( _params: GetMainMenuItemsParams): MenuItemDef{
|
|
126
|
+
return {
|
|
127
|
+
icon: `<i class='ez-icon-filter'></i>`,
|
|
128
|
+
name: "Filtrar",
|
|
129
|
+
action: () => window.alert("Abrir popover de filtro")
|
|
130
|
+
}
|
|
131
|
+
}*/
|
|
132
|
+
buildMenuItemOptionPin(params) {
|
|
133
|
+
const { column, columnApi } = params;
|
|
134
|
+
const isPinned = params.column.isPinned();
|
|
135
|
+
return {
|
|
136
|
+
icon: `<i class='ez-icon-${isPinned ? 'un-pin' : 'push-pin'}'></i>`,
|
|
137
|
+
name: isPinned ? "Desafixar coluna" : "Fixar coluna",
|
|
138
|
+
action: () => {
|
|
139
|
+
columnApi.applyColumnState({
|
|
140
|
+
state: [{ colId: column.getColId(), pinned: column.isPinned() ? null : 'left' }],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
sortDataByColumn(params, order) {
|
|
146
|
+
const col = params.column;
|
|
147
|
+
const colApi = params.columnApi;
|
|
148
|
+
if (col.getSort() === order) {
|
|
149
|
+
colApi.applyColumnState({
|
|
150
|
+
defaultState: { sort: null },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
colApi.applyColumnState({
|
|
155
|
+
state: [{ colId: col.getColId(), sort: order }],
|
|
156
|
+
defaultState: { sort: null },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
105
160
|
getRowHeight() {
|
|
106
161
|
return this.DEFAULT_ROW_HEIGHT;
|
|
107
162
|
}
|
|
@@ -422,7 +477,10 @@ export default class AgGridController {
|
|
|
422
477
|
return this._gridOptions.api.getSelectedRows();
|
|
423
478
|
}
|
|
424
479
|
addColumnMenuItem(item) {
|
|
425
|
-
this._menuItems.
|
|
480
|
+
const itemsNames = this._menuItems.map(i => i.name);
|
|
481
|
+
if (!itemsNames.includes(item.name)) {
|
|
482
|
+
this._menuItems.push(item);
|
|
483
|
+
}
|
|
426
484
|
}
|
|
427
485
|
quickFilter(term) {
|
|
428
486
|
if (term) {
|
|
@@ -444,10 +502,12 @@ export default class AgGridController {
|
|
|
444
502
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
445
503
|
}
|
|
446
504
|
hasFilterColumn(_columnName) {
|
|
447
|
-
return false;
|
|
505
|
+
return false; //TODO: substituir pelo state dos filtros de colunas
|
|
448
506
|
}
|
|
449
507
|
showColumnFilter() {
|
|
450
|
-
|
|
508
|
+
/*
|
|
509
|
+
TODO: Implementar chamada para apresentar filtro de coluna na grid
|
|
510
|
+
*/
|
|
451
511
|
}
|
|
452
512
|
buildColDef(source) {
|
|
453
513
|
var _a, _b, _c;
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js
CHANGED
|
@@ -12,8 +12,8 @@ export class EzGridCustomHeader {
|
|
|
12
12
|
</div>
|
|
13
13
|
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
14
14
|
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
15
|
-
<i id='ez-grid-sort-icon-
|
|
16
|
-
<i id='ez-grid-sort-icon-
|
|
15
|
+
<i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
16
|
+
<i id='ez-grid-sort-icon-up' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
19
19
|
this.configMenuClick();
|
|
@@ -24,6 +24,7 @@ export class EzGridCustomHeader {
|
|
|
24
24
|
refresh(agParams) {
|
|
25
25
|
this.params = agParams;
|
|
26
26
|
this.configFilterButton();
|
|
27
|
+
this.configSortIcon();
|
|
27
28
|
}
|
|
28
29
|
configFilterButton() {
|
|
29
30
|
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
@@ -31,7 +32,7 @@ export class EzGridCustomHeader {
|
|
|
31
32
|
this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
|
|
32
33
|
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
configSortIcon() {
|
|
35
36
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
36
37
|
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
37
38
|
}
|
|
@@ -39,17 +40,20 @@ export class EzGridCustomHeader {
|
|
|
39
40
|
if (this.params.enableSorting) {
|
|
40
41
|
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
|
|
41
42
|
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
|
|
42
|
-
this.onSortChangedListener = this.
|
|
43
|
+
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
43
44
|
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
45
|
+
this.configSortIcon();
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
onSortClick(event) {
|
|
47
49
|
this.params.progressSort(event.shiftKey);
|
|
48
50
|
}
|
|
49
51
|
configSortClick() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if (this.params.column.getColDef().sortable) {
|
|
53
|
+
this.headerContainer = this.element.querySelector('#ez-header-container');
|
|
54
|
+
this.onSortClickListener = this.onSortClick.bind(this);
|
|
55
|
+
this.headerContainer.addEventListener('click', this.onSortClickListener);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
onMenuClick() {
|
|
55
59
|
this.params.showColumnMenu(this.menuButton);
|
|
@@ -27,8 +27,8 @@ export class EzGrid {
|
|
|
27
27
|
/**
|
|
28
28
|
* Adiciona item de menu nas colunas.
|
|
29
29
|
*/
|
|
30
|
-
async addColumnMenuItem(label, name, action) {
|
|
31
|
-
this._gridController.addColumnMenuItem({ label, name, action });
|
|
30
|
+
async addColumnMenuItem(label, name, action, icon) {
|
|
31
|
+
this._gridController.addColumnMenuItem({ label, name, action, icon });
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Aplica o estado das colunas.
|
|
@@ -354,7 +354,7 @@ export class EzGrid {
|
|
|
354
354
|
"optional": false,
|
|
355
355
|
"docs": {
|
|
356
356
|
"tags": [],
|
|
357
|
-
"text": "Unidade de dados. Respons\u00E1vel pelo controle de edi\u00E7\u00E3o de registros e
|
|
357
|
+
"text": "Unidade de dados. Respons\u00E1vel pelo controle de edi\u00E7\u00E3o de registros e\ninforma\u00E7\u00F5es pertinentes aos campos."
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
360
|
"statusResolver": {
|
|
@@ -516,7 +516,7 @@ export class EzGrid {
|
|
|
516
516
|
},
|
|
517
517
|
"addColumnMenuItem": {
|
|
518
518
|
"complexType": {
|
|
519
|
-
"signature": "(label: string, name: string, action: Function) => Promise<void>",
|
|
519
|
+
"signature": "(label: string, name: string, action: Function, icon: HTMLElement | string) => Promise<void>",
|
|
520
520
|
"parameters": [{
|
|
521
521
|
"tags": [],
|
|
522
522
|
"text": ""
|
|
@@ -526,6 +526,9 @@ export class EzGrid {
|
|
|
526
526
|
}, {
|
|
527
527
|
"tags": [],
|
|
528
528
|
"text": ""
|
|
529
|
+
}, {
|
|
530
|
+
"tags": [],
|
|
531
|
+
"text": ""
|
|
529
532
|
}],
|
|
530
533
|
"references": {
|
|
531
534
|
"Promise": {
|
|
@@ -533,6 +536,9 @@ export class EzGrid {
|
|
|
533
536
|
},
|
|
534
537
|
"Function": {
|
|
535
538
|
"location": "global"
|
|
539
|
+
},
|
|
540
|
+
"HTMLElement": {
|
|
541
|
+
"location": "global"
|
|
536
542
|
}
|
|
537
543
|
},
|
|
538
544
|
"return": "Promise<void>"
|
|
@@ -123568,8 +123568,8 @@ class EzGridCustomHeader {
|
|
|
123568
123568
|
</div>
|
|
123569
123569
|
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
123570
123570
|
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
123571
|
-
<i id='ez-grid-sort-icon-
|
|
123572
|
-
<i id='ez-grid-sort-icon-
|
|
123571
|
+
<i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
123572
|
+
<i id='ez-grid-sort-icon-up' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: var(--text--medium, 14px);align-self: center;'></i>
|
|
123573
123573
|
</div>
|
|
123574
123574
|
`;
|
|
123575
123575
|
this.configMenuClick();
|
|
@@ -123580,6 +123580,7 @@ class EzGridCustomHeader {
|
|
|
123580
123580
|
refresh(agParams) {
|
|
123581
123581
|
this.params = agParams;
|
|
123582
123582
|
this.configFilterButton();
|
|
123583
|
+
this.configSortIcon();
|
|
123583
123584
|
}
|
|
123584
123585
|
configFilterButton() {
|
|
123585
123586
|
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
@@ -123587,7 +123588,7 @@ class EzGridCustomHeader {
|
|
|
123587
123588
|
this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
|
|
123588
123589
|
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
123589
123590
|
}
|
|
123590
|
-
|
|
123591
|
+
configSortIcon() {
|
|
123591
123592
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
123592
123593
|
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
123593
123594
|
}
|
|
@@ -123595,17 +123596,20 @@ class EzGridCustomHeader {
|
|
|
123595
123596
|
if (this.params.enableSorting) {
|
|
123596
123597
|
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
|
|
123597
123598
|
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
|
|
123598
|
-
this.onSortChangedListener = this.
|
|
123599
|
+
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
123599
123600
|
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
123601
|
+
this.configSortIcon();
|
|
123600
123602
|
}
|
|
123601
123603
|
}
|
|
123602
123604
|
onSortClick(event) {
|
|
123603
123605
|
this.params.progressSort(event.shiftKey);
|
|
123604
123606
|
}
|
|
123605
123607
|
configSortClick() {
|
|
123606
|
-
|
|
123607
|
-
|
|
123608
|
-
|
|
123608
|
+
if (this.params.column.getColDef().sortable) {
|
|
123609
|
+
this.headerContainer = this.element.querySelector('#ez-header-container');
|
|
123610
|
+
this.onSortClickListener = this.onSortClick.bind(this);
|
|
123611
|
+
this.headerContainer.addEventListener('click', this.onSortClickListener);
|
|
123612
|
+
}
|
|
123609
123613
|
}
|
|
123610
123614
|
onMenuClick() {
|
|
123611
123615
|
this.params.showColumnMenu(this.menuButton);
|
|
@@ -123686,15 +123690,7 @@ class AgGridController {
|
|
|
123686
123690
|
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
123687
123691
|
navigateToNextCell: this.navigateToNextCell.bind(this),
|
|
123688
123692
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
123689
|
-
getMainMenuItems: (params) =>
|
|
123690
|
-
const column = params.column;
|
|
123691
|
-
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
123692
|
-
this._menuItems.forEach(m => items.push({
|
|
123693
|
-
name: m.label,
|
|
123694
|
-
action: () => m.action(column.getColId(), m.name)
|
|
123695
|
-
}));
|
|
123696
|
-
return items;
|
|
123697
|
-
},
|
|
123693
|
+
getMainMenuItems: (params) => this.buildMenuItemOptions(params),
|
|
123698
123694
|
getRowHeight: this.getRowHeight.bind(this),
|
|
123699
123695
|
defaultColDef: {
|
|
123700
123696
|
headerClass: "ez-grid__cell-header",
|
|
@@ -123728,6 +123724,69 @@ class AgGridController {
|
|
|
123728
123724
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
123729
123725
|
}
|
|
123730
123726
|
}
|
|
123727
|
+
buildMenuItemOptions(params) {
|
|
123728
|
+
const col = params.column;
|
|
123729
|
+
const items = [];
|
|
123730
|
+
if (col.getColDef().sortable) {
|
|
123731
|
+
items.push(this.buildMenuItemOptionSort(params, 'asc'));
|
|
123732
|
+
items.push(this.buildMenuItemOptionSort(params, 'desc'));
|
|
123733
|
+
}
|
|
123734
|
+
/*
|
|
123735
|
+
TODO: Adicionar quando filtro de colunar estiver finalizado.
|
|
123736
|
+
items.push(this.buildMenuItemFilterColumn(params));
|
|
123737
|
+
*/
|
|
123738
|
+
this._menuItems.forEach(m => items.push({
|
|
123739
|
+
icon: m.icon,
|
|
123740
|
+
name: m.label,
|
|
123741
|
+
action: () => m.action(params),
|
|
123742
|
+
}));
|
|
123743
|
+
items.push(this.buildMenuItemOptionPin(params));
|
|
123744
|
+
return items;
|
|
123745
|
+
}
|
|
123746
|
+
buildMenuItemOptionSort(params, sortOrder) {
|
|
123747
|
+
return {
|
|
123748
|
+
icon: `<div style="${sortOrder === "asc" ? 'transform: rotate(180deg); position: relative; top: -4px;' : ''}"><i class='ez-icon-arrow_downward'></i></div>`,
|
|
123749
|
+
name: sortOrder === "asc" ? "Ordenar Ascendente" : "Ordenar Descendente",
|
|
123750
|
+
action: () => this.sortDataByColumn(params, sortOrder)
|
|
123751
|
+
};
|
|
123752
|
+
}
|
|
123753
|
+
/*
|
|
123754
|
+
TODO: Voltar função quando for implementado o filtro de coluna
|
|
123755
|
+
private buildMenuItemFilterColumn( _params: GetMainMenuItemsParams): MenuItemDef{
|
|
123756
|
+
return {
|
|
123757
|
+
icon: `<i class='ez-icon-filter'></i>`,
|
|
123758
|
+
name: "Filtrar",
|
|
123759
|
+
action: () => window.alert("Abrir popover de filtro")
|
|
123760
|
+
}
|
|
123761
|
+
}*/
|
|
123762
|
+
buildMenuItemOptionPin(params) {
|
|
123763
|
+
const { column, columnApi } = params;
|
|
123764
|
+
const isPinned = params.column.isPinned();
|
|
123765
|
+
return {
|
|
123766
|
+
icon: `<i class='ez-icon-${isPinned ? 'un-pin' : 'push-pin'}'></i>`,
|
|
123767
|
+
name: isPinned ? "Desafixar coluna" : "Fixar coluna",
|
|
123768
|
+
action: () => {
|
|
123769
|
+
columnApi.applyColumnState({
|
|
123770
|
+
state: [{ colId: column.getColId(), pinned: column.isPinned() ? null : 'left' }],
|
|
123771
|
+
});
|
|
123772
|
+
}
|
|
123773
|
+
};
|
|
123774
|
+
}
|
|
123775
|
+
sortDataByColumn(params, order) {
|
|
123776
|
+
const col = params.column;
|
|
123777
|
+
const colApi = params.columnApi;
|
|
123778
|
+
if (col.getSort() === order) {
|
|
123779
|
+
colApi.applyColumnState({
|
|
123780
|
+
defaultState: { sort: null },
|
|
123781
|
+
});
|
|
123782
|
+
}
|
|
123783
|
+
else {
|
|
123784
|
+
colApi.applyColumnState({
|
|
123785
|
+
state: [{ colId: col.getColId(), sort: order }],
|
|
123786
|
+
defaultState: { sort: null },
|
|
123787
|
+
});
|
|
123788
|
+
}
|
|
123789
|
+
}
|
|
123731
123790
|
getRowHeight() {
|
|
123732
123791
|
return this.DEFAULT_ROW_HEIGHT;
|
|
123733
123792
|
}
|
|
@@ -124048,7 +124107,10 @@ class AgGridController {
|
|
|
124048
124107
|
return this._gridOptions.api.getSelectedRows();
|
|
124049
124108
|
}
|
|
124050
124109
|
addColumnMenuItem(item) {
|
|
124051
|
-
this._menuItems.
|
|
124110
|
+
const itemsNames = this._menuItems.map(i => i.name);
|
|
124111
|
+
if (!itemsNames.includes(item.name)) {
|
|
124112
|
+
this._menuItems.push(item);
|
|
124113
|
+
}
|
|
124052
124114
|
}
|
|
124053
124115
|
quickFilter(term) {
|
|
124054
124116
|
if (term) {
|
|
@@ -124070,10 +124132,12 @@ class AgGridController {
|
|
|
124070
124132
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
124071
124133
|
}
|
|
124072
124134
|
hasFilterColumn(_columnName) {
|
|
124073
|
-
return false;
|
|
124135
|
+
return false; //TODO: substituir pelo state dos filtros de colunas
|
|
124074
124136
|
}
|
|
124075
124137
|
showColumnFilter() {
|
|
124076
|
-
|
|
124138
|
+
/*
|
|
124139
|
+
TODO: Implementar chamada para apresentar filtro de coluna na grid
|
|
124140
|
+
*/
|
|
124077
124141
|
}
|
|
124078
124142
|
buildColDef(source) {
|
|
124079
124143
|
var _a, _b, _c;
|
|
@@ -124316,8 +124380,8 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
124316
124380
|
/**
|
|
124317
124381
|
* Adiciona item de menu nas colunas.
|
|
124318
124382
|
*/
|
|
124319
|
-
async addColumnMenuItem(label, name, action) {
|
|
124320
|
-
this._gridController.addColumnMenuItem({ label, name, action });
|
|
124383
|
+
async addColumnMenuItem(label, name, action, icon) {
|
|
124384
|
+
this._gridController.addColumnMenuItem({ label, name, action, icon });
|
|
124321
124385
|
}
|
|
124322
124386
|
/**
|
|
124323
124387
|
* Aplica o estado das colunas.
|