@sankhyalabs/ezui 4.18.2 → 4.19.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.
Files changed (78) hide show
  1. package/dist/cjs/constants-3a1d64fb.js +7 -0
  2. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +2 -2
  4. package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
  5. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-grid.cjs.entry.js +373 -282
  7. package/dist/cjs/ez-list.cjs.entry.js +85 -72
  8. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +181 -0
  9. package/dist/cjs/{ez-filter-input_4.cjs.entry.js → ez-scroller_3.cjs.entry.js} +0 -116
  10. package/dist/cjs/ezui.cjs.js +1 -1
  11. package/dist/cjs/filter-column.cjs.entry.js +108 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/collection-manifest.json +3 -0
  14. package/dist/collection/components/ez-check/ez-check.css +1 -0
  15. package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -1
  16. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +186 -119
  17. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
  18. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +8 -1
  19. package/dist/collection/components/ez-grid/ez-grid.css +14 -4
  20. package/dist/collection/components/ez-grid/ez-grid.js +49 -20
  21. package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
  22. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +297 -0
  23. package/dist/collection/components/ez-list/ez-list.css +0 -1
  24. package/dist/collection/components/ez-list/ez-list.js +88 -77
  25. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
  26. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +318 -0
  27. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
  28. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
  29. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
  30. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
  31. package/dist/collection/utils/constants.js +1 -0
  32. package/dist/custom-elements/index.d.ts +18 -0
  33. package/dist/custom-elements/index.js +761 -362
  34. package/dist/esm/constants-6dab64f7.js +4 -0
  35. package/dist/esm/ez-check.entry.js +1 -1
  36. package/dist/esm/ez-combo-box.entry.js +2 -2
  37. package/dist/esm/ez-filter-input_2.entry.js +132 -0
  38. package/dist/esm/ez-form-view.entry.js +1 -1
  39. package/dist/esm/ez-grid.entry.js +373 -282
  40. package/dist/esm/ez-list.entry.js +85 -72
  41. package/dist/esm/ez-multi-selection-list.entry.js +177 -0
  42. package/dist/esm/{ez-filter-input_4.entry.js → ez-scroller_3.entry.js} +3 -118
  43. package/dist/esm/ezui.js +1 -1
  44. package/dist/esm/filter-column.entry.js +104 -0
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/ezui/ezui.esm.js +1 -1
  47. package/dist/ezui/p-06b3c6cd.entry.js +1 -0
  48. package/dist/ezui/{p-967758ac.entry.js → p-0dc118f3.entry.js} +1 -1
  49. package/dist/ezui/p-27a01a26.js +1 -0
  50. package/dist/ezui/p-353be5eb.entry.js +1 -0
  51. package/dist/ezui/p-3e25ecbc.entry.js +1 -0
  52. package/dist/ezui/{p-b945133d.entry.js → p-4186ca4f.entry.js} +1 -1
  53. package/dist/ezui/{p-b2056805.entry.js → p-5c0ac5ba.entry.js} +1 -1
  54. package/dist/ezui/{p-9334e296.entry.js → p-b7dd1382.entry.js} +2 -2
  55. package/dist/ezui/p-c72a799e.entry.js +1 -0
  56. package/dist/ezui/p-e04e9dbd.entry.js +1 -0
  57. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +5 -1
  58. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +14 -5
  59. package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
  60. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +9 -7
  61. package/dist/types/components/ez-grid/ez-grid.d.ts +14 -4
  62. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +45 -0
  63. package/dist/types/components/ez-list/ez-list.d.ts +5 -5
  64. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +64 -0
  65. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
  66. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
  67. package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
  68. package/dist/types/components.d.ts +117 -1
  69. package/dist/types/utils/constants.d.ts +1 -0
  70. package/package.json +1 -1
  71. package/react/components.d.ts +3 -0
  72. package/react/components.js +3 -0
  73. package/react/components.js.map +1 -1
  74. package/dist/cjs/constants-5a75e2f3.js +0 -5
  75. package/dist/esm/constants-ca136201.js +0 -3
  76. package/dist/ezui/p-3f4ae3a3.js +0 -1
  77. package/dist/ezui/p-4ebb1d15.entry.js +0 -1
  78. package/dist/ezui/p-afea6e50.entry.js +0 -1
@@ -1,6 +1,7 @@
1
1
  import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-6fbf1820.js';
2
2
  import { Action, ObjectUtils as ObjectUtils$1, ApplicationContext, StringUtils as StringUtils$1, UserInterface, NumberUtils as NumberUtils$1, DataType, SortMode, ElementIDUtils, JSUtils } from '@sankhyalabs/core';
3
3
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
4
+ import { D as DISTINCT_FILTER_NAME_PREFIX } from './constants-6dab64f7.js';
4
5
 
