@sankhyalabs/ezui 5.11.0-dev.5 → 5.11.0-dev.7

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 (42) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +8 -2
  2. package/dist/cjs/ez-grid.cjs.entry.js +87 -38
  3. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
  4. package/dist/cjs/ez-search.cjs.entry.js +2 -1
  5. package/dist/cjs/ezui.cjs.js +1 -1
  6. package/dist/cjs/filter-column.cjs.entry.js +30 -7
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/components/ez-combo-box/ez-combo-box.js +26 -2
  9. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  10. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  11. package/dist/collection/components/ez-grid/ez-grid.js +11 -39
  12. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
  13. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
  14. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
  15. package/dist/collection/components/ez-search/ez-search.js +20 -1
  16. package/dist/custom-elements/index.js +135 -54
  17. package/dist/esm/ez-combo-box.entry.js +8 -2
  18. package/dist/esm/ez-grid.entry.js +88 -39
  19. package/dist/esm/ez-multi-selection-list.entry.js +3 -1
  20. package/dist/esm/ez-search.entry.js +2 -1
  21. package/dist/esm/ezui.js +1 -1
  22. package/dist/esm/filter-column.entry.js +30 -7
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/ezui/ezui.esm.js +1 -1
  25. package/dist/ezui/p-061f4d73.entry.js +1 -0
  26. package/dist/ezui/p-25562cf8.entry.js +1 -0
  27. package/dist/ezui/p-5e55a42b.entry.js +1 -0
  28. package/dist/ezui/p-7526f2b6.entry.js +1 -0
  29. package/dist/ezui/{p-fd54b5b4.entry.js → p-964e5571.entry.js} +2 -2
  30. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -0
  31. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  32. package/dist/types/components/ez-grid/ez-grid.d.ts +3 -5
  33. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
  34. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
  35. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
  36. package/dist/types/components/ez-search/ez-search.d.ts +4 -0
  37. package/dist/types/components.d.ts +26 -0
  38. package/package.json +1 -1
  39. package/dist/ezui/p-2a0e1679.entry.js +0 -1
  40. package/dist/ezui/p-411f3579.entry.js +0 -1
  41. package/dist/ezui/p-4c8b029b.entry.js +0 -1
  42. package/dist/ezui/p-5a1d8bf8.entry.js +0 -1
@@ -2157,6 +2157,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2157
2157
  this.mode = "regular";
2158
2158
  this.hideErrorOnFocusOut = true;
2159
2159
  this.listOptionsPosition = undefined;
2160
+ this.isTextSearch = false;
2160
2161
  }
2161
2162
  observeErrorMessage() {
2162
2163
  var _a;
@@ -2479,7 +2480,6 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2479
2480
  this._visibleOptions = [];
2480
2481
  this.clearSource();
2481
2482
  }
2482
- this.setFocus();
2483
2483
  }
2484
2484
  loadOptions(mode, argument = "") {
2485
2485
  this._criteria = argument;
@@ -2664,6 +2664,12 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2664
2664
  handlerIconClick() {
2665
2665
  this.searchMode ? this.loadOptions(SearchMode.ADVANCED) : this.showOptions();
2666
2666
  }
2667
+ buildNumberArgument(argument) {
2668
+ if (this.isTextSearch) {
2669
+ return NaN;
2670
+ }
2671
+ return Number(argument || undefined);
2672
+ }
2667
2673
  onTextInputChangeHandler(event) {
2668
2674
  var _a;
2669
2675
  this.clearDeboucingTimeout();
@@ -2674,7 +2680,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2674
2680
  return;
2675
2681
  }
2676
2682
  const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
2677
- const argumentNumber = Number(argument || undefined);
2683
+ const argumentNumber = this.buildNumberArgument(argument);
2678
2684
  if (!this._criteria) {
2679
2685
  this._textInput.value = event.data || argument;
2680
2686
  }
@@ -123693,7 +123699,7 @@ class EzGridCustomHeader {
123693
123699
  onClickFilter() {
123694
123700
  var _a;
123695
123701
  const iconLeft = (_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left;
123696
- this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`);
123702
+ this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`, true);
123697
123703
  }
123698
123704
  configSortIcon() {
123699
123705
  this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
@@ -124935,7 +124941,7 @@ class AgGridController {
124935
124941
  tooltip: tooltip,
124936
124942
  isSortable: propSortable,
124937
124943
  hasFilter: () => this.hasFilterColumn(source.name),
124938
- showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name) }),
124944
+ showColumnFilter: (leftPosition, fromIcon) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon }),
124939
124945
  },
