@sankhyalabs/ezui 1.1.131 → 1.1.134

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 (44) 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-time-input.cjs.entry.js +1 -2
  5. package/dist/cjs/ezui.cjs.js +1 -1
  6. package/dist/cjs/grid-config.cjs.entry.js +64 -4
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/components/ez-form/DataBinder.js +13 -2
  9. package/dist/collection/components/ez-form/ez-form.js +1 -1
  10. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +10 -5
  11. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +128 -36
  12. package/dist/collection/components/ez-grid/ez-grid.js +253 -15
  13. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +44 -2
  14. package/dist/collection/components/ez-list/ez-list.js +27 -0
  15. package/dist/collection/components/ez-time-input/ez-time-input.js +1 -2
  16. package/dist/collection/utils/interfaces/PageableComponent.js +1 -0
  17. package/dist/custom-elements/index.js +305 -78
  18. package/dist/esm/ez-form.entry.js +14 -3
  19. package/dist/esm/ez-grid.entry.js +216 -52
  20. package/dist/esm/ez-list.entry.js +11 -0
  21. package/dist/esm/ez-time-input.entry.js +1 -2
  22. package/dist/esm/ezui.js +1 -1
  23. package/dist/esm/grid-config.entry.js +64 -4
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/ezui/ezui.esm.js +1 -1
  26. package/dist/ezui/{p-2d165ca8.entry.js → p-80d863c2.entry.js} +7 -7
  27. package/dist/ezui/p-bb7ad4ae.entry.js +1 -0
  28. package/dist/ezui/{p-47fe4273.entry.js → p-cfa7378a.entry.js} +1 -1
  29. package/dist/ezui/p-d9bb2a96.entry.js +1 -0
  30. package/dist/ezui/p-f1a18697.entry.js +1 -0
  31. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +46 -0
  32. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +12 -0
  33. package/dist/types/components/ez-grid/ez-grid.d.ts +45 -4
  34. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
  35. package/dist/types/components/ez-list/ez-list.d.ts +4 -0
  36. package/dist/types/components.d.ts +45 -0
  37. package/dist/types/utils/interfaces/PageableComponent.d.ts +12 -0
  38. package/package.json +1 -1
  39. package/dist/cjs/AssetsUtils-78164781.js +0 -24
  40. package/dist/esm/AssetsUtils-aab9ca8f.js +0 -22
  41. package/dist/ezui/p-51b878f7.js +0 -1
  42. package/dist/ezui/p-6d39b7ea.entry.js +0 -1
  43. package/dist/ezui/p-7d5b2ebf.entry.js +0 -1
  44. package/dist/ezui/p-ed1e0331.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement as HTMLElement$1, createEvent, h, forceUpdate, Host, getAssetPath, setAssetPath, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