5
6
  /**
6
7
  * @ag-grid-community/all-modules - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.1
@@ -118822,81 +118823,6 @@ var AllEnterpriseModules = [
118822
118823
 
118823
118824
  ModuleRegistry.registerModules(AllEnterpriseModules);
118824
118825
 
118825
- const gridTerms = {
118826
- // for filter panel
118827
- page: "Página",
118828
- more: "mais",
118829
- to: "para",
118830
- of: "de",
118831
- next: "Próximo",
118832
- last: "Último",
118833
- first: "Primeiro",
118834
- previous: "Anterior",
118835
- loadingOoo: "Carregar",
118836
- // for set filter
118837
- selectAll: "Selecionar tudo",
118838
- searchOoo: "Procurar",
118839
- blanks: "Vazio",
118840
- // for number filter and text filter
118841
- filterOoo: "Filtrar",
118842
- applyFilter: "Aplicar filtro",
118843
- // for number filter
118844
- equals: "Igual",
118845
- lessThan: "Menor que",
118846
- greaterThan: "Maior que",
118847
- // for text filter
118848
- contains: "Contém",
118849
- startsWith: "Começa com",
118850
- endsWith: "Termina com",
118851
- // the header of the default group column
118852
- group: "Grupo",
118853
- // tool panel
118854
- columns: "Colunas",
118855
- rowGroupColumns: "Colunas do grupo de linhas",
118856
- rowGroupColumnsEmptyMessage: "Colunas do grupo de linhas vazias",
118857
- valueColumns: "Valores das colunas",
118858
- pivotMode: "Modo pivô",
118859
- groups: "Grupos",
118860
- values: "Valores",
118861
- pivots: "Pivôs",
118862
- valueColumnsEmptyMessage: "Valores de colunas vazias",
118863
- pivotColumnsEmptyMessage: "Pivôs de colunas vazias",
118864
- toolPanelButton: "Botão de painel de ferramentas",
118865
- // other
118866
- noRowsToShow: "Não há registros para mostrar.",
118867
- // enterprise menu
118868
- pinColumn: "Fixar coluna",
118869
- valueAggregation: "Agregar valor",
118870
- autosizeThiscolumn: "Redimensionar esta coluna",
118871
- autosizeAllColumns: "Redimensionar todas colunas",
118872
- groupBy: "Agrupar por",
118873
- ungroupBy: "Desagrupar por",
118874
- resetColumns: "Resetar colunas",
118875
- expandAll: "Expandir tudo",
118876
- collapseAll: "Contrair tudo",
118877
- toolPanel: "Painel de ferramentas",
118878
- export: "Exportar",
118879
- csvExport: "Exportar para CSV",
118880
- excelExport: "Exportar para Excel",
118881
- // enterprise menu pinning
118882
- pinLeft: "Fixar coluna",
118883
- pinRight: "Fixar a direita",
118884
- noPin: "Desfixar coluna",
118885
- // enterprise menu aggregation and status panel
118886
- sum: "Soma",
118887
- min: "Mínimo",
118888
- max: "Máximo",
118889
- none: "Nenhum",
118890
- count: "Contagem",
118891
- average: "Média",
118892
- // standard menu
118893
- copy: "Copiar",
118894
- copyWithHeaders: "Copiar com cabeçalho",
118895
- ctrlC: "Ctrl+C",
118896
- paste: "Colar",
118897
- ctrlV: "Ctrl+V"
118898
- };
118899
-
118900
118826
  class DataSource {
118901
118827
  constructor(dataUnit, controller, options) {
118902
118828
  this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
@@ -118997,6 +118923,103 @@ class DataSource {
118997
118923
  }
118998
118924
  }
118999
118925
 
118926
+ function calcFilterColumnLeftPosition(leftReference) {
118927
+ const FIX_MARGIN = 60;
118928
+ const FILTER_COLUMN_WIDTH = 330;
118929
+ const screenWidth = window.innerWidth;
118930
+ const maxLeft = screenWidth - (FILTER_COLUMN_WIDTH + FIX_MARGIN);
118931
+ const leftInt = leftReference - FIX_MARGIN;
118932
+ return leftInt > maxLeft ? maxLeft : leftInt;
118933
+ }
118934
+
118935
+ class EzGridCustomHeader {
118936
+ init(agParams) {
118937
+ var _a;
118938
+ this.params = agParams;
118939
+ this.element = document.createElement('div');
118940
+ this.element.classList.add('ag-cell-label-container');
118941
+ this.element.setAttribute('title', (_a = this.params.tooltip) !== null && _a !== void 0 ? _a : '');
118942
+ this.element.innerHTML = `
118943
+ <div class='ez-flex ez-flex--justify-between'>
118944
+ <i id='ez-grid-filter-icon' class='ez-icon-filter' style='color:#008561'></i>
118945
+ <i id='ez-grid-menu-icon' class='ez-icon-dots-vertical'></i>
118946
+ </div>
118947
+ <div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
118948
+ <span class='ag-header-cell-text'>${this.params.displayName}</span>
118949
+ <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>
118950
+ <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>
118951
+ </div>
118952
+ `;
118953
+ this.configMenuClick();
118954
+ this.configSortClick();
118955
+ this.configSortListener();
118956
+ this.configFilterButton();
118957
+ }
118958
+ refresh(agParams) {
118959
+ this.params = agParams;
118960
+ this.configFilterButton();
118961
+ this.configSortIcon();
118962
+ }
118963
+ configFilterButton() {
118964
+ this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
118965
+ this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
118966
+ this.onFilterButtonClickListener = this.onClickFilter.bind(this);
118967
+ this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
118968
+ }
118969
+ onClickFilter() {
118970
+ var _a;
118971
+ const iconLeft = (_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left;
118972
+ this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`);
118973
+ }
118974
+ configSortIcon() {
118975
+ this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
118976
+ this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
118977
+ }
118978
+ configSortListener() {
118979
+ if (this.params.enableSorting) {
118980
+ this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
118981
+ this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
118982
+ this.onSortChangedListener = this.configSortIcon.bind(this);
118983
+ this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
118984
+ this.configSortIcon();
118985
+ }
118986
+ }
118987
+ onSortClick(event) {
118988
+ this.params.progressSort(event.shiftKey);
118989
+ }
118990
+ configSortClick() {
118991
+ if (this.params.column.getColDef().sortable) {
118992
+ this.headerContainer = this.element.querySelector('#ez-header-container');
118993
+ this.onSortClickListener = this.onSortClick.bind(this);
118994
+ this.headerContainer.addEventListener('click', this.onSortClickListener);
118995
+ }
118996
+ }
118997
+ onMenuClick() {
118998
+ this.params.showColumnMenu(this.menuButton);
118999
+ }
119000
+ configMenuClick() {
119001
+ this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
119002
+ this.onMenuClickListener = this.onMenuClick.bind(this);
119003
+ this.menuButton.addEventListener('click', this.onMenuClickListener);
119004
+ }
119005
+ getGui() {
119006
+ return this.element;
119007
+ }
119008
+ destroy() {
119009
+ if (this.onMenuClickListener) {
119010
+ this.menuButton.removeEventListener('click', this.onMenuClickListener);
119011
+ }
119012
+ if (this.onSortClickListener) {
119013
+ this.headerContainer.removeEventListener('click', this.onSortClickListener);
119014
+ }
119015
+ if (this.onFilterButtonClickListener) {
119016
+ this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
119017
+ }
119018
+ this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
119019
+ this.params.column.removeEventListener('applyFilterColumnOptions', this.onFilterAppliedListener);
119020
+ }
119021
+ }
119022
+
119000
119023
  class CellRendererStatus {
119001
119024
  constructor() {
119002
119025
  this.DEFAULT_COLOR = 'transparent';
@@ -119082,102 +119105,111 @@ class SelectionHeader {
119082
119105
  }
119083
119106
  }
119084
119107
 
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);
119108
+ const gridTerms = {
119109
+ // for filter panel
119110
+ page: "Página",
119111
+ more: "mais",
119112
+ to: "para",
119113
+ of: "de",
119114
+ next: "Próximo",
119115
+ last: "Último",
119116
+ first: "Primeiro",
119117
+ previous: "Anterior",
119118
+ loadingOoo: "Carregar",
119119
+ // for set filter
119120
+ selectAll: "Selecionar tudo",
119121
+ searchOoo: "Procurar",
119122
+ blanks: "Vazio",
119123
+ // for number filter and text filter
119124
+ filterOoo: "Filtrar",
119125
+ applyFilter: "Aplicar filtro",
119126
+ // for number filter
119127
+ equals: "Igual",
119128
+ lessThan: "Menor que",
119129
+ greaterThan: "Maior que",
119130
+ // for text filter
119131
+ contains: "Contém",
119132
+ startsWith: "Começa com",
119133
+ endsWith: "Termina com",
119134
+ // the header of the default group column
119135
+ group: "Grupo",
119136
+ // tool panel
119137
+ columns: "Colunas",
119138
+ rowGroupColumns: "Colunas do grupo de linhas",
119139
+ rowGroupColumnsEmptyMessage: "Colunas do grupo de linhas vazias",
119140
+ valueColumns: "Valores das colunas",
119141
+ pivotMode: "Modo pivô",
119142
+ groups: "Grupos",
119143
+ values: "Valores",
119144
+ pivots: "Pivôs",
119145
+ valueColumnsEmptyMessage: "Valores de colunas vazias",
119146
+ pivotColumnsEmptyMessage: "Pivôs de colunas vazias",
119147
+ toolPanelButton: "Botão de painel de ferramentas",
119148
+ // other
119149
+ noRowsToShow: "Não há registros para mostrar.",
119150
+ // enterprise menu
119151
+ pinColumn: "Fixar coluna",
119152
+ valueAggregation: "Agregar valor",
119153
+ autosizeThiscolumn: "Redimensionar esta coluna",
119154
+ autosizeAllColumns: "Redimensionar todas colunas",
119155
+ groupBy: "Agrupar por",
119156
+ ungroupBy: "Desagrupar por",
119157
+ resetColumns: "Resetar colunas",
119158
+ expandAll: "Expandir tudo",
119159
+ collapseAll: "Contrair tudo",
119160
+ toolPanel: "Painel de ferramentas",
119161
+ export: "Exportar",
119162
+ csvExport: "Exportar para CSV",
119163
+ excelExport: "Exportar para Excel",
119164
+ // enterprise menu pinning
119165
+ pinLeft: "Fixar coluna",
119166
+ pinRight: "Fixar a direita",
119167
+ noPin: "Desfixar coluna",
119168
+ // enterprise menu aggregation and status panel
119169
+ sum: "Soma",
119170
+ min: "Mínimo",
119171
+ max: "Máximo",
119172
+ none: "Nenhum",
119173
+ count: "Contagem",
119174
+ average: "Média",
119175
+ // standard menu
119176
+ copy: "Copiar",
119177
+ copyWithHeaders: "Copiar com cabeçalho",
119178
+ ctrlC: "Ctrl+C",
119179
+ paste: "Colar",
119180
+ ctrlV: "Ctrl+V"
119181
+ };
119182
+
119183
+ class AgGridController {
119184
+ configFilterColumn(filterColumn) {
119185
+ this._filterColumn = filterColumn;
119186
+ this._filterColumn.addEventListener('applyFilterColumnOptions', this.handleFilteredColumnsChanged.bind(this));
119149
119187
  }
119150
- getGui() {
119151
- return this.element;
119188
+ handleFilteredColumnsChanged(event) {
119189
+ const applied = event.detail;
119190
+ this._filteredColumns.set(applied.field, applied.values);
119191
+ this._gridOptions.api.refreshHeader();
119192
+ this._dataUnit.loadData();
119152
119193
  }
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);
119194
+ showFilterColumn(configs) {
119195
+ var _a;
119196
+ (_a = this._filterColumn) === null || _a === void 0 ? void 0 : _a.show(configs);
119164
119197
  }
119165
- }
119166
-
119167
- class AgGridController {
119168
119198
  constructor(enterprise) {
119169
119199
  this.DEFAULT_ROW_HEIGHT = 30;
119170
119200
  this.DEFAULT_HEADER_ROW_HEIGHT = 32;
119171
- this.CHECK_BOX_COL_ID = "checkBoxColumn";
119172
- this.STATUS_COL_ID = "statusColumn";
119173
- this.RECORD_ARCHIVE_COL_ID = "__RECORD_ARCHIVE__";
119201
+ this.CHECK_BOX_COL_ID = 'checkBoxColumn';
119202
+ this.STATUS_COL_ID = 'statusColumn';
119203
+ this.RECORD_ARCHIVE_COL_ID = '__RECORD_ARCHIVE__';
119174
119204
  this.BLOCK_LOAD_DEBOUNCE = 400;
119175
119205
  this.DEFAULT_FONT_SIZE = 14;
119176
119206
  this.DEFAULT_ICON_SIZE = 12;
119177
119207
  this.DEFAULT_MAX_SIZE = 200;
119178
119208
  this._menuItems = [];
119179
- this._idAttribName = "__record__id__";
119209
+ this._idAttribName = '__record__id__';
119180
119210
  this._gridConfig = [];
119211
+ this._filteredColumns = new Map();
119212
+ this._filterColumnleftPosition = '0px';
119181
119213
  this._enterprise = enterprise;
119182
119214
  }
119183
119215
  getGridConfig() {
@@ -119185,23 +119217,59 @@ class AgGridController {
119185
119217
  }
119186
119218
  getSort() {
119187
119219
  const sortedColumns = [];
119188
- this._gridOptions.columnApi.getColumnState()
119220
+ this._gridOptions.columnApi
119221
+ .getColumnState()
119189
119222
  .sort((colA, colB) => colA.sortIndex - colB.sortIndex)
119190
119223
  .forEach(({ colId, sort }) => {
119191
119224
  if (sort) {
119192
119225
  const field = this._dataUnit.getField(colId);
119193
- const mode = sort === "asc" ? SortMode.ASC : SortMode.DESC;
119226
+ const mode = sort === 'asc' ? SortMode.ASC : SortMode.DESC;
119194
119227
  const sortField = field ? { field: field.name, dataType: field.dataType, mode } : { field: colId, dataType: DataType.TEXT, mode };
119195
119228
  sortedColumns.push(sortField);
119196
119229
  }
119197
119230
  });
119198
119231
  return sortedColumns;
119199
119232
  }
119200
- ;
119233
+ getFilter() {
119234
+ if (!this._filteredColumns || this._filteredColumns.size === 0) {
119235
+ return;
119236
+ }
119237
+ return Array.from(this._filteredColumns.entries())
119238
+ .map(([column, items]) => {
119239
+ var _a;
119240
+ const checkedOptions = items.filter(option => option.check);
119241
+ if (checkedOptions.length > 0) {
119242
+ const fieldDescriptor = this._dataUnit.getField(column);
119243
+ const dataType = (_a = fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.dataType) !== null && _a !== void 0 ? _a : DataType.TEXT;
119244
+ let placeholders = '';
119245
+ const params = [];
119246
+ checkedOptions.forEach(option => {
119247
+ if (placeholders.length > 0) {
119248
+ placeholders = placeholders + ',';
119249
+ }
119250
+ const paramName = `PARAM_${column}_${params.length + 1}`;
119251
+ placeholders = `${placeholders}:${paramName}`; //FIXME: trocar por ? quando o backend estiver funcionando
119252
+ params.push({
119253
+ dataType: dataType === DataType.OBJECT ? DataType.TEXT : dataType,
119254
+ name: paramName,
119255
+ value: option.value,
119256
+ });
119257
+ });
119258
+ const columnExpression = dataType === DataType.DATE ? `onlydate(this.${column})` : `this.${column}`;
119259
+ return {
119260
+ name: `${DISTINCT_FILTER_NAME_PREFIX}${column}`,
119261
+ expression: `${columnExpression} in (${placeholders})`,
119262
+ params,
119263
+ };
119264
+ }
119265
+ return undefined;
119266
+ })
119267
+ .filter(item => item != undefined);
119268
+ }
119201
119269
  initDatagrid(container, options) {
119202
119270
  var _a;
119203
119271
  if (this._grid === undefined) {
119204
- LicenseManager.setLicenseKey(ApplicationContext.getContextValue("__EZUI__GRID_LICENSE__"));
119272
+ LicenseManager.setLicenseKey(ApplicationContext.getContextValue('__EZUI__GRID_LICENSE__'));
119205
119273
  this._columnStateChangeCallback = options.onColumnStateChange;
119206
119274
  this._selectionChangeCallback = options.onSelectionChange;
119207
119275
  this._doubleClickCallBack = options.onDoubleClick;
@@ -119210,28 +119278,30 @@ class AgGridController {
119210
119278
  this._statusResolver = options.statusResolver;
119211
119279
  if (this._dataUnit) {
119212
119280
  this._dataUnit.sortingProvider = this;
119281
+ this._dataUnit.addFilterProvider(this);
119213
119282
  }
119214
119283
  this._gridOptions = {
119215
119284
  localeText: gridTerms,
119216
- rowSelection: this._multipleSelection ? "multiple" : "single",
119285
+ rowSelection: this._multipleSelection ? 'multiple' : 'single',
119217
119286
  sortingOrder: ['desc', 'asc', null],
119218
119287
  blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
119219
119288
  navigateToNextCell: this.navigateToNextCell.bind(this),
119220
- getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
119289
+ getRowNodeId: this._dataUnit ? params => (typeof params === 'string' ? params : params[this._idAttribName]) : undefined,
119221
119290
  getMainMenuItems: (params) => this.buildMenuItemOptions(params),
119291
+ postProcessPopup: (params) => this.setFilterColumnLeftPosition(params),
119222
119292
  getRowHeight: this.getRowHeight.bind(this),
119223
119293
  defaultColDef: {
119224
- headerClass: "ez-grid__cell-header",
119225
- cellClass: "ez-grid__cell-body"
119294
+ headerClass: 'ez-grid__cell-header',
119295
+ cellClass: 'ez-grid__cell-body',
119226
119296
  },
119227
119297
  components: {
119228
- 'ezGridHeaderComponent': SelectionHeader,
119229
- 'ezGridCustomHeader': EzGridCustomHeader,
119298
+ ezGridHeaderComponent: SelectionHeader,
119299
+ ezGridCustomHeader: EzGridCustomHeader,
119230
119300
  },
119231
119301
  context: {
119232
119302
  headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
119233
- headerCheckStatusSetter: (selectAll) => this.updateSelectionForAll(selectAll)
119234
- }
119303
+ headerCheckStatusSetter: (selectAll) => this.updateSelectionForAll(selectAll),
119304
+ },
119235
119305
  };
119236
119306
  this.defineRowModelType(this._gridOptions, options);
119237
119307
  this.setOptionsEvents(this._gridOptions);
@@ -119252,17 +119322,22 @@ class AgGridController {
119252
119322
  this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
119253
119323
  }
119254
119324
  }
119325
+ setFilterColumnLeftPosition(params) {
119326
+ if (params.type === 'columnMenu') {
119327
+ const ePopup = params.ePopup;
119328
+ const leftString = ePopup.style.left.replace('px', '');
119329
+ this._filterColumnleftPosition = `${calcFilterColumnLeftPosition(parseInt(leftString))}px`;
119330
+ return;
119331
+ }
119332
+ }
119255
119333
  buildMenuItemOptions(params) {
119256
119334
  const col = params.column;
119257
119335
  const items = [];
119258
119336
  if (col.getColDef().sortable) {
119259
119337
  items.push(this.buildMenuItemOptionSort(params, 'asc'));
119260
119338
  items.push(this.buildMenuItemOptionSort(params, 'desc'));
119339
+ items.push(this.buildMenuItemFilterColumn(params));
119261
119340
  }
119262
- /*
119263
- TODO: Adicionar quando filtro de colunar estiver finalizado.
119264
- items.push(this.buildMenuItemFilterColumn(params));
119265
- */
119266
119341
  this._menuItems.forEach(m => items.push({
119267
119342
  icon: m.icon,
119268
119343
  name: m.label,
@@ -119273,31 +119348,31 @@ class AgGridController {
119273
119348
  }
119274
119349
  buildMenuItemOptionSort(params, sortOrder) {
119275
119350
  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)
119351
+ icon: `<i class='ez-icon-arrow_downward'></i>`,
119352
+ name: sortOrder === 'asc' ? 'Ordenar Ascendente' : 'Ordenar Descendente',
119353
+ action: () => this.sortDataByColumn(params, sortOrder),
119354
+ };
119355
+ }
119356
+ buildMenuItemFilterColumn(params) {
119357
+ const columnName = params.column.getId();
119358
+ const columnLabel = params.column.getColDef().headerName;
119359
+ return {
119360
+ icon: `<i class='ez-icon-filter'></i>`,
119361
+ name: 'Filtrar',
119362
+ action: () => this.showFilterColumn({ columnName, columnLabel, leftPosition: this._filterColumnleftPosition, filteredOptions: this._filteredColumns.get(columnName) }),
119279
119363
  };
119280
119364
  }
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
119365
  buildMenuItemOptionPin(params) {
119291
119366
  const { column, columnApi } = params;
119292
119367
  const isPinned = params.column.isPinned();
119293
119368
  return {
119294
119369
  icon: `<i class='ez-icon-${isPinned ? 'un-pin' : 'push-pin'}'></i>`,
119295
- name: isPinned ? "Desafixar coluna" : "Fixar coluna",
119370
+ name: isPinned ? 'Desafixar coluna' : 'Fixar coluna',
119296
119371
  action: () => {
119297
119372
  columnApi.applyColumnState({
119298
119373
  state: [{ colId: column.getColId(), pinned: column.isPinned() ? null : 'left' }],
119299
119374
  });
119300
- }
119375
+ },
119301
119376
  };
119302
119377
  }