124940
124946
  valueFormatter: params => {
124941
124947
  if (params.value == undefined) {
@@ -125158,6 +125164,84 @@ function getElementID(sufix) {
125158
125164
  };
125159
125165
  }
125160
125166
 
125167
+ class InMemoryFilterColumnDataSource {
125168
+ constructor(dataUnit) {
125169
+ var _a;
125170
+ this.onDataUnitAction = (action) => {
125171
+ if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
125172
+ this.originalRecords = this.dataUnit.records;
125173
+ }
125174
+ };
125175
+ this.dataUnit = dataUnit;
125176
+ this.originalRecords = (_a = this.dataUnit.records) !== null && _a !== void 0 ? _a : [];
125177
+ this.dataUnit.subscribe(this.onDataUnitAction);
125178
+ }
125179
+ fetchData(filterTerm, fieldName) {
125180
+ return new Promise(resolve => {
125181
+ const filteredRecords = this.originalRecords.filter(record => this.includesSearchTerm(record, fieldName, filterTerm));
125182
+ const options = filteredRecords.map(item => this.buildFieldOption(item, fieldName));
125183
+ resolve(this.removeDuplicatedOptions(options));
125184
+ });
125185
+ }
125186
+ buildFieldOption(item, fieldName) {
125187
+ return {
125188
+ value: this.buildValue(item, fieldName),
125189
+ label: this.formatLabel(fieldName, item[fieldName]),
125190
+ check: true,
125191
+ };
125192
+ }
125193
+ buildValue(item, fieldName) {
125194
+ var _a;
125195
+ let value = item[fieldName];
125196
+ if (((_a = this.dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType) === DataType.OBJECT) {
125197
+ value = value.value;
125198
+ }
125199
+ return value === null || value === void 0 ? void 0 : value.toString();
125200
+ }
125201
+ removeDuplicatedOptions(options) {
125202
+ const noDuplicatedOptions = [];
125203
+ options.forEach(option => {
125204
+ if (!noDuplicatedOptions.find(({ label }) => label === option.label)) {
125205
+ noDuplicatedOptions.push(option);
125206
+ }
125207
+ });
125208
+ return noDuplicatedOptions;
125209
+ }
125210
+ includesSearchTerm(record, fieldName, filterTerm) {
125211
+ let label = this.buildLabel(fieldName, record[fieldName]);
125212
+ return label.toLowerCase().includes(filterTerm.toLowerCase());
125213
+ }
125214
+ buildLabel(fieldName, value) {
125215
+ var _a;
125216
+ const { dataType } = this.dataUnit.getField(fieldName);
125217
+ if (dataType === DataType.NUMBER) {
125218
+ return value === null || value === void 0 ? void 0 : value.toString().replace('.', ',');
125219
+ }
125220
+ if (dataType === DataType.DATE) {
125221
+ return (typeof value === 'object')
125222
+ ? (_a = DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString()
125223
+ : value === null || value === void 0 ? void 0 : value.toString();
125224
+ }
125225
+ if (dataType === DataType.OBJECT) {
125226
+ return `${value === null || value === void 0 ? void 0 : value.value} - ${value === null || value === void 0 ? void 0 : value.label}`;
125227
+ }
125228
+ return value === null || value === void 0 ? void 0 : value.toString();
125229
+ }
125230
+ formatLabel(fieldName, value) {
125231
+ var _a, _b;
125232
+ const { userInterface, dataType } = this.dataUnit.getField(fieldName);
125233
+ if (dataType === DataType.DATE) {
125234
+ return (typeof value === 'object')
125235
+ ? DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))
125236
+ : value === null || value === void 0 ? void 0 : value.toString();
125237
+ }
125238
+ if (dataType === DataType.NUMBER && userInterface !== UserInterface.DECIMALNUMBER) {
125239
+ return (_a = parseInt(this.dataUnit.getFormattedValue(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString();
125240
+ }
125241
+ return (_b = this.dataUnit.getFormattedValue(fieldName, value)) === null || _b === void 0 ? void 0 : _b.toString();
125242
+ }
125243
+ }
125244
+
125161
125245
  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(--visible, 1);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}.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(--more-visible, 2)}.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{height:0;padding:0}";
125162
125246
 
125163
125247
  const windowInstace$1 = window;
@@ -125172,18 +125256,13 @@ const EzGrid$1 = class extends HTMLElement$1 {
125172
125256
  this.componentReady = createEvent(this, "componentReady", 7);
125173
125257
  this._gridController = new AgGridController(false);
125174
125258
  this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
125175
- this.onDataUnitAction = (action) => {
125176
- if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
125177
- this._originalRecords = this.dataUnit.records;
125178
- }
125179
- };
125180
125259
  this._paginationInfo = undefined;
125181
125260
  this._paginationChangedByKeyboard = true;
125182
125261
  this._showSelectionCounter = false;
125183
125262
  this._isAllSelection = false;
125184
125263
  this._currentPageSelected = undefined;
125185
125264
  this._selectionCount = undefined;
125186
- this._originalRecords = [];
125265
+ this._hasLeftButtons = false;
125187
125266
  this.multipleSelection = undefined;
125188
125267
  this.config = undefined;
125189
125268
  this.selectionToastConfig = undefined;
@@ -125453,44 +125532,20 @@ const EzGrid$1 = class extends HTMLElement$1 {
125453
125532
  });
125454
125533
  }
