@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-66028.0 → 0.0.0-bugfix-dev-KB-66441.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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -0
  3. package/dist/cjs/ez-form-view.cjs.entry.js +2 -1
  4. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-grid.cjs.entry.js +9 -4
  6. package/dist/cjs/ez-search.cjs.entry.js +24 -13
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/ez-form/ez-form.js +1 -1
  10. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +22 -0
  11. package/dist/collection/components/ez-form-view/ez-form-view.js +22 -1
  12. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -1
  13. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +2 -1
  14. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +4 -0
  15. package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +1 -1
  16. package/dist/collection/components/ez-search/ez-search.js +24 -13
  17. package/dist/custom-elements/index.js +40 -21
  18. package/dist/esm/ez-custom-form-input_2.entry.js +2 -0
  19. package/dist/esm/ez-form-view.entry.js +2 -1
  20. package/dist/esm/ez-form.entry.js +1 -1
  21. package/dist/esm/ez-grid.entry.js +9 -4
  22. package/dist/esm/ez-search.entry.js +24 -13
  23. package/dist/esm/ezui.js +1 -1
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/ezui/ezui.esm.js +1 -1
  26. package/dist/ezui/{p-1ee2479b.entry.js → p-5056284a.entry.js} +1 -1
  27. package/dist/ezui/p-5264876b.entry.js +1 -0
  28. package/dist/ezui/{p-3b56d2ef.entry.js → p-9ab22a07.entry.js} +1 -1
  29. package/dist/ezui/p-b283351d.entry.js +1 -0
  30. package/dist/ezui/{p-6ebee89c.entry.js → p-e252a728.entry.js} +1 -1
  31. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +5 -0
  32. package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -1
  33. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +3 -0
  34. package/dist/types/components/ez-search/ez-search.d.ts +2 -0
  35. package/dist/types/components.d.ts +17 -1
  36. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
  37. package/package.json +1 -1
  38. package/dist/ezui/p-1a35324b.entry.js +0 -1
  39. package/dist/ezui/p-1c462106.entry.js +0 -1
@@ -41,25 +41,31 @@ export class EzSearch {
41
41
  var _a;
42
42
  if (this._textInput) {
43
43
  this._textInput.errorMessage = this.errorMessage;
44
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
44
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
45
45
  this.setInputValue();
46
46
  }
47
47
  }
48
48
  }
