@sankhyalabs/ezui 1.1.130 → 1.1.133

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 (52) hide show
  1. package/dist/cjs/ez-form.cjs.entry.js +14 -3
  2. package/dist/cjs/ez-grid.cjs.entry.js +215 -51
  3. package/dist/cjs/ez-list.cjs.entry.js +11 -0
  4. package/dist/cjs/ez-modal.cjs.entry.js +6 -0
  5. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-text-input.cjs.entry.js +10 -8
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/grid-config.cjs.entry.js +44 -2
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/ez-form/DataBinder.js +13 -2
  11. package/dist/collection/components/ez-form/ez-form.js +1 -1
  12. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +10 -5
  13. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +128 -36
  14. package/dist/collection/components/ez-grid/ez-grid.js +253 -15
  15. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +44 -2
  16. package/dist/collection/components/ez-list/ez-list.js +27 -0
  17. package/dist/collection/components/ez-modal/ez-modal.js +20 -0
  18. package/dist/collection/components/ez-number-input/ez-number-input.js +1 -1
  19. package/dist/collection/components/ez-text-input/ez-text-input.js +10 -8
  20. package/dist/collection/utils/interfaces/PageableComponent.js +1 -0
  21. package/dist/custom-elements/index.js +302 -67
  22. package/dist/esm/ez-form.entry.js +14 -3
  23. package/dist/esm/ez-grid.entry.js +216 -52
  24. package/dist/esm/ez-list.entry.js +11 -0
  25. package/dist/esm/ez-modal.entry.js +6 -0
  26. package/dist/esm/ez-number-input.entry.js +1 -1
  27. package/dist/esm/ez-text-input.entry.js +10 -8
  28. package/dist/esm/ezui.js +1 -1
  29. package/dist/esm/grid-config.entry.js +44 -2
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/ezui/ezui.esm.js +1 -1
  32. package/dist/ezui/p-48ba92b2.entry.js +1 -0
  33. package/dist/ezui/p-4ded39c2.entry.js +1 -0
  34. package/dist/ezui/{p-2d165ca8.entry.js → p-80d863c2.entry.js} +7 -7
  35. package/dist/ezui/p-c8f9b691.entry.js +1 -0
  36. package/dist/ezui/{p-47fe4273.entry.js → p-cfa7378a.entry.js} +1 -1
  37. package/dist/ezui/p-d5c93280.entry.js +1 -0
  38. package/dist/ezui/p-d9bb2a96.entry.js +1 -0
  39. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +46 -0
  40. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +12 -0
  41. package/dist/types/components/ez-grid/ez-grid.d.ts +45 -4
  42. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
  43. package/dist/types/components/ez-list/ez-list.d.ts +4 -0
  44. package/dist/types/components/ez-modal/ez-modal.d.ts +5 -0
  45. package/dist/types/components.d.ts +49 -0
  46. package/dist/types/utils/interfaces/PageableComponent.d.ts +12 -0
  47. package/package.json +1 -1
  48. package/dist/ezui/p-6d39b7ea.entry.js +0 -1
  49. package/dist/ezui/p-7d5b2ebf.entry.js +0 -1
  50. package/dist/ezui/p-c6b2b2e5.entry.js +0 -1
  51. package/dist/ezui/p-ef8f1275.entry.js +0 -1
  52. package/dist/ezui/p-f65302bb.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-bf1aef20.js';