125455
125534
  componentWillLoad() {
125535
+ this._hasLeftButtons = !!this._element.querySelector('[slot="leftButtons"]');
125456
125536
  if (!this.dataUnit.name.includes("InMemoryDataUnit"))
125457
125537
  return;
125458
- this.dataUnit.subscribe(this.onDataUnitAction);
125459
125538
  }
125460
125539
  getDataSource() {
125461
- return this.columnfilterDataSource ? this.columnfilterDataSource : this.buildDefaultDataSource();
125462
- }
125463
- buildDefaultDataSource() {
125464
- var _a, _b;
125465
- if (this._originalRecords.length === 0) {
125466
- this._originalRecords = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
125467
- }
125468
- return {
125469
- fetchData: (filterTerm, fieldName) => {
125470
- return new Promise(resolve => {
125471
- const filteredRecords = this._originalRecords.filter(record => {
125472
- var _a, _b;
125473
- const label = typeof record[fieldName] === "object" ? `${(_a = record[fieldName]) === null || _a === void 0 ? void 0 : _a.value} - ${(_b = record[fieldName]) === null || _b === void 0 ? void 0 : _b.label}` : record[fieldName];
125474
- return label === null || label === void 0 ? void 0 : label.toString().toLowerCase().includes(filterTerm.toLowerCase());
125475
- });
125476
- const options = filteredRecords.map(item => {
125477
- return { value: item[fieldName].toString(), label: this.formatLabel(fieldName, item[fieldName]), check: true };
125478
- });
125479
- resolve(options);
125480
- });
125481
- }
125482
- };
125540
+ var _a;
125541
+ return (_a = this.columnfilterDataSource) !== null && _a !== void 0 ? _a : new InMemoryFilterColumnDataSource(this.dataUnit);
125483
125542
  }
125484
- formatLabel(fieldName, value) {
125485
- const { userInterface } = this.dataUnit.getField(fieldName);
125486
- if (userInterface === UserInterface.DATETIME) {
125487
- return DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value));
125488
- }
125489
- return String(this.dataUnit.getFormattedValue(fieldName, value));
125543
+ hideHeader() {
125544
+ return (!!this._element.getAttribute("no-header") && !this._paginationInfo);
125490
125545
  }
125491
125546
  render() {
125492
125547
  var _a;
125493
- return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: !!this._element.getAttribute("no-header"), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
125548
+ return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
125494
125549
  ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
125495
125550
  ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
125496
125551
  }
@@ -126358,6 +126413,7 @@ const EzMuiltiSelectionList = class extends HTMLElement$1 {
126358
126413
  this.dataSource = undefined;
126359
126414
  this.useOptions = false;
126360
126415
  this.options = undefined;
126416
+ this.isTextSearch = false;
126361
126417
  this.filteredOptions = undefined;
126362
126418
  this.displayOptions = undefined;
126363
126419
  this.viewScenario = undefined;
@@ -126440,6 +126496,7 @@ const EzMuiltiSelectionList = class extends HTMLElement$1 {
126440
126496
  this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
126441
126497
  }
126442
126498
  this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
126499
+ this.searchInput.value = "";
126443
126500
  }
126444
126501
  handleRemoveItemFromOptions(item) {
126445
126502
  this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
@@ -126503,7 +126560,7 @@ const EzMuiltiSelectionList = class extends HTMLElement$1 {
126503
126560
  return scenarios[view];
126504
126561
  }
126505
126562
  render() {
126506
- return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this) })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
126563
+ return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this), isTextSearch: this.isTextSearch })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
126507
126564
  }