119303
119378
  sortDataByColumn(params, order) {
@@ -119349,9 +119424,9 @@ class AgGridController {
119349
119424
  (_h = this._dataUnit) === null || _h === void 0 ? void 0 : _h.nextRecord();
119350
119425
  }
119351
119426
  return params.nextCellPosition;
119352
- case "ArrowLeft":
119353
- case "ArrowRight":
119354
- if (((_j = params.nextCellPosition) === null || _j === void 0 ? void 0 : _j.column.colDef.headerName) !== "") {
119427
+ case 'ArrowLeft':
119428
+ case 'ArrowRight':
119429
+ if (((_j = params.nextCellPosition) === null || _j === void 0 ? void 0 : _j.column.colDef.headerName) !== '') {
119355
119430
  return params.nextCellPosition;
119356
119431
  }
119357
119432
  else {
@@ -119362,21 +119437,21 @@ class AgGridController {
119362
119437
  }
119363
119438
  defineRowModelType(opt, sourceOptions) {
119364
119439
  if (this._dataUnit != undefined) {
119365
- opt.rowModelType = "serverSide";
119440
+ opt.rowModelType = 'serverSide';
119366
119441
  opt.serverSideDatasource = new DataSource(this._dataUnit, this, sourceOptions);
119367
119442
  opt.serverSideSortOnServer = true;
119368
119443
  opt.columnDefs = this._colDefs;
119369
119444
  }
119370
119445
  }
119371
119446
  setOptionsEvents(opt) {
119372
- opt.onSortChanged = e => this.onCallStateChange("sort", e);
119373
- opt.onColumnResized = e => this.onCallStateChange("columnResize", e);
119374
- opt.onColumnPinned = e => this.onCallStateChange("columnPinned", e);
119375
- opt.onColumnMoved = e => this.onCallStateChange("columnMoved", e);
119376
- opt.onColumnVisible = e => this.onCallStateChange("visibleChange", e);
119447
+ opt.onSortChanged = e => this.onCallStateChange('sort', e);
119448
+ opt.onColumnResized = e => this.onCallStateChange('columnResize', e);
119449
+ opt.onColumnPinned = e => this.onCallStateChange('columnPinned', e);
119450
+ opt.onColumnMoved = e => this.onCallStateChange('columnMoved', e);
119451
+ opt.onColumnVisible = e => this.onCallStateChange('visibleChange', e);
119377
119452
  opt.onSelectionChanged = e => this.onSelectionChange(e);
119378
119453
  opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
119379
- opt.onDragStopped = evt => this.onCallStateChange("columnMovedEnd", evt);
119454
+ opt.onDragStopped = evt => this.onCallStateChange('columnMovedEnd', evt);
119380
119455
  }
119381
119456
  setOptionsSupress(opt) {
119382
119457
  opt.suppressDragLeaveHidesColumns = true;
@@ -119410,18 +119485,18 @@ class AgGridController {
119410
119485
  }
119411
119486
  setData(data) {
119412
119487
  if (this._grid === undefined) {
119413
- throw new Error("Erro interno: Grid ainda não inicializado.");
119488
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119414
119489
  }
119415
119490
  this._gridOptions.api.setRowData(data);
119416
119491
  }
119417
119492
  addRows() {
119418
119493
  if (this._grid === undefined) {
119419
- throw new Error("Erro interno: Grid ainda não inicializado.");
119494
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119420
119495
  }
119421
119496
  }
119422
119497
  updateRows() {
119423
119498
  if (this._grid === undefined) {
119424
- throw new Error("Erro interno: Grid ainda não inicializado.");
119499
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119425
119500
  }
119426
119501
  }
119427
119502
  selectAll(quietly = false) {
@@ -119444,7 +119519,7 @@ class AgGridController {
119444
119519
  try {
119445
119520
  this._gridOptions.context.selectionChangeQuietly = quietly;
119446
119521
  if (this._grid === undefined) {
119447
- throw new Error("Erro interno: Grid ainda não inicializado.");
119522
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119448
119523
  }
119449
119524
  let lastSelected;
119450
119525
  this._gridOptions.api.forEachNode(node => {
@@ -119476,13 +119551,13 @@ class AgGridController {
119476
119551
  }
119477
119552
  removeRows() {
119478
119553
  if (this._grid === undefined) {
119479
- throw new Error("Erro interno: Grid ainda não inicializado.");
119554
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119480
119555
  }
119481
119556
  this._gridOptions.api.refreshServerSide({ purge: true });
119482
119557
  }
119483
119558
  changeValues(changes, rowIds) {
119484
119559
  if (this._grid === undefined) {
119485
- throw new Error("Erro interno: Grid ainda não inicializado.");
119560
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119486
119561
  }
119487
119562
  if (changes) {
119488
119563
  let rowNodes;
@@ -119509,7 +119584,7 @@ class AgGridController {
119509
119584
  }
119510
119585
  refresh() {
119511
119586
  if (this._grid === undefined) {
119512
- throw new Error("Erro interno: Grid ainda não inicializado.");
119587
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119513
119588
  }
119514
119589
  this._gridOptions.api.refreshServerSide({ purge: false });
119515
119590
  }
@@ -119527,17 +119602,19 @@ class AgGridController {
119527
119602
  }
119528
119603
  setFocusOnRow(rowIndex) {
119529
119604
  let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
119530
- let firstCell = displayedColumns.find((column) => column.getColDef().headerName !== "");
119605
+ let firstCell = displayedColumns.find(column => column.getColDef().headerName !== '');
119531
119606
  this._gridOptions.api.ensureColumnVisible(firstCell);
119532
119607
  this._gridOptions.api.ensureIndexVisible(rowIndex);
119533
119608
  this._gridOptions.api.setFocusedCell(rowIndex, firstCell);
119534
119609
  }
119535
119610
  setColumnsDef(cols) {
119536
- const newColDefs = [Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: "", checkboxSelection: true, width: 29, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, this._multipleSelection && { headerComponent: "ezGridHeaderComponent", headerClass: "ag-column-select-header" })];
119611
+ const newColDefs = [
119612
+ Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: '', checkboxSelection: true, width: 29, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, (this._multipleSelection && { headerComponent: 'ezGridHeaderComponent', headerClass: 'ag-column-select-header' })),
119613
+ ];
119537
119614
  if (this._statusResolver != undefined) {
119538
119615
  newColDefs.push({
119539
119616
  colId: this.STATUS_COL_ID,
119540
- headerName: "",
119617
+ headerName: '',
119541
119618
  checkboxSelection: false,
119542
119619
  headerCheckboxSelection: false,
119543
119620
  width: 29,
@@ -119548,11 +119625,11 @@ class AgGridController {
119548
119625
  pinned: true,
119549
119626
  cellRenderer: CellRendererStatus,
119550
119627
  cellRendererParams: {
119551
- statusResolver: this._statusResolver
119628
+ statusResolver: this._statusResolver,
119552
119629
  },
119553
119630
  cellStyle: {
119554
- "text-align": "center"
119555
- }
119631
+ 'text-align': 'center',
119632
+ },
119556
119633
  });
119557
119634
  }
119558
119635
  cols.forEach(c => {
@@ -119565,25 +119642,27 @@ class AgGridController {
119565
119642
  }
119566
119643
  getColumnsDef() {
119567
119644
  if (this._grid === undefined) {
119568
- throw new Error("Erro interno: Grid ainda não inicializado.");
119645
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119569
119646
  }
119570
119647
  const colDef = this._gridOptions.columnApi.getColumns();
119571
- return colDef.filter(c => ![this.CHECK_BOX_COL_ID, this.STATUS_COL_ID].includes(c.getColId())).map(c => {
119648
+ return colDef
119649
+ .filter(c => ![this.CHECK_BOX_COL_ID, this.STATUS_COL_ID].includes(c.getColId()))
119650
+ .map(c => {
119572
119651
  const def = c.getColDef();
119573
119652
  const colDef = { name: def.field, label: def.headerName };
119574
- this.conditionalSet(colDef, "sortable", def.sortable);
119575
- this.conditionalSet(colDef, "resizable", def.resizable);
119576
- this.conditionalSet(colDef, "sort", def.sort);
119577
- this.conditionalSet(colDef, "sortIndex", def.sortIndex);
119578
- this.conditionalSet(colDef, "width", def.width);
119579
- this.conditionalSet(colDef, "pinned", def.pinned !== null);
119580
- this.conditionalSet(colDef, "hidden", def.hide);
119653
+ this.conditionalSet(colDef, 'sortable', def.sortable);
119654
+ this.conditionalSet(colDef, 'resizable', def.resizable);
119655
+ this.conditionalSet(colDef, 'sort', def.sort);
119656
+ this.conditionalSet(colDef, 'sortIndex', def.sortIndex);
119657
+ this.conditionalSet(colDef, 'width', def.width);
119658
+ this.conditionalSet(colDef, 'pinned', def.pinned !== null);
119659
+ this.conditionalSet(colDef, 'hidden', def.hide);
119581
119660
  return colDef;
119582
119661
  });
119583
119662
  }
119584
119663
  setColumnsState(state) {
119585
119664
  if (this._grid === undefined) {
119586
- throw new Error("Erro interno: Grid ainda não inicializado.");
119665
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119587
119666
  }
119588
119667
  const colDef = this._gridOptions.columnApi.getColumns();
119589
119668
  let columns = this.getColumnsDef();
@@ -119612,24 +119691,26 @@ class AgGridController {
119612
119691
  }
119613
119692
  getColumnsState() {
119614
119693
  if (this._grid === undefined) {
119615
- throw new Error("Erro interno: Grid ainda não inicializado.");
119694
+ throw new Error('Erro interno: Grid ainda não inicializado.');
119616
119695
  }
119617
119696
  const colState = this._gridOptions.columnApi.getColumnState();
119618
- return colState.map(s => {
119697
+ return colState
119698
+ .map(s => {
119619
119699
  const def = this._gridOptions.columnApi.getColumn(s.colId).getColDef();
119620
119700
  const label = def.headerName;
119621
- const name = def.checkboxSelection ? "__SELECTION__" : s.colId;
119701
+ const name = def.checkboxSelection ? '__SELECTION__' : s.colId;
119622
119702
  const colState = { label, name };
119623
- this.conditionalSet(colState, "sort", s.sort);
119624
- this.conditionalSet(colState, "sortIndex", s.sortIndex);
119625
- this.conditionalSet(colState, "width", s.width);
119626
- this.conditionalSet(colState, "pinned", s.pinned !== null);
119627
- this.conditionalSet(colState, "hidden", s.hide);
119703
+ this.conditionalSet(colState, 'sort', s.sort);
119704
+ this.conditionalSet(colState, 'sortIndex', s.sortIndex);
119705
+ this.conditionalSet(colState, 'width', s.width);
119706
+ this.conditionalSet(colState, 'pinned', s.pinned !== null);
119707
+ this.conditionalSet(colState, 'hidden', s.hide);
119628
119708
  const props = new Map();
119629
119709
  props.set('sortable', def.sortable);
119630
- this.conditionalSet(colState, "props", props);
119710
+ this.conditionalSet(colState, 'props', props);
119631
119711
  return colState;
119632
- }).filter(c => c.name !== "__SELECTION__" && c.name !== this.STATUS_COL_ID);
119712
+ })
119713
+ .filter(c => c.name !== '__SELECTION__' && c.name !== this.STATUS_COL_ID);
119633
119714
  }
119634
119715
  getSelection() {
119635
119716
  return this._gridOptions.api.getSelectedRows();
@@ -119647,7 +119728,7 @@ class AgGridController {
119647
119728
  fields: this._gridOptions.columnApi
119648
119729
  .getColumns()
119649
119730
  .filter(col => col.isVisible() && ![this.CHECK_BOX_COL_ID, this.STATUS_COL_ID, this.RECORD_ARCHIVE_COL_ID].includes(col.getColId()))
119650
- .map(col => col.getColId())
119731
+ .map(col => col.getColId()),
119651
119732
  };
119652
119733
  this._dataSource.quickFilter = quickFilter;
119653
119734
  }
@@ -119659,23 +119740,20 @@ class AgGridController {
119659
119740
  var _a;
119660
119741
  (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
119661
119742
  }
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
- */
119743
+ hasFilterColumn(columnName) {
119744
+ var _a;
119745
+ const filterOptions = (_a = this._filteredColumns.get(columnName)) !== null && _a !== void 0 ? _a : [];
119746
+ return filterOptions.map(item => item.check).includes(true);
119669
119747
  }
119670
119748
  buildColDef(source) {
119671
119749
  var _a, _b, _c;
119672
119750
  let tooltip = undefined;
119673
- const propSortable = StringUtils$1.getBooleanValue((_a = source.props) === null || _a === void 0 ? void 0 : _a.get("gridSortable"), true);
119674
- if ((_b = source.props) === null || _b === void 0 ? void 0 : _b.get("gridHeaderTooltip")) {
119675
- tooltip = (_c = source.props) === null || _c === void 0 ? void 0 : _c.get("gridHeaderTooltip");
119751
+ const propSortable = StringUtils$1.getBooleanValue((_a = source.props) === null || _a === void 0 ? void 0 : _a.get('gridSortable'), true);
119752
+ if ((_b = source.props) === null || _b === void 0 ? void 0 : _b.get('gridHeaderTooltip')) {
119753
+ tooltip = (_c = source.props) === null || _c === void 0 ? void 0 : _c.get('gridHeaderTooltip');
119676
119754
  }
119677
119755
  else if (propSortable === false) {
119678
- tooltip = "Coluna não pode ser ordenada";
119756
+ tooltip = 'Coluna não pode ser ordenada';
119679
119757
  }
119680
119758
  return {
119681
119759
  headerName: source.label,
@@ -119685,18 +119763,19 @@ class AgGridController {
119685
119763
  headerComponent: 'ezGridCustomHeader',
119686
119764
  headerComponentParams: {
119687
119765
  tooltip: tooltip,
119766
+ isSortable: propSortable,
119688
119767
  hasFilter: () => this.hasFilterColumn(source.name),
119689
- showColumnFilter: () => this.showColumnFilter()
119768
+ showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name) }),
119690
119769
  },
119691
119770
  valueFormatter: params => {
119692
119771
  return this.getFormatterByColumn(params, source);
119693
119772
  },
119694
- cellStyle: this.getStyleByColumn(source)
119773
+ cellStyle: this.getStyleByColumn(source),
119695
119774
  };
119696
119775
  }
119697
119776
  getInitCellStyle() {
119698
119777
  return {
119699
- "line-height": (this.getRowHeight() - 1) + "px"
119778
+ 'line-height': this.getRowHeight() - 1 + 'px',
119700
119779
  };
119701
119780
  }
119702
119781
  getStyleByColumn(source) {
@@ -119704,32 +119783,34 @@ class AgGridController {
119704
119783
  switch (source === null || source === void 0 ? void 0 : source.userInterface) {
119705
119784
  case UserInterface.DECIMALNUMBER:
119706
119785
  case UserInterface.INTEGERNUMBER:
119707
- cellStyle["text-align"] = "right";
119786
+ cellStyle['text-align'] = 'right';
119708
119787
  break;
119709
119788
  case UserInterface.DATE:
119710
119789
  case UserInterface.DATETIME:
119711
119790
  case UserInterface.TIME:
119712
- cellStyle["text-align"] = "center";
119791
+ cellStyle['text-align'] = 'center';
119713
119792
  break;
119714
119793
  default:
119715
- cellStyle["text-align"] = "left";
119794
+ cellStyle['text-align'] = 'left';
119716
119795
  }
119717
119796
  return cellStyle;
119718
119797
  }
119719
119798
  getFormatterByColumn(params, source) {
119720
119799
  var _a;
119721
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "OPTIONSELECTOR" && source.options) {
119800
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === 'OPTIONSELECTOR' && source.options) {
119722
119801
  const prop = source === null || source === void 0 ? void 0 : source.options;
119723
119802
  let options;
119724
- if (typeof prop === "string") {
119803
+ if (typeof prop === 'string') {
119725
119804
  const parsed = JSON.parse(prop);
119726
- options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
119805
+ options = Object.keys(parsed).map(key => {
119806
+ return { value: key, label: parsed[key] };
119807
+ });
119727
119808
  }
119728
119809
  else {
119729
119810
  options = prop;
119730
119811
  }
119731
119812
  let optionSelected;
119732
- options.forEach((option) => {
119813
+ options.forEach(option => {
119733
119814
  if (option.value == params.value) {
119734
119815
  optionSelected = option;
119735
119816
  }
@@ -119737,16 +119818,16 @@ class AgGridController {
119737
119818
  return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
119738
119819
  }
119739
119820
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SWITCH) {
119740
- if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true || (params === null || params === void 0 ? void 0 : params.value) === "true") {
119741
- return "Sim";
119821
+ if ((params === null || params === void 0 ? void 0 : params.value) === 'S' || (params === null || params === void 0 ? void 0 : params.value) === true || (params === null || params === void 0 ? void 0 : params.value) === 'true') {
119822
+ return 'Sim';
119742
119823
  }
119743
- else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false || (params === null || params === void 0 ? void 0 : params.value) === "false") {
119744
- return "Não";
119824
+ else if ((params === null || params === void 0 ? void 0 : params.value) === 'N' || (params === null || params === void 0 ? void 0 : params.value) === false || (params === null || params === void 0 ? void 0 : params.value) === 'false') {
119825
+ return 'Não';
119745
119826
  }
119746
119827
  }
119747
119828
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SEARCH) {
119748
119829
  if (((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) != undefined) {
119749
- return params.value.value + " - " + params.value.label;
119830
+ return params.value.value + ' - ' + params.value.label;
119750
119831
  }
119751
119832
  else {
119752
119833
  return params === null || params === void 0 ? void 0 : params.value;
@@ -119754,7 +119835,7 @@ class AgGridController {
119754
119835
  }
119755
119836
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DECIMALNUMBER) {
119756
119837
  if (params.value != undefined) {
119757
- const precision = Number(source.props.get("precision")) || 2;
119838
+ const precision = Number(source.props.get('precision')) || 2;
119758
119839
  return NumberUtils$1.format(params.value.toString(), precision, precision);
119759
119840
  }
119760
119841
  }
@@ -119765,7 +119846,7 @@ class AgGridController {
119765
119846
  }
119766
119847
  }
119767
119848
  onCallStateChange(type, e) {
119768
- const finished = !("finished" in e) || e["finished"];
119849
+ const finished = !('finished' in e) || e['finished'];
119769
119850
  if (finished && this._columnStateChangeCallback) {
119770
119851
  let info = {};
119771
119852
  let isUserChange = this.isUIEvent(e['source'], e['type']);
@@ -119778,10 +119859,10 @@ class AgGridController {
119778
119859
  }
119779
119860
  }
119780
119861
  isElementResize(e) {
119781
- return e["target"] && e["target"].getAttribute("ref") === "eResize";
119862
+ return e['target'] && e['target'].getAttribute('ref') === 'eResize';
119782
119863
  }
119783
119864
  isUIEvent(source, type) {
119784
- let optionsArr = ["uiColumnMoved", "uiColumnResized", "uiColumnDragged", "uiColumnExpanded", "uiColumnSorted"];
119865
+ let optionsArr = ['uiColumnMoved', 'uiColumnResized', 'uiColumnDragged', 'uiColumnExpanded', 'uiColumnSorted'];
119785
119866
  if (type === 'dragStopped') {
119786
119867
  return true;
119787
119868
  }
@@ -119799,14 +119880,14 @@ class AgGridController {
119799
119880
  const selectionInfo = this._dataUnit;
119800
119881
  this._selectionChangeCallback({
119801
119882
  selection: selectionInfo.records,
119802
- selectionHeaderStatus: this.getSelectionHeaderStatus()
119883
+ selectionHeaderStatus: this.getSelectionHeaderStatus(),
119803
119884
  });
119804
119885
  }
119805
119886
  else {
119806
119887
  this._dataUnit.updatePageSelection(this._gridOptions.api.getSelectedRows().map((r) => r.__record__id__)).then(selectionInfo => {
119807
119888
  this._selectionChangeCallback({
119808
119889
  selection: selectionInfo.records,
119809
- selectionHeaderStatus: this.getSelectionHeaderStatus()
119890
+ selectionHeaderStatus: this.getSelectionHeaderStatus(),
119810
119891
  });
119811
119892
  });
119812
119893
  }
@@ -119814,7 +119895,7 @@ class AgGridController {
119814
119895
  else {
119815
119896
  this._selectionChangeCallback({
119816
119897
  selection: this._gridOptions.api.getSelectedRows(),
119817
- selectionHeaderStatus: this.getSelectionHeaderStatus()
119898
+ selectionHeaderStatus: this.getSelectionHeaderStatus(),
119818
119899
  });
119819
119900
  }
119820
119901
  }, 0);
@@ -119842,7 +119923,7 @@ class AgGridController {
119842
119923
  if ((field === null || field === void 0 ? void 0 : field.userInterface) === UserInterface.SEARCH) {
119843
119924
  return this.DEFAULT_MAX_SIZE;
119844
119925
  }
119845
- const labelSize = ((((_b = field === null || field === void 0 ? void 0 : field.label) === null || _b === void 0 ? void 0 : _b.length) || 0) * this.DEFAULT_FONT_SIZE) + this.DEFAULT_ICON_SIZE;
119926
+ const labelSize = (((_b = field === null || field === void 0 ? void 0 : field.label) === null || _b === void 0 ? void 0 : _b.length) || 0) * this.DEFAULT_FONT_SIZE + this.DEFAULT_ICON_SIZE;
119846
119927
  return labelSize > this.DEFAULT_MAX_SIZE ? this.DEFAULT_MAX_SIZE : labelSize;
119847
119928
  }
119848
119929
  }
@@ -119875,8 +119956,9 @@ function getElementID(sufix) {
119875
119956
  };
119876
119957
  }
119877
119958
 
119878
- const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--more-visible, 2);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}[no-header].sc-ez-grid-h{grid-template-rows:1fr auto}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ez-grid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s;z-index:var(--ez-grid__selection-counter--z-index)}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}[no-header].sc-ez-grid-h .grid-header.sc-ez-grid{display:none}";
119959
+ const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--more-visible, 2);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}[no-header].sc-ez-grid-h{grid-template-rows:1fr auto}.grid-header.sc-ez-grid{display:grid;justify-content:space-between;align-items:center;grid-template-columns:1fr;background-color:var(--ez-grid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__popover.sc-ez-grid{position:relative;top:var(--space--sm, 16px)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid-header__position.sc-ez-grid{display:flex;align-items:center;justify-content:space-between}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s;z-index:var(--ez-grid__selection-counter--z-index)}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}[no-header].sc-ez-grid-h .grid-header.sc-ez-grid{display:none}";
119879
119960
 
119961
+ const windowInstace = window;
119880
119962
  const EzGrid = class {
119881
119963
  constructor(hostRef) {
119882
119964
  registerInstance(this, hostRef);
@@ -119886,6 +119968,8 @@ const EzGrid = class {
119886
119968
  this.configChange = createEvent(this, "configChange", 7);
119887
119969
  this.componentReady = createEvent(this, "componentReady", 7);
119888
119970
  this._gridController = new AgGridController(false);
119971
+ this.timeFadeOutInMs = 3000;
119972
+ this.toastMessageToUpdateFilterColumn = 'Filtro de coluna aplicado com sucesso!';
119889
119973
  this._paginationInfo = undefined;
119890
119974
  this._paginationChangedByKeyboard = true;
119891
119975
  this._showSelectionCounter = false;
@@ -119897,6 +119981,7 @@ const EzGrid = class {
119897
119981
  this.serverUrl = undefined;
119898
119982
  this.dataUnit = undefined;
119899
119983
  this.statusResolver = undefined;
119984
+ this.columnfilterDataSource = undefined;
119900
119985
  }
119901
119986
  /**
119902
119987
  * Aplica a definição de colunas.
@@ -119983,7 +120068,7 @@ const EzGrid = class {
119983
120068
  newConfigColumn['width'] = columnState.width;
119984
120069
  }
119985
120070
  if (columnState.sort) {
119986
- newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === 'ASC');
120071
+ newConfigColumn['ascending'] = columnState.sort.toUpperCase() === 'ASC';
119987
120072
  newConfigColumn['orderIndex'] = columnState.sortIndex;
119988
120073
  }
119989
120074
  else {
@@ -120007,23 +120092,23 @@ const EzGrid = class {
120007
120092
  return;
120008
120093
  }
120009
120094
  const limitBottom = boundingContainer.bottom - 30;
120010
- this._gridSelectionCounter.style.bottom = (document.body.clientHeight - limitBottom) + 'px';
120095
+ this._gridSelectionCounter.style.bottom = document.body.clientHeight - limitBottom + 'px';
120011
120096
  }
120012
120097
  else {
120013
- this._gridSelectionCounter.style.bottom = "";
120098
+ this._gridSelectionCounter.style.bottom = '';
120014
120099
  }
120015
120100
  }
120016
120101
  setEvents() {
120017
- window.removeEventListener("scroll", this.positionSelectionCounter.bind(this));
120018
- window.addEventListener("scroll", this.positionSelectionCounter.bind(this));
120102
+ window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
120103
+ window.addEventListener('scroll', this.positionSelectionCounter.bind(this));
120019
120104
  }
120020
120105
  resizeSelectionCounter() {
120021
120106
  if (this._gridSelectionCounter == undefined) {
120022
120107
  return;
120023
120108
  }
120024
- this._gridSelectionCounter.style.width = "";
120109
+ this._gridSelectionCounter.style.width = '';
120025
120110
  if (this._gridSelectionCounter.clientHeight > 42) {
120026
- this._gridSelectionCounter.style.width = "min-content";
120111
+ this._gridSelectionCounter.style.width = 'min-content';
120027
120112
  }
120028
120113
  this.positionSelectionCounter();
120029
120114
  }
@@ -120082,8 +120167,8 @@ const EzGrid = class {
120082
120167
  buildDataElementId() {
120083
120168
  const dataInfo = { dataUnit: this.dataUnit };
120084
120169
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
120085
- const dtInfo = { id: "ezGrid" };
120086
- ElementIDUtils.addIDInfo(this._refPaginationControl, "pagination", dtInfo);
120170
+ const dtInfo = { id: 'ezGrid' };
120171
+ ElementIDUtils.addIDInfo(this._refPaginationControl, 'pagination', dtInfo);
120087
120172
  }
120088
120173
  previousPage() {
120089
120174
  if (this.dataUnit) {
@@ -120103,7 +120188,7 @@ const EzGrid = class {
120103
120188
  return [
120104
120189
  h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, `${firstRecord}-${lastRecord}`), ` de ${total}`),
120105
120190
  h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }),
120106
- h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
120191
+ h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }),
120107
120192
  ];
120108
120193
  }
120109
120194
  return null;
@@ -120129,7 +120214,7 @@ const EzGrid = class {
120129
120214
  allowMultipleSelection: this.multipleSelection,
120130
120215
  serverURL: this.serverUrl,
120131
120216
  dataUnit: this.dataUnit,
120132
- statusResolver: this.statusResolver
120217
+ statusResolver: this.statusResolver,
120133
120218
  });
120134
120219
  if (this.config) {
120135
120220
  this.observeConfig(this.config);
@@ -120137,15 +120222,21 @@ const EzGrid = class {
120137
120222
  this.buildDataElementId();
120138
120223
  this.setEvents();
120139
120224
  this.componentReady.emit();
120225
+ this._gridController.configFilterColumn(this._filterColumn);
120140
120226
  }
120141
120227
  componentWillRender() {
120142
120228
  this.configSelectionCounter();
120143
120229
  }
120230
+ componentDidRender() {
120231
+ windowInstace.addEventListener('onSubmitFilter', () => {
120232
+ this.toastElementRef.show(this.toastMessageToUpdateFilterColumn, this.timeFadeOutInMs, true, true);
120233
+ });
120234
+ }
120144
120235
  render() {
120145
120236
  var _a;
120146
- return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => this._refPaginationControl = ref }, this.getPaginationControl())), h("div", { ref: (ref) => this._gridSelectionCounter = ref, class: `grid__selection-counter
120147
- ${this._showSelectionCounter ? "grid__selection-counter--opened" : ""}
120148
- ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, hasPagination: !!this._paginationInfo, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => this._showSelectionCounter = false })), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
120237
+ return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", dataSource: this.columnfilterDataSource, dataUnit: this.dataUnit, ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
120238
+ ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
120239
+ ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, hasPagination: !!this._paginationInfo, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" })), h("ez-toast", { ref: (element) => (this.toastElementRef = element) }, h("ez-icon", { slot: "icon", iconName: "check" }))));
120149
120240
  }
120150
120241
  static get assetsDirs() { return ["../assets"]; }
120151
120242
  get _element() { return getElement(this); }