2
- import { DataType, Action } from '@sankhyalabs/core';
2
+ import { NumberUtils, DataType, Action } from '@sankhyalabs/core';
3
3
  import { UserInterface, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
4
 
5
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -110059,8 +110059,11 @@ class DataSource {
110059
110059
 
110060
110060
  class AgGridController {
110061
110061
  constructor(enterprise) {
110062
+ this.DEFAULT_ROW_HEIGHT = 25;
110062
110063
  this._menuItems = [];
110063
110064
  this._idAttribName = "__record__id__";
110065
+ this._isFirstRecordOfPage = true;
110066
+ this._isLastRecordOfPage = false;
110064
110067
  this._enterprise = enterprise;
110065
110068
  }
110066
110069
  getSort() {
@@ -110088,7 +110091,9 @@ class AgGridController {
110088
110091
  this._pageSize = options.pageSize;
110089
110092
  this._serverURL = options.serverURL;
110090
110093
  this._dataUnit = options.dataUnit;
110091
- this._dataUnit.sortingProvider = this;
110094
+ if (this._dataUnit) {
110095
+ this._dataUnit.sortingProvider = this;
110096
+ }
110092
110097
  this._dataSource = new DataSource(this._dataUnit, this._serverURL);
110093
110098
  this._gridOptions = {
110094
110099
  localeText: gridTerms,
@@ -110097,7 +110102,7 @@ class AgGridController {
110097
110102
  rowSelection: this._multipleSelection ? "multiple" : "single",
110098
110103
  serverSideDatasource: this._dataSource,
110099
110104
  sortingOrder: ['desc', 'asc', null],
110100
- getRowNodeId: (params) => typeof params === "string" ? params : params[this._idAttribName],
110105
+ getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
110101
110106
  getMainMenuItems: (params) => {
110102
110107
  const column = params.column;
110103
110108
  const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
@@ -110107,14 +110112,12 @@ class AgGridController {
110107
110112
  }));
110108
110113
  return items;
110109
110114
  },
110110
- getRowHeight: () => {
110111
- //FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
110112
- //apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
110113
- //dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
110114
- //Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
110115
- //tamanho errado, isso afeta menos o componente.
110116
- return 25;
110117
- }
110115
+ //FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
110116
+ //apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
110117
+ //dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
110118
+ //Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
110119
+ //tamanho errado, isso afeta menos o componente.
110120
+ rowHeight: this.DEFAULT_ROW_HEIGHT
110118
110121
  };
110119
110122
  this.setOptionsEvents(this._gridOptions);
110120
110123
  this.setOptionsPagination(this._gridOptions);
@@ -110137,16 +110140,17 @@ class AgGridController {
110137
110140
  opt.onPaginationChanged = () => this.onPaginationChange();
110138
110141
  opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
110139
110142
  opt.onDragStopped = evt => this.onCallStateChange("columnMovedEnd", evt);
110140
- opt.onViewportChanged = () => {
110141
- if (this._dataUnit) {
110142
- this.selectRows(this._dataUnit.getSelection());
110143
- }
110144
- };
110143
+ }
110144
+ syncSelection() {
110145
+ if (this._dataUnit) {
110146
+ this.selectRows(this._dataUnit.getSelection());
110147
+ }
110145
110148
  }
110146
110149
  setOptionsPagination(opt) {
110147
110150
  opt.pagination = (this._pageSize > -1);
110148
110151
  opt.paginationPageSize = this._pageSize;
110149
110152
  opt.cacheBlockSize = this._pageSize;
110153
+ opt.maxBlocksInCache = 1;
110150
110154
  }
110151
110155
  setOptionsSupress(opt) {
110152
110156
  opt.suppressDragLeaveHidesColumns = true;
@@ -110182,7 +110186,7 @@ class AgGridController {
110182
110186
  if (this._grid === undefined) {
110183
110187
  throw new Error("Erro interno: Grid ainda não inicializado.");
110184
110188
  }
110185
- this._gridOptions.api.refreshServerSideStore({});
110189
+ this._gridOptions.api.refreshServerSideStore({ purge: true });
110186
110190
  }
110187
110191
  changeValues(changes, rowIds) {
110188
110192
  if (this._grid === undefined) {
@@ -110319,6 +110323,75 @@ class AgGridController {
110319
110323
  this.goToPage(0);
110320
110324
  this._gridOptions.api.refreshServerSideStore({ purge: true });
110321
110325
  }
110326
+ isLastOfPage() {
110327
+ return this._isLastRecordOfPage;
110328
+ }
110329
+ isFirstOfPage() {
110330
+ return this._isFirstRecordOfPage;
110331
+ }
110332
+ previousRecord() {
110333
+ const pagination = this.getPaginationStatus();
110334
+ if (this._isFirstRecordOfPage && pagination.hasPrevious) {
110335
+ this.previousPage();
110336
+ }
110337
+ else {
110338
+ if (this._dataUnit) {
110339
+ this._dataUnit.previousRecord();
110340
+ }
110341
+ else {
110342
+ const node = this._gridOptions.api.getSelectedNodes()[0];
110343
+ this.setSelectedIndex(node.rowIndex - 1);
110344
+ }
110345
+ }
110346
+ }
110347
+ nextRecord() {
110348
+ const pagination = this.getPaginationStatus();
110349
+ if (this._isLastRecordOfPage && pagination.hasNext) {
110350
+ this.nextPage();
110351
+ }
110352
+ else {
110353
+ if (this._dataUnit) {
110354
+ this._dataUnit.nextRecord();
110355
+ }
110356
+ else {
110357
+ const node = this._gridOptions.api.getSelectedNodes()[0];
110358
+ this.setSelectedIndex(node.rowIndex + 1);
110359
+ }
110360
+ }
110361
+ }
110362
+ setSelectedIndex(index) {
110363
+ var _a;
110364
+ (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
110365
+ }
110366
+ hasPreviousRecord() {
110367
+ const pagination = this.getPaginationStatus();
110368
+ if (this._isFirstRecordOfPage) {
110369
+ return pagination.hasPrevious;
110370
+ }
110371
+ else {
110372
+ if (this._dataUnit) {
110373
+ return this._dataUnit.hasPrevious();
110374
+ }
110375
+ else {
110376
+ return pagination.hasPrevious || this._gridOptions.api.getSelectedRows()[0].rowIndex > 0;
110377
+ }
110378
+ }
110379
+ }
110380
+ hasNextRecord() {
110381
+ const pagination = this.getPaginationStatus();
110382
+ if (this._isLastRecordOfPage) {
110383
+ return pagination.hasNext;
110384
+ }
110385
+ else {
110386
+ if (this._dataUnit) {
110387
+ return this._dataUnit.hasNext() || this.getPaginationStatus().hasNext;
110388
+ }
110389
+ else {
110390
+ const api = this._gridOptions.api;
110391
+ return pagination.hasNext || api.getSelectedRows()[0].rowIndex < api.getDisplayedRowCount();
110392
+ }
110393
+ }
110394
+ }
110322
110395
  buildColDef(source) {
110323
110396
  return {
110324
110397
  headerName: source.label,
@@ -110353,19 +110426,24 @@ class AgGridController {
110353
110426
  });
110354
110427
  return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
110355
110428
  }
110356
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
110357
- if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
110429
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SWITCH) {
110430
+ 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") {
110358
110431
  return "Sim";
110359
110432
  }
110360
- else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
110433
+ 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") {
110361
110434
  return "Não";
110362
110435
  }
110363
110436
  }
110364
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
110437
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SEARCH) {
110365
110438
  if (params.value !== undefined) {
110366
110439
  return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
110367
110440
  }
110368
110441
  }
110442
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DECIMALNUMBER) {
110443
+ if (params.value !== undefined) {
110444
+ return NumberUtils.format(params.value.toString(), 2, 2);
110445
+ }
110446
+ }
110369
110447
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATETIME) {
110370
110448
  if (params.value !== undefined) {
110371
110449
  return params.value.toLocaleDateString();
@@ -110395,31 +110473,44 @@ class AgGridController {
110395
110473
  return false;
110396
110474
  }
110397
110475
  onSelectionChange(e) {
110476
+ const selectedNodes = e.api.getSelectedNodes();
110477
+ if (selectedNodes.length > 0) {
110478
+ this._isFirstRecordOfPage = selectedNodes[0].rowIndex === e.api.getFirstDisplayedRow();
110479
+ this._isLastRecordOfPage = selectedNodes[0].rowIndex === e.api.getLastDisplayedRow();
110480
+ }
110398
110481
  if (this._selectionChangeCallback) {
110399
- this._selectionChangeCallback(e.api.getSelectedRows());
110482
+ this._selectionChangeCallback({
110483
+ selection: e.api.getSelectedRows(),
110484
+ isFirstOfPage: this._isFirstRecordOfPage,
110485
+ isLastOfPage: this._isLastRecordOfPage
110486
+ });
110400
110487
  }
110401
110488
  }
110402
110489
  onPaginationChange() {
110490
+ this.syncSelection();
110403
110491
  if (this._paginationChangeCallback) {
110404
110492
  if (this._gridOptions.api) {
110405
- const api = this._gridOptions.api;
110406
- const currentPage = api.paginationGetCurrentPage();
110407
- const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
110408
- const pageSize = api.paginationGetPageSize();
110409
- const totalRows = api.paginationGetRowCount();
110410
- const pageStart = currentPage * pageSize + 1;
110411
- const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
110412
- this._paginationChangeCallback({
110413
- hasPrevious: currentPage > 0,
110414
- hasNext: !isLastPage,
110415
- currentPage: currentPage + 1,
110416
- pageStart,
110417
- pageEnd,
110418
- totalRows
110419
- });
110493
+ this._paginationChangeCallback(this.getPaginationStatus());
110420
110494
  }
110421
110495
  }
110422
110496
  }
110497
+ getPaginationStatus() {
110498
+ const api = this._gridOptions.api;
110499
+ const currentPage = api.paginationGetCurrentPage();
110500
+ const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
110501
+ const pageSize = api.paginationGetPageSize();
110502
+ const totalRows = api.paginationGetRowCount();
110503
+ const pageStart = currentPage * pageSize + 1;
110504
+ const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
110505
+ return {
110506
+ hasPrevious: currentPage > 0,
110507
+ hasNext: !isLastPage,
110508
+ currentPage: currentPage + 1,
110509
+ pageStart,
110510
+ pageEnd,
110511
+ totalRows
110512
+ };
110513
+ }
110423
110514
  onRowDoubleClick(evt) {
110424
110515
  if (this._doubleClickCallBack) {
110425
110516
  this._doubleClickCallBack(evt.data);
@@ -110443,10 +110534,6 @@ class DataUnitBridge {
110443
110534
  const { records } = action.payload;
110444
110535
  this._gridController.removeRows(records);
110445
110536
  break;
110446
- case Action.RECORDS_ADDED:
110447
- case Action.RECORDS_COPIED:
110448
- this._gridController.addRows(action.payload);
110449
- break;
110450
110537
  case Action.EDITION_CANCELED:
110451
110538
  case Action.DATA_SAVED:
110452
110539
  this._gridController.refresh();
@@ -110455,6 +110542,10 @@ class DataUnitBridge {
110455
110542
  const { selection } = action.payload;
110456
110543
  this._gridController.selectRows(selection);
110457
110544
  break;
110545
+ case Action.NEXT_SELECTED:
110546
+ case Action.PREVIOUS_SELECTED:
110547
+ this._gridController.selectRows(this._dataUnit.getSelection());
110548
+ break;
110458
110549
  case Action.DATA_CHANGED:
110459
110550
  const changes = Object.assign({}, action.payload);
110460
110551
  delete changes.records;
@@ -110471,7 +110562,12 @@ class DataUnitBridge {
110471
110562
  this._dataUnit.metadata.fields.forEach(f => {
110472
110563
  var _a;
110473
110564
  if (f.visible !== false) {
110474
- columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options });
110565
+ const props = new Map();
110566
+ const properties = this._dataUnit.getField(f.name).properties;
110567
+ for (const value in properties) {
110568
+ props.set(value, properties[value]);
110569
+ }
110570
+ columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props });
110475
110571
  }
110476
110572
  });
110477
110573
  }
@@ -110492,7 +110588,7 @@ let EzGrid = class {
110492
110588
  this.ezDoubleClick = createEvent(this, "ezDoubleClick", 7);
110493
110589
  this.configChange = createEvent(this, "configChange", 7);
110494
110590
  this._gridController = new AgGridController(false);
110495
- this._popUpVisible = false;
110591
+ this._popUpGridConfig = false;
110496
110592
  /**
110497
110593
  * Determina o número de linhas de cada página. Caso informado o valor -1
110498
110594
  * não haverá paginação.
@@ -110554,6 +110650,74 @@ let EzGrid = class {
110554
110650
  async quickFilter(term) {
110555
110651
  this._gridController.quickFilter(term);
110556
110652
  }
110653
+ /**
110654
+ * Método para fazer um filtro rápido na grid.
110655
+ */
110656
+ async nextPage() {
110657
+ this._gridController.nextPage();
110658
+ }
110659
+ /**
110660
+ * Método para fazer um filtro rápido na grid.
110661
+ */
110662
+ async previousPage() {
110663
+ this._gridController.previousPage();
110664
+ }
110665
+ /**
110666
+ * Método para fazer um filtro rápido na grid.
110667
+ */
110668
+ async hasNextPage() {
110669
+ return new Promise(resolve => {
110670
+ resolve(this._navigationHasNext);
110671
+ });
110672
+ }
110673
+ /**
110674
+ * Método para fazer um filtro rápido na grid.
110675
+ */
110676
+ async hasPreviousPage() {
110677
+ return new Promise(resolve => {
110678
+ resolve(this._navigationHasPrevious);
110679
+ });
110680
+ }
110681
+ /**
110682
+ * Método para verificar se o registro selecionado é o ultimo da página.
110683
+ */
110684
+ async isLastOfPage() {
110685
+ return new Promise(resolve => {
110686
+ resolve(this._gridController.isLastOfPage());
110687
+ });
110688
+ }
110689
+ /**
110690
+ * Método para verificar se o registro selecionado é o primeiro da página.
110691
+ */
110692
+ async isFirstOfPage() {
110693
+ return new Promise(resolve => {
110694
+ resolve(this._gridController.isFirstOfPage());
110695
+ });
110696
+ }
110697
+ /**
110698
+ * Método para navegar para o proxímo registro da grid.
110699
+ */
110700
+ async nextRecord() {
110701
+ this._gridController.nextRecord();
110702
+ }
110703
+ /**
110704
+ * Método para navegar para o registro anterior da grid.
110705
+ */
110706
+ async previousRecord() {
110707
+ this._gridController.previousRecord();
110708
+ }
110709
+ /**
110710
+ * Método para verificar se existem proximos registros.
110711
+ */
110712
+ async hasNextRecord() {
110713
+ return Promise.resolve(this._gridController.hasNextRecord());
110714
+ }
110715
+ /**
110716
+ * Método para verificar se existem registros anteriores.
110717
+ */
110718
+ async hasPreviousRecord() {
110719
+ return Promise.resolve(this._gridController.hasPreviousRecord());
110720
+ }
110557
110721
  componentWillLoad() {
110558
110722
  if (this.dataUnit) {
110559
110723
  this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
@@ -110626,7 +110790,7 @@ let EzGrid = class {
110626
110790
  componentDidLoad() {
110627
110791
  this._gridController.initDatagrid(this._container, {
110628
110792
  onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
110629
- onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
110793
+ onSelectionChange: (state) => this.ezSelectionChange.emit(state.selection),
110630
110794
  onPaginationChange: (status) => {
110631
110795
  this._navigationHasPrevious = status.hasPrevious;
110632
110796
  this._navigationHasNext = status.hasNext;
@@ -110660,24 +110824,24 @@ let EzGrid = class {
110660
110824
  }
110661
110825
  return [
110662
110826
  h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, `${this._navigationFirstRow}-${this._navigationLastRow}`), ` de ${this._navigationTotalRows}`),
110663
- h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this._gridController.previousPage(), label: "P\u00E1gina anterior" }),
110664
- h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this._gridController.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
110827
+ h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }),
110828
+ h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
110665
110829
  ];
110666
110830
  }
110667
110831
  applyConfig(config) {
110668
110832
  this._gridController.setColumnsState(config.columns);
110669
- this.closeConfig();
110833
+ this.closeGridConfig();
110670
110834
  }
110671
- closeConfig() {
110672
- this._popUpVisible = false;
110835
+ closeGridConfig() {
110836
+ this._popUpGridConfig = false;
110673
110837
  }
110674
- openConfig() {
110838
+ openGridConfig() {
110675
110839
  this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
110676
110840
  this._gridConfig.selectedTab = "Colunas";
110677
- this._popUpVisible = true;
110841
+ this._popUpGridConfig = true;
110678
110842
  }
110679
110843
  render() {
110680
- return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl(), h("ez-button", { size: "small", iconName: "settings", class: "ez-button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false }, h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeConfig() }))));
110844
+ return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl())), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
110681
110845
  }
110682
110846
  static get assetsDirs() { return ["../assets"]; }
110683
110847
  static get watchers() { return {
@@ -55,6 +55,17 @@ let EzList = class {
55
55
  this._listItemsHistory = [];
56
56
  }
57
57
  /**
58
+ * Responsável por dar um scroll top no componente da lista.
59
+ */
60
+ async scrollToTop() {
61
+ if (this.useGroups) {
62
+ this._element.shadowRoot.querySelector('.group-container').scrollTop = 0;
63
+ }
64
+ else {
65
+ this._element.shadowRoot.querySelector('.items-container').scrollTop = 0;
66
+ }
67
+ }
68
+ /**
58
69
  * Recebe como argumento um ListItem {label: string} e um booleano que define se o componente deve fazer scroll para exibir o item específico (opcional).
59
70
  */
60
71
  async setSelection(selectedItem, scrollToOption) {
@@ -6,6 +6,7 @@ let EzModal = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
8
  this.ezCloseModal = createEvent(this, "ezCloseModal", 7);
9
+ this.ezOpenModal = createEvent(this, "ezOpenModal", 7);
9
10
  /**
10
11
  * Controle de exibição do Modal
11
12
  */
@@ -39,6 +40,11 @@ let EzModal = class {
39
40
  componentDidLoad() {
40
41
  this.handleopenedChange();
41
42
  }
43
+ componentDidRender() {
44
+ if (this.opened) {
45
+ this.ezOpenModal.emit();
46
+ }
47
+ }
42
48
  onMouseDownHandler(event) {
43
49
  if (this.closeOutsideClick && event.target === this._overlay) {
44
50
  this.closeModal();
@@ -42,7 +42,7 @@ let EzNumberInput = class {
42
42
  }
43
43
  changeValue(newValue) {
44
44
  this.errorMessage = "";
45
- if (newValue && newValue !== this.value) {
45
+ if (newValue !== this.value) {
46
46
  this.value = newValue;
47
47
  this.ezChange.emit(this.value);
48
48
  }
@@ -22,14 +22,16 @@ let EzTextInput = class {
22
22
  }
23
23
  showError() {
24
24
  var _a, _b;
25
- const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
26
- if (hasError) {
27
- this._inputElem.classList.add("hasError");
28
- (_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
29
- }
30
- else {
31
- this._inputElem.classList.remove("hasError");
32
- (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
25
+ if (this._inputElem) {
26
+ const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
27
+ if (hasError) {
28
+ this._inputElem.classList.add("hasError");
29
+ (_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
30
+ }
31
+ else {
32
+ this._inputElem.classList.remove("hasError");
33
+ (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
34
+ }
33
35
  }
34
36
  }
35
37
  prepareMask() {
package/dist/esm/ezui.js CHANGED
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040],"config":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[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],"setFocus":[64],"setBlur":[64]}]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"stretchTitle":[516,"stretch-title"],"showHide":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du",[[0,"test-du",{"isDirty":[32]}]]]], options);
16
+ return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpGridConfig":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64],"nextPage":[64],"previousPage":[64],"hasNextPage":[64],"hasPreviousPage":[64],"isLastOfPage":[64],"isFirstOfPage":[64],"nextRecord":[64],"previousRecord":[64],"hasNextRecord":[64],"hasPreviousRecord":[64],"openGridConfig":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040],"config":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[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],"setFocus":[64],"setBlur":[64]}]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"stretchTitle":[516,"stretch-title"],"showHide":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]],["test-du",[[0,"test-du",{"isDirty":[32]}]]]], options);
17
17
  });
@@ -1,6 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-bf1aef20.js';
2
2
  import { StringUtils } from '@sankhyalabs/core';
3
3
  import { g as getSpritePath } from './AssetsUtils-aab9ca8f.js';
4
+ import { A as ApplicationUtils } from './ApplicationUtils-35350d20.js';
4
5
 
5
6
  const gridConfigCss = ".sc-grid-config-h{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-weight:var(--text-weight--large, 700);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);--ez-grid__group--font-family:var(--font-pattern, \"Sora\");--ez-grid__group--font-size:var(--text--medium, 14px);--ez-grid__group--font-weight:var(--text-weight--large, 600);--ez-grid__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.heigth-calc.sc-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:space-between;align-items:center;width:359px}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size);color:var(--text--primary)}.title.sc-grid-config{display:flex;margin:0;font-family:var(--ez-grid-config__title--font-family);font-size:var(--title--large);font-weight:var(--ez-grid-config__title--font-weight);line-height:normal;letter-spacing:0em;text-align:left;color:var(--title--primary)}.grid-config__main.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main.sc-grid-config::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}.group-name.sc-grid-config{font-family:var(--ez-grid__group--font-family);font-size:var(--ez-grid__group--font-size);font-weight:var(--ez-grid__group--font-weight);padding-bottom:var(--ez-grid__group--padding-bottom)}";
6
7
 
@@ -13,6 +14,7 @@ let GridConfig = class {
13
14
  this._orderPriorityList = [];
14
15
  this._columListItems = [];
15
16
  this._selectedIndex = -1;
17
+ this._dataChanged = false;
16
18
  this.selectedTab = "Colunas";
17
19
  }
18
20
  /* Creation Methods */
@@ -88,6 +90,7 @@ let GridConfig = class {
88
90
  }
89
91
  updateOrder(sortOrder, updatedItemLabel) {
90
92
  var _a;
93
+ this._dataChanged = true;
91
94
  let newList = [...this.columns];
92
95
  let newItem = newList.find(item => item.label === updatedItemLabel);
93
96
  if (newItem) {
@@ -116,6 +119,7 @@ let GridConfig = class {
116
119
  switchColumnGroup(ev, switchedItem) {
117
120
  ev.stopPropagation();
118
121
  let newList = [...this._columListItems];
122
+ this._dataChanged = true;
119
123
  if (ev.detail === true) {
120
124
  let hiddenGroup = newList.find(group => group.group === "Ocultas");
121
125
  let index = hiddenGroup.items.findIndex(item => item.label === switchedItem.label);
@@ -155,6 +159,9 @@ let GridConfig = class {
155
159
  });
156
160
  });
157
161
  this.columns = newColumnList;
162
+ this._dataChanged = false;
163
+ this.closeConfig();
164
+ ApplicationUtils.info("As configurações foram salvas com sucesso!");
158
165
  this.save();
159
166
  }
160
167
  save() {
@@ -337,13 +344,46 @@ let GridConfig = class {
337
344
  return false;
338
345
  }
339
346
  closeConfig() {
340
- this.configCancel.emit();
341
- this._orderList.clearHistory();
347
+ this._orderList.scrollToTop();
348
+ this._columnList.scrollToTop();
349
+ this._searchElement.value = "";
350
+ if (this._dataChanged) {
351
+ let options = {
352
+ canClose: false,
353
+ labelCancel: "Descartar",
354
+ labelConfirm: "Salvar",
355
+ btnConfirmDanger: false
356
+ };
357
+ ApplicationUtils.confirm("Aviso", "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?", null, false, options)
358
+ .then(response => {
359
+ if (!response) {
360
+ this._dataChanged = false;
361
+ this.configCancel.emit();
362
+ this._orderList.clearHistory();
363
+ }
364
+ else {
365
+ this.finish();
366
+ }
367
+ });
368
+ }
369
+ else {
370
+ this.configCancel.emit();
371
+ this._orderList.clearHistory();
372
+ }
342
373
  }
343
374
  /* Handlers */
344
375
  handleTabChange(ev) {
345
376
  var _a;
346
377
  if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.selectedTab) {
378
+ if (this.selectedTab !== ev.target.selectedTab) {
379
+ if (ev.target.selectedTab === "Colunas") {
380
+ this._orderList.scrollToTop();
381
+ }
382
+ else if (ev.target.selectedTab === "Ordenação das linhas") {
383
+ this._columnList.scrollToTop();
384
+ }
385
+ this._searchElement.value = "";
386
+ }
347
387
  if (ev.target.selectedTab === "Ordenação das linhas") {
348
388
  this.createOrderList();
349
389
  }
@@ -355,6 +395,7 @@ let GridConfig = class {
355
395
  if (ev.detail) {
356
396
  let visibleItems = (_a = ev.detail.find(group => group.group === "Visíveis")) === null || _a === void 0 ? void 0 : _a.items;
357
397
  if (visibleItems) {
398
+ this._dataChanged = true;
358
399
  this._orderListItems = visibleItems;
359
400
  }
360
401
  }
@@ -363,6 +404,7 @@ let GridConfig = class {
363
404
  if (ev.detail) {
364
405
  let orderPriorityList = ev.detail;
365
406
  if (orderPriorityList) {
407
+ this._dataChanged = true;
366
408
  this._orderPriorityList = orderPriorityList;
367
409
  }
368
410
  }