126508
126565
  static get watchers() { return {
126509
126566
  "useOptions": ["onChangeUseOptions"],
@@ -127150,6 +127207,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
127150
127207
  this.canShowError = true;
127151
127208
  this.hideErrorOnFocusOut = true;
127152
127209
  this.listOptionsPosition = undefined;
127210
+ this.isTextSearch = false;
127153
127211
  }
127154
127212
  observeErrorMessage() {
127155
127213
  if (this._comboElement) {
@@ -127207,7 +127265,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
127207
127265
  }
127208
127266
  render() {
127209
127267
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
127210
- return (h("ez-combo-box", { "data-element-id": ElementIDUtils.getInternalIDInfo("combo"), ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, hideErrorOnFocusOut: this.hideErrorOnFocusOut, optionLoader: this.optionLoader, searchMode: true, onEzChange: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode, canShowError: this.canShowError, listOptionsPosition: this.listOptionsPosition }));
127268
+ return (h("ez-combo-box", { "data-element-id": ElementIDUtils.getInternalIDInfo("combo"), ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, hideErrorOnFocusOut: this.hideErrorOnFocusOut, optionLoader: this.optionLoader, searchMode: true, onEzChange: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode, canShowError: this.canShowError, listOptionsPosition: this.listOptionsPosition, isTextSearch: this.isTextSearch }));
127211
127269
  }
127212
127270
  ;
127213
127271
  get _elem() { return this; }
@@ -129344,19 +129402,23 @@ const FilterColumn$1 = class extends HTMLElement$1 {
129344
129402
  super();
129345
129403
  this.__registerHost();
129346
129404
  this.applyFilterColumnOptions = createEvent(this, "applyFilterColumnOptions", 7);
129347
- this.TOP_POSITION = '65px';
129405
+ this.TOP_POSITION = '65';
129348
129406
  this.TOP_POSITION_HEADER_HIDDEN = '18';
129407
+ this.TOP_POSITION_NO_TASKBAR = '32';
129408
+ this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN = '20';
129349
129409
  this.DEFAULT_HEIGHT = 430;
129350
129410
  this.opened = true;
129351
129411
  this.columnName = undefined;
129352
129412
  this.columnLabel = undefined;
129353
129413
  this.gridHeaderHidden = false;
129414
+ this.noHeaderTaskBar = false;
129354
129415
  this.dataSource = undefined;
129355
129416
  this.dataUnit = undefined;
129356
129417
  this.options = undefined;
129357
129418
  this.selectedItems = undefined;
129358
129419
  this.fieldDescriptor = undefined;
129359
129420
  this.useOptions = false;
129421
+ this.isTextSearch = false;
129360
129422
  }
129361
129423
  async hide() {
129362
129424
  await this.ezPopoverElement.hide();
@@ -129370,26 +129432,45 @@ const FilterColumn$1 = class extends HTMLElement$1 {
129370
129432
  if (this.canShow(configs)) {
129371
129433
  await this.hide();
129372
129434
  this.fieldDescriptor = this.dataUnit.getField(configs.columnName);
129435
+ this.buildIsTextSearch();
129373
129436
  this.setOptions(configs.filteredOptions);
129374
129437
  this.columnName = configs.columnName;
129375
129438
  this.columnLabel = configs.columnLabel;
129376
- await this.ezPopoverElement.show(this.calcTopPosition(), configs.leftPosition);
129439
+ await this.ezPopoverElement.show(this.calcTopPosition(), this.calculateLeftPosition(configs));
129440
+ }
129441
+ }
129442
+ calculateLeftPosition(configs) {
129443
+ if (!configs.fromIcon) {
129444
+ return configs.leftPosition;
129377
129445
  }
129446
+ const difference = this.ezPopoverElement.getBoundingClientRect().left;
129447
+ const leftReference = parseInt(configs.leftPosition.replace('px', ''));
129448
+ const leftResolved = (leftReference + 16) - difference;
129449
+ return `${(leftResolved > 0 ? leftResolved : 0)}px`;
129450
+ }
129451
+ buildIsTextSearch() {
129452
+ var _a, _b;
129453
+ const userInterface = (_b = (_a = this.fieldDescriptor) === null || _a === void 0 ? void 0 : _a.userInterface) !== null && _b !== void 0 ? _b : UserInterface.SHORTTEXT;
129454
+ this.isTextSearch = !(userInterface === UserInterface.DECIMALNUMBER || userInterface === UserInterface.INTEGERNUMBER);
129378
129455
  }
129379
129456
  calcTopPosition() {
129380
- const referencePosition = this.gridHeaderHidden
129381
- ? this.TOP_POSITION_HEADER_HIDDEN
129382
- : this.TOP_POSITION.replace('px', '');
129457
+ const referencePosition = this.buildReferenceTopPosition();
129383
129458
  const totalPopoverHeight = parseInt(referencePosition) + this.DEFAULT_HEIGHT;
129384
129459
  const popoverPosition = Math.round(this.ezPopoverElement.getBoundingClientRect().top);
129385
129460
  const popoverBottomPosition = popoverPosition + totalPopoverHeight;
129386
129461
  const windowHeight = window.innerHeight;
129387
129462
  if (windowHeight > popoverBottomPosition) {
129388
- return referencePosition;
129463
+ return `${referencePosition}px`;
129389
129464
  }
129390
129465
  const differenceBetween = windowHeight - popoverBottomPosition;
129391
129466
  return `${differenceBetween}px`;
129392
129467
  }
129468
+ buildReferenceTopPosition() {
129469
+ if (this.noHeaderTaskBar) {
129470
+ return this.gridHeaderHidden ? this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN : this.TOP_POSITION_NO_TASKBAR;
129471
+ }
129472
+ return this.gridHeaderHidden ? this.TOP_POSITION_HEADER_HIDDEN : this.TOP_POSITION;
129473
+ }
129393
129474
  async clearConfigs() {
129394
129475
  var _a;
129395
129476
  await ((_a = this.ezMultiSelectionList) === null || _a === void 0 ? void 0 : _a.clearFilteredOptions());
@@ -129447,7 +129528,7 @@ const FilterColumn$1 = class extends HTMLElement$1 {
129447
129528
  }
129448
129529
  }
129449
129530
  render() {
129450
- return (h("ez-popover", { class: 'filter-column__popover', "overlay-type": 'none', ref: (element) => (this.ezPopoverElement = element), autoClose: true, onEzVisibilityChange: this.handleEzVisibilityChange.bind(this) }, h("section", { class: 'filter-column' }, h("header", { class: 'filter-column__header' }, h("span", { class: 'ez-text ez-text--medium filter-column__header-title' }, "Filtro da coluna ", this.columnLabel), h("ez-button", { mode: 'icon', "icon-name": 'close', class: 'ez-button--tertiary', onClick: () => this.hide() })), h("ez-multi-selection-list", { columnName: this.columnName, dataSource: this.dataSource, options: this.options, useOptions: this.useOptions, ref: (element) => (this.ezMultiSelectionList = element), onChangeFilteredOptions: (event) => this.changeSelectedItems(event.detail) }), h("footer", { class: 'filter-column__footer' }, h("ez-button", { label: 'Aplicar', class: 'ez-button--primary', onClick: this.submit.bind(this) })))));
129531
+ return (h("ez-popover", { class: 'filter-column__popover', "overlay-type": 'none', ref: (element) => (this.ezPopoverElement = element), autoClose: true, onEzVisibilityChange: this.handleEzVisibilityChange.bind(this) }, h("section", { class: 'filter-column' }, h("header", { class: 'filter-column__header' }, h("span", { class: 'ez-text ez-text--medium filter-column__header-title' }, "Filtro da coluna ", this.columnLabel), h("ez-button", { mode: 'icon', "icon-name": 'close', class: 'ez-button--tertiary', onClick: () => this.hide() })), h("ez-multi-selection-list", { columnName: this.columnName, dataSource: this.dataSource, options: this.options, useOptions: this.useOptions, ref: (element) => (this.ezMultiSelectionList = element), onChangeFilteredOptions: (event) => this.changeSelectedItems(event.detail), isTextSearch: this.isTextSearch }), h("footer", { class: 'filter-column__footer' }, h("ez-button", { label: 'Aplicar', class: 'ez-button--primary', onClick: this.submit.bind(this) })))));
129451
129532
  }
129452
129533
  static get style() { return filterColumnCss; }
129453
129534
  };
@@ -129477,7 +129558,7 @@ const EzCardItem = /*@__PURE__*/proxyCustomElement(EzCardItem$1, [1,"ez-card-ite
129477
129558
  const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[1540],"mode":[513],"compact":[4]}]);
129478
129559
  const EzChip = /*@__PURE__*/proxyCustomElement(EzChip$1, [1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540],"showNativeTooltip":[4,"show-native-tooltip"]}]);
