@sankhyalabs/ezui 4.16.1 → 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 +166 -29
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +83 -13
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +81 -0
- package/dist/collection/components/ez-grid/ez-grid.js +10 -4
- package/dist/custom-elements/index.js +166 -29
- package/dist/esm/ez-grid.entry.js +166 -29
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-00f4bff5.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 +6 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +30 -0
- 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
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +0 -16
|
@@ -123369,21 +123369,6 @@ const gridTerms = {
|
|
|
123369
123369
|
ctrlV: "Ctrl+V"
|
|
123370
123370
|
};
|
|
123371
123371
|
|
|
123372
|
-
const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation" title="{{HEADER_TITLE}}">
|
|
123373
|
-
<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
|
|
123374
|
-
<div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
|
|
123375
|
-
<span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
|
|
123376
|
-
<span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon ag-hidden" aria-hidden="true"></span>
|
|
123377
|
-
<span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon ag-hidden" aria-hidden="true"></span>
|
|
123378
|
-
<span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon ag-hidden" aria-hidden="true"></span>
|
|
123379
|
-
<span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon ag-hidden" aria-hidden="true"></span>
|
|
123380
|
-
</div>
|
|
123381
|
-
</div>`;
|
|
123382
|
-
|
|
123383
|
-
function getHeaderColumnTemplate(headerTooltip = "") {
|
|
123384
|
-
return HeaderColumnTemplate.replaceAll("{{HEADER_TITLE}}", headerTooltip)
|
|
123385
|
-
}
|
|
123386
|
-
|
|
123387
123372
|
class DataSource {
|
|
123388
123373
|
constructor(dataUnit, controller, options) {
|
|
123389
123374
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
@@ -123569,6 +123554,88 @@ class SelectionHeader {
|
|
|
123569
123554
|
}
|
|
123570
123555
|
}
|
|
123571
123556
|
|
|
123557
|
+
class EzGridCustomHeader {
|
|
123558
|
+
init(agParams) {
|
|
123559
|
+
var _a;
|
|
123560
|
+
this.params = agParams;
|
|
123561
|
+
this.element = document.createElement('div');
|
|
123562
|
+
this.element.classList.add('ag-cell-label-container');
|
|
123563
|
+
this.element.setAttribute('title', (_a = this.params.tooltip) !== null && _a !== void 0 ? _a : '');
|
|
123564
|
+
this.element.innerHTML = `
|
|
123565
|
+
<div class='ez-flex ez-flex--justify-between'>
|
|
123566
|
+
<i id='ez-grid-filter-icon' class='ez-icon-filter' style='color:#008561'></i>
|
|
123567
|
+
<i id='ez-grid-menu-icon' class='ez-icon-dots-vertical'></i>
|
|
123568
|
+
</div>
|
|
123569
|
+
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
123570
|
+
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
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
|
+
</div>
|
|
123574
|
+
`;
|
|
123575
|
+
this.configMenuClick();
|
|
123576
|
+
this.configSortClick();
|
|
123577
|
+
this.configSortListener();
|
|
123578
|
+
this.configFilterButton();
|
|
123579
|
+
}
|
|
123580
|
+
refresh(agParams) {
|
|
123581
|
+
this.params = agParams;
|
|
123582
|
+
this.configFilterButton();
|
|
123583
|
+
this.configSortIcon();
|
|
123584
|
+
}
|
|
123585
|
+
configFilterButton() {
|
|
123586
|
+
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
123587
|
+
this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
|
|
123588
|
+
this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
|
|
123589
|
+
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
123590
|
+
}
|
|
123591
|
+
configSortIcon() {
|
|
123592
|
+
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
123593
|
+
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
123594
|
+
}
|
|
123595
|
+
configSortListener() {
|
|
123596
|
+
if (this.params.enableSorting) {
|
|
123597
|
+
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
|
|
123598
|
+
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
|
|
123599
|
+
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
123600
|
+
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
123601
|
+
this.configSortIcon();
|
|
123602
|
+
}
|
|
123603
|
+
}
|
|
123604
|
+
onSortClick(event) {
|
|
123605
|
+
this.params.progressSort(event.shiftKey);
|
|
123606
|
+
}
|
|
123607
|
+
configSortClick() {
|
|
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
|
+
}
|
|
123613
|
+
}
|
|
123614
|
+
onMenuClick() {
|
|
123615
|
+
this.params.showColumnMenu(this.menuButton);
|
|
123616
|
+
}
|
|
123617
|
+
configMenuClick() {
|
|
123618
|
+
this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
|
|
123619
|
+
this.onMenuClickListener = this.onMenuClick.bind(this);
|
|
123620
|
+
this.menuButton.addEventListener('click', this.onMenuClickListener);
|
|
123621
|
+
}
|
|
123622
|
+
getGui() {
|
|
123623
|
+
return this.element;
|
|
123624
|
+
}
|
|
123625
|
+
destroy() {
|
|
123626
|
+
if (this.onMenuClickListener) {
|
|
123627
|
+
this.menuButton.removeEventListener('click', this.onMenuClickListener);
|
|
123628
|
+
}
|
|
123629
|
+
if (this.onSortClickListener) {
|
|
123630
|
+
this.headerContainer.removeEventListener('click', this.onSortClickListener);
|
|
123631
|
+
}
|
|
123632
|
+
if (this.onFilterButtonClickListener) {
|
|
123633
|
+
this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
|
|
123634
|
+
}
|
|
123635
|
+
this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
|
|
123636
|
+
}
|
|
123637
|
+
}
|
|
123638
|
+
|
|
123572
123639
|
class AgGridController {
|
|
123573
123640
|
constructor(enterprise) {
|
|
123574
123641
|
this.DEFAULT_ROW_HEIGHT = 30;
|
|
@@ -123623,22 +123690,15 @@ class AgGridController {
|
|
|
123623
123690
|
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
123624
123691
|
navigateToNextCell: this.navigateToNextCell.bind(this),
|
|
123625
123692
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
123626
|
-
getMainMenuItems: (params) =>
|
|
123627
|
-
const column = params.column;
|
|
123628
|
-
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
123629
|
-
this._menuItems.forEach(m => items.push({
|
|
123630
|
-
name: m.label,
|
|
123631
|
-
action: () => m.action(column.getColId(), m.name)
|
|
123632
|
-
}));
|
|
123633
|
-
return items;
|
|
123634
|
-
},
|
|
123693
|
+
getMainMenuItems: (params) => this.buildMenuItemOptions(params),
|
|
123635
123694
|
getRowHeight: this.getRowHeight.bind(this),
|
|
123636
123695
|
defaultColDef: {
|
|
123637
123696
|
headerClass: "ez-grid__cell-header",
|
|
123638
123697
|
cellClass: "ez-grid__cell-body"
|
|
123639
123698
|
},
|
|
123640
123699
|
components: {
|
|
123641
|
-
'ezGridHeaderComponent': SelectionHeader
|
|
123700
|
+
'ezGridHeaderComponent': SelectionHeader,
|
|
123701
|
+
'ezGridCustomHeader': EzGridCustomHeader,
|
|
123642
123702
|
},
|
|
123643
123703
|
context: {
|
|
123644
123704
|
headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
|
|
@@ -123664,6 +123724,69 @@ class AgGridController {
|
|
|
123664
123724
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
123665
123725
|
}
|
|
123666
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
|
+
}
|
|
123667
123790
|
getRowHeight() {
|
|
123668
123791
|
return this.DEFAULT_ROW_HEIGHT;
|
|
123669
123792
|
}
|
|
@@ -123984,7 +124107,10 @@ class AgGridController {
|
|
|
123984
124107
|
return this._gridOptions.api.getSelectedRows();
|
|
123985
124108
|
}
|
|
123986
124109
|
addColumnMenuItem(item) {
|
|
123987
|
-
this._menuItems.
|
|
124110
|
+
const itemsNames = this._menuItems.map(i => i.name);
|
|
124111
|
+
if (!itemsNames.includes(item.name)) {
|
|
124112
|
+
this._menuItems.push(item);
|
|
124113
|
+
}
|
|
123988
124114
|
}
|
|
123989
124115
|
quickFilter(term) {
|
|
123990
124116
|
if (term) {
|
|
@@ -124005,6 +124131,14 @@ class AgGridController {
|
|
|
124005
124131
|
var _a;
|
|
124006
124132
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
124007
124133
|
}
|
|
124134
|
+
hasFilterColumn(_columnName) {
|
|
124135
|
+
return false; //TODO: substituir pelo state dos filtros de colunas
|
|
124136
|
+
}
|
|
124137
|
+
showColumnFilter() {
|
|
124138
|
+
/*
|
|
124139
|
+
TODO: Implementar chamada para apresentar filtro de coluna na grid
|
|
124140
|
+
*/
|
|
124141
|
+
}
|
|
124008
124142
|
buildColDef(source) {
|
|
124009
124143
|
var _a, _b, _c;
|
|
124010
124144
|
let tooltip = undefined;
|
|
@@ -124020,8 +124154,11 @@ class AgGridController {
|
|
|
124020
124154
|
field: source.name,
|
|
124021
124155
|
sortable: propSortable,
|
|
124022
124156
|
resizable: true,
|
|
124157
|
+
headerComponent: 'ezGridCustomHeader',
|
|
124023
124158
|
headerComponentParams: {
|
|
124024
|
-
|
|
124159
|
+
tooltip: tooltip,
|
|
124160
|
+
hasFilter: () => this.hasFilterColumn(source.name),
|
|
124161
|
+
showColumnFilter: () => this.showColumnFilter()
|
|
124025
124162
|
},
|
|
124026
124163
|
valueFormatter: params => {
|
|
124027
124164
|
return this.getFormatterByColumn(params, source);
|
|
@@ -124243,8 +124380,8 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
124243
124380
|
/**
|
|
124244
124381
|
* Adiciona item de menu nas colunas.
|
|
124245
124382
|
*/
|
|
124246
|
-
async addColumnMenuItem(label, name, action) {
|
|
124247
|
-
this._gridController.addColumnMenuItem({ label, name, action });
|
|
124383
|
+
async addColumnMenuItem(label, name, action, icon) {
|
|
124384
|
+
this._gridController.addColumnMenuItem({ label, name, action, icon });
|
|
124248
124385
|
}
|
|
124249
124386
|
/**
|
|
124250
124387
|
* Aplica o estado das colunas.
|
|
@@ -118897,21 +118897,6 @@ const gridTerms = {
|
|
|
118897
118897
|
ctrlV: "Ctrl+V"
|
|
118898
118898
|
};
|
|
118899
118899
|
|
|
118900
|
-
const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation" title="{{HEADER_TITLE}}">
|
|
118901
|
-
<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
|
|
118902
|
-
<div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
|
|
118903
|
-
<span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
|
|
118904
|
-
<span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon ag-hidden" aria-hidden="true"></span>
|
|
118905
|
-
<span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon ag-hidden" aria-hidden="true"></span>
|
|
118906
|
-
<span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon ag-hidden" aria-hidden="true"></span>
|
|
118907
|
-
<span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon ag-hidden" aria-hidden="true"></span>
|
|
118908
|
-
</div>
|
|
118909
|
-
</div>`;
|
|
118910
|
-
|
|
118911
|
-
function getHeaderColumnTemplate(headerTooltip = "") {
|
|
118912
|
-
return HeaderColumnTemplate.replaceAll("{{HEADER_TITLE}}", headerTooltip)
|
|
118913
|
-
}
|
|
118914
|
-
|
|
118915
118900
|
class DataSource {
|
|
118916
118901
|
constructor(dataUnit, controller, options) {
|
|
118917
118902
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
@@ -119097,6 +119082,88 @@ class SelectionHeader {
|
|
|
119097
119082
|
}
|
|
119098
119083
|
}
|
|
119099
119084
|
|
|
119085
|
+
class EzGridCustomHeader {
|
|
119086
|
+
init(agParams) {
|
|
119087
|
+
var _a;
|
|
119088
|
+
this.params = agParams;
|
|
119089
|
+
this.element = document.createElement('div');
|
|
119090
|
+
this.element.classList.add('ag-cell-label-container');
|
|
119091
|
+
this.element.setAttribute('title', (_a = this.params.tooltip) !== null && _a !== void 0 ? _a : '');
|
|
119092
|
+
this.element.innerHTML = `
|
|
119093
|
+
<div class='ez-flex ez-flex--justify-between'>
|
|
119094
|
+
<i id='ez-grid-filter-icon' class='ez-icon-filter' style='color:#008561'></i>
|
|
119095
|
+
<i id='ez-grid-menu-icon' class='ez-icon-dots-vertical'></i>
|
|
119096
|
+
</div>
|
|
119097
|
+
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
119098
|
+
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
119099
|
+
<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>
|
|
119100
|
+
<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>
|
|
119101
|
+
</div>
|
|
119102
|
+
`;
|
|
119103
|
+
this.configMenuClick();
|
|
119104
|
+
this.configSortClick();
|
|
119105
|
+
this.configSortListener();
|
|
119106
|
+
this.configFilterButton();
|
|
119107
|
+
}
|
|
119108
|
+
refresh(agParams) {
|
|
119109
|
+
this.params = agParams;
|
|
119110
|
+
this.configFilterButton();
|
|
119111
|
+
this.configSortIcon();
|
|
119112
|
+
}
|
|
119113
|
+
configFilterButton() {
|
|
119114
|
+
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
119115
|
+
this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
|
|
119116
|
+
this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
|
|
119117
|
+
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
119118
|
+
}
|
|
119119
|
+
configSortIcon() {
|
|
119120
|
+
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
119121
|
+
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
119122
|
+
}
|
|
119123
|
+
configSortListener() {
|
|
119124
|
+
if (this.params.enableSorting) {
|
|
119125
|
+
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
|
|
119126
|
+
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
|
|
119127
|
+
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
119128
|
+
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
119129
|
+
this.configSortIcon();
|
|
119130
|
+
}
|
|
119131
|
+
}
|
|
119132
|
+
onSortClick(event) {
|
|
119133
|
+
this.params.progressSort(event.shiftKey);
|
|
119134
|
+
}
|
|
119135
|
+
configSortClick() {
|
|
119136
|
+
if (this.params.column.getColDef().sortable) {
|
|
119137
|
+
this.headerContainer = this.element.querySelector('#ez-header-container');
|
|
119138
|
+
this.onSortClickListener = this.onSortClick.bind(this);
|
|
119139
|
+
this.headerContainer.addEventListener('click', this.onSortClickListener);
|
|
119140
|
+
}
|
|
119141
|
+
}
|
|
119142
|
+
onMenuClick() {
|
|
119143
|
+
this.params.showColumnMenu(this.menuButton);
|
|
119144
|
+
}
|
|
119145
|
+
configMenuClick() {
|
|
119146
|
+
this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
|
|
119147
|
+
this.onMenuClickListener = this.onMenuClick.bind(this);
|
|
119148
|
+
this.menuButton.addEventListener('click', this.onMenuClickListener);
|
|
119149
|
+
}
|
|
119150
|
+
getGui() {
|
|
119151
|
+
return this.element;
|
|
119152
|
+
}
|
|
119153
|
+
destroy() {
|
|
119154
|
+
if (this.onMenuClickListener) {
|
|
119155
|
+
this.menuButton.removeEventListener('click', this.onMenuClickListener);
|
|
119156
|
+
}
|
|
119157
|
+
if (this.onSortClickListener) {
|
|
119158
|
+
this.headerContainer.removeEventListener('click', this.onSortClickListener);
|
|
119159
|
+
}
|
|
119160
|
+
if (this.onFilterButtonClickListener) {
|
|
119161
|
+
this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
|
|
119162
|
+
}
|
|
119163
|
+
this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
|
|
119164
|
+
}
|
|
119165
|
+
}
|
|
119166
|
+
|
|
119100
119167
|
class AgGridController {
|
|
119101
119168
|
constructor(enterprise) {
|
|
119102
119169
|
this.DEFAULT_ROW_HEIGHT = 30;
|
|
@@ -119151,22 +119218,15 @@ class AgGridController {
|
|
|
119151
119218
|
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
119152
119219
|
navigateToNextCell: this.navigateToNextCell.bind(this),
|
|
119153
119220
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
119154
|
-
getMainMenuItems: (params) =>
|
|
119155
|
-
const column = params.column;
|
|
119156
|
-
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
119157
|
-
this._menuItems.forEach(m => items.push({
|
|
119158
|
-
name: m.label,
|
|
119159
|
-
action: () => m.action(column.getColId(), m.name)
|
|
119160
|
-
}));
|
|
119161
|
-
return items;
|
|
119162
|
-
},
|
|
119221
|
+
getMainMenuItems: (params) => this.buildMenuItemOptions(params),
|
|
119163
119222
|
getRowHeight: this.getRowHeight.bind(this),
|
|
119164
119223
|
defaultColDef: {
|
|
119165
119224
|
headerClass: "ez-grid__cell-header",
|
|
119166
119225
|
cellClass: "ez-grid__cell-body"
|
|
119167
119226
|
},
|
|
119168
119227
|
components: {
|
|
119169
|
-
'ezGridHeaderComponent': SelectionHeader
|
|
119228
|
+
'ezGridHeaderComponent': SelectionHeader,
|
|
119229
|
+
'ezGridCustomHeader': EzGridCustomHeader,
|
|
119170
119230
|
},
|
|
119171
119231
|
context: {
|
|
119172
119232
|
headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
|
|
@@ -119192,6 +119252,69 @@ class AgGridController {
|
|
|
119192
119252
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
119193
119253
|
}
|
|
119194
119254
|
}
|
|
119255
|
+
buildMenuItemOptions(params) {
|
|
119256
|
+
const col = params.column;
|
|
119257
|
+
const items = [];
|
|
119258
|
+
if (col.getColDef().sortable) {
|
|
119259
|
+
items.push(this.buildMenuItemOptionSort(params, 'asc'));
|
|
119260
|
+
items.push(this.buildMenuItemOptionSort(params, 'desc'));
|
|
119261
|
+
}
|
|
119262
|
+
/*
|
|
119263
|
+
TODO: Adicionar quando filtro de colunar estiver finalizado.
|
|
119264
|
+
items.push(this.buildMenuItemFilterColumn(params));
|
|
119265
|
+
*/
|
|
119266
|
+
this._menuItems.forEach(m => items.push({
|
|
119267
|
+
icon: m.icon,
|
|
119268
|
+
name: m.label,
|
|
119269
|
+
action: () => m.action(params),
|
|
119270
|
+
}));
|
|
119271
|
+
items.push(this.buildMenuItemOptionPin(params));
|
|
119272
|
+
return items;
|
|
119273
|
+
}
|
|
119274
|
+
buildMenuItemOptionSort(params, sortOrder) {
|
|
119275
|
+
return {
|
|
119276
|
+
icon: `<div style="${sortOrder === "asc" ? 'transform: rotate(180deg); position: relative; top: -4px;' : ''}"><i class='ez-icon-arrow_downward'></i></div>`,
|
|
119277
|
+
name: sortOrder === "asc" ? "Ordenar Ascendente" : "Ordenar Descendente",
|
|
119278
|
+
action: () => this.sortDataByColumn(params, sortOrder)
|
|
119279
|
+
};
|
|
119280
|
+
}
|
|
119281
|
+
/*
|
|
119282
|
+
TODO: Voltar função quando for implementado o filtro de coluna
|
|
119283
|
+
private buildMenuItemFilterColumn( _params: GetMainMenuItemsParams): MenuItemDef{
|
|
119284
|
+
return {
|
|
119285
|
+
icon: `<i class='ez-icon-filter'></i>`,
|
|
119286
|
+
name: "Filtrar",
|
|
119287
|
+
action: () => window.alert("Abrir popover de filtro")
|
|
119288
|
+
}
|
|
119289
|
+
}*/
|
|
119290
|
+
buildMenuItemOptionPin(params) {
|
|
119291
|
+
const { column, columnApi } = params;
|
|
119292
|
+
const isPinned = params.column.isPinned();
|
|
119293
|
+
return {
|
|
119294
|
+
icon: `<i class='ez-icon-${isPinned ? 'un-pin' : 'push-pin'}'></i>`,
|
|
119295
|
+
name: isPinned ? "Desafixar coluna" : "Fixar coluna",
|
|
119296
|
+
action: () => {
|
|
119297
|
+
columnApi.applyColumnState({
|
|
119298
|
+
state: [{ colId: column.getColId(), pinned: column.isPinned() ? null : 'left' }],
|
|
119299
|
+
});
|
|
119300
|
+
}
|
|
119301
|
+
};
|
|
119302
|
+
}
|
|
119303
|
+
sortDataByColumn(params, order) {
|
|
119304
|
+
const col = params.column;
|
|
119305
|
+
const colApi = params.columnApi;
|
|
119306
|
+
if (col.getSort() === order) {
|
|
119307
|
+
colApi.applyColumnState({
|
|
119308
|
+
defaultState: { sort: null },
|
|
119309
|
+
});
|
|
119310
|
+
}
|
|
119311
|
+
else {
|
|
119312
|
+
colApi.applyColumnState({
|
|
119313
|
+
state: [{ colId: col.getColId(), sort: order }],
|
|
119314
|
+
defaultState: { sort: null },
|
|
119315
|
+
});
|
|
119316
|
+
}
|
|
119317
|
+
}
|
|
119195
119318
|
getRowHeight() {
|
|
119196
119319
|
return this.DEFAULT_ROW_HEIGHT;
|
|
119197
119320
|
}
|
|
@@ -119512,7 +119635,10 @@ class AgGridController {
|
|
|
119512
119635
|
return this._gridOptions.api.getSelectedRows();
|
|
119513
119636
|
}
|
|
119514
119637
|
addColumnMenuItem(item) {
|
|
119515
|
-
this._menuItems.
|
|
119638
|
+
const itemsNames = this._menuItems.map(i => i.name);
|
|
119639
|
+
if (!itemsNames.includes(item.name)) {
|
|
119640
|
+
this._menuItems.push(item);
|
|
119641
|
+
}
|
|
119516
119642
|
}
|
|
119517
119643
|
quickFilter(term) {
|
|
119518
119644
|
if (term) {
|
|
@@ -119533,6 +119659,14 @@ class AgGridController {
|
|
|
119533
119659
|
var _a;
|
|
119534
119660
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
119535
119661
|
}
|
|
119662
|
+
hasFilterColumn(_columnName) {
|
|
119663
|
+
return false; //TODO: substituir pelo state dos filtros de colunas
|
|
119664
|
+
}
|
|
119665
|
+
showColumnFilter() {
|
|
119666
|
+
/*
|
|
119667
|
+
TODO: Implementar chamada para apresentar filtro de coluna na grid
|
|
119668
|
+
*/
|
|
119669
|
+
}
|
|
119536
119670
|
buildColDef(source) {
|
|
119537
119671
|
var _a, _b, _c;
|
|
119538
119672
|
let tooltip = undefined;
|
|
@@ -119548,8 +119682,11 @@ class AgGridController {
|
|
|
119548
119682
|
field: source.name,
|
|
119549
119683
|
sortable: propSortable,
|
|
119550
119684
|
resizable: true,
|
|
119685
|
+
headerComponent: 'ezGridCustomHeader',
|
|
119551
119686
|
headerComponentParams: {
|
|
119552
|
-
|
|
119687
|
+
tooltip: tooltip,
|
|
119688
|
+
hasFilter: () => this.hasFilterColumn(source.name),
|
|
119689
|
+
showColumnFilter: () => this.showColumnFilter()
|
|
119553
119690
|
},
|
|
119554
119691
|
valueFormatter: params => {
|
|
119555
119692
|
return this.getFormatterByColumn(params, source);
|
|
@@ -119770,8 +119907,8 @@ const EzGrid = class {
|
|
|
119770
119907
|
/**
|
|
119771
119908
|
* Adiciona item de menu nas colunas.
|
|
119772
119909
|
*/
|
|
119773
|
-
async addColumnMenuItem(label, name, action) {
|
|
119774
|
-
this._gridController.addColumnMenuItem({ label, name, action });
|
|
119910
|
+
async addColumnMenuItem(label, name, action, icon) {
|
|
119911
|
+
this._gridController.addColumnMenuItem({ label, name, action, icon });
|
|
119775
119912
|
}
|
|
119776
119913
|
/**
|
|
119777
119914
|
* Aplica o estado das colunas.
|
package/dist/ezui/ezui.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-bfc7b8ca.js";export{s as setNonce}from"./p-bfc7b8ca.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-2756003d",[[1,"ez-guide-navigator",{open:[1540],selectedId:[1537,"selected-id"],items:[16],tooltipResolver:[16],filterText:[32],disableItem:[64],enableItem:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],selectGuide:[64],getParent:[64]}]]],["p-dc03c30f",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],displayIcon:[513,"display-icon"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-b01e05a1",[[1,"ez-breadcrumb",{items:[1040],fillMode:[1025,"fill-mode"],maxItems:[1026,"max-items"],positionEllipsis:[1026,"position-ellipsis"],visibleItems:[32],hiddenItems:[32],showDropdown:[32],collapseConfigPosition:[32]}]]],["p-816a3218",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],beforeClose:[1040],show:[64]}]]],["p-
|
|
1
|
+
import{p as e,b as o}from"./p-bfc7b8ca.js";export{s as setNonce}from"./p-bfc7b8ca.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-2756003d",[[1,"ez-guide-navigator",{open:[1540],selectedId:[1537,"selected-id"],items:[16],tooltipResolver:[16],filterText:[32],disableItem:[64],enableItem:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],selectGuide:[64],getParent:[64]}]]],["p-dc03c30f",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],displayIcon:[513,"display-icon"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-b01e05a1",[[1,"ez-breadcrumb",{items:[1040],fillMode:[1025,"fill-mode"],maxItems:[1026,"max-items"],positionEllipsis:[1026,"position-ellipsis"],visibleItems:[32],hiddenItems:[32],showDropdown:[32],collapseConfigPosition:[32]}]]],["p-816a3218",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],beforeClose:[1040],show:[64]}]]],["p-9334e296",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],serverUrl:[1,"server-url"],dataUnit:[16],statusResolver:[16],_paginationInfo:[32],_paginationChangedByKeyboard:[32],_showSelectionCounter:[32],_isAllSelection:[32],_currentPageSelected:[32],_selectionCount:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],quickFilter:[64]},[[0,"ezSelectionChange","onSelectionChange"]]]]],["p-f71f0aa2",[[6,"ez-modal-container",{modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],showTitleBar:[4,"show-title-bar"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],cancelButtonStatus:[1,"cancel-button-status"],okButtonStatus:[1,"ok-button-status"]}]]],["p-997b2df9",[[1,"ez-alert",{alertType:[513,"alert-type"]}]]],["p-6adf3791",[[1,"ez-badge",{size:[513],label:[513],iconLeft:[513,"icon-left"],iconRight:[513,"icon-right"],position:[1040],hasSlot:[32]}]]],["p-d892dc4f",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-2f80d68c",[[1,"ez-file-item",{canRemove:[4,"can-remove"],fileName:[1,"file-name"],iconName:[1,"icon-name"],fileSize:[2,"file-size"],progress:[2]}]]],["p-b2056805",[[1,"ez-list",{dataSource:[1040],listMode:[1,"list-mode"],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],hoverFeedback:[1028,"hover-feedback"],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-e8e7ec07",[[0,"ez-application"]]],["p-848bc350",[[1,"ez-card-item",{item:[16]}]]],["p-1ac06223",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-5110b212",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],heightMode:[1,"height-mode"],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"],scrim:[1]}]]],["p-62ebbd06",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],overlayType:[513,"overlay-type"],updatePosition:[64],show:[64],hide:[64]}]]],["p-04a52868",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[516,"use-header"],heightMode:[513,"height-mode"],ezTitle:[1,"ez-title"]}]]],["p-6e453307",[[1,"ez-radio-button",{value:[1544],options:[1040],enabled:[516],label:[513],direction:[1537]}]]],["p-672c1fba",[[0,"ez-skeleton",{count:[2],variant:[1],width:[1],height:[1],marginBottom:[1,"margin-bottom"],animation:[1]}]]],["p-0c2187a1",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-6d794472",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-41e82662",[[1,"ez-dropdown",{items:[1040],value:[1040],itemBuilder:[16]}]]],["p-fc71f135",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32]}]]],["p-c00e734a",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],noBorder:[516,"no-border"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-64fcb7e7",[[1,"ez-collapsible-box",{value:[1540],boxBordered:[4,"box-bordered"],label:[513],subtitle:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],headerAlign:[513,"header-align"],removable:[516],editable:[516],conditionalSave:[16],_activeEditText:[32],showHide:[64],applyFocusTextEdit:[64],cancelEdition:[64]}]]],["p-5a01fb34",[[1,"ez-search",{value:[1537],label:[1537],enabled:[1540],errorMessage:[1537,"error-message"],optionLoader:[16],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],canShowError:[516,"can-show-error"],setFocus:[64],setBlur:[64],isInvalid:[64],clearValue:[64]}]]],["p-3173d988",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],canShowError:[516,"can-show-error"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-7cce14cd",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],canShowError:[516,"can-show-error"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-d96793f1",[[1,"ez-time-input",{label:[513],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],canShowError:[516,"can-show-error"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-c0f7917c",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],canShowError:[516,"can-show-error"],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-6f11ddf8",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-10370913",[[1,"ez-upload",{label:[1],subtitle:[1],enabled:[4],maxFileSize:[2,"max-file-size"],maxFiles:[2,"max-files"],requestHeaders:[8,"request-headers"],urlUpload:[1,"url-upload"],urlDelete:[1,"url-delete"],value:[1040],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-a4907f2a",[[1,"ez-text-edit",{value:[1],styled:[16],_newValue:[32],applyFocusSelect:[64]}]]],["p-afea6e50",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressSearch:[4,"suppress-search"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],_startLoading:[32],_showLoading:[32],_criteria:[32],setFocus:[64],setBlur:[64],isInvalid:[64],clearValue:[64]}]]],["p-b945133d",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],indeterminate:[1540],mode:[513],compact:[4],getMode:[64],setFocus:[64]}]]],["p-967758ac",[[2,"ez-form-view",{fields:[16],showUp:[64]}]]],["p-4ebb1d15",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],asyncSearch:[516,"async-search"],canShowError:[516,"can-show-error"],setFocus:[64],setBlur:[64],isInvalid:[64],setValue:[64],endSearch:[64]}],[1,"ez-tree",{items:[1040],value:[1040],selectedId:[1537,"selected-id"],iconResolver:[16],tooltipResolver:[16],_tree:[32],_waintingForLoad:[32],selectItem:[64],openItem:[64],disableItem:[64],enableItem:[64],addChild:[64],applyFilter:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],getParent:[64]},[[2,"keydown","onKeyDownListener"]]],[1,"ez-scroller",{direction:[1],locked:[4],activeShadow:[4,"active-shadow"],isActive:[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]],[1,"ez-sidebar-button"]]],["p-994c4934",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-1a902d0e",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-9518ef88",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]},[[2,"click","clickListener"]]]]],["p-6629e5c5",[[2,"ez-form",{dataUnit:[1040],config:[16],recordsValidator:[16],validate:[64]}]]]],e)));
|