@sankhyalabs/ezui 4.16.0 → 4.17.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.
@@ -118,10 +118,7 @@ const EzComboBox = class {
118
118
  if (!this.showSelectedValue || currentValue.value == undefined) {
119
119
  return currentValue.label;
120
120
  }
121
- if (!currentValue.label) {
122
- return;
123
- }
124
- return `${currentValue.value} - ${currentValue.label}`;
121
+ return currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
125
122
  }
126
123
  getText() {
127
124
  const currentValue = this.getSelectedOption(this.value);
@@ -184,7 +181,7 @@ const EzComboBox = class {
184
181
  }
185
182
  buildItem(opt, index$1) {
186
183
  const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
187
- opt.label = opt.label || (opt.value ? `<SEM ${this.getFieldLabel()}>` : "");
184
+ opt.label = opt.label || opt.value;
188
185
  return index.h("li", { class: index$1 === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index$1 }, this.showOptionValue
189
186
  ? index.h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
190
187
  : undefined, index.h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
@@ -355,10 +352,7 @@ const EzComboBox = class {
355
352
  }
356
353
  let value = this.value;
357
354
  if (typeof value === "object") {
358
- if (!core.StringUtils.isEmpty(value.label)) {
359
- return;
360
- }
361
- value = value.value;
355
+ return;
362
356
  }
363
357
  if (core.StringUtils.isEmpty(value)) {
364
358
  return;
@@ -397,9 +391,6 @@ const EzComboBox = class {
397
391
  this.showNoResultMessage();
398
392
  return;
399
393
  }
400
- if (!value.label) {
401
- value.label = `<SEM ${this.getFieldLabel()}>`;
402
- }
403
394
  this._lookupMode = true;
404
395
  this.value = value;
405
396
  }
@@ -118901,21 +118901,6 @@ const gridTerms = {
118901
118901
  ctrlV: "Ctrl+V"
118902
118902
  };
118903
118903
 
118904
- const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation" title="{{HEADER_TITLE}}">
118905
- <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
118906
- <div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
118907
- <span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
118908
- <span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon ag-hidden" aria-hidden="true"></span>
118909
- <span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon ag-hidden" aria-hidden="true"></span>
118910
- <span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon ag-hidden" aria-hidden="true"></span>
118911
- <span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon ag-hidden" aria-hidden="true"></span>
118912
- </div>
118913
- </div>`;
118914
-
118915
- function getHeaderColumnTemplate(headerTooltip = "") {
118916
- return HeaderColumnTemplate.replaceAll("{{HEADER_TITLE}}", headerTooltip)
118917
- }
118918
-
118919
118904
  class DataSource {
118920
118905
  constructor(dataUnit, controller, options) {
118921
118906
  this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
@@ -119101,6 +119086,84 @@ class SelectionHeader {
119101
119086
  }
119102
119087
  }
119103
119088
 
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-up' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: 14px;align-self: center;'></i>
119104
+ <i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: 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
+ }
119116
+ configFilterButton() {
119117
+ this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
119118
+ this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
119119
+ this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
119120
+ this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
119121
+ }
119122
+ onSortChanged() {
119123
+ this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
119124
+ this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
119125
+ }
119126
+ configSortListener() {
119127
+ if (this.params.enableSorting) {
119128
+ this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
119129
+ this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
119130
+ this.onSortChangedListener = this.onSortChanged.bind(this);
119131
+ this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
119132
+ }
119133
+ }
119134
+ onSortClick(event) {
119135
+ this.params.progressSort(event.shiftKey);
119136
+ }
119137
+ configSortClick() {
119138
+ this.headerContainer = this.element.querySelector('#ez-header-container');
119139
+ this.onSortClickListener = this.onSortClick.bind(this);
119140
+ this.headerContainer.addEventListener('click', this.onSortClickListener);
119141
+ }
119142
+ onMenuClick() {
119143
+ this.params.showColumnMenu(this.menuButton);
119144
+ }
119145
+ configMenuClick() {
119146
+ this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
119147
+ this.onMenuClickListener = this.onMenuClick.bind(this);
119148
+ this.menuButton.addEventListener('click', this.onMenuClickListener);
119149
+ }
119150
+ getGui() {
119151
+ return this.element;
119152
+ }
119153
+ destroy() {
119154
+ if (this.onMenuClickListener) {
119155
+ this.menuButton.removeEventListener('click', this.onMenuClickListener);
119156
+ }
119157
+ if (this.onSortClickListener) {
119158
+ this.headerContainer.removeEventListener('click', this.onSortClickListener);
119159
+ }
119160
+ if (this.onFilterButtonClickListener) {
119161
+ this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
119162
+ }
119163
+ this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
119164
+ }
119165
+ }
119166
+
119104
119167
  class AgGridController {
119105
119168
  constructor(enterprise) {
119106
119169
  this.DEFAULT_ROW_HEIGHT = 30;
@@ -119170,7 +119233,8 @@ class AgGridController {
119170
119233
  cellClass: "ez-grid__cell-body"
119171
119234
  },
119172
119235
  components: {
119173
- 'ezGridHeaderComponent': SelectionHeader
119236
+ 'ezGridHeaderComponent': SelectionHeader,
119237
+ 'ezGridCustomHeader': EzGridCustomHeader,
119174
119238
  },
119175
119239
  context: {
119176
119240
  headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
@@ -119537,6 +119601,12 @@ class AgGridController {
119537
119601
  var _a;
119538
119602
  (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
119539
119603
  }
119604
+ hasFilterColumn(_columnName) {
119605
+ return false;
119606
+ }
119607
+ showColumnFilter() {
119608
+ //TODO: Implementar apresentação dos filtros
119609
+ }
119540
119610
  buildColDef(source) {
119541
119611
  var _a, _b, _c;
119542
119612
  let tooltip = undefined;
@@ -119552,8 +119622,11 @@ class AgGridController {
119552
119622
  field: source.name,
119553
119623
  sortable: propSortable,
119554
119624
  resizable: true,
119625
+ headerComponent: 'ezGridCustomHeader',
119555
119626
  headerComponentParams: {
119556
- template: getHeaderColumnTemplate(tooltip)
119627
+ tooltip: tooltip,
119628
+ hasFilter: () => this.hasFilterColumn(source.name),
119629
+ showColumnFilter: () => this.showColumnFilter()
119557
119630
  },
119558
119631
  valueFormatter: params => {
119559
119632
  return this.getFormatterByColumn(params, source);
@@ -106,10 +106,7 @@ export class EzComboBox {
106
106
  if (!this.showSelectedValue || currentValue.value == undefined) {
107
107
  return currentValue.label;
108
108
  }
109
- if (!currentValue.label) {
110
- return;
111
- }
112
- return `${currentValue.value} - ${currentValue.label}`;
109
+ return currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
113
110
  }
114
111
  getText() {
115
112
  const currentValue = this.getSelectedOption(this.value);
@@ -172,7 +169,7 @@ export class EzComboBox {
172
169
  }
173
170
  buildItem(opt, index) {
174
171
  const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
175
- opt.label = opt.label || (opt.value ? `<SEM ${this.getFieldLabel()}>` : "");
172
+ opt.label = opt.label || opt.value;
176
173
  return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index }, this.showOptionValue
177
174
  ? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
178
175
  : undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
@@ -343,10 +340,7 @@ export class EzComboBox {
343
340
  }
344
341
  let value = this.value;
345
342
  if (typeof value === "object") {
346
- if (!StringUtils.isEmpty(value.label)) {
347
- return;
348
- }
349
- value = value.value;
343
+ return;
350
344
  }
351
345
  if (StringUtils.isEmpty(value)) {
352
346
  return;
@@ -385,9 +379,6 @@ export class EzComboBox {
385
379
  this.showNoResultMessage();
386
380
  return;
387
381
  }
388
- if (!value.label) {
389
- value.label = `<SEM ${this.getFieldLabel()}>`;
390
- }
391
382
  this._lookupMode = true;
392
383
  this.value = value;
393
384
  }
@@ -2,10 +2,10 @@ import { Grid as EnterpriseGrid, LicenseManager } from "ag-grid-enterprise";
2
2
  import { Grid } from "ag-grid-community";
3
3
  import { ApplicationContext, DataType, SortMode, UserInterface, NumberUtils, StringUtils } from "@sankhyalabs/core";
4
4
  import gridTerms from "./i18n/pt-BR.js";
5
- import getHeaderColumnTemplate from "./template/HeaderColumnTemplate.js";
6
5
  import DataSource from "./DataSource";
7
6
  import { CellRendererStatus } from "./components/cellRendererStatus";
8
7
  import SelectionHeader from "./components/selectionHeader";
8
+ import { EzGridCustomHeader } from './components/EzGridCustomHeader';
9
9
  export default class AgGridController {
10
10
  constructor(enterprise) {
11
11
  this.DEFAULT_ROW_HEIGHT = 30;
@@ -75,7 +75,8 @@ export default class AgGridController {
75
75
  cellClass: "ez-grid__cell-body"
76
76
  },
77
77
  components: {
78
- 'ezGridHeaderComponent': SelectionHeader
78
+ 'ezGridHeaderComponent': SelectionHeader,
79
+ 'ezGridCustomHeader': EzGridCustomHeader,
79
80
  },
80
81
  context: {
81
82
  headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
@@ -442,6 +443,12 @@ export default class AgGridController {
442
443
  var _a;
443
444
  (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
444
445
  }
446
+ hasFilterColumn(_columnName) {
447
+ return false;
448
+ }
449
+ showColumnFilter() {
450
+ //TODO: Implementar apresentação dos filtros
451
+ }
445
452
  buildColDef(source) {
446
453
  var _a, _b, _c;
447
454
  let tooltip = undefined;
@@ -457,8 +464,11 @@ export default class AgGridController {
457
464
  field: source.name,
458
465
  sortable: propSortable,
459
466
  resizable: true,
467
+ headerComponent: 'ezGridCustomHeader',
460
468
  headerComponentParams: {
461
- template: getHeaderColumnTemplate(tooltip)
469
+ tooltip: tooltip,
470
+ hasFilter: () => this.hasFilterColumn(source.name),
471
+ showColumnFilter: () => this.showColumnFilter()
462
472
  },
463
473
  valueFormatter: params => {
464
474
  return this.getFormatterByColumn(params, source);
@@ -0,0 +1,77 @@
1
+ export class EzGridCustomHeader {
2
+ init(agParams) {
3
+ var _a;
4
+ this.params = agParams;
5
+ this.element = document.createElement('div');
6
+ this.element.classList.add('ag-cell-label-container');
7
+ this.element.setAttribute('title', (_a = this.params.tooltip) !== null && _a !== void 0 ? _a : '');
8
+ this.element.innerHTML = `
9
+ <div class='ez-flex ez-flex--justify-between'>
10
+ <i id='ez-grid-filter-icon' class='ez-icon-filter' style='color:#008561'></i>
11
+ <i id='ez-grid-menu-icon' class='ez-icon-dots-vertical'></i>
12
+ </div>
13
+ <div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
14
+ <span class='ag-header-cell-text'>${this.params.displayName}</span>
15
+ <i id='ez-grid-sort-icon-up' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: 14px;align-self: center;'></i>
16
+ <i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: 14px;align-self: center;'></i>
17
+ </div>
18
+ `;
19
+ this.configMenuClick();
20
+ this.configSortClick();
21
+ this.configSortListener();
22
+ this.configFilterButton();
23
+ }
24
+ refresh(agParams) {
25
+ this.params = agParams;
26
+ this.configFilterButton();
27
+ }
28
+ configFilterButton() {
29
+ this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
30
+ this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
31
+ this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
32
+ this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
33
+ }
34
+ onSortChanged() {
35
+ this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
36
+ this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
37
+ }
38
+ configSortListener() {
39
+ if (this.params.enableSorting) {
40
+ this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
41
+ this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
42
+ this.onSortChangedListener = this.onSortChanged.bind(this);
43
+ this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
44
+ }
45
+ }
46
+ onSortClick(event) {
47
+ this.params.progressSort(event.shiftKey);
48
+ }
49
+ configSortClick() {
50
+ this.headerContainer = this.element.querySelector('#ez-header-container');
51
+ this.onSortClickListener = this.onSortClick.bind(this);
52
+ this.headerContainer.addEventListener('click', this.onSortClickListener);
53
+ }
54
+ onMenuClick() {
55
+ this.params.showColumnMenu(this.menuButton);
56
+ }
57
+ configMenuClick() {
58
+ this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
59
+ this.onMenuClickListener = this.onMenuClick.bind(this);
60
+ this.menuButton.addEventListener('click', this.onMenuClickListener);
61
+ }
62
+ getGui() {
63
+ return this.element;
64
+ }
65
+ destroy() {
66
+ if (this.onMenuClickListener) {
67
+ this.menuButton.removeEventListener('click', this.onMenuClickListener);
68
+ }
69
+ if (this.onSortClickListener) {
70
+ this.headerContainer.removeEventListener('click', this.onSortClickListener);
71
+ }
72
+ if (this.onFilterButtonClickListener) {
73
+ this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
74
+ }
75
+ this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
76
+ }
77
+ }
@@ -2174,10 +2174,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2174
2174
  if (!this.showSelectedValue || currentValue.value == undefined) {
2175
2175
  return currentValue.label;
2176
2176
  }
2177
- if (!currentValue.label) {
2178
- return;
2179
- }
2180
- return `${currentValue.value} - ${currentValue.label}`;
2177
+ return currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
2181
2178
  }
2182
2179
  getText() {
2183
2180
  const currentValue = this.getSelectedOption(this.value);
@@ -2240,7 +2237,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2240
2237
  }
2241
2238
  buildItem(opt, index) {
2242
2239
  const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
2243
- opt.label = opt.label || (opt.value ? `<SEM ${this.getFieldLabel()}>` : "");
2240
+ opt.label = opt.label || opt.value;
2244
2241
  return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index }, this.showOptionValue
2245
2242
  ? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
2246
2243
  : undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
@@ -2411,10 +2408,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2411
2408
  }
2412
2409
  let value = this.value;
2413
2410
  if (typeof value === "object") {
2414
- if (!StringUtils$1.isEmpty(value.label)) {
2415
- return;
2416
- }
2417
- value = value.value;
2411
+ return;
2418
2412
  }
2419
2413
  if (StringUtils$1.isEmpty(value)) {
2420
2414
  return;
@@ -2453,9 +2447,6 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2453
2447
  this.showNoResultMessage();
2454
2448
  return;
2455
2449
  }
2456
- if (!value.label) {
2457
- value.label = `<SEM ${this.getFieldLabel()}>`;
2458
- }
2459
2450
  this._lookupMode = true;
2460
2451
  this.value = value;
2461
2452
  }
@@ -123378,21 +123369,6 @@ const gridTerms = {
123378
123369
  ctrlV: "Ctrl+V"
123379
123370
  };
123380
123371
 
123381
- const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation" title="{{HEADER_TITLE}}">
123382
- <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
123383
- <div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
123384
- <span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
123385
- <span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon ag-hidden" aria-hidden="true"></span>
123386
- <span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon ag-hidden" aria-hidden="true"></span>
123387
- <span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon ag-hidden" aria-hidden="true"></span>
123388
- <span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon ag-hidden" aria-hidden="true"></span>
123389
- </div>
123390
- </div>`;
123391
-
123392
- function getHeaderColumnTemplate(headerTooltip = "") {
123393
- return HeaderColumnTemplate.replaceAll("{{HEADER_TITLE}}", headerTooltip)
123394
- }
123395
-
123396
123372
  class DataSource {
123397
123373
  constructor(dataUnit, controller, options) {
123398
123374
  this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
@@ -123578,6 +123554,84 @@ class SelectionHeader {
123578
123554
  }
123579
123555
  }
123580
123556
 
123557
+ class EzGridCustomHeader {
123558
+ init(agParams) {
123559
+ var _a;
123560
+ this.params = agParams;
123561
+ this.element = document.createElement('div');
123562
+ this.element.classList.add('ag-cell-label-container');
123563
+ this.element.setAttribute('title', (_a = this.params.tooltip) !== null && _a !== void 0 ? _a : '');
123564
+ this.element.innerHTML = `
123565
+ <div class='ez-flex ez-flex--justify-between'>
123566
+ <i id='ez-grid-filter-icon' class='ez-icon-filter' style='color:#008561'></i>
123567
+ <i id='ez-grid-menu-icon' class='ez-icon-dots-vertical'></i>
123568
+ </div>
123569
+ <div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
123570
+ <span class='ag-header-cell-text'>${this.params.displayName}</span>
123571
+ <i id='ez-grid-sort-icon-up' class='ez-icon-arrow_downward' style='display: none;margin-left: 4px;font-size: 14px;align-self: center;'></i>
123572
+ <i id='ez-grid-sort-icon-down' class='ez-icon-arrow_downward' style='display: none; transform: rotate(180deg);margin-left: 4px;font-size: 14px;align-self: center;'></i>
123573
+ </div>
123574
+ `;
123575
+ this.configMenuClick();
123576
+ this.configSortClick();
123577
+ this.configSortListener();
123578
+ this.configFilterButton();
123579
+ }
123580
+ refresh(agParams) {
123581
+ this.params = agParams;
123582
+ this.configFilterButton();
123583
+ }
123584
+ configFilterButton() {
123585
+ this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
123586
+ this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
123587
+ this.onFilterButtonClickListener = this.params.showColumnFilter.bind(this);
123588
+ this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
123589
+ }
123590
+ onSortChanged() {
123591
+ this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
123592
+ this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
123593
+ }
123594
+ configSortListener() {
123595
+ if (this.params.enableSorting) {
123596
+ this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-up');
123597
+ this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-down');
123598
+ this.onSortChangedListener = this.onSortChanged.bind(this);
123599
+ this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
123600
+ }
123601
+ }
123602
+ onSortClick(event) {
123603
+ this.params.progressSort(event.shiftKey);
123604
+ }
123605
+ configSortClick() {
123606
+ this.headerContainer = this.element.querySelector('#ez-header-container');
123607
+ this.onSortClickListener = this.onSortClick.bind(this);
123608
+ this.headerContainer.addEventListener('click', this.onSortClickListener);
123609
+ }
123610
+ onMenuClick() {
123611
+ this.params.showColumnMenu(this.menuButton);
123612
+ }
123613
+ configMenuClick() {
123614
+ this.menuButton = this.element.querySelector('#ez-grid-menu-icon');
123615
+ this.onMenuClickListener = this.onMenuClick.bind(this);
123616
+ this.menuButton.addEventListener('click', this.onMenuClickListener);
123617
+ }
123618
+ getGui() {
123619
+ return this.element;
123620
+ }
123621
+ destroy() {
123622
+ if (this.onMenuClickListener) {
123623
+ this.menuButton.removeEventListener('click', this.onMenuClickListener);
123624
+ }
123625
+ if (this.onSortClickListener) {
123626
+ this.headerContainer.removeEventListener('click', this.onSortClickListener);
123627
+ }
123628
+ if (this.onFilterButtonClickListener) {
123629
+ this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
123630
+ }
123631
+ this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
123632
+ }
123633
+ }
123634
+
123581
123635
  class AgGridController {
123582
123636
  constructor(enterprise) {
123583
123637
  this.DEFAULT_ROW_HEIGHT = 30;
@@ -123647,7 +123701,8 @@ class AgGridController {
123647
123701
  cellClass: "ez-grid__cell-body"
123648
123702
  },
123649
123703
  components: {
123650
- 'ezGridHeaderComponent': SelectionHeader
123704
+ 'ezGridHeaderComponent': SelectionHeader,
123705
+ 'ezGridCustomHeader': EzGridCustomHeader,
123651
123706
  },
123652
123707
  context: {
123653
123708
  headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
@@ -124014,6 +124069,12 @@ class AgGridController {
124014
124069
  var _a;
124015
124070
  (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
124016
124071
  }
124072
+ hasFilterColumn(_columnName) {
124073
+ return false;
124074
+ }
124075
+ showColumnFilter() {
124076
+ //TODO: Implementar apresentação dos filtros
124077
+ }
124017
124078
  buildColDef(source) {
124018
124079
  var _a, _b, _c;
124019
124080
  let tooltip = undefined;
@@ -124029,8 +124090,11 @@ class AgGridController {
124029
124090
  field: source.name,
124030
124091
  sortable: propSortable,
124031
124092
  resizable: true,
124093
+ headerComponent: 'ezGridCustomHeader',
124032
124094
  headerComponentParams: {
124033
- template: getHeaderColumnTemplate(tooltip)
124095
+ tooltip: tooltip,
124096
+ hasFilter: () => this.hasFilterColumn(source.name),
124097
+ showColumnFilter: () => this.showColumnFilter()
124034
124098
  },
124035
124099
  valueFormatter: params => {
124036
124100
  return this.getFormatterByColumn(params, source);
@@ -114,10 +114,7 @@ const EzComboBox = class {
114
114
  if (!this.showSelectedValue || currentValue.value == undefined) {
115
115
  return currentValue.label;
116
116
  }
117
- if (!currentValue.label) {
118
- return;
119
- }
120
- return `${currentValue.value} - ${currentValue.label}`;
117
+ return currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
121
118
  }
122
119
  getText() {
123
120
  const currentValue = this.getSelectedOption(this.value);
@@ -180,7 +177,7 @@ const EzComboBox = class {
180
177
  }
181
178
  buildItem(opt, index) {
182
179
  const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
183
- opt.label = opt.label || (opt.value ? `<SEM ${this.getFieldLabel()}>` : "");
180
+ opt.label = opt.label || opt.value;
184
181
  return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index }, this.showOptionValue
185
182
  ? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
186
183
  : undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
@@ -351,10 +348,7 @@ const EzComboBox = class {
351
348
  }
352
349
  let value = this.value;
353
350
  if (typeof value === "object") {
354
- if (!StringUtils.isEmpty(value.label)) {
355
- return;
356
- }
357
- value = value.value;
351
+ return;
358
352
  }
359
353
  if (StringUtils.isEmpty(value)) {
360
354
  return;
@@ -393,9 +387,6 @@ const EzComboBox = class {
393
387
  this.showNoResultMessage();
394
388
  return;
395
389
  }
396
- if (!value.label) {
397
- value.label = `<SEM ${this.getFieldLabel()}>`;
398
- }
399
390
  this._lookupMode = true;
400
391
  this.value = value;
401
392
  }