129479
129560
  const EzCollapsibleBox = /*@__PURE__*/proxyCustomElement(EzCollapsibleBox$1, [1,"ez-collapsible-box",{"value":[1540],"boxBordered":[4,"box-bordered"],"label":[513],"subtitle":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"headerAlign":[513,"header-align"],"removable":[516],"editable":[516],"conditionalSave":[16],"_activeEditText":[32]}]);
129480
- const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]},[[11,"scroll","scrollListener"]]]);
129561
+ const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]},[[11,"scroll","scrollListener"]]]);
129481
129562
  const EzDateInput = /*@__PURE__*/proxyCustomElement(EzDateInput$1, [1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"canShowError":[516,"can-show-error"]}]);
129482
129563
  const EzDateTimeInput = /*@__PURE__*/proxyCustomElement(EzDateTimeInput$1, [1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"canShowError":[516,"can-show-error"]}]);
129483
129564
  const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"confirm":[1028],"dialogType":[1025,"dialog-type"],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"beforeClose":[1040]}]);
@@ -129486,20 +129567,20 @@ const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-ite
129486
129567
  const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"],"canShowError":[516,"can-show-error"]}]);
129487
129568
  const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16]}]);
129488
129569
  const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
129489
- const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_originalRecords":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
129570
+ const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_hasLeftButtons":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
129490
129571
  const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
129491
129572
  const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
129492
129573
  const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"listMode":[1,"list-mode"],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"itemLeftSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32]}]);
129493
129574
  const EzLoadingBar = /*@__PURE__*/proxyCustomElement(EzLoadingBar$1, [1,"ez-loading-bar",{"_showLoading":[32]}]);