- import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit, DataType, StringUtils, NumberUtils, MaskFormatter } from '@sankhyalabs/core';
3
+ import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit, NumberUtils, DataType, StringUtils, MaskFormatter } from '@sankhyalabs/core';
4
4
  import { UserInterface as UserInterface$1, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
5
5
 
6
6
  const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
@@ -1793,7 +1793,12 @@ class DataBinder {
1793
1793
  const oldValue = field["value"];
1794
1794
  const newValue = this._dataUnit.getFieldValue(fieldName);
1795
1795
  if (oldValue != newValue) {
1796
- field["value"] = newValue;
1796
+ if (newValue === undefined) {
1797
+ field.removeAttribute("value");
1798
+ }
1799
+ else {
1800
+ field["value"] = newValue;
1801
+ }
1797
1802
  }
1798
1803
  }
1799
1804
  updateBind(fieldName, field) {
@@ -1801,7 +1806,13 @@ class DataBinder {
1801
1806
  if (oldBind) {
1802
1807
  oldBind.destroy();
1803
1808
  }
1804
- field["value"] = this._dataUnit.getFieldValue(fieldName);
1809
+ const value = this._dataUnit.getFieldValue(fieldName);
1810
+ if (value === undefined) {
1811
+ field.removeAttribute("value");
1812
+ }
1813
+ else {
1814
+ field["value"] = value;
1815
+ }
1805
1816
  this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
1806
1817
  this.bindSearchOptionsLoader(fieldName, field);
1807
1818
  this.applyEzUploadContext(fieldName, field);
@@ -1928,7 +1939,7 @@ let EzForm$1 = class extends HTMLElement$1 {
1928
1939
  .filter(f => f.dataset.required)
1929
1940
  .map(f => f.dataset.fieldName)
1930
1941
  .concat(metadata.getRequiredFields());
1931
- const records = this.dataUnit.records;
1942
+ const records = this.dataUnit.getModifiedRecords();
1932
1943
  for (let i = 0; i < records.length; i++) {
1933
1944
  if (!this.validateRequired(requiredFields, records[i])) {
1934
1945
  reject();
@@ -112090,8 +112101,11 @@ class DataSource {
112090
112101
 
112091
112102
  class AgGridController {
112092
112103
  constructor(enterprise) {
112104
+ this.DEFAULT_ROW_HEIGHT = 25;
112093
112105
  this._menuItems = [];
112094
112106
  this._idAttribName = "__record__id__";
112107
+ this._isFirstRecordOfPage = true;
112108
+ this._isLastRecordOfPage = false;
112095
112109
  this._enterprise = enterprise;
112096
112110
  }
112097
112111
  getSort() {
@@ -112119,7 +112133,9 @@ class AgGridController {
112119
112133
  this._pageSize = options.pageSize;
112120
112134
  this._serverURL = options.serverURL;
112121
112135
  this._dataUnit = options.dataUnit;
112122
- this._dataUnit.sortingProvider = this;
112136
+ if (this._dataUnit) {
112137
+ this._dataUnit.sortingProvider = this;
112138
+ }
112123
112139
  this._dataSource = new DataSource(this._dataUnit, this._serverURL);
112124
112140
  this._gridOptions = {
112125
112141
  localeText: gridTerms,
@@ -112128,7 +112144,7 @@ class AgGridController {
112128
112144
  rowSelection: this._multipleSelection ? "multiple" : "single",
112129
112145
  serverSideDatasource: this._dataSource,
112130
112146
  sortingOrder: ['desc', 'asc', null],
112131
- getRowNodeId: (params) => typeof params === "string" ? params : params[this._idAttribName],
112147
+ getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
112132
112148
  getMainMenuItems: (params) => {
112133
112149
  const column = params.column;
112134
112150
  const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
@@ -112138,14 +112154,12 @@ class AgGridController {
112138
112154
  }));
112139
112155
  return items;
112140
112156
  },
112141
- getRowHeight: () => {
112142
- //FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
112143
- //apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
112144
- //dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
112145
- //Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
112146
- //tamanho errado, isso afeta menos o componente.
112147
- return 25;
112148
- }
112157
+ //FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
112158
+ //apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
112159
+ //dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
112160
+ //Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
112161
+ //tamanho errado, isso afeta menos o componente.
112162
+ rowHeight: this.DEFAULT_ROW_HEIGHT
112149
112163
  };
112150
112164
  this.setOptionsEvents(this._gridOptions);
112151
112165
  this.setOptionsPagination(this._gridOptions);
@@ -112168,16 +112182,17 @@ class AgGridController {
112168
112182
  opt.onPaginationChanged = () => this.onPaginationChange();
112169
112183
  opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
112170
112184
  opt.onDragStopped = evt => this.onCallStateChange("columnMovedEnd", evt);
112171
- opt.onViewportChanged = () => {
112172
- if (this._dataUnit) {
112173
- this.selectRows(this._dataUnit.getSelection());
112174
- }
112175
- };
112185
+ }
112186
+ syncSelection() {
112187
+ if (this._dataUnit) {
112188
+ this.selectRows(this._dataUnit.getSelection());
112189
+ }
112176
112190
  }
112177
112191
  setOptionsPagination(opt) {
112178
112192
  opt.pagination = (this._pageSize > -1);
112179
112193
  opt.paginationPageSize = this._pageSize;
112180
112194
  opt.cacheBlockSize = this._pageSize;
112195
+ opt.maxBlocksInCache = 1;
112181
112196
  }
112182
112197
  setOptionsSupress(opt) {
112183
112198
  opt.suppressDragLeaveHidesColumns = true;
@@ -112213,7 +112228,7 @@ class AgGridController {
112213
112228
  if (this._grid === undefined) {
112214
112229
  throw new Error("Erro interno: Grid ainda não inicializado.");
112215
112230
  }
112216
- this._gridOptions.api.refreshServerSideStore({});
112231
+ this._gridOptions.api.refreshServerSideStore({ purge: true });
112217
112232
  }
112218
112233
  changeValues(changes, rowIds) {
112219
112234
  if (this._grid === undefined) {
@@ -112350,6 +112365,75 @@ class AgGridController {
112350
112365
  this.goToPage(0);
112351
112366
  this._gridOptions.api.refreshServerSideStore({ purge: true });
112352
112367
  }
112368
+ isLastOfPage() {
112369
+ return this._isLastRecordOfPage;
112370
+ }
112371
+ isFirstOfPage() {
112372
+ return this._isFirstRecordOfPage;
112373
+ }
112374
+ previousRecord() {
112375
+ const pagination = this.getPaginationStatus();
112376
+ if (this._isFirstRecordOfPage && pagination.hasPrevious) {
112377
+ this.previousPage();
112378
+ }
112379
+ else {
112380
+ if (this._dataUnit) {
112381
+ this._dataUnit.previousRecord();
112382
+ }
112383
+ else {
112384
+ const node = this._gridOptions.api.getSelectedNodes()[0];
112385
+ this.setSelectedIndex(node.rowIndex - 1);
112386
+ }
112387
+ }
112388
+ }
112389
+ nextRecord() {
112390
+ const pagination = this.getPaginationStatus();
112391
+ if (this._isLastRecordOfPage && pagination.hasNext) {
112392
+ this.nextPage();
112393
+ }
112394
+ else {
112395
+ if (this._dataUnit) {
112396
+ this._dataUnit.nextRecord();
112397
+ }
112398
+ else {
112399
+ const node = this._gridOptions.api.getSelectedNodes()[0];
112400
+ this.setSelectedIndex(node.rowIndex + 1);
112401
+ }
112402
+ }
112403
+ }
112404
+ setSelectedIndex(index) {
112405
+ var _a;
112406
+ (_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
112407
+ }
112408
+ hasPreviousRecord() {
112409
+ const pagination = this.getPaginationStatus();
112410
+ if (this._isFirstRecordOfPage) {
112411
+ return pagination.hasPrevious;
112412
+ }
112413
+ else {
112414
+ if (this._dataUnit) {
112415
+ return this._dataUnit.hasPrevious();
112416
+ }
112417
+ else {
112418
+ return pagination.hasPrevious || this._gridOptions.api.getSelectedRows()[0].rowIndex > 0;
112419
+ }
112420
+ }
112421
+ }
112422
+ hasNextRecord() {
112423
+ const pagination = this.getPaginationStatus();
112424
+ if (this._isLastRecordOfPage) {
112425
+ return pagination.hasNext;
112426
+ }
112427
+ else {
112428
+ if (this._dataUnit) {
112429
+ return this._dataUnit.hasNext() || this.getPaginationStatus().hasNext;
112430
+ }
112431
+ else {
112432
+ const api = this._gridOptions.api;
112433
+ return pagination.hasNext || api.getSelectedRows()[0].rowIndex < api.getDisplayedRowCount();
112434
+ }
112435
+ }
112436
+ }
112353
112437
  buildColDef(source) {
112354
112438
  return {
112355
112439
  headerName: source.label,
@@ -112384,19 +112468,24 @@ class AgGridController {
112384
112468
  });
112385
112469
  return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
112386
112470
  }
112387
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
112388
- if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
112471
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface$1.SWITCH) {
112472
+ 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") {
112389
112473
  return "Sim";
112390
112474
  }
112391
- else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
112475
+ 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") {
112392
112476
  return "Não";
112393
112477
  }
112394
112478
  }
112395
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
112479
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface$1.SEARCH) {
112396
112480
  if (params.value !== undefined) {
112397
112481
  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);
112398
112482
  }
112399
112483
  }
112484
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface$1.DECIMALNUMBER) {
112485
+ if (params.value !== undefined) {
112486
+ return NumberUtils.format(params.value.toString(), 2, 2);
112487
+ }
112488
+ }
112400
112489
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface$1.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface$1.DATETIME) {
112401
112490
  if (params.value !== undefined) {
112402
112491
  return params.value.toLocaleDateString();
@@ -112426,31 +112515,44 @@ class AgGridController {
112426
112515
  return false;
112427
112516
  }
112428
112517
  onSelectionChange(e) {
112518
+ const selectedNodes = e.api.getSelectedNodes();
112519
+ if (selectedNodes.length > 0) {
112520
+ this._isFirstRecordOfPage = selectedNodes[0].rowIndex === e.api.getFirstDisplayedRow();
112521
+ this._isLastRecordOfPage = selectedNodes[0].rowIndex === e.api.getLastDisplayedRow();
112522
+ }
112429
112523
  if (this._selectionChangeCallback) {
112430
- this._selectionChangeCallback(e.api.getSelectedRows());
112524
+ this._selectionChangeCallback({
112525
+ selection: e.api.getSelectedRows(),
112526
+ isFirstOfPage: this._isFirstRecordOfPage,
112527
+ isLastOfPage: this._isLastRecordOfPage
112528
+ });
112431
112529
  }
112432
112530
  }
112433
112531
  onPaginationChange() {
112532
+ this.syncSelection();
112434
112533
  if (this._paginationChangeCallback) {
112435
112534
  if (this._gridOptions.api) {
112436
- const api = this._gridOptions.api;
112437
- const currentPage = api.paginationGetCurrentPage();
112438
- const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
112439
- const pageSize = api.paginationGetPageSize();
112440
- const totalRows = api.paginationGetRowCount();
112441
- const pageStart = currentPage * pageSize + 1;
112442
- const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
112443
- this._paginationChangeCallback({
112444
- hasPrevious: currentPage > 0,
112445
- hasNext: !isLastPage,
112446
- currentPage: currentPage + 1,
112447
- pageStart,
112448
- pageEnd,
112449
- totalRows
112450
- });
112535
+ this._paginationChangeCallback(this.getPaginationStatus());
112451
112536
  }
112452
112537
  }
112453
112538
  }
112539
+ getPaginationStatus() {
112540
+ const api = this._gridOptions.api;
112541
+ const currentPage = api.paginationGetCurrentPage();
112542
+ const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
112543
+ const pageSize = api.paginationGetPageSize();
112544
+ const totalRows = api.paginationGetRowCount();
112545
+ const pageStart = currentPage * pageSize + 1;
112546
+ const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
112547
+ return {
112548
+ hasPrevious: currentPage > 0,
112549
+ hasNext: !isLastPage,
112550
+ currentPage: currentPage + 1,
112551
+ pageStart,
112552
+ pageEnd,
112553
+ totalRows
112554
+ };
112555
+ }
112454
112556
  onRowDoubleClick(evt) {
112455
112557
  if (this._doubleClickCallBack) {
112456
112558
  this._doubleClickCallBack(evt.data);
@@ -112474,10 +112576,6 @@ class DataUnitBridge {
112474
112576
  const { records } = action.payload;
112475
112577
  this._gridController.removeRows(records);
112476
112578
  break;
112477
- case Action.RECORDS_ADDED:
112478
- case Action.RECORDS_COPIED:
112479
- this._gridController.addRows(action.payload);
112480
- break;
112481
112579
  case Action.EDITION_CANCELED:
112482
112580
  case Action.DATA_SAVED:
112483
112581
  this._gridController.refresh();
@@ -112486,6 +112584,10 @@ class DataUnitBridge {
112486
112584
  const { selection } = action.payload;
112487
112585
  this._gridController.selectRows(selection);
112488
112586
  break;
112587
+ case Action.NEXT_SELECTED:
112588
+ case Action.PREVIOUS_SELECTED:
112589
+ this._gridController.selectRows(this._dataUnit.getSelection());
112590
+ break;
112489
112591
  case Action.DATA_CHANGED:
112490
112592
  const changes = Object.assign({}, action.payload);
112491
112593
  delete changes.records;
@@ -112502,7 +112604,12 @@ class DataUnitBridge {
112502
112604
  this._dataUnit.metadata.fields.forEach(f => {
112503
112605
  var _a;
112504
112606
  if (f.visible !== false) {
112505
- 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 });
112607
+ const props = new Map();
112608
+ const properties = this._dataUnit.getField(f.name).properties;
112609
+ for (const value in properties) {
112610
+ props.set(value, properties[value]);
112611
+ }
112612
+ 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 });
112506
112613
  }
112507
112614
  });
112508
112615
  }
@@ -112524,7 +112631,7 @@ let EzGrid$1 = class extends HTMLElement$1 {
112524
112631
  this.ezDoubleClick = createEvent(this, "ezDoubleClick", 7);
112525
112632
  this.configChange = createEvent(this, "configChange", 7);
112526
112633
  this._gridController = new AgGridController(false);
112527
- this._popUpVisible = false;
112634
+ this._popUpGridConfig = false;
112528
112635
  /**
112529
112636
  * Determina o número de linhas de cada página. Caso informado o valor -1
112530
112637
  * não haverá paginação.
@@ -112586,6 +112693,74 @@ let EzGrid$1 = class extends HTMLElement$1 {
112586
112693
  async quickFilter(term) {
112587
112694
  this._gridController.quickFilter(term);
112588
112695
  }
112696
+ /**
112697
+ * Método para fazer um filtro rápido na grid.
112698
+ */
112699
+ async nextPage() {
112700
+ this._gridController.nextPage();
112701
+ }
112702
+ /**
112703
+ * Método para fazer um filtro rápido na grid.
112704
+ */
112705
+ async previousPage() {
112706
+ this._gridController.previousPage();
112707
+ }
112708
+ /**
112709
+ * Método para fazer um filtro rápido na grid.
112710
+ */
112711
+ async hasNextPage() {
112712
+ return new Promise(resolve => {
112713
+ resolve(this._navigationHasNext);
112714
+ });
112715
+ }
112716
+ /**
112717
+ * Método para fazer um filtro rápido na grid.
112718
+ */
112719
+ async hasPreviousPage() {
112720
+ return new Promise(resolve => {
112721
+ resolve(this._navigationHasPrevious);
112722
+ });
112723
+ }
112724
+ /**
112725
+ * Método para verificar se o registro selecionado é o ultimo da página.
112726
+ */
112727
+ async isLastOfPage() {
112728
+ return new Promise(resolve => {
112729
+ resolve(this._gridController.isLastOfPage());
112730
+ });
112731
+ }
112732
+ /**
112733
+ * Método para verificar se o registro selecionado é o primeiro da página.
112734
+ */
112735
+ async isFirstOfPage() {
112736
+ return new Promise(resolve => {
112737
+ resolve(this._gridController.isFirstOfPage());
112738
+ });
112739
+ }
112740
+ /**
112741
+ * Método para navegar para o proxímo registro da grid.
112742
+ */
112743
+ async nextRecord() {
112744
+ this._gridController.nextRecord();
112745
+ }
112746
+ /**
112747
+ * Método para navegar para o registro anterior da grid.
112748
+ */
112749
+ async previousRecord() {
112750
+ this._gridController.previousRecord();
112751
+ }
112752
+ /**
112753
+ * Método para verificar se existem proximos registros.
112754
+ */
112755
+ async hasNextRecord() {
112756
+ return Promise.resolve(this._gridController.hasNextRecord());
112757
+ }
112758
+ /**
112759
+ * Método para verificar se existem registros anteriores.
112760
+ */
112761
+ async hasPreviousRecord() {
112762
+ return Promise.resolve(this._gridController.hasPreviousRecord());
112763
+ }
112589
112764
  componentWillLoad() {
112590
112765
  if (this.dataUnit) {
112591
112766
  this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
@@ -112658,7 +112833,7 @@ let EzGrid$1 = class extends HTMLElement$1 {
112658
112833
  componentDidLoad() {
112659
112834
  this._gridController.initDatagrid(this._container, {
112660
112835
  onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
112661
- onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
112836
+ onSelectionChange: (state) => this.ezSelectionChange.emit(state.selection),
112662
112837
  onPaginationChange: (status) => {
112663
112838
  this._navigationHasPrevious = status.hasPrevious;
112664
112839
  this._navigationHasNext = status.hasNext;
@@ -112692,24 +112867,24 @@ let EzGrid$1 = class extends HTMLElement$1 {
112692
112867
  }
112693
112868
  return [
112694
112869
  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}`),
112695
- 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" }),
112696
- 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" })
112870
+ 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" }),
112871
+ 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" })
112697
112872
  ];
112698
112873
  }
112699
112874
  applyConfig(config) {
112700
112875
  this._gridController.setColumnsState(config.columns);
112701
- this.closeConfig();
112876
+ this.closeGridConfig();
112702
112877
  }
112703
- closeConfig() {
112704
- this._popUpVisible = false;
112878
+ closeGridConfig() {
112879
+ this._popUpGridConfig = false;
112705
112880
  }
112706
- openConfig() {
112881
+ openGridConfig() {
112707
112882
  this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
112708
112883
  this._gridConfig.selectedTab = "Colunas";
112709
- this._popUpVisible = true;
112884
+ this._popUpGridConfig = true;
112710
112885
  }
112711
112886
  render() {
112712
- 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() }))));
112887
+ 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() }))));
112713
112888
  }
112714
112889
  static get assetsDirs() { return ["../assets"]; }
112715
112890
  static get watchers() { return {
@@ -112909,6 +113084,17 @@ let EzList$1 = class extends HTMLElement$1 {
112909
113084
  this._listItemsHistory = [];
112910
113085
  }
112911
113086
  /**
113087
+ * Responsável por dar um scroll top no componente da lista.
113088
+ */
113089
+ async scrollToTop() {
113090
+ if (this.useGroups) {
113091
+ this._element.shadowRoot.querySelector('.group-container').scrollTop = 0;
113092
+ }
113093
+ else {
113094
+ this._element.shadowRoot.querySelector('.items-container').scrollTop = 0;
113095
+ }
113096
+ }
113097
+ /**
112912
113098
  * 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).
112913
113099
  */
112914
113100
  async setSelection(selectedItem, scrollToOption) {
@@ -114278,25 +114464,6 @@ let EzTextInput$1 = class extends HTMLElement$1 {
114278
114464
  static get style() { return ezTextInputCss; }
114279
114465
  };
114280
114466
 
114281
- const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
114282
- let ctxLoaded = false;
114283
- function getContextAssetsPath(resource) {
114284
- if (!ctxLoaded) {
114285
- const scriptElem = document.querySelector("script[data-ezui-assets-url]");
114286
- if (scriptElem) {
114287
- let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
114288
- if (assetsPath) {
114289
- if (assetsPath.startsWith('/')) {
114290
- assetsPath = window.location.origin + assetsPath;
114291
- }
114292
- setAssetPath(assetsPath);
114293
- }
114294
- }
114295
- ctxLoaded = true;
114296
- }
114297
- return getAssetPath(resource);
114298
- }
114299
-
114300
114467
  const ezTimeInputCss = ":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";
114301
114468
 
114302
114469
  let EzTimeInput$1 = class extends HTMLElement$1 {
@@ -114401,7 +114568,7 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
114401
114568
  }
114402
114569
  }
114403
114570
  render() {
114404
- return (h(Host, null, h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode }, h("ez-icon", { slot: "leftIcon", href: getSpritePath("timer-outline") }))));
114571
+ return (h(Host, null, h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode }, h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
114405
114572
  }
114406
114573
  static get assetsDirs() { return ["../assets"]; }
114407
114574
  get _elem() { return this; }
@@ -114852,6 +115019,25 @@ let EzUpload$1 = class extends HTMLElement$1 {
114852
115019
  static get style() { return ezUploadCss; }
114853
115020
  };
114854
115021
 
115022
+ const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
115023
+ let ctxLoaded = false;
115024
+ function getContextAssetsPath(resource) {
115025
+ if (!ctxLoaded) {
115026
+ const scriptElem = document.querySelector("script[data-ezui-assets-url]");
115027
+ if (scriptElem) {
115028
+ let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
115029
+ if (assetsPath) {
115030
+ if (assetsPath.startsWith('/')) {
115031
+ assetsPath = window.location.origin + assetsPath;
115032
+ }
115033
+ setAssetPath(assetsPath);
115034
+ }
115035
+ }
115036
+ ctxLoaded = true;
115037
+ }
115038
+ return getAssetPath(resource);
115039
+ }
115040
+
114855
115041
  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)}";
114856
115042
 
114857
115043
  let GridConfig$1 = class extends HTMLElement$1 {
@@ -114864,6 +115050,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
114864
115050
  this._orderPriorityList = [];
114865
115051
  this._columListItems = [];
114866
115052
  this._selectedIndex = -1;
115053
+ this._dataChanged = false;
114867
115054
  this.selectedTab = "Colunas";
114868
115055
  }
114869
115056
  /* Creation Methods */
@@ -114939,6 +115126,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
114939
115126
  }
114940
115127
  updateOrder(sortOrder, updatedItemLabel) {
114941
115128
  var _a;
115129
+ this._dataChanged = true;
114942
115130
  let newList = [...this.columns];
114943
115131
  let newItem = newList.find(item => item.label === updatedItemLabel);
114944
115132
  if (newItem) {
@@ -114967,6 +115155,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
114967
115155
  switchColumnGroup(ev, switchedItem) {
114968
115156
  ev.stopPropagation();
114969
115157
  let newList = [...this._columListItems];
115158
+ this._dataChanged = true;
114970
115159
  if (ev.detail === true) {
114971
115160
  let hiddenGroup = newList.find(group => group.group === "Ocultas");
114972
115161
  let index = hiddenGroup.items.findIndex(item => item.label === switchedItem.label);
@@ -115006,6 +115195,9 @@ let GridConfig$1 = class extends HTMLElement$1 {
115006
115195
  });
115007
115196
  });
115008
115197
  this.columns = newColumnList;
115198
+ this._dataChanged = false;
115199
+ this.closeConfig();
115200
+ ApplicationUtils.info("As configurações foram salvas com sucesso!");
115009
115201
  this.save();
115010
115202
  }
115011
115203
  save() {
@@ -115188,13 +115380,46 @@ let GridConfig$1 = class extends HTMLElement$1 {
115188
115380
  return false;
115189
115381
  }
115190
115382
  closeConfig() {
115191
- this.configCancel.emit();
115192
- this._orderList.clearHistory();
115383
+ this._orderList.scrollToTop();
115384
+ this._columnList.scrollToTop();
115385
+ this._searchElement.value = "";
115386
+ if (this._dataChanged) {
115387
+ let options = {
115388
+ canClose: false,
115389
+ labelCancel: "Descartar",
115390
+ labelConfirm: "Salvar",
115391
+ btnConfirmDanger: false
115392
+ };
115393
+ ApplicationUtils.confirm("Aviso", "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?", null, false, options)
115394
+ .then(response => {
115395
+ if (!response) {
115396
+ this._dataChanged = false;
115397
+ this.configCancel.emit();
115398
+ this._orderList.clearHistory();
115399
+ }
115400
+ else {
115401
+ this.finish();
115402
+ }
115403
+ });
115404
+ }
115405
+ else {
115406
+ this.configCancel.emit();
115407
+ this._orderList.clearHistory();
115408
+ }
115193
115409
  }
115194
115410
  /* Handlers */
115195
115411
  handleTabChange(ev) {
115196
115412
  var _a;
115197
115413
  if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.selectedTab) {
115414
+ if (this.selectedTab !== ev.target.selectedTab) {
115415
+ if (ev.target.selectedTab === "Colunas") {
115416
+ this._orderList.scrollToTop();
115417
+ }
115418
+ else if (ev.target.selectedTab === "Ordenação das linhas") {
115419
+ this._columnList.scrollToTop();
115420
+ }
115421
+ this._searchElement.value = "";
115422
+ }
115198
115423
  if (ev.target.selectedTab === "Ordenação das linhas") {
115199
115424
  this.createOrderList();
115200
115425
  }
@@ -115206,6 +115431,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
115206
115431
  if (ev.detail) {
115207
115432
  let visibleItems = (_a = ev.detail.find(group => group.group === "Visíveis")) === null || _a === void 0 ? void 0 : _a.items;
115208
115433
  if (visibleItems) {
115434
+ this._dataChanged = true;
115209
115435
  this._orderListItems = visibleItems;
115210
115436
  }
115211
115437
  }
@@ -115214,6 +115440,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
115214
115440
  if (ev.detail) {
115215
115441
  let orderPriorityList = ev.detail;
115216
115442
  if (orderPriorityList) {
115443
+ this._dataChanged = true;
115217
115444
  this._orderPriorityList = orderPriorityList;
115218
115445
  }
115219
115446
  }
@@ -115328,7 +115555,7 @@ const EzDateTimeInput = /*@__PURE__*/proxyCustomElement(EzDateTimeInput$1, [1,"e
115328
115555
  const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"]}]);
115329
115556
  const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513]}]);
115330
115557
  const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"dataUnit":[1040],"config":[16]}]);
115331
- const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [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]}]);
115558
+ const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [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]}]);
115332
115559
  const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
115333
115560
  const EzLabelChip = /*@__PURE__*/proxyCustomElement(EzLabelChip$1, [1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540]}]);
115334
115561
  const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32]}]);