@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-72698.1 → 0.0.0-bugfix-dev-KB-72911.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +19 -2
  2. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +3 -1
  3. package/dist/cjs/ez-date-input.cjs.entry.js +3 -0
  4. package/dist/cjs/ez-grid.cjs.entry.js +102 -60
  5. package/dist/cjs/ez-search.cjs.entry.js +20 -0
  6. package/dist/cjs/ezui.cjs.js +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/components/ez-combo-box/ez-combo-box.js +37 -2
  9. package/dist/collection/components/ez-date-input/ez-date-input.js +3 -0
  10. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -1
  11. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +63 -34
  12. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +17 -6
  13. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +22 -24
  14. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +3 -2
  15. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  16. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  17. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +1 -0
  18. package/dist/collection/components/ez-grid/ez-grid.js +2 -1
  19. package/dist/collection/components/ez-search/ez-search.js +38 -0
  20. package/dist/custom-elements/index.js +149 -65
  21. package/dist/esm/ez-combo-box.entry.js +19 -2
  22. package/dist/esm/ez-custom-form-input_2.entry.js +3 -1
  23. package/dist/esm/ez-date-input.entry.js +3 -0
  24. package/dist/esm/ez-grid.entry.js +102 -60
  25. package/dist/esm/ez-search.entry.js +20 -0
  26. package/dist/esm/ezui.js +1 -1
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/ezui/ezui.esm.js +1 -1
  29. package/dist/ezui/p-10820c20.entry.js +1 -0
  30. package/dist/ezui/p-4b819b58.entry.js +1 -0
  31. package/dist/ezui/p-583e6dab.entry.js +1 -0
  32. package/dist/ezui/p-67e87fcf.entry.js +1 -0
  33. package/dist/ezui/{p-d9545f64.entry.js → p-c3c3d640.entry.js} +1 -1
  34. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -0
  35. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +15 -3
  36. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +9 -2
  37. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -0
  38. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +10 -8
  39. package/dist/types/components/ez-search/ez-search.d.ts +7 -0
  40. package/dist/types/components.d.ts +16 -0
  41. package/package.json +1 -1
  42. package/dist/ezui/p-4c799a1b.entry.js +0 -1
  43. package/dist/ezui/p-7922142b.entry.js +0 -1
  44. package/dist/ezui/p-bae4e180.entry.js +0 -1
  45. package/dist/ezui/p-e26f12dd.entry.js +0 -1
