@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-67199.0 → 0.0.0-bugfix-dev-KB-66441.1

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.
@@ -120422,11 +120422,9 @@ class AgGridController {
120422
120422
  //Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
120423
120423
  //Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
120424
120424
  const columnsOffset = colDef.length - columns.length;
120425
- this._gridConfig = state;
120426
120425
  let sort = [];
120427
120426
  state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
120428
- var _a;
120429
- const colWidth = (_a = this._gridOptions.columnApi.getColumn(cfgColumn.name)) === null || _a === void 0 ? void 0 : _a.getActualWidth();
120427
+ const colWidth = this._gridOptions.columnApi.getColumn(cfgColumn.name).getActualWidth();
120430
120428
  this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
120431
120429
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
120432
120430
  visibleColumns.push(cfgColumn.name);
@@ -120441,6 +120439,7 @@ class AgGridController {
120441
120439
  state: sort,
120442
120440
  defaultState: { sort: null },
120443
120441
  });
120442
+ this._gridConfig = state;
120444
120443
  }
120445
120444
  getAdaptiveWidth(width) {
120446
120445
  const widthGrid = this._container.clientWidth;
@@ -24,7 +24,6 @@ const EzSearch = class {
24
24
  this._tabPressed = false;
25
25
  this._textEmptyList = "Nenhum resultado encontrado";
26
26
  this._textEmptySearch = "Nenhum resultado de {0} encontrado";
27
- this._lookupMode = false;
28
27
  this._startHighlightTag = "<span class='card-item__highlight'>";
29
28
  this._endHighlightTag = "</span>";
30
29
  this._preSelection = undefined;
@@ -53,36 +52,35 @@ const EzSearch = class {
53
52
  var _a;
54
53
  if (this._textInput) {
55
54
  this._textInput.errorMessage = this.errorMessage;
56
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
55
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
57
56
  this.setInputValue();
58
57
  }
59
58
  }
60
59
  }
60
+ validateNewValue(newValue, oldValue) {
61
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
62
+ return false;
63
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
64
+ return false;
65
+ if (typeof newValue == 'object' && typeof oldValue == 'object' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
66
+ return false;
67
+ return true;
68
+ }
61
69
  async observeValue(newValue, oldValue) {
62
- if (this._textInput && newValue != oldValue) {
63
- try {
64
- if (typeof newValue === "string") {
65
- await this.handleValueAsString(newValue);
66
- return;
67
- }
68
- const newValueSelected = this.getSelectedOption(newValue);
69
- const oldValueSelected = this.getSelectedOption(oldValue);
70
- const currentValue = this.getSelectedOption(this.value);
71
- if (this.isDifferentValues(currentValue, newValueSelected)) {
72
- this.value = newValueSelected;
73
- }
74
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
75
- this.setInputValue();
76
- const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
77
- if (!this._lookupMode) {
78
- this.ezChange.emit(valueEmitted);
79
- }
80
- }
81
- this.resetOptions();
70
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
71
+ if (typeof newValue === "string") {
72
+ await this.handleValueAsString(newValue);
73
+ return;
82
74
  }
83
- finally {
84
- this._lookupMode = false;
75
+ const newValueSelected = this.getSelectedOption(newValue);
76
+ const currentValue = this.getSelectedOption(this._currentValue);
77
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
78
+ this._currentValue = newValueSelected;
79
+ this.setInputValue();
80
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
81
+ this.ezChange.emit(valueEmitted);
85
82
  }
83
+ this.resetOptions();
86
84
  }
87
85
  }
88
86
  observeOptions(newOptions, oldOptions) {
@@ -155,7 +153,9 @@ const EzSearch = class {
155
153
  return;
156
154
  }
157
155
  await this.loadDescriptionValue(value);
156
+ this.setInputValue();
158
157
  this.ezChange.emit(this.value);
158
+ this._currentValue = this.value;
159
159
  }
160
160
  updateListPosition() {
161
161
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -212,7 +212,7 @@ const EzSearch = class {
212
212
  return text;
213
213
  }
214
214
  getText() {
215
- const currentValue = this.getSelectedOption(this.value);
215
+ const currentValue = this.getSelectedOption(this._currentValue);
216
216
  const text = this.getFormattedText(currentValue);
217
217
  if (text == undefined) {
218
218
  return;
@@ -387,6 +387,7 @@ const EzSearch = class {
387
387
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
388
388
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
389
389
  this.value = adjustedOpt;
390
+ this._currentValue = adjustedOpt;
390
391
  }
391
392
  else {
392
393
  this.setInputValue();
@@ -407,7 +408,7 @@ const EzSearch = class {
407
408
  }
408
409
  }
409
410
  cancelPreselection() {
410
- if (!this._textInput.value && this.value) {
411
+ if (!this._textInput.value && this._currentValue) {
411
412
  this.selectOption(undefined);
412
413
  }
413
414
  else {
@@ -428,6 +429,7 @@ const EzSearch = class {
428
429
  }
429
430
  clearSearch() {
430
431
  this.value = null;
432
+ this._currentValue = null;
431
433
  }
432
434
  controlListWithOnlyOne() {
433
435
  var _a, _b;
@@ -457,11 +459,11 @@ const EzSearch = class {
457
459
  if (core.StringUtils.isEmpty(this.value)) {
458
460
  return;
459
461
  }
460
- let value = this.value;
461
- if (typeof value === "object") {
462
+ if (!this.validateNewValue(this.value, this._currentValue)) {
462
463
  return;
463
464
  }
464
- if (core.StringUtils.isEmpty(value)) {
465
+ let value = this.value;
466
+ if (typeof value === "object") {
465
467
  return;
466
468
  }
467
469
  this.loadDescriptionValue(value);
@@ -498,8 +500,8 @@ const EzSearch = class {
498
500
  this.showNoResultMessage();
499
501
  return;
500
502
  }
501
- this._lookupMode = true;
502
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
503
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
504
+ this.value = this._currentValue;
503
505
  }
504
506
  loadOptionValue(argument) {
505
507
  var _a;
@@ -576,11 +576,9 @@ export default class AgGridController {
576
576
  //Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
577
577
  //Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
578
578
  const columnsOffset = colDef.length - columns.length;
579
- this._gridConfig = state;
580
579
  let sort = [];
581
580
  state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
582
- var _a;
583
- const colWidth = (_a = this._gridOptions.columnApi.getColumn(cfgColumn.name)) === null || _a === void 0 ? void 0 : _a.getActualWidth();
581
+ const colWidth = this._gridOptions.columnApi.getColumn(cfgColumn.name).getActualWidth();
584
582
  this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
585
583
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
586
584
  visibleColumns.push(cfgColumn.name);
@@ -595,6 +593,7 @@ export default class AgGridController {
595
593
  state: sort,
596
594
  defaultState: { sort: null },
597
595
  });
596
+ this._gridConfig = state;
598
597
  }
599
598
  getAdaptiveWidth(width) {
600
599
  const widthGrid = this._container.clientWidth;
@@ -12,7 +12,6 @@ export class EzSearch {
12
12
  this._tabPressed = false;
13
13
  this._textEmptyList = "Nenhum resultado encontrado";
14
14
  this._textEmptySearch = "Nenhum resultado de {0} encontrado";
15
- this._lookupMode = false;
16
15
  this._startHighlightTag = "<span class='card-item__highlight'>";
17
16
  this._endHighlightTag = "</span>";
18
17
  this._preSelection = undefined;
@@ -41,36 +40,35 @@ export class EzSearch {
41
40
  var _a;
42
41
  if (this._textInput) {
43
42
  this._textInput.errorMessage = this.errorMessage;
44
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
43
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
45
44
  this.setInputValue();
46
45
  }
47
46
  }
48
47
  }
48
+ validateNewValue(newValue, oldValue) {
49
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
50
+ return false;
51
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
52
+ return false;
53
+ if (typeof newValue == 'object' && typeof oldValue == 'object' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
54
+ return false;
55
+ return true;
56
+ }
49
57
  async observeValue(newValue, oldValue) {
50
- if (this._textInput && newValue != oldValue) {
51
- try {
52
- if (typeof newValue === "string") {
53
- await this.handleValueAsString(newValue);
54
- return;
55
- }
56
- const newValueSelected = this.getSelectedOption(newValue);
57
- const oldValueSelected = this.getSelectedOption(oldValue);
58
- const currentValue = this.getSelectedOption(this.value);
59
- if (this.isDifferentValues(currentValue, newValueSelected)) {
60
- this.value = newValueSelected;
61
- }
62
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
63
- this.setInputValue();
64
- const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
65
- if (!this._lookupMode) {
66
- this.ezChange.emit(valueEmitted);
67
- }
68
- }
69
- this.resetOptions();
58
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
59
+ if (typeof newValue === "string") {
60
+ await this.handleValueAsString(newValue);
61
+ return;
70
62
  }
71
- finally {
72
- this._lookupMode = false;
63
+ const newValueSelected = this.getSelectedOption(newValue);
64
+ const currentValue = this.getSelectedOption(this._currentValue);
65
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
66
+ this._currentValue = newValueSelected;
67
+ this.setInputValue();
68
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
69
+ this.ezChange.emit(valueEmitted);
73
70
  }
71
+ this.resetOptions();
74
72
  }
75
73
  }
76
74
  observeOptions(newOptions, oldOptions) {
@@ -143,7 +141,9 @@ export class EzSearch {
143
141
  return;
144
142
  }
145
143
  await this.loadDescriptionValue(value);
144
+ this.setInputValue();
146
145
  this.ezChange.emit(this.value);
146
+ this._currentValue = this.value;
147
147
  }
148
148
  updateListPosition() {
149
149
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -200,7 +200,7 @@ export class EzSearch {
200
200
  return text;
201
201
  }
202
202
  getText() {
203
- const currentValue = this.getSelectedOption(this.value);
203
+ const currentValue = this.getSelectedOption(this._currentValue);
204
204
  const text = this.getFormattedText(currentValue);
205
205
  if (text == undefined) {
206
206
  return;
@@ -375,6 +375,7 @@ export class EzSearch {
375
375
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
376
376
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
377
377
  this.value = adjustedOpt;
378
+ this._currentValue = adjustedOpt;
378
379
  }
379
380
  else {
380
381
  this.setInputValue();
@@ -395,7 +396,7 @@ export class EzSearch {
395
396
  }
396
397
  }
397
398
  cancelPreselection() {
398
- if (!this._textInput.value && this.value) {
399
+ if (!this._textInput.value && this._currentValue) {
399
400
  this.selectOption(undefined);
400
401
  }
401
402
  else {
@@ -416,6 +417,7 @@ export class EzSearch {
416
417
  }
417
418
  clearSearch() {
418
419
  this.value = null;
420
+ this._currentValue = null;
419
421
  }
420
422
  controlListWithOnlyOne() {
421
423
  var _a, _b;
@@ -445,11 +447,11 @@ export class EzSearch {
445
447
  if (StringUtils.isEmpty(this.value)) {
446
448
  return;
447
449
  }
448
- let value = this.value;
449
- if (typeof value === "object") {
450
+ if (!this.validateNewValue(this.value, this._currentValue)) {
450
451
  return;
451
452
  }
452
- if (StringUtils.isEmpty(value)) {
453
+ let value = this.value;
454
+ if (typeof value === "object") {
453
455
  return;
454
456
  }
455
457
  this.loadDescriptionValue(value);
@@ -486,8 +488,8 @@ export class EzSearch {
486
488
  this.showNoResultMessage();
487
489
  return;
488
490
  }
489
- this._lookupMode = true;
490
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
491
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
492
+ this.value = this._currentValue;
491
493
  }
492
494
  loadOptionValue(argument) {
493
495
  var _a;
@@ -125988,11 +125988,9 @@ class AgGridController {
125988
125988
  //Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
125989
125989
  //Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
125990
125990
  const columnsOffset = colDef.length - columns.length;
125991
- this._gridConfig = state;
125992
125991
  let sort = [];
125993
125992
  state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
125994
- var _a;
125995
- const colWidth = (_a = this._gridOptions.columnApi.getColumn(cfgColumn.name)) === null || _a === void 0 ? void 0 : _a.getActualWidth();
125993
+ const colWidth = this._gridOptions.columnApi.getColumn(cfgColumn.name).getActualWidth();
125996
125994
  this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
125997
125995
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
125998
125996
  visibleColumns.push(cfgColumn.name);
@@ -126007,6 +126005,7 @@ class AgGridController {
126007
126005
  state: sort,
126008
126006
  defaultState: { sort: null },
126009
126007
  });
126008
+ this._gridConfig = state;
126010
126009
  }
126011
126010
  getAdaptiveWidth(width) {
126012
126011
  const widthGrid = this._container.clientWidth;
@@ -128688,7 +128687,6 @@ const EzSearch$1 = class extends HTMLElement$1 {
128688
128687
  this._tabPressed = false;
128689
128688
  this._textEmptyList = "Nenhum resultado encontrado";
128690
128689
  this._textEmptySearch = "Nenhum resultado de {0} encontrado";
128691
- this._lookupMode = false;
128692
128690
  this._startHighlightTag = "<span class='card-item__highlight'>";
128693
128691
  this._endHighlightTag = "</span>";
128694
128692
  this._preSelection = undefined;
@@ -128717,36 +128715,35 @@ const EzSearch$1 = class extends HTMLElement$1 {
128717
128715
  var _a;
128718
128716
  if (this._textInput) {
128719
128717
  this._textInput.errorMessage = this.errorMessage;
128720
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
128718
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
128721
128719
  this.setInputValue();
128722
128720
  }
128723
128721
  }
128724
128722
  }
128723
+ validateNewValue(newValue, oldValue) {
128724
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
128725
+ return false;
128726
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
128727
+ return false;
128728
+ if (typeof newValue == 'object' && typeof oldValue == 'object' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
128729
+ return false;
128730
+ return true;
128731
+ }
128725
128732
  async observeValue(newValue, oldValue) {
128726
- if (this._textInput && newValue != oldValue) {
128727
- try {
128728
- if (typeof newValue === "string") {
128729
- await this.handleValueAsString(newValue);
128730
- return;
128731
- }
128732
- const newValueSelected = this.getSelectedOption(newValue);
128733
- const oldValueSelected = this.getSelectedOption(oldValue);
128734
- const currentValue = this.getSelectedOption(this.value);
128735
- if (this.isDifferentValues(currentValue, newValueSelected)) {
128736
- this.value = newValueSelected;
128737
- }
128738
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
128739
- this.setInputValue();
128740
- const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
128741
- if (!this._lookupMode) {
128742
- this.ezChange.emit(valueEmitted);
128743
- }
128744
- }
128745
- this.resetOptions();
128733
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
128734
+ if (typeof newValue === "string") {
128735
+ await this.handleValueAsString(newValue);
128736
+ return;
128746
128737
  }
128747
- finally {
128748
- this._lookupMode = false;
128738
+ const newValueSelected = this.getSelectedOption(newValue);
128739
+ const currentValue = this.getSelectedOption(this._currentValue);
128740
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
128741
+ this._currentValue = newValueSelected;
128742
+ this.setInputValue();
128743
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
128744
+ this.ezChange.emit(valueEmitted);
128749
128745
  }
128746
+ this.resetOptions();
128750
128747
  }
128751
128748
  }
128752
128749
  observeOptions(newOptions, oldOptions) {
@@ -128819,7 +128816,9 @@ const EzSearch$1 = class extends HTMLElement$1 {
128819
128816
  return;
128820
128817
  }
128821
128818
  await this.loadDescriptionValue(value);
128819
+ this.setInputValue();
128822
128820
  this.ezChange.emit(this.value);
128821
+ this._currentValue = this.value;
128823
128822
  }
128824
128823
  updateListPosition() {
128825
128824
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -128876,7 +128875,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
128876
128875
  return text;
128877
128876
  }
128878
128877
  getText() {
128879
- const currentValue = this.getSelectedOption(this.value);
128878
+ const currentValue = this.getSelectedOption(this._currentValue);
128880
128879
  const text = this.getFormattedText(currentValue);
128881
128880
  if (text == undefined) {
128882
128881
  return;
@@ -129051,6 +129050,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129051
129050
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
129052
129051
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
129053
129052
  this.value = adjustedOpt;
129053
+ this._currentValue = adjustedOpt;
129054
129054
  }
129055
129055
  else {
129056
129056
  this.setInputValue();
@@ -129071,7 +129071,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129071
129071
  }
129072
129072
  }
129073
129073
  cancelPreselection() {
129074
- if (!this._textInput.value && this.value) {
129074
+ if (!this._textInput.value && this._currentValue) {
129075
129075
  this.selectOption(undefined);
129076
129076
  }
129077
129077
  else {
@@ -129092,6 +129092,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129092
129092
  }
129093
129093
  clearSearch() {
129094
129094
  this.value = null;
129095
+ this._currentValue = null;
129095
129096
  }
129096
129097
  controlListWithOnlyOne() {
129097
129098
  var _a, _b;
@@ -129121,11 +129122,11 @@ const EzSearch$1 = class extends HTMLElement$1 {
129121
129122
  if (StringUtils$1.isEmpty(this.value)) {
129122
129123
  return;
129123
129124
  }
129124
- let value = this.value;
129125
- if (typeof value === "object") {
129125
+ if (!this.validateNewValue(this.value, this._currentValue)) {
129126
129126
  return;
129127
129127
  }
129128
- if (StringUtils$1.isEmpty(value)) {
129128
+ let value = this.value;
129129
+ if (typeof value === "object") {
129129
129130
  return;
129130
129131
  }
129131
129132
  this.loadDescriptionValue(value);
@@ -129162,8 +129163,8 @@ const EzSearch$1 = class extends HTMLElement$1 {
129162
129163
  this.showNoResultMessage();
129163
129164
  return;
129164
129165
  }
129165
- this._lookupMode = true;
129166
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
129166
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
129167
+ this.value = this._currentValue;
129167
129168
  }
129168
129169
  loadOptionValue(argument) {
129169
129170
  var _a;
@@ -120418,11 +120418,9 @@ class AgGridController {
120418
120418
  //Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
120419
120419
  //Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
120420
120420
  const columnsOffset = colDef.length - columns.length;
120421
- this._gridConfig = state;
120422
120421
  let sort = [];
120423
120422
  state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
120424
- var _a;
120425
- const colWidth = (_a = this._gridOptions.columnApi.getColumn(cfgColumn.name)) === null || _a === void 0 ? void 0 : _a.getActualWidth();
120423
+ const colWidth = this._gridOptions.columnApi.getColumn(cfgColumn.name).getActualWidth();
120426
120424
  this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
120427
120425
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
120428
120426
  visibleColumns.push(cfgColumn.name);
@@ -120437,6 +120435,7 @@ class AgGridController {
120437
120435
  state: sort,
120438
120436
  defaultState: { sort: null },
120439
120437
  });
120438
+ this._gridConfig = state;
120440
120439
  }
120441
120440
  getAdaptiveWidth(width) {
120442
120441
  const widthGrid = this._container.clientWidth;
@@ -20,7 +20,6 @@ const EzSearch = class {
20
20
  this._tabPressed = false;
21
21
  this._textEmptyList = "Nenhum resultado encontrado";
22
22
  this._textEmptySearch = "Nenhum resultado de {0} encontrado";
23
- this._lookupMode = false;
24
23
  this._startHighlightTag = "<span class='card-item__highlight'>";
25
24
  this._endHighlightTag = "</span>";
26
25
  this._preSelection = undefined;
@@ -49,36 +48,35 @@ const EzSearch = class {
49
48
  var _a;
50
49
  if (this._textInput) {
51
50
  this._textInput.errorMessage = this.errorMessage;
52
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
51
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
53
52
  this.setInputValue();
54
53
  }
55
54
  }
56
55
  }
56
+ validateNewValue(newValue, oldValue) {
57
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
58
+ return false;
59
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
60
+ return false;
61
+ if (typeof newValue == 'object' && typeof oldValue == 'object' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
62
+ return false;
63
+ return true;
64
+ }
57
65
  async observeValue(newValue, oldValue) {
58
- if (this._textInput && newValue != oldValue) {
59
- try {
60
- if (typeof newValue === "string") {
61
- await this.handleValueAsString(newValue);
62
- return;
63
- }
64
- const newValueSelected = this.getSelectedOption(newValue);
65
- const oldValueSelected = this.getSelectedOption(oldValue);
66
- const currentValue = this.getSelectedOption(this.value);
67
- if (this.isDifferentValues(currentValue, newValueSelected)) {
68
- this.value = newValueSelected;
69
- }
70
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
71
- this.setInputValue();
72
- const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
73
- if (!this._lookupMode) {
74
- this.ezChange.emit(valueEmitted);
75
- }
76
- }
77
- this.resetOptions();
66
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
67
+ if (typeof newValue === "string") {
68
+ await this.handleValueAsString(newValue);
69
+ return;
78
70
  }
79
- finally {
80
- this._lookupMode = false;
71
+ const newValueSelected = this.getSelectedOption(newValue);
72
+ const currentValue = this.getSelectedOption(this._currentValue);
73
+ if (this.isDifferentValues(currentValue, newValueSelected)) {
74
+ this._currentValue = newValueSelected;
75
+ this.setInputValue();
76
+ const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
77
+ this.ezChange.emit(valueEmitted);
81
78
  }
79
+ this.resetOptions();
82
80
  }
83
81
  }
84
82
  observeOptions(newOptions, oldOptions) {
@@ -151,7 +149,9 @@ const EzSearch = class {
151
149
  return;
152
150
  }
153
151
  await this.loadDescriptionValue(value);
152
+ this.setInputValue();
154
153
  this.ezChange.emit(this.value);
154
+ this._currentValue = this.value;
155
155
  }
156
156
  updateListPosition() {
157
157
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -208,7 +208,7 @@ const EzSearch = class {
208
208
  return text;
209
209
  }
210
210
  getText() {
211
- const currentValue = this.getSelectedOption(this.value);
211
+ const currentValue = this.getSelectedOption(this._currentValue);
212
212
  const text = this.getFormattedText(currentValue);
213
213
  if (text == undefined) {
214
214
  return;
@@ -383,6 +383,7 @@ const EzSearch = class {
383
383
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
384
384
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
385
385
  this.value = adjustedOpt;
386
+ this._currentValue = adjustedOpt;
386
387
  }
387
388
  else {
388
389
  this.setInputValue();
@@ -403,7 +404,7 @@ const EzSearch = class {
403
404
  }
404
405
  }
405
406
  cancelPreselection() {
406
- if (!this._textInput.value && this.value) {
407
+ if (!this._textInput.value && this._currentValue) {
407
408
  this.selectOption(undefined);
408
409
  }
409
410
  else {
@@ -424,6 +425,7 @@ const EzSearch = class {
424
425
  }
425
426
  clearSearch() {
426
427
  this.value = null;
428
+ this._currentValue = null;
427
429
  }
428
430
  controlListWithOnlyOne() {
429
431
  var _a, _b;
@@ -453,11 +455,11 @@ const EzSearch = class {
453
455
  if (StringUtils.isEmpty(this.value)) {
454
456
  return;
455
457
  }
456
- let value = this.value;
457
- if (typeof value === "object") {
458
+ if (!this.validateNewValue(this.value, this._currentValue)) {
458
459
  return;
459
460
  }
460
- if (StringUtils.isEmpty(value)) {
461
+ let value = this.value;
462
+ if (typeof value === "object") {
461
463
  return;
462
464
  }
463
465
  this.loadDescriptionValue(value);
@@ -494,8 +496,8 @@ const EzSearch = class {
494
496
  this.showNoResultMessage();
495
497
  return;
496
498
  }
497
- this._lookupMode = true;
498
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
499
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
500
+ this.value = this._currentValue;
499
501
  }
500
502
  loadOptionValue(argument) {
501
503
  var _a;