129494
129575
  const EzModal = /*@__PURE__*/proxyCustomElement(EzModal$1, [1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"heightMode":[1,"height-mode"],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"],"scrim":[1]}]);
129495
129576
  const EzModalContainer = /*@__PURE__*/proxyCustomElement(EzModalContainer$1, [6,"ez-modal-container",{"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"showTitleBar":[4,"show-title-bar"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"cancelButtonStatus":[1,"cancel-button-status"],"okButtonStatus":[1,"ok-button-status"]}]);
129496
- const EzMultiSelectionList = /*@__PURE__*/proxyCustomElement(EzMuiltiSelectionList, [2,"ez-multi-selection-list",{"columnName":[1,"column-name"],"dataSource":[16],"useOptions":[1028,"use-options"],"options":[16],"filteredOptions":[32],"displayOptions":[32],"viewScenario":[32],"displayOptionToCheckAllItems":[32]}]);
129577
+ const EzMultiSelectionList = /*@__PURE__*/proxyCustomElement(EzMuiltiSelectionList, [2,"ez-multi-selection-list",{"columnName":[1,"column-name"],"dataSource":[16],"useOptions":[1028,"use-options"],"options":[16],"isTextSearch":[4,"is-text-search"],"filteredOptions":[32],"displayOptions":[32],"viewScenario":[32],"displayOptionToCheckAllItems":[32]}]);
129497
129578
  const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"canShowError":[516,"can-show-error"],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513]}]);
129498
129579
  const EzPopover = /*@__PURE__*/proxyCustomElement(EzPopover$1, [1,"ez-popover",{"autoClose":[516,"auto-close"],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"overlayType":[513,"overlay-type"]}]);
129499
129580
  const EzPopup = /*@__PURE__*/proxyCustomElement(EzPopup$1, [1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[516,"use-header"],"heightMode":[513,"height-mode"],"ezTitle":[1,"ez-title"]}]);
129500
129581
  const EzRadioButton = /*@__PURE__*/proxyCustomElement(EzRadioButton$1, [1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]);
129501
129582
  const EzScroller = /*@__PURE__*/proxyCustomElement(EzScroller$1, [1,"ez-scroller",{"direction":[1],"locked":[4],"activeShadow":[4,"active-shadow"],"isActive":[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]);
129502
- const EzSearch = /*@__PURE__*/proxyCustomElement(EzSearch$1, [1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"canShowError":[516,"can-show-error"],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16]}]);
129583
+ const EzSearch = /*@__PURE__*/proxyCustomElement(EzSearch$1, [1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"canShowError":[516,"can-show-error"],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"]}]);
129503
129584
  const EzSidebarButton = /*@__PURE__*/proxyCustomElement(EzSidebarButton$1, [1,"ez-sidebar-button"]);
129504
129585
  const EzSkeleton = /*@__PURE__*/proxyCustomElement(EzSkeleton$1, [0,"ez-skeleton",{"count":[2],"variant":[1],"width":[1],"height":[1],"marginBottom":[1,"margin-bottom"],"animation":[1]}]);
129505
129586
  const EzTabselector = /*@__PURE__*/proxyCustomElement(EzTabselector$1, [1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32]}]);