49
+ validateNewValue(newValue, oldValue) {
50
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
51
+ return false;
52
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
53
+ return false;
54
+ 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))
55
+ return false;
56
+ return true;
57
+ }
49
58
  async observeValue(newValue, oldValue) {
50
- if (this._textInput && newValue != oldValue) {
59
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
51
60
  try {
52
61
  if (typeof newValue === "string") {
53
62
  await this.handleValueAsString(newValue);
54
63
  return;
55
64
  }
56
65
  const newValueSelected = this.getSelectedOption(newValue);
57
- const oldValueSelected = this.getSelectedOption(oldValue);
58
- const currentValue = this.getSelectedOption(this.value);
66
+ const currentValue = this.getSelectedOption(this._currentValue);
59
67
  if (this.isDifferentValues(currentValue, newValueSelected)) {
60
- this.value = newValueSelected;
61
- }
62
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
68
+ this._currentValue = newValueSelected;
63
69
  this.setInputValue();
64
70
  const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
65
71
  if (!this._lookupMode) {
@@ -143,7 +149,9 @@ export class EzSearch {
143
149
  return;
144
150
  }
145
151
  await this.loadDescriptionValue(value);
152
+ this.setInputValue();
146
153
  this.ezChange.emit(this.value);
154
+ this._currentValue = this.value;
147
155
  }
148
156
  updateListPosition() {
149
157
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -200,7 +208,7 @@ export class EzSearch {
200
208
  return text;
201
209
  }
202
210
  getText() {
203
- const currentValue = this.getSelectedOption(this.value);
211
+ const currentValue = this.getSelectedOption(this._currentValue);
204
212
  const text = this.getFormattedText(currentValue);
205
213
  if (text == undefined) {
206
214
  return;
@@ -375,6 +383,7 @@ export class EzSearch {
375
383
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
376
384
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
377
385
  this.value = adjustedOpt;
386
+ this._currentValue = adjustedOpt;
378
387
  }
379
388
  else {
380
389
  this.setInputValue();
@@ -395,7 +404,7 @@ export class EzSearch {
395
404
  }
396
405
  }
397
406
  cancelPreselection() {
398
- if (!this._textInput.value && this.value) {
407
+ if (!this._textInput.value && this._currentValue) {
399
408
  this.selectOption(undefined);
400
409
  }
401
410
  else {
@@ -416,6 +425,7 @@ export class EzSearch {
416
425
  }
417
426
  clearSearch() {
418
427
  this.value = null;
428
+ this._currentValue = null;
419
429
  }
420
430
  controlListWithOnlyOne() {
421
431
  var _a, _b;
@@ -445,11 +455,11 @@ export class EzSearch {
445
455
  if (StringUtils.isEmpty(this.value)) {
446
456
  return;
447
457
  }
448
- let value = this.value;
449
- if (typeof value === "object") {
458
+ if (!this.validateNewValue(this.value, this._currentValue)) {
450
459
  return;
451
460
  }
452
- if (StringUtils.isEmpty(value)) {
461
+ let value = this.value;
462
+ if (typeof value === "object") {
453
463
  return;
454
464
  }
455
465
  this.loadDescriptionValue(value);
@@ -487,7 +497,8 @@ export class EzSearch {
487
497
  return;
488
498
  }
489
499
  this._lookupMode = true;
490
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
500
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
501
+ this.value = this._currentValue;
491
502
  }
492
503
  loadOptionValue(argument) {
493
504
  var _a;
@@ -3394,6 +3394,7 @@ const EzCustomFormInput$1 = class extends HTMLElement$1 {
3394
3394
  this.value = undefined;
3395
3395
  this.detailContext = undefined;
3396
3396
  this.builderFallback = undefined;
3397
+ this.selectedRecord = undefined;
3397
3398
  }
3398
3399
  /**
3399
3400
  * Aplica foco no campo.
@@ -3428,6 +3429,7 @@ const EzCustomFormInput$1 = class extends HTMLElement$1 {
3428
3429
  currentEditor: this.builderFallback(this.formViewField),
3429
3430
  setValue: (value) => this.setValue(value),
3430
3431
  getValue: this.getValue,
3432
+ record: this.selectedRecord,
3431
3433
  editorMetadata: {
3432
3434
  label: this.formViewField.label,
3433
3435
  hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
@@ -5243,7 +5245,7 @@ const EzForm$1 = class extends HTMLElement$1 {
5243
5245
  }
5244
5246
  this.ezFormSetFields.emit(fields);
5245
5247
  const idFormSheet = `${StringUtils$1.replaceAccentuatedChars(StringUtils$1.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
5246
- return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { ref: (element) => (this._formView = element), class: "ez-row ez-padding-vertical--small", fields: fields })));
5248
+ return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { ref: (element) => (this._formView = element), class: "ez-row ez-padding-vertical--small", fields: fields, selectedRecord: this.dataUnit.getSelectedRecord() })));
5247
5249
  }
5248
5250
  processMetadata() {
5249
5251
  if (this.bindFields() && this.dataUnit && this._store) {
@@ -5485,6 +5487,7 @@ const EzFormView$1 = class extends HTMLElement$1 {
5485
5487
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
5486
5488
  this._customEditors = new Map();
5487
5489
  this.fields = undefined;
5490
+ this.selectedRecord = undefined;
5488
5491
  }
5489
5492
  async showUp() {
5490
5493
  this._element.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -5548,7 +5551,7 @@ const EzFormView$1 = class extends HTMLElement$1 {
5548
5551
  if (this._customEditors.has(item.name)) {
5549
5552
  const value = (_a = this._formElements.map(el => ({ name: el.dataset.fieldName, value: el['value'] })).find(field => field.name === item.name)) === null || _a === void 0 ? void 0 : _a.value;
5550
5553
  const customEditor = this._customEditors.get(item.name).customEditor;
5551
- return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value }));
5554
+ return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value, selectedRecord: this.selectedRecord }));
5552
5555
  }
5553
5556
  return h("div", { class: classItem }, fieldBuilder(item));
5554
5557
  }
@@ -124436,7 +124439,7 @@ class DataSource {
124436
124439
  return false;
124437
124440
  }
124438
124441
  if (action.type === Action.DATA_CHANGED) {
124439
- return ((_a = Object.keys(action === null || action === void 0 ? void 0 : action.payload)) === null || _a === void 0 ? void 0 : _a.filter(changeName => changeName.startsWith("transient.") || changeName === "records").length) > 0;
124442
+ return (_a = Object.keys(action === null || action === void 0 ? void 0 : action.payload)) === null || _a === void 0 ? void 0 : _a.some(key => { var _a; return (key.startsWith("transient.") && action.payload[key]) || ((_a = action.payload.records) === null || _a === void 0 ? void 0 : _a.length) > 0; });
124440
124443
  }
124441
124444
  if (action.type === Action.EDITION_CANCELED) {
124442
124445
  return ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.silent) === true;
@@ -124986,6 +124989,7 @@ uiBuilders.set(UserInterface.LONGTEXT, buildTextAreaInput);
124986
124989
  uiBuilders.set(UserInterface.SEARCH, buildSearch);
124987
124990
  class EzCellEditor {
124988
124991
  init(params) {
124992
+ this._rowData = params.data;
124989
124993
  const fieldName = params.column.getColId();
124990
124994
  const dataUnit = params.context.dataUnit;
124991
124995
  this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
@@ -125017,6 +125021,9 @@ class EzCellEditor {
125017
125021
  getFieldMetadata() {
125018
125022
  return this._fieldMetadata;
125019
125023
  }
125024
+ getRecord() {
125025
+ return this._rowData;
125026
+ }
125020
125027
  }
125021
125028
 
125022
125029
  class EzGridCustomCellEditor extends EzCellEditor {
@@ -125037,6 +125044,7 @@ class EzGridCustomCellEditor extends EzCellEditor {
125037
125044
  detailContext: params.customEditorsInfo.detailContext,
125038
125045
  setValue: (value) => this.setValue(value),
125039
125046
  getValue: () => this.getValue(),
125047
+ record: super.getRecord(),
125040
125048
  editorMetadata: {
125041
125049
  hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
125042
125050
  label: fieldMetadata.label,
@@ -125044,7 +125052,7 @@ class EzGridCustomCellEditor extends EzCellEditor {
125044
125052
  props: fieldMetadata.props,
125045
125053
  optionLoader: fieldMetadata.optionLoader,
125046
125054
  options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
125047
- }
125055
+ },
125048
125056
  };
125049
125057
  }
125050
125058
  getDefaultGui() {
@@ -126332,8 +126340,8 @@ const SelectionCounter = (props) => {
126332
126340
  h("label", Object.assign({ innerHTML: getText(selectionCount, allRecordSelected), class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium ez-margin-top--medium" }, getElementID("ezGridSelectionCounter_label"))),
126333
126341
  h("div", { class: "ez-flex ez-margin-right--medium" },
126334
126342
  shouldRenderSelectionButton() &&
126335
- h("ez-button", Object.assign({ title: buildSelectAllTitle(total), enabled: enableSelectAll(total), class: "ez-margin-right--medium", label: buildSelectAllLabel(allRecordSelected, count, total), mode: "link", onClick: allRecordSelected ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allRecordSelected ? "Page" : "All"}`))),
126336
- h("ez-button", Object.assign({ class: "grid__btn-clear", label: "Limpar Sele\u00E7\u00E3o", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))),
126343
+ h("ez-button", Object.assign({ key: "selectAllRecordsEzButton", title: buildSelectAllTitle(total), enabled: enableSelectAll(total), class: "ez-margin-right--medium", label: buildSelectAllLabel(allRecordSelected, count, total), mode: "link", onClick: allRecordSelected ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allRecordSelected ? "Page" : "All"}`))),
126344
+ h("ez-button", Object.assign({ key: "clearAllSelectionEzButton", class: "grid__btn-clear", label: "Limpar Sele\u00E7\u00E3o", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))),
126337
126345
  h("button", Object.assign({ class: "grid__btn-close", title: "Fechar", onClick: onClose }, getElementID("ezGridSelectionCounter_close")),
126338
126346
  h("ez-icon", { iconName: "close" })))));
126339
126347
  };
@@ -128708,25 +128716,31 @@ const EzSearch$1 = class extends HTMLElement$1 {
128708
128716
  var _a;
128709
128717
  if (this._textInput) {
128710
128718
  this._textInput.errorMessage = this.errorMessage;
128711
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
128719
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
128712
128720
  this.setInputValue();
128713
128721
  }
128714
128722
  }
128715
128723
  }
128724
+ validateNewValue(newValue, oldValue) {
128725
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
128726
+ return false;
128727
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
128728
+ return false;
128729
+ 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))
128730
+ return false;
128731
+ return true;
128732
+ }
128716
128733
  async observeValue(newValue, oldValue) {
128717
- if (this._textInput && newValue != oldValue) {
128734
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
128718
128735
  try {
128719
128736
  if (typeof newValue === "string") {
128720
128737
  await this.handleValueAsString(newValue);
128721
128738
  return;
128722
128739
  }
128723
128740
  const newValueSelected = this.getSelectedOption(newValue);
128724
- const oldValueSelected = this.getSelectedOption(oldValue);
128725
- const currentValue = this.getSelectedOption(this.value);
128741
+ const currentValue = this.getSelectedOption(this._currentValue);
128726
128742
  if (this.isDifferentValues(currentValue, newValueSelected)) {
128727
- this.value = newValueSelected;
128728
- }
128729
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
128743
+ this._currentValue = newValueSelected;
128730
128744
  this.setInputValue();
128731
128745
  const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
128732
128746
  if (!this._lookupMode) {
@@ -128810,7 +128824,9 @@ const EzSearch$1 = class extends HTMLElement$1 {
128810
128824
  return;
128811
128825
  }
128812
128826
  await this.loadDescriptionValue(value);
128827
+ this.setInputValue();
128813
128828
  this.ezChange.emit(this.value);
128829
+ this._currentValue = this.value;
128814
128830
  }
128815
128831
  updateListPosition() {
128816
128832
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -128867,7 +128883,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
128867
128883
  return text;
128868
128884
  }
128869
128885
  getText() {
128870
- const currentValue = this.getSelectedOption(this.value);
128886
+ const currentValue = this.getSelectedOption(this._currentValue);
128871
128887
  const text = this.getFormattedText(currentValue);
128872
128888
  if (text == undefined) {
128873
128889
  return;
@@ -129042,6 +129058,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129042
129058
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
129043
129059
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
129044
129060
  this.value = adjustedOpt;
129061
+ this._currentValue = adjustedOpt;
129045
129062
  }
129046
129063
  else {
129047
129064
  this.setInputValue();
@@ -129062,7 +129079,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129062
129079
  }
129063
129080
  }
129064
129081
  cancelPreselection() {
129065
- if (!this._textInput.value && this.value) {
129082
+ if (!this._textInput.value && this._currentValue) {
129066
129083
  this.selectOption(undefined);
129067
129084
  }
129068
129085
  else {
@@ -129083,6 +129100,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
129083
129100
  }
129084
129101
  clearSearch() {
129085
129102
  this.value = null;
129103
+ this._currentValue = null;
129086
129104
  }
129087
129105
  controlListWithOnlyOne() {
129088
129106
  var _a, _b;
@@ -129112,11 +129130,11 @@ const EzSearch$1 = class extends HTMLElement$1 {
129112
129130
  if (StringUtils$1.isEmpty(this.value)) {
129113
129131
  return;
129114
129132
  }
129115
- let value = this.value;
129116
- if (typeof value === "object") {
129133
+ if (!this.validateNewValue(this.value, this._currentValue)) {
129117
129134
  return;
129118
129135
  }
129119
- if (StringUtils$1.isEmpty(value)) {
129136
+ let value = this.value;
129137
+ if (typeof value === "object") {
129120
129138
  return;
129121
129139
  }
129122
129140
  this.loadDescriptionValue(value);
@@ -129154,7 +129172,8 @@ const EzSearch$1 = class extends HTMLElement$1 {
129154
129172
  return;
129155
129173
  }
129156
129174
  this._lookupMode = true;
129157
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
129175
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
129176
+ this.value = this._currentValue;
129158
129177
  }
129159
129178
  loadOptionValue(argument) {
129160
129179
  var _a;
@@ -132689,7 +132708,7 @@ const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label
132689
132708
  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"]}]);
132690
132709
  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]}]);
132691
132710
  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"]]]);
132692
- const EzCustomFormInput = /*@__PURE__*/proxyCustomElement(EzCustomFormInput$1, [2,"ez-custom-form-input",{"customEditor":[16],"formViewField":[16],"value":[1032],"detailContext":[1,"detail-context"],"builderFallback":[16],"gui":[32]}]);
132711
+ 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]}]);
132693
132712
  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"]}]);
132694
132713
  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"]}]);
132695
132714
  const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"confirm":[1028],"dialogType":[1025,"dialog-type"],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"beforeClose":[1040]},[[8,"keydown","handleKeyDown"]]]);
@@ -132697,7 +132716,7 @@ const EzDropdown = /*@__PURE__*/proxyCustomElement(EzDropdown$1, [1,"ez-dropdown
132697
132716
  const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-item",{"canRemove":[4,"can-remove"],"fileName":[1,"file-name"],"iconName":[1,"icon-name"],"fileSize":[2,"file-size"],"progress":[2]}]);
132698
132717
  const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"],"canShowError":[516,"can-show-error"]}]);
132699
132718
  const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"onlyStaticFields":[4,"only-static-fields"],"_fieldsProps":[32]}]);
132700
- const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16],"_customEditors":[32]}]);
132719
+ const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16],"selectedRecord":[16],"_customEditors":[32]}]);
132701
132720
  const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"autoFocus":[4,"auto-focus"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_hasLeftButtons":[32],"_customFormatters":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
132702
132721
  const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
132703
132722
  const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
@@ -14,6 +14,7 @@ const EzCustomFormInput = class {
14
14
  this.value = undefined;
15
15
  this.detailContext = undefined;
16
16
  this.builderFallback = undefined;
17
+ this.selectedRecord = undefined;
17
18
  }
18
19
  /**
19
20
  * Aplica foco no campo.
@@ -48,6 +49,7 @@ const EzCustomFormInput = class {
48
49
  currentEditor: this.builderFallback(this.formViewField),
49
50
  setValue: (value) => this.setValue(value),
50
51
  getValue: this.getValue,
52
+ record: this.selectedRecord,
51
53
  editorMetadata: {
52
54
  label: this.formViewField.label,
53
55
  hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
@@ -148,6 +148,7 @@ const EzFormView = class {
148
148
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
149
149
  this._customEditors = new Map();
150
150
  this.fields = undefined;
151
+ this.selectedRecord = undefined;
151
152
  }
152
153
  async showUp() {
153
154
  this._element.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -211,7 +212,7 @@ const EzFormView = class {
211
212
  if (this._customEditors.has(item.name)) {
212
213
  const value = (_a = this._formElements.map(el => ({ name: el.dataset.fieldName, value: el['value'] })).find(field => field.name === item.name)) === null || _a === void 0 ? void 0 : _a.value;
213
214
  const customEditor = this._customEditors.get(item.name).customEditor;
214
- return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value }));
215
+ return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value, selectedRecord: this.selectedRecord }));
215
216
  }
216
217
  return h("div", { class: classItem }, fieldBuilder(item));
217
218
  }
@@ -940,7 +940,7 @@ const EzForm = class {
940
940
  }
941
941
  this.ezFormSetFields.emit(fields);
942
942
  const idFormSheet = `${StringUtils.replaceAccentuatedChars(StringUtils.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
943
- return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { ref: (element) => (this._formView = element), class: "ez-row ez-padding-vertical--small", fields: fields })));
943
+ return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { ref: (element) => (this._formView = element), class: "ez-row ez-padding-vertical--small", fields: fields, selectedRecord: this.dataUnit.getSelectedRecord() })));
944
944
  }
945
945
  processMetadata() {
946
946
  if (this.bindFields() && this.dataUnit && this._store) {
@@ -118869,7 +118869,7 @@ class DataSource {
118869
118869
  return false;
118870
118870
  }
118871
118871
  if (action.type === Action.DATA_CHANGED) {
118872
- return ((_a = Object.keys(action === null || action === void 0 ? void 0 : action.payload)) === null || _a === void 0 ? void 0 : _a.filter(changeName => changeName.startsWith("transient.") || changeName === "records").length) > 0;
118872
+ return (_a = Object.keys(action === null || action === void 0 ? void 0 : action.payload)) === null || _a === void 0 ? void 0 : _a.some(key => { var _a; return (key.startsWith("transient.") && action.payload[key]) || ((_a = action.payload.records) === null || _a === void 0 ? void 0 : _a.length) > 0; });
118873
118873
  }
118874
118874
  if (action.type === Action.EDITION_CANCELED) {
118875
118875
  return ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.silent) === true;
@@ -119419,6 +119419,7 @@ uiBuilders.set(UserInterface.LONGTEXT, buildTextAreaInput);
119419
119419
  uiBuilders.set(UserInterface.SEARCH, buildSearch);
119420
119420
  class EzCellEditor {
119421
119421
  init(params) {
119422
+ this._rowData = params.data;
119422
119423
  const fieldName = params.column.getColId();
119423
119424
  const dataUnit = params.context.dataUnit;
119424
119425
  this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
@@ -119450,6 +119451,9 @@ class EzCellEditor {
119450
119451
  getFieldMetadata() {
119451
119452
  return this._fieldMetadata;
119452
119453
  }
119454
+ getRecord() {
119455
+ return this._rowData;
119456
+ }
119453
119457
  }
119454
119458
 
119455
119459
  class EzGridCustomCellEditor extends EzCellEditor {
@@ -119470,6 +119474,7 @@ class EzGridCustomCellEditor extends EzCellEditor {
119470
119474
  detailContext: params.customEditorsInfo.detailContext,
119471
119475
  setValue: (value) => this.setValue(value),
119472
119476
  getValue: () => this.getValue(),
119477
+ record: super.getRecord(),
119473
119478
  editorMetadata: {
119474
119479
  hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
119475
119480
  label: fieldMetadata.label,
@@ -119477,7 +119482,7 @@ class EzGridCustomCellEditor extends EzCellEditor {
119477
119482
  props: fieldMetadata.props,
119478
119483
  optionLoader: fieldMetadata.optionLoader,
119479
119484
  options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
119480
- }
119485
+ },
119481
119486
  };
119482
119487
  }
119483
119488
  getDefaultGui() {
@@ -120765,8 +120770,8 @@ const SelectionCounter = (props) => {
120765
120770
  h("label", Object.assign({ innerHTML: getText(selectionCount, allRecordSelected), class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium ez-margin-top--medium" }, getElementID("ezGridSelectionCounter_label"))),
120766
120771
  h("div", { class: "ez-flex ez-margin-right--medium" },
120767
120772
  shouldRenderSelectionButton() &&
120768
- h("ez-button", Object.assign({ title: buildSelectAllTitle(total), enabled: enableSelectAll(total), class: "ez-margin-right--medium", label: buildSelectAllLabel(allRecordSelected, count, total), mode: "link", onClick: allRecordSelected ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allRecordSelected ? "Page" : "All"}`))),
120769
- h("ez-button", Object.assign({ class: "grid__btn-clear", label: "Limpar Sele\u00E7\u00E3o", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))),
120773
+ h("ez-button", Object.assign({ key: "selectAllRecordsEzButton", title: buildSelectAllTitle(total), enabled: enableSelectAll(total), class: "ez-margin-right--medium", label: buildSelectAllLabel(allRecordSelected, count, total), mode: "link", onClick: allRecordSelected ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allRecordSelected ? "Page" : "All"}`))),
120774
+ h("ez-button", Object.assign({ key: "clearAllSelectionEzButton", class: "grid__btn-clear", label: "Limpar Sele\u00E7\u00E3o", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))),
120770
120775
  h("button", Object.assign({ class: "grid__btn-close", title: "Fechar", onClick: onClose }, getElementID("ezGridSelectionCounter_close")),
120771
120776
  h("ez-icon", { iconName: "close" })))));
120772
120777
  };
@@ -49,25 +49,31 @@ const EzSearch = class {
49
49
  var _a;
50
50
  if (this._textInput) {
51
51
  this._textInput.errorMessage = this.errorMessage;
52
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
52
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim()) && this.errorMessage) {
53
53
  this.setInputValue();
54
54
  }
55
55
  }
56
56
  }
57
+ validateNewValue(newValue, oldValue) {
58
+ if (typeof newValue == 'string' && typeof oldValue == 'object' && newValue === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.value))
59
+ return false;
60
+ if (typeof newValue == 'object' && typeof oldValue == 'string' && (newValue === null || newValue === void 0 ? void 0 : newValue.value) === oldValue)
61
+ return false;
62
+ 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))
63
+ return false;
64
+ return true;
65
+ }
57
66
  async observeValue(newValue, oldValue) {
58
- if (this._textInput && newValue != oldValue) {
67
+ if (this._textInput && newValue != oldValue && this.validateNewValue(newValue, oldValue)) {
59
68
  try {
60
69
  if (typeof newValue === "string") {
61
70
  await this.handleValueAsString(newValue);
62
71
  return;
63
72
  }
64
73
  const newValueSelected = this.getSelectedOption(newValue);
65
- const oldValueSelected = this.getSelectedOption(oldValue);
66
- const currentValue = this.getSelectedOption(this.value);
74
+ const currentValue = this.getSelectedOption(this._currentValue);
67
75
  if (this.isDifferentValues(currentValue, newValueSelected)) {
68
- this.value = newValueSelected;
69
- }
70
- if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
76
+ this._currentValue = newValueSelected;
71
77
  this.setInputValue();
72
78
  const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
73
79
  if (!this._lookupMode) {
@@ -151,7 +157,9 @@ const EzSearch = class {
151
157
  return;
152
158
  }
153
159
  await this.loadDescriptionValue(value);
160
+ this.setInputValue();
154
161
  this.ezChange.emit(this.value);
162
+ this._currentValue = this.value;
155
163
  }
156
164
  updateListPosition() {
157
165
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
@@ -208,7 +216,7 @@ const EzSearch = class {
208
216
  return text;
209
217
  }
210
218
  getText() {
211
- const currentValue = this.getSelectedOption(this.value);
219
+ const currentValue = this.getSelectedOption(this._currentValue);
212
220
  const text = this.getFormattedText(currentValue);
213
221
  if (text == undefined) {
214
222
  return;
@@ -383,6 +391,7 @@ const EzSearch = class {
383
391
  || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
384
392
  const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
385
393
  this.value = adjustedOpt;
394
+ this._currentValue = adjustedOpt;
386
395
  }
387
396
  else {
388
397
  this.setInputValue();
@@ -403,7 +412,7 @@ const EzSearch = class {
403
412
  }
404
413
  }
405
414
  cancelPreselection() {
406
- if (!this._textInput.value && this.value) {
415
+ if (!this._textInput.value && this._currentValue) {
407
416
  this.selectOption(undefined);
408
417
  }
409
418
  else {
@@ -424,6 +433,7 @@ const EzSearch = class {
424
433
  }
425
434
  clearSearch() {
426
435
  this.value = null;
436
+ this._currentValue = null;
427
437
  }
428
438
  controlListWithOnlyOne() {
429
439
  var _a, _b;
@@ -453,11 +463,11 @@ const EzSearch = class {
453
463
  if (StringUtils.isEmpty(this.value)) {
454
464
  return;
455
465
  }
456
- let value = this.value;
457
- if (typeof value === "object") {
466
+ if (!this.validateNewValue(this.value, this._currentValue)) {
458
467
  return;
459
468
  }
460
- if (StringUtils.isEmpty(value)) {
469
+ let value = this.value;
470
+ if (typeof value === "object") {
461
471
  return;
462
472
  }
463
473
  this.loadDescriptionValue(value);
@@ -495,7 +505,8 @@ const EzSearch = class {
495
505
  return;
496
506
  }
497
507
  this._lookupMode = true;
498
- this.value = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
508
+ this._currentValue = value ? Object.assign(Object.assign({}, value), { value: this.replaceHighlight(value.value), label: this.replaceHighlight(value.label) }) : value;
509
+ this.value = this._currentValue;
499
510
  }
500
511
  loadOptionValue(argument) {
501
512
  var _a;