@@ -27,6 +27,7 @@ export class EzSearch {
27
27
  this.showSelectedValue = true;
28
28
  this.showOptionValue = true;
29
29
  this.suppressEmptyOption = false;
30
+ this.stopPropagateEnterKeyEvent = false;
30
31
  this.mode = "regular";
31
32
  this.canShowError = true;
32
33
  this.hideErrorOnFocusOut = true;
@@ -201,6 +202,9 @@ export class EzSearch {
201
202
  getText() {
202
203
  const currentValue = this.getSelectedOption(this._currentValue);
203
204
  const text = this.getFormattedText(currentValue);
205
+ return this.replaceQuotes(text);
206
+ }
207
+ replaceQuotes(text) {
204
208
  if (text == undefined) {
205
209
  return;
206
210
  }
@@ -489,6 +493,15 @@ export class EzSearch {
489
493
  }
490
494
  this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
491
495
  this.value = this._currentValue;
496
+ this.setTextInputValue();
497
+ }
498
+ setTextInputValue() {
499
+ if (this._textInput && (this._textInput.value === null || this._textInput.value === undefined)) {
500
+ if (this.value === undefined || this.value === null)
501
+ return;
502
+ const textValue = (typeof this.value === 'string') ? this.value : this.getFormattedText(this.value);
503
+ this._textInput.value = this.replaceQuotes(textValue);
504
+ }
492
505
  }
493
506
  loadOptionValue(argument) {
494
507
  var _a;
@@ -637,6 +650,7 @@ export class EzSearch {
637
650
  event.stopPropagation();
638
651
  break;
639
652
  case "Enter":
653
+ this.handleEventPropagation(event);
640
654
  this.selectCurrentOption();
641
655
  break;
642
656
  case "Escape":
@@ -653,6 +667,12 @@ export class EzSearch {
653
667
  //e o contexto pode reagir (fechar um popup por exemplo).
654
668
  //event.stopPropagation();
655
669
  }
670
+ //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
671
+ handleEventPropagation(event) {
672
+ if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
673
+ event.stopPropagation();
674
+ }
675
+ }
656
676
  onTextInputFocusOutHandler() {
657
677
  if (this.hideErrorOnFocusOut)
658
678
  this.cancelPreselection();
@@ -839,6 +859,24 @@ export class EzSearch {
839
859
  "reflect": false,
840
860
  "defaultValue": "false"
841
861
  },
862
+ "stopPropagateEnterKeyEvent": {
863
+ "type": "boolean",
864
+ "mutable": false,
865
+ "complexType": {
866
+ "original": "boolean",
867
+ "resolved": "boolean",
868
+ "references": {}
869
+ },
870
+ "required": false,
871
+ "optional": false,
872
+ "docs": {
873
+ "tags": [],
874
+ "text": "Se true, ineterrompe a propaga\u00E7\u00E3o do evento de KeyDown da tecla enter"
875
+ },
876
+ "attribute": "stop-propagate-enter-key-event",
877
+ "reflect": false,
878
+ "defaultValue": "false"
879
+ },
842
880
  "mode": {
843
881
  "type": "string",
844
882
  "mutable": false,
@@ -2903,6 +2903,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
2903
2903
  this.suppressSearch = false;
2904
2904
  this.optionLoader = undefined;
2905
2905
  this.suppressEmptyOption = false;
2906
+ this.stopPropagateEnterKeyEvent = false;
2906
2907
  this.canShowError = true;
2907
2908
  this.mode = "regular";
2908
2909
  this.hideErrorOnFocusOut = true;
@@ -3240,7 +3241,6 @@ const EzComboBox$1 = class extends HTMLElement$1 {
3240
3241
  this.setInputValue(false);
3241
3242
  }, this._deboucingTime);
3242
3243
  }
3243
- this.resetOptions();
3244
3244
  }
3245
3245
  setInputValue(clearError = true) {
3246
3246
  const textValue = this.getText();
@@ -3329,7 +3329,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
3329
3329
  this.showOptions();
3330
3330
  }
3331
3331
  else {
3332
- this.hideOptions();
3332
+ this._preSelection = undefined;
3333
3333
  this.updateVisibleOptions();
3334
3334
  }
3335
3335
  }
@@ -3357,21 +3357,32 @@ const EzComboBox$1 = class extends HTMLElement$1 {
3357
3357
  }
3358
3358
  switch (event.key) {
3359
3359
  case "ArrowDown":
3360
+ this.showOptions();
3360
3361
  this.nextOption();
3361
3362
  event.stopPropagation();
3362
3363
  break;
3363
3364
  case "ArrowUp":
3365
+ this.showOptions();
3364
3366
  this.previousOption();
3365
3367
  event.stopPropagation();
3366
3368
  break;
3367
3369
  case "Enter":
3370
+ this.handleEventPropagation(event);
3368
3371
  this.selectCurrentOption();
3369
3372
  break;
3370
3373
  case "Escape":
3374
+ if (this.isOptionsVisible()) {
3375
+ event.stopPropagation();
3376
+ }
3371
3377
  this.cancelPreselection();
3378
+ this.resetOptions();
3372
3379
  break;
3373
3380
  case "Tab":
3374
3381
  this._tabPressed = true;
3382
+ if (this.isOptionsVisible()) {
3383
+ this.selectCurrentOption();
3384
+ }
3385
+ this.resetOptions();
3375
3386
  break;
3376
3387
  }
3377
3388
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -3380,6 +3391,12 @@ const EzComboBox$1 = class extends HTMLElement$1 {
3380
3391
  //e o contexto pode reagir (fechar um popup por exemplo).
3381
3392
  //event.stopPropagation();
3382
3393
  }
3394
+ //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
3395
+ handleEventPropagation(event) {
3396
+ if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
3397
+ event.stopPropagation();
3398
+ }
3399
+ }
3383
3400
  onTextInputFocusOutHandler() {
3384
3401
  if (this.hideErrorOnFocusOut)
3385
3402
  this.cancelPreselection();
@@ -3461,7 +3478,9 @@ const EzCustomFormInput$1 = class extends HTMLElement$1 {
3461
3478
  this.getContent();
3462
3479
  }
3463
3480
  watchSelectedRecord(newValue, oldValue) {
3464
- if (newValue['__record__id__'] !== oldValue['__record__id__']) {
3481
+ const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
3482
+ const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
3483
+ if (newRecordId !== oldRecordId) {
3465
3484
  this.getContent();
3466
3485
  }
3467
3486
  }
@@ -3624,6 +3643,9 @@ const EzDateInput$1 = class extends HTMLElement$1 {
3624
3643
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
3625
3644
  this.value = newValueValidated;
3626
3645
  }
3646
+ else {
3647
+ this._changePending = false;
3648
+ }
3627
3649
  }
3628
3650
  showCalendar() {
3629
3651
  this.handleBlur();
@@ -124477,6 +124499,17 @@ class DataSourceInterceptor {
124477
124499
  }
124478
124500
 
124479
124501
  class DataSource {
124502
+ handleDataSaved(action) {
124503
+ this._controller.clearInvalidCells();
124504
+ this.handleRefreshOrReload(action);
124505
+ this._controller.processContinuousInsert();
124506
+ }
124507
+ handleEditionCanceled(action) {
124508
+ if (this._options.enableGridInsert) {
124509
+ this._controller.processEditionCanceled();
124510
+ }
124511
+ this.handleRefreshOrReload(action);
124512
+ }
124480
124513
  handleSavingCanceled(action) {
124481
124514
  var _a, _b, _c, _d;
124482
124515
  if (!((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fields) || !((_b = action.payload) === null || _b === void 0 ? void 0 : _b.recordId))
@@ -124544,10 +124577,8 @@ class DataSource {
124544
124577
  * e callbacks implementados no AgGridController e GridEditionManager.
124545
124578
  */
124546
124579
  setTimeout(() => {
124547
- var _a;
124548
- const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
124549
- this._controller.startEditionOnRowByIndex(newRowIndex);
124550
- }, 500);
124580
+ this._controller.startEditionOnLastRow();
124581
+ }, 1000);
124551
124582
  }
124552
124583
  updateLoadedRecords(action) {
124553
124584
  const records = action.payload;
@@ -124601,12 +124632,14 @@ class DataSource {
124601
124632
  }
124602
124633
  break;
124603
124634
  case Action.RECORDS_ADDED:
124635
+ case Action.RECORDS_COPIED:
124604
124636
  this.handleRecordsAdded();
124605
124637
  break;
124606
124638
  case Action.DATA_SAVED:
124639
+ this.handleDataSaved(action);
124640
+ break;
124607
124641
  case Action.EDITION_CANCELED:
124608
- this._controller.clearInvalidCells(action.type);
124609
- this.handleRefreshOrReload(action);
124642
+ this.handleEditionCanceled(action);
124610
124643
  break;
124611
124644
  case Action.DATA_CHANGED:
124612
124645
  case Action.DATA_RESOLVED:
@@ -125083,6 +125116,7 @@ const buildComboBox = ({ required, props, eGridCell }) => {
125083
125116
  mode="slim"
125084
125117
  />`);
125085
125118
  combo.options = options;
125119
+ combo.stopPropagateEnterKeyEvent = true;
125086
125120
  combo.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
125087
125121
  return combo;
125088
125122
  };
@@ -125115,6 +125149,7 @@ const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) => {
125115
125149
  ezSearch.ensureClearButtonVisible = true;
125116
125150
  ezSearch.suppressPreLoad = true;
125117
125151
  ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
125152
+ ezSearch.stopPropagateEnterKeyEvent = true;
125118
125153
  ezSearch.valueGetter = () => ezSearch.getValueAsync();
125119
125154
  return ezSearch;
125120
125155
  };
@@ -125233,9 +125268,10 @@ class EzGridCustomCellEditor extends EzCellEditor {
125233
125268
  this._value = value;
125234
125269
  }
125235
125270
  getValue() {
125236
- if (this._customGui.getValue)
125271
+ var _a, _b;
125272
+ if ((_a = this._customGui) === null || _a === void 0 ? void 0 : _a.getValue)
125237
125273
  return this._customGui.getValue();
125238
- if (this._customGui.hasAttribute('value'))
125274
+ if ((_b = this._customGui) === null || _b === void 0 ? void 0 : _b.hasAttribute('value'))
125239
125275
  return this._customGui.value;
125240
125276
  return this._value;
125241
125277
  }
@@ -125320,7 +125356,7 @@ class EzGridCustomCellRender extends EzCellRender {
125320
125356
  }
125321
125357
 
125322
125358
  class GridEditionManager {
125323
- constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert) {
125359
+ constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert) {
125324
125360
  this._dataUnit = dataUnit;
125325
125361
  this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
125326
125362
  getRequiredFields: () => this.getRequiredFields(),
@@ -125330,6 +125366,7 @@ class GridEditionManager {
125330
125366
  this._useEnterLikeTab = useEnterLikeTab;
125331
125367
  this._editionIsDisabled = editionIsDisabled;
125332
125368
  this._enableContinuousInsert = enableContinuousInsert;
125369
+ this._enableGridInsert = enableGridInsert;
125333
125370
  this._customEditors = customEditors;
125334
125371
  this._customRenders = customRenders;
125335
125372
  }
@@ -125363,7 +125400,7 @@ class GridEditionManager {
125363
125400
  this.saveSuccess();
125364
125401
  return;
125365
125402
  }
125366
- if (!this._isGridEdition || this._dataUnit.hasNewRecord()) {
125403
+ if (!this._isGridEdition) {
125367
125404
  return;
125368
125405
  }
125369
125406
  const currentRercord = this._dataUnit.getSelectedRecord();
@@ -125375,14 +125412,7 @@ class GridEditionManager {
125375
125412
  .validate(true)
125376
125413
  .then(() => {
125377
125414
  this._dataUnit.saveData()
125378
- .then(() => {
125379
- if (this.canContinuousInsert()) {
125380
- this._dataUnit.addRecord();
125381
- }
125382
- else {
125383
- this.saveSuccess();
125384
- }
125385
- })
125415
+ .then(() => this.saveSuccess())
125386
125416
  .catch(reason => this.saveFail(reason));
125387
125417
  })
125388
125418
  .catch(reason => this.saveFail(reason));
@@ -125480,11 +125510,12 @@ class GridEditionManager {
125480
125510
  }
125481
125511
  }
125482
125512
  focusOnCell(cell) {
125513
+ var _a;
125483
125514
  if (cell == undefined) {
125484
125515
  return;
125485
125516
  }
125486
125517
  const { rowIndex, column } = cell;
125487
- this._gridOptions.api.getDisplayedRowAtIndex(rowIndex).setSelected(true, true);
125518
+ (_a = this._gridOptions.api.getDisplayedRowAtIndex(rowIndex)) === null || _a === void 0 ? void 0 : _a.setSelected(true, true);
125488
125519
  this._gridOptions.api.clearRangeSelection();
125489
125520
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [column] });
125490
125521
  this._gridOptions.api.startEditingCell({ colKey: column.getColId(), rowIndex });
@@ -125524,9 +125555,10 @@ class GridEditionManager {
125524
125555
  }
125525
125556
  }
125526
125557
  else {
125558
+ const actualRowIndex = rowIndex;
125527
125559
  rowIndex = rowIndex + 1;
125528
125560
  if (rowIndex >= this._dataUnit.records.length) {
125529
- rowIndex = 0;
125561
+ rowIndex = !this._enableGridInsert ? 0 : actualRowIndex;
125530
125562
  }
125531
125563
  }
125532
125564
  this._targetEditionCell = new TargetEdition(rowIndex, column, true);
@@ -125595,7 +125627,7 @@ class GridEditionManager {
125595
125627
  event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: value }));
125596
125628
  }
125597
125629
  this._isGridEdition = true;
125598
- this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__], undefined, true);
125630
+ this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__], { suppressCreateNewRecord: true });
125599
125631
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
125600
125632
  }
125601
125633
  }
@@ -125611,14 +125643,16 @@ class GridEditionManager {
125611
125643
  getInvalidCell() {
125612
125644
  return this._invalidCell;
125613
125645
  }
125614
- clearInvalidCells(action) {
125646
+ processContinuousInsert() {
125647
+ if (!this.canContinuousInsert())
125648
+ return;
125649
+ this._dataUnit.addRecord();
125650
+ }
125651
+ clearInvalidCells(stopEdition) {
125615
125652
  this._invalidCell = undefined;
125616
- if (action === Action.EDITION_CANCELED) {
125653
+ if (stopEdition) {
125617
125654
  this._isGridEdition = false;
125618
125655
  }
125619
- else if (action === Action.DATA_SAVED && this.canContinuousInsert()) {
125620
- this._dataUnit.addRecord();
125621
- }
125622
125656
  }
125623
125657
  setEnableContinuousInsert(enable) {
125624
125658
  this._enableContinuousInsert = enable;
@@ -125763,7 +125797,7 @@ class AgGridController {
125763
125797
  this._doubleClickCallBack = options.onDoubleClick;
125764
125798
  this._multipleSelection = options.allowMultipleSelection;
125765
125799
  this._dataUnit = options.dataUnit;
125766
- this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert);
125800
+ this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert, options.enableGridInsert);
125767
125801
  this._statusResolver = options.statusResolver;
125768
125802
  if (this._dataUnit) {
125769
125803
  this._dataUnit.sortingProvider = this;
@@ -126203,10 +126237,20 @@ class AgGridController {
126203
126237
  }
126204
126238
  }
126205
126239
  startEditionOnRowByIndex(rowIndex) {
126240
+ this._dataUnit.setSelectionByIndex([rowIndex]);
126206
126241
  const firstCol = this.getFirstEditableColl(rowIndex);
126242
+ if (!firstCol)
126243
+ return;
126207
126244
  this.focusByCollAndRow(firstCol, rowIndex);
126208
126245
  this.startEdition(rowIndex, firstCol);
126209
126246
  }
126247
+ startEditionOnLastRow() {
126248
+ var _a;
126249
+ if (this._gridShowDom) {
126250
+ const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
126251
+ this.startEditionOnRowByIndex(newRowIndex);
126252
+ }
126253
+ }
126210
126254
  startEdition(rowIndex, firstCol) {
126211
126255
  this._gridOptions.api.clearRangeSelection();
126212
126256
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
@@ -126218,8 +126262,13 @@ class AgGridController {
126218
126262
  }
126219
126263
  }
126220
126264
  getFirstEditableColl(rowIndex) {
126221
- const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
126222
- return displayedColumns.find(column => this.isColumnEditable(rowIndex, column));
126265
+ try {
126266
+ const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
126267
+ return displayedColumns.find(column => this.isColumnEditable(rowIndex, column));
126268
+ }
126269
+ catch (e) {
126270
+ console.warn(e);
126271
+ }
126223
126272
  }
126224
126273
  isColumnEditable(rowIndex, column) {
126225
126274
  if (column.getColDef().headerName === '' || rowIndex === -1)
@@ -126555,36 +126604,41 @@ class AgGridController {
126555
126604
  return false;
126556
126605
  }
126557
126606
  onSelectionChange(event) {
126558
- if (this._selectionChangeCallback) {
126559
- clearTimeout(this._selectionChangeDeboucing);
126560
- this._selectionChangeDeboucing = window.setTimeout(() => {
126561
- this._editionManager.proceedAutoSave();
126562
- if (this._dataUnit) {
126563
- if (event.context.selectionChangeQuietly) {
126564
- const selectionInfo = this._dataUnit;
126565
- this._selectionChangeCallback({
126566
- selection: selectionInfo.records,
126567
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
126568
- });
126569
- }
126570
- else {
126571
- this._dataUnit.updatePageSelection(this._gridOptions.api.getSelectedRows().map((r) => r.__record__id__)).then(selectionInfo => {
126572
- this._selectionChangeCallback({
126573
- selection: selectionInfo.records,
126574
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
126575
- });
126576
- });
126577
- }
126578
- }
126579
- else {
126580
- this._selectionChangeCallback({
126581
- selection: this._gridOptions.api.getSelectedRows(),
126582
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
126583
- });
126584
- }
126585
- }, 0);
126607
+ if (!this._selectionChangeCallback)
126608
+ return;
126609
+ clearTimeout(this._selectionChangeDeboucing);
126610
+ this._selectionChangeDeboucing = window.setTimeout(() => {
126611
+ this.handleExecuteProceedAutosave();
126612
+ this.processBuildSelectionChangeCallback(event);
126613
+ }, 0);
126614
+ }
126615
+ handleExecuteProceedAutosave() {
126616
+ if (this._gridShowDom) {
126617
+ this._editionManager.proceedAutoSave();
126586
126618
  }
126587
126619
  }
126620
+ processBuildSelectionChangeCallback(event) {
126621
+ if (this._dataUnit) {
126622
+ this.handleBuildSelectionChangeWithDU(event.context.selectionChangeQuietly);
126623
+ return;
126624
+ }
126625
+ this.buildSelectionChangeCallback(this._gridOptions.api.getSelectedRows());
126626
+ }
126627
+ handleBuildSelectionChangeWithDU(quietly) {
126628
+ if (quietly) {
126629
+ this.buildSelectionChangeCallback(this._dataUnit.records);
126630
+ return;
126631
+ }
126632
+ this._dataUnit.updatePageSelection(this._gridOptions.api.getSelectedRows()
126633
+ .map((r) => r.__record__id__))
126634
+ .then(selectionInfo => this.buildSelectionChangeCallback(selectionInfo.records));
126635
+ }
126636
+ buildSelectionChangeCallback(records) {
126637
+ this._selectionChangeCallback({
126638
+ selection: records,
126639
+ selectionHeaderStatus: this.getSelectionHeaderStatus(),
126640
+ });
126641
+ }
126588
126642
  onRowDoubleClick(evt) {
126589
126643
  if (this._doubleClickCallBack) {
126590
126644
  this._doubleClickCallBack(evt.data);
@@ -126595,6 +126649,12 @@ class AgGridController {
126595
126649
  host[attribute] = value;
126596
126650
  }
126597
126651
  }
126652
+ processEditionCanceled() {
126653
+ this.clearInvalidCells(true);
126654
+ if (this._gridShowDom) {
126655
+ this._dataUnit.clearSelection();
126656
+ }
126657
+ }
126598
126658
  setCellEditors(customEditors) {
126599
126659
  var _a;
126600
126660
  if (!this._editionManager) {
@@ -126613,12 +126673,15 @@ class AgGridController {
126613
126673
  this._editionManager.setCellRenders(customRenders);
126614
126674
  (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
126615
126675
  }
126616
- clearInvalidCells(action) {
126676
+ clearInvalidCells(stopEdition) {
126617
126677
  if (!this._editionManager)
126618
126678
  return;
126619
- this._editionManager.clearInvalidCells(action);
126679
+ this._editionManager.clearInvalidCells(stopEdition);
126620
126680
  this._gridOptions.api.refreshCells({ force: true });
126621
126681
  }
126682
+ processContinuousInsert() {
126683
+ this._editionManager.processContinuousInsert();
126684
+ }
126622
126685
  destroy() {
126623
126686
  this.observer.disconnect();
126624
126687
  }
@@ -127257,7 +127320,8 @@ const EzGrid$1 = class extends HTMLElement$1 {
127257
127320
  return this._getActualPageLabel() + this._getRemainingPageLabel();
127258
127321
  }
127259
127322
  _initHeaderOverflowWatcher() {
127260
- this._headerOverflowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
127323
+ if (this._refPaginationControl)
127324
+ this._headerOverflowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
127261
127325
  }
127262
127326
  buildOverFlowWatcherParams() {
127263
127327
  return {
@@ -129069,6 +129133,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129069
129133
  this.showSelectedValue = true;
129070
129134
  this.showOptionValue = true;
129071
129135
  this.suppressEmptyOption = false;
129136
+ this.stopPropagateEnterKeyEvent = false;
129072
129137
  this.mode = "regular";
129073
129138
  this.canShowError = true;
129074
129139
  this.hideErrorOnFocusOut = true;
@@ -129243,6 +129308,9 @@ const EzSearch$1 = class extends HTMLElement$1 {
129243
129308
  getText() {
129244
129309
  const currentValue = this.getSelectedOption(this._currentValue);
129245
129310
  const text = this.getFormattedText(currentValue);
129311
+ return this.replaceQuotes(text);
129312
+ }
129313
+ replaceQuotes(text) {
129246
129314
  if (text == undefined) {
129247
129315
  return;
129248
129316
  }
@@ -129531,6 +129599,15 @@ const EzSearch$1 = class extends HTMLElement$1 {
129531
129599
  }
129532
129600
  this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
129533
129601
  this.value = this._currentValue;
129602
+ this.setTextInputValue();
129603
+ }
129604
+ setTextInputValue() {
129605
+ if (this._textInput && (this._textInput.value === null || this._textInput.value === undefined)) {
129606
+ if (this.value === undefined || this.value === null)
129607
+ return;
129608
+ const textValue = (typeof this.value === 'string') ? this.value : this.getFormattedText(this.value);
129609
+ this._textInput.value = this.replaceQuotes(textValue);
129610
+ }
129534
129611
  }
129535
129612
  loadOptionValue(argument) {
129536
129613
  var _a;
@@ -129679,6 +129756,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129679
129756
  event.stopPropagation();
129680
129757
  break;
129681
129758
  case "Enter":
129759
+ this.handleEventPropagation(event);
129682
129760
  this.selectCurrentOption();
129683
129761
  break;
129684
129762
  case "Escape":
@@ -129695,6 +129773,12 @@ const EzSearch$1 = class extends HTMLElement$1 {
129695
129773
  //e o contexto pode reagir (fechar um popup por exemplo).
129696
129774
  //event.stopPropagation();
129697
129775
  }
129776
+ //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
129777
+ handleEventPropagation(event) {
129778
+ if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
129779
+ event.stopPropagation();
129780
+ }
129781
+ }
129698
129782
  onTextInputFocusOutHandler() {
129699
129783
  if (this.hideErrorOnFocusOut)
129700
129784
  this.cancelPreselection();
@@ -133156,7 +133240,7 @@ const EzChart = /*@__PURE__*/proxyCustomElement(EzChart$1, [1,"ez-chart",{"type"
133156
133240
  const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[1540],"mode":[513],"compact":[4]}]);
133157
133241
  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"]}]);
133158
133242
  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]}]);
133159
- const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"limitCharsToSearch":[2,"limit-chars-to-search"],"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"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"]]]);
133243
+ const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"limitCharsToSearch":[2,"limit-chars-to-search"],"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"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"]]]);
133160
133244
  const EzCustomFormInput = /*@__PURE__*/proxyCustomElement(EzCustomFormInput$1, [2,"ez-custom-form-input",{"customEditor":[16],"formViewField":[16],"value":[1032],"detailContext":[1,"detail-context"],"builderFallback":[16],"selectedRecord":[16],"gui":[32]}]);
133161
133245
  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"]}]);
133162
133246
  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"]}]);
@@ -133179,7 +133263,7 @@ const EzPopover = /*@__PURE__*/proxyCustomElement(EzPopover$1, [1,"ez-popover",{
133179
133263
  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"],"enabledScroll":[4,"enabled-scroll"]}]);
133180
133264
  const EzRadioButton = /*@__PURE__*/proxyCustomElement(EzRadioButton$1, [1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]);
133181
133265
  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"]]]);
133182
- 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"],"ignoreLimitCharsToSearch":[4,"ignore-limit-chars-to-search"],"options":[1040],"suppressSearch":[4,"suppress-search"],"ensureClearButtonVisible":[4,"ensure-clear-button-visible"],"suppressPreLoad":[4,"suppress-pre-load"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]},[[11,"scroll","scrollListener"]]]);
133266
+ 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"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"mode":[513],"canShowError":[516,"can-show-error"],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"ignoreLimitCharsToSearch":[4,"ignore-limit-chars-to-search"],"options":[1040],"suppressSearch":[4,"suppress-search"],"ensureClearButtonVisible":[4,"ensure-clear-button-visible"],"suppressPreLoad":[4,"suppress-pre-load"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]},[[11,"scroll","scrollListener"]]]);
133183
133267
  const EzSidebarButton = /*@__PURE__*/proxyCustomElement(EzSidebarButton$1, [1,"ez-sidebar-button"]);
133184
133268
  const EzSidebarNavigator = /*@__PURE__*/proxyCustomElement(EzSidebarNavigator$1, [1,"ez-sidebar-navigator",{"type":[1],"mode":[1025],"size":[1],"isResponsive":[4,"is-responsive"],"titleMenu":[1,"title-menu"],"showCollapseMenu":[4,"show-collapse-menu"],"showFixedButton":[4,"show-fixed-button"],"open":[32]}]);
133185
133269
  const EzSkeleton = /*@__PURE__*/proxyCustomElement(EzSkeleton$1, [0,"ez-skeleton",{"count":[2],"variant":[1],"width":[1],"height":[1],"marginBottom":[1,"margin-bottom"],"animation":[1]}]);
@@ -34,6 +34,7 @@ const EzComboBox = class {
34
34
  this.suppressSearch = false;
35
35
  this.optionLoader = undefined;
36
36
  this.suppressEmptyOption = false;
37
+ this.stopPropagateEnterKeyEvent = false;
37
38
  this.canShowError = true;
38
39
  this.mode = "regular";
39
40
  this.hideErrorOnFocusOut = true;
@@ -371,7 +372,6 @@ const EzComboBox = class {
371
372
  this.setInputValue(false);
372
373
  }, this._deboucingTime);
373
374
  }
374
- this.resetOptions();
375
375
  }
376
376
  setInputValue(clearError = true) {
377
377
  const textValue = this.getText();
@@ -460,7 +460,7 @@ const EzComboBox = class {
460
460
  this.showOptions();
461
461
  }
462
462
  else {
463
- this.hideOptions();
463
+ this._preSelection = undefined;
464
464
  this.updateVisibleOptions();
465
465
  }
466
466
  }
@@ -488,21 +488,32 @@ const EzComboBox = class {
488
488
  }
489
489
  switch (event.key) {
490
490
  case "ArrowDown":
491
+ this.showOptions();
491
492
  this.nextOption();
492
493
  event.stopPropagation();
493
494
  break;
494
495
  case "ArrowUp":
496
+ this.showOptions();
495
497
  this.previousOption();
496
498
  event.stopPropagation();
497
499
  break;
498
500
  case "Enter":
501
+ this.handleEventPropagation(event);
499
502
  this.selectCurrentOption();
500
503
  break;
501
504
  case "Escape":
505
+ if (this.isOptionsVisible()) {
506
+ event.stopPropagation();
507
+ }
502
508
  this.cancelPreselection();
509
+ this.resetOptions();
503
510
  break;
504
511
  case "Tab":
505
512
  this._tabPressed = true;
513
+ if (this.isOptionsVisible()) {
514
+ this.selectCurrentOption();
515
+ }
516
+ this.resetOptions();
506
517
  break;
507
518
  }
508
519
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -511,6 +522,12 @@ const EzComboBox = class {
511
522
  //e o contexto pode reagir (fechar um popup por exemplo).
512
523
  //event.stopPropagation();
513
524
  }
525
+ //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
526
+ handleEventPropagation(event) {
527
+ if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
528
+ event.stopPropagation();
529
+ }
530
+ }
514
531
  onTextInputFocusOutHandler() {
515
532
  if (this.hideErrorOnFocusOut)
516
533
  this.cancelPreselection();
@@ -54,7 +54,9 @@ const EzCustomFormInput = class {
54
54
  this.getContent();
55
55
  }
56
56
  watchSelectedRecord(newValue, oldValue) {
57
- if (newValue['__record__id__'] !== oldValue['__record__id__']) {
57
+ const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
58
+ const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
59
+ if (newRecordId !== oldRecordId) {
58
60
  this.getContent();
59
61
  }
60
62
  }
@@ -88,6 +88,9 @@ const EzDateInput = class {
88
88
  if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
89
89
  this.value = newValueValidated;
90
90
  }
91
+ else {
92
+ this._changePending = false;
93
+ }
91
94
  }
92
95
  showCalendar() {
93
96
  this.handleBlur();