@@ -129511,7 +129592,7 @@ const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"messa
129511
129592
  const EzTree = /*@__PURE__*/proxyCustomElement(EzTree$1, [1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_tree":[32],"_waintingForLoad":[32]},[[2,"keydown","onKeyDownListener"]]]);
129512
129593
  const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"subtitle":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
129513
129594
  const EzViewStack = /*@__PURE__*/proxyCustomElement(EzViewStack$1, [0,"ez-view-stack"]);
129514
- const FilterColumn = /*@__PURE__*/proxyCustomElement(FilterColumn$1, [0,"filter-column",{"opened":[4],"columnName":[1,"column-name"],"columnLabel":[1,"column-label"],"gridHeaderHidden":[4,"grid-header-hidden"],"dataSource":[16],"dataUnit":[16],"options":[1040],"selectedItems":[32],"fieldDescriptor":[32],"useOptions":[32]}]);
129595
+ const FilterColumn = /*@__PURE__*/proxyCustomElement(FilterColumn$1, [0,"filter-column",{"opened":[4],"columnName":[1,"column-name"],"columnLabel":[1,"column-label"],"gridHeaderHidden":[4,"grid-header-hidden"],"noHeaderTaskBar":[1028,"no-header-task-bar"],"dataSource":[16],"dataUnit":[16],"options":[1040],"selectedItems":[32],"fieldDescriptor":[32],"useOptions":[32],"isTextSearch":[32]}]);
129515
129596
  const MultiSelectionBoxMessage = /*@__PURE__*/proxyCustomElement(MultiSelectionBoxMessage$1, [0,"multi-selection-box-message",{"message":[1]}]);
129516
129597
  const defineCustomElements = (opts) => {
129517
129598
  if (typeof customElements !== 'undefined') {
@@ -40,6 +40,7 @@ const EzComboBox = class {
40
40
  this.mode = "regular";
41
41
  this.hideErrorOnFocusOut = true;
42
42
  this.listOptionsPosition = undefined;
43
+ this.isTextSearch = false;
43
44
  }
44
45
  observeErrorMessage() {
45
46
  var _a;
@@ -362,7 +363,6 @@ const EzComboBox = class {
362
363
  this._visibleOptions = [];
363
364
  this.clearSource();
364
365
  }
365
- this.setFocus();
366
366
  }
367
367
  loadOptions(mode, argument = "") {
368
368
  this._criteria = argument;
@@ -547,6 +547,12 @@ const EzComboBox = class {
547
547
  handlerIconClick() {
548
548
  this.searchMode ? this.loadOptions(SearchMode.ADVANCED) : this.showOptions();
549
549
  }
550
+ buildNumberArgument(argument) {
551
+ if (this.isTextSearch) {
552
+ return NaN;
553
+ }
554
+ return Number(argument || undefined);
555
+ }
550
556
  onTextInputChangeHandler(event) {
551
557
  var _a;
552
558
  this.clearDeboucingTimeout();
@@ -557,7 +563,7 @@ const EzComboBox = class {
557
563
  return;
558
564
  }
559
565
  const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
560
- const argumentNumber = Number(argument || undefined);
566
+ const argumentNumber = this.buildNumberArgument(argument);
561
567
  if (!this._criteria) {
562
568
  this._textInput.value = event.data || argument;
563
569
  }
@@ -1,5 +1,5 @@
1
1
  import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-296b8458.js';
2
- import { Action, ObjectUtils as ObjectUtils$1, HTMLBuilder, ApplicationContext, UserInterface, StringUtils as StringUtils$1, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, ElementIDUtils, JSUtils, DateUtils as DateUtils$1 } from '@sankhyalabs/core';
2
+ import { Action, ObjectUtils as ObjectUtils$1, HTMLBuilder, ApplicationContext, UserInterface, StringUtils as StringUtils$1, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, ElementIDUtils, DateUtils as DateUtils$1, JSUtils } from '@sankhyalabs/core';
3
3
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
4
4
  import { D as DISTINCT_FILTER_NAME_PREFIX } from './constants-6dab64f7.js';
5
5
  import { b as buildFieldMetadata, R as RecordValidationProcessor } from './RecordValidationProcessor-abc814af.js';
@@ -118974,7 +118974,7 @@ class EzGridCustomHeader {
118974
118974
  onClickFilter() {
118975
118975
  var _a;
118976
118976
  const iconLeft = (_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left;
118977
- this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`);
118977
+ this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`, true);
118978
118978
  }
118979
118979
  configSortIcon() {
118980
118980
  this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
@@ -120216,7 +120216,7 @@ class AgGridController {
120216
120216
  tooltip: tooltip,
120217
120217
  isSortable: propSortable,
120218
120218
  hasFilter: () => this.hasFilterColumn(source.name),
120219
- showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name) }),
120219
+ showColumnFilter: (leftPosition, fromIcon) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon }),
120220
120220
  },
120221
120221
  valueFormatter: params => {
120222
120222
  if (params.value == undefined) {
@@ -120439,6 +120439,84 @@ function getElementID(sufix) {
120439
120439
  };
120440
120440
  }
120441
120441
 
120442
+ class InMemoryFilterColumnDataSource {
120443
+ constructor(dataUnit) {
120444
+ var _a;
120445
+ this.onDataUnitAction = (action) => {
120446
+ if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
120447
+ this.originalRecords = this.dataUnit.records;
120448
+ }
120449
+ };
120450
+ this.dataUnit = dataUnit;
120451
+ this.originalRecords = (_a = this.dataUnit.records) !== null && _a !== void 0 ? _a : [];
120452
+ this.dataUnit.subscribe(this.onDataUnitAction);
120453
+ }
120454
+ fetchData(filterTerm, fieldName) {
120455
+ return new Promise(resolve => {
120456
+ const filteredRecords = this.originalRecords.filter(record => this.includesSearchTerm(record, fieldName, filterTerm));
120457
+ const options = filteredRecords.map(item => this.buildFieldOption(item, fieldName));
120458
+ resolve(this.removeDuplicatedOptions(options));
120459
+ });
120460
+ }
120461
+ buildFieldOption(item, fieldName) {
120462
+ return {
120463
+ value: this.buildValue(item, fieldName),
120464
+ label: this.formatLabel(fieldName, item[fieldName]),
120465
+ check: true,
120466
+ };
120467
+ }
120468
+ buildValue(item, fieldName) {
120469
+ var _a;
120470
+ let value = item[fieldName];
120471
+ if (((_a = this.dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType) === DataType.OBJECT) {
120472
+ value = value.value;
120473
+ }
120474
+ return value === null || value === void 0 ? void 0 : value.toString();
120475
+ }
120476
+ removeDuplicatedOptions(options) {
120477
+ const noDuplicatedOptions = [];
120478
+ options.forEach(option => {
120479
+ if (!noDuplicatedOptions.find(({ label }) => label === option.label)) {
120480
+ noDuplicatedOptions.push(option);
120481
+ }
120482
+ });
120483
+ return noDuplicatedOptions;
120484
+ }
120485
+ includesSearchTerm(record, fieldName, filterTerm) {
120486
+ let label = this.buildLabel(fieldName, record[fieldName]);
120487
+ return label.toLowerCase().includes(filterTerm.toLowerCase());
120488
+ }
120489
+ buildLabel(fieldName, value) {
120490
+ var _a;
120491
+ const { dataType } = this.dataUnit.getField(fieldName);
120492
+ if (dataType === DataType.NUMBER) {
120493
+ return value === null || value === void 0 ? void 0 : value.toString().replace('.', ',');
120494
+ }
120495
+ if (dataType === DataType.DATE) {
120496
+ return (typeof value === 'object')
120497
+ ? (_a = DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString()
120498
+ : value === null || value === void 0 ? void 0 : value.toString();
120499
+ }
120500
+ if (dataType === DataType.OBJECT) {
120501
+ return `${value === null || value === void 0 ? void 0 : value.value} - ${value === null || value === void 0 ? void 0 : value.label}`;
120502
+ }
120503
+ return value === null || value === void 0 ? void 0 : value.toString();
120504
+ }
120505
+ formatLabel(fieldName, value) {
120506
+ var _a, _b;
120507
+ const { userInterface, dataType } = this.dataUnit.getField(fieldName);
120508
+ if (dataType === DataType.DATE) {
120509
+ return (typeof value === 'object')
120510
+ ? DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value))
120511
+ : value === null || value === void 0 ? void 0 : value.toString();
120512
+ }
120513
+ if (dataType === DataType.NUMBER && userInterface !== UserInterface.DECIMALNUMBER) {
120514
+ return (_a = parseInt(this.dataUnit.getFormattedValue(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString();
120515
+ }
120516
+ return (_b = this.dataUnit.getFormattedValue(fieldName, value)) === null || _b === void 0 ? void 0 : _b.toString();
120517
+ }
120518
+ }
120519
+
120442
120520
  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(--visible, 1);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}.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(--more-visible, 2)}.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{height:0;padding:0}";
120443
120521
 
120444
120522
  const windowInstace = window;
@@ -120452,18 +120530,13 @@ const EzGrid = class {
120452
120530
  this.componentReady = createEvent(this, "componentReady", 7);
120453
120531
  this._gridController = new AgGridController(false);
120454
120532
  this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
120455
- this.onDataUnitAction = (action) => {
120456
- if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
120457
- this._originalRecords = this.dataUnit.records;
120458
- }
120459
- };
120460
120533
  this._paginationInfo = undefined;
120461
120534
  this._paginationChangedByKeyboard = true;
120462
120535
  this._showSelectionCounter = false;
120463
120536
  this._isAllSelection = false;
120464
120537
  this._currentPageSelected = undefined;
120465
120538
  this._selectionCount = undefined;
120466
- this._originalRecords = [];
120539
+ this._hasLeftButtons = false;
120467
120540
  this.multipleSelection = undefined;
120468
120541
  this.config = undefined;
120469
120542
  this.selectionToastConfig = undefined;
@@ -120733,44 +120806,20 @@ const EzGrid = class {
120733
120806
  });
120734
120807
  }
120735
120808
  componentWillLoad() {
120809
+ this._hasLeftButtons = !!this._element.querySelector('[slot="leftButtons"]');
120736
120810
  if (!this.dataUnit.name.includes("InMemoryDataUnit"))
120737
120811
  return;
120738
- this.dataUnit.subscribe(this.onDataUnitAction);
120739
120812
  }
120740
120813
  getDataSource() {
120741
- return this.columnfilterDataSource ? this.columnfilterDataSource : this.buildDefaultDataSource();
120742
- }
120743
- buildDefaultDataSource() {
120744
- var _a, _b;
120745
- if (this._originalRecords.length === 0) {
120746
- this._originalRecords = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
120747
- }
120748
- return {
120749
- fetchData: (filterTerm, fieldName) => {
120750
- return new Promise(resolve => {
120751
- const filteredRecords = this._originalRecords.filter(record => {
120752
- var _a, _b;
120753
- const label = typeof record[fieldName] === "object" ? `${(_a = record[fieldName]) === null || _a === void 0 ? void 0 : _a.value} - ${(_b = record[fieldName]) === null || _b === void 0 ? void 0 : _b.label}` : record[fieldName];
120754
- return label === null || label === void 0 ? void 0 : label.toString().toLowerCase().includes(filterTerm.toLowerCase());
120755
- });
120756
- const options = filteredRecords.map(item => {
120757
- return { value: item[fieldName].toString(), label: this.formatLabel(fieldName, item[fieldName]), check: true };
120758
- });
120759
- resolve(options);
120760
- });
120761
- }
120762
- };
120814
+ var _a;
120815
+ return (_a = this.columnfilterDataSource) !== null && _a !== void 0 ? _a : new InMemoryFilterColumnDataSource(this.dataUnit);
120763
120816
  }
120764
- formatLabel(fieldName, value) {
120765
- const { userInterface } = this.dataUnit.getField(fieldName);
120766
- if (userInterface === UserInterface.DATETIME) {
120767
- return DateUtils$1.formatDate(this.dataUnit.valueFromString(fieldName, value));
120768
- }
120769
- return String(this.dataUnit.getFormattedValue(fieldName, value));
120817
+ hideHeader() {
120818
+ return (!!this._element.getAttribute("no-header") && !this._paginationInfo);
120770
120819
  }
120771
120820
  render() {
120772
120821
  var _a;
120773
- return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: !!this._element.getAttribute("no-header"), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
120822
+ return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
120774
120823
  ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
120775
120824
  ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
120776
120825
  }