@sankhyalabs/ezui 4.18.2 → 4.19.1

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