@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77074.0 → 0.0.0-bugfix-dev-kb-77634.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 (177) hide show
  1. package/dist/cjs/DataBinder-3b083480.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-card-item_3.cjs.entry.js +12 -19
  5. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
  7. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +3 -2
  8. package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
  9. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
  10. package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
  11. package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
  12. package/dist/cjs/ez-form.cjs.entry.js +5 -325
  13. package/dist/cjs/ez-grid.cjs.entry.js +14614 -70500
  14. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-list.cjs.entry.js +151 -100
  16. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
  18. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-popup.cjs.entry.js +2 -2
  20. package/dist/cjs/ez-search.cjs.entry.js +71 -22
  21. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
  23. package/dist/cjs/ez-text-input.cjs.entry.js +49 -7
  24. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  25. package/dist/cjs/ezui.cjs.js +1 -1
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/collection/collection-manifest.json +1 -1
  28. package/dist/collection/components/ez-button/ez-button.css +2 -2
  29. package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
  30. package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
  31. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  32. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  33. package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
  34. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  35. package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
  36. package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
  37. package/dist/collection/components/ez-form/ez-form.js +1 -0
  38. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
  39. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  40. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +96 -27
  41. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +8 -0
  42. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +164 -46
  43. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  44. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  45. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  46. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  47. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  48. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  49. package/dist/collection/components/ez-grid/ez-grid.js +90 -3
  50. package/dist/collection/components/ez-icon/ez-icon.css +153 -149
  51. package/dist/collection/components/ez-list/ez-list.css +5 -5
  52. package/dist/collection/components/ez-list/ez-list.js +152 -170
  53. package/dist/collection/components/ez-modal/ez-modal.css +4 -0
  54. package/dist/collection/components/ez-modal/ez-modal.js +2 -2
  55. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  56. package/dist/collection/components/ez-popover/ez-popover.css +3 -10
  57. package/dist/collection/components/ez-popup/ez-popup.css +1 -1
  58. package/dist/collection/components/ez-popup/ez-popup.js +1 -1
  59. package/dist/collection/components/ez-search/ez-search.css +1 -1
  60. package/dist/collection/components/ez-search/ez-search.js +98 -24
  61. package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
  62. package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
  63. package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
  64. package/dist/collection/components/ez-text-input/ez-text-input.css +27 -53
  65. package/dist/collection/components/ez-text-input/ez-text-input.js +84 -6
  66. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  67. package/dist/collection/utils/FocusResolver.js +31 -0
  68. package/dist/collection/utils/form/DataBinder.js +18 -3
  69. package/dist/collection/utils/form/FormMetadata.js +1 -1
  70. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  71. package/dist/custom-elements/index.js +15294 -70867
  72. package/dist/esm/DataBinder-02fa9bb9.js +441 -0
  73. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  74. package/dist/esm/ez-button.entry.js +1 -1
  75. package/dist/esm/ez-card-item_3.entry.js +12 -19
  76. package/dist/esm/ez-chart.entry.js +1 -1
  77. package/dist/esm/ez-combo-box.entry.js +47 -11
  78. package/dist/esm/ez-custom-form-input_2.entry.js +3 -2
  79. package/dist/esm/ez-date-input.entry.js +8 -2
  80. package/dist/esm/ez-date-time-input.entry.js +8 -2
  81. package/dist/esm/ez-dialog.entry.js +10 -2
  82. package/dist/esm/ez-form-view.entry.js +2 -2
  83. package/dist/esm/ez-form.entry.js +4 -324
  84. package/dist/esm/ez-grid.entry.js +14584 -70470
  85. package/dist/esm/ez-icon.entry.js +1 -1
  86. package/dist/esm/ez-list.entry.js +152 -101
  87. package/dist/esm/ez-modal.entry.js +1 -1
  88. package/dist/esm/ez-number-input.entry.js +7 -0
  89. package/dist/esm/ez-popover.entry.js +1 -1
  90. package/dist/esm/ez-popup.entry.js +2 -2
  91. package/dist/esm/ez-search.entry.js +71 -22
  92. package/dist/esm/ez-split-button.entry.js +1 -1
  93. package/dist/esm/ez-text-area.entry.js +66 -4
  94. package/dist/esm/ez-text-input.entry.js +49 -7
  95. package/dist/esm/ez-time-input.entry.js +6 -0
  96. package/dist/esm/ezui.js +1 -1
  97. package/dist/esm/loader.js +1 -1
  98. package/dist/ezui/ezui.esm.js +1 -1
  99. package/dist/ezui/p-0a75bb05.entry.js +1 -0
  100. package/dist/ezui/p-0db68715.entry.js +1 -0
  101. package/dist/ezui/p-15d7af92.entry.js +1 -0
  102. package/dist/ezui/p-19098a3f.entry.js +1 -0
  103. package/dist/ezui/p-1f830a2f.entry.js +1 -0
  104. package/dist/ezui/p-2aa8e4b2.entry.js +1 -0
  105. package/dist/ezui/p-2bb2a0c4.entry.js +1 -0
  106. package/dist/ezui/p-3175fe8c.entry.js +1 -0
  107. package/dist/ezui/p-455e737c.js +1 -0
  108. package/dist/ezui/{p-a2e5b8c3.entry.js → p-7409eeaa.entry.js} +1 -1
  109. package/dist/ezui/p-7ed30844.entry.js +1 -0
  110. package/dist/ezui/p-97af4b13.entry.js +1 -0
  111. package/dist/ezui/p-98dc7ce3.entry.js +309 -0
  112. package/dist/ezui/p-a5b91a77.entry.js +1 -0
  113. package/dist/ezui/p-a80b1287.entry.js +1 -0
  114. package/dist/ezui/p-bfad39eb.entry.js +1 -0
  115. package/dist/ezui/p-cd2e78f0.entry.js +1 -0
  116. package/dist/ezui/p-d0ca26fe.entry.js +1 -0
  117. package/dist/ezui/p-d24a7b4c.entry.js +1 -0
  118. package/dist/ezui/p-dc628ed3.js +1 -0
  119. package/dist/ezui/p-dc8b36c3.entry.js +1 -0
  120. package/dist/ezui/p-e5e16038.entry.js +1 -0
  121. package/dist/ezui/p-fec696ab.entry.js +1 -0
  122. package/dist/ezui/p-ffd246f5.entry.js +1 -0
  123. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  124. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  125. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  126. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  127. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
  128. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  129. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -0
  130. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +7 -2
  131. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
  132. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +19 -7
  133. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +3 -1
  134. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  135. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  136. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  137. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  138. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
  139. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  140. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  141. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  142. package/dist/types/components/ez-grid/ez-grid.d.ts +11 -1
  143. package/dist/types/components/ez-list/ez-list.d.ts +3 -26
  144. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  145. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  146. package/dist/types/components/ez-search/ez-search.d.ts +10 -2
  147. package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
  148. package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
  149. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  150. package/dist/types/components.d.ts +109 -44
  151. package/dist/types/utils/FocusResolver.d.ts +5 -0
  152. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  153. package/package.json +11 -4
  154. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  155. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  156. package/dist/ezui/p-10820c20.entry.js +0 -1
  157. package/dist/ezui/p-188f1c4c.entry.js +0 -1
  158. package/dist/ezui/p-49456b34.entry.js +0 -1
  159. package/dist/ezui/p-5a90d7d1.entry.js +0 -1
  160. package/dist/ezui/p-5b205c80.entry.js +0 -1
  161. package/dist/ezui/p-62732269.entry.js +0 -1
  162. package/dist/ezui/p-7bc07c31.entry.js +0 -1
  163. package/dist/ezui/p-86b6aa01.entry.js +0 -1
  164. package/dist/ezui/p-9d9ecb7c.entry.js +0 -1
  165. package/dist/ezui/p-abce5219.entry.js +0 -1
  166. package/dist/ezui/p-b3b94f72.entry.js +0 -1
  167. package/dist/ezui/p-b95632e8.entry.js +0 -1
  168. package/dist/ezui/p-bcd47eda.entry.js +0 -1
  169. package/dist/ezui/p-c3c3d640.entry.js +0 -304
  170. package/dist/ezui/p-cdc472cc.entry.js +0 -1
  171. package/dist/ezui/p-d2c06f38.entry.js +0 -1
  172. package/dist/ezui/p-d8f64bb7.entry.js +0 -1
  173. package/dist/ezui/p-dc4ada32.entry.js +0 -1
  174. package/dist/ezui/p-e85c48d7.entry.js +0 -1
  175. package/dist/ezui/p-f299c608.entry.js +0 -1
  176. package/dist/ezui/p-f42855b9.js +0 -1
  177. package/dist/ezui/p-f80ac647.entry.js +0 -1
@@ -13,6 +13,7 @@ export class EzDateTimeInput {
13
13
  this.showSeconds = false;
14
14
  this.mode = "regular";
15
15
  this.canShowError = true;
16
+ this.autoFocus = false;
16
17
  }
17
18
  observeLabel() {
18
19
  if (this._textInput) {
@@ -49,8 +50,8 @@ export class EzDateTimeInput {
49
50
  /**
50
51
  * Aplica o foco no campo.
51
52
  */
52
- async setFocus() {
53
- this._textInput.setFocus();
53
+ async setFocus(options) {
54
+ this._textInput.setFocus(options);
54
55
  }
55
56
  /**
56
57
  * Remove o foco do campo.
@@ -217,6 +218,11 @@ export class EzDateTimeInput {
217
218
  componentDidLoad() {
218
219
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
219
220
  this.setInputValue();
221
+ if (this.autoFocus) {
222
+ requestAnimationFrame(() => {
223
+ this.setFocus({ selectText: true });
224
+ });
225
+ }
220
226
  }
221
227
  render() {
222
228
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
@@ -360,6 +366,24 @@ export class EzDateTimeInput {
360
366
  "attribute": "can-show-error",
361
367
  "reflect": true,
362
368
  "defaultValue": "true"
369
+ },
370
+ "autoFocus": {
371
+ "type": "boolean",
372
+ "mutable": false,
373
+ "complexType": {
374
+ "original": "boolean",
375
+ "resolved": "boolean",
376
+ "references": {}
377
+ },
378
+ "required": false,
379
+ "optional": false,
380
+ "docs": {
381
+ "tags": [],
382
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
383
+ },
384
+ "attribute": "auto-focus",
385
+ "reflect": false,
386
+ "defaultValue": "false"
363
387
  }
364
388
  };
365
389
  }
@@ -424,11 +448,18 @@ export class EzDateTimeInput {
424
448
  return {
425
449
  "setFocus": {
426
450
  "complexType": {
427
- "signature": "() => Promise<void>",
428
- "parameters": [],
451
+ "signature": "(options?: TFocusOptions) => Promise<void>",
452
+ "parameters": [{
453
+ "tags": [],
454
+ "text": ""
455
+ }],
429
456
  "references": {
430
457
  "Promise": {
431
458
  "location": "global"
459
+ },
460
+ "TFocusOptions": {
461
+ "location": "import",
462
+ "path": "../ez-text-input/ez-text-input"
432
463
  }
433
464
  },
434
465
  "return": "Promise<void>"
@@ -2,7 +2,7 @@
2
2
 
3
3
  /* Container */
4
4
  /*@doc Define o espaçamento do container.*/
5
- --dialog__container-padding: var(--space--large, 24px);
5
+ --dialog__container-padding: var(--space--md, 20px);
6
6
 
7
7
  /* Botões */
8
8
  /*@doc Define a cor de fundo do botão de fechar.*/
@@ -31,7 +31,7 @@
31
31
  /*@doc Define o peso do texto da mensagem.*/
32
32
  --dialog__body--text-weight--medium: var(--text-weight--medium, 400);
33
33
  /*@doc Define o espaçamento inferior do texto da mensagem.*/
34
- --dialog__body--padding-bottom: var(--space--large, 24px);
34
+ --dialog__body--padding-bottom: var(--space--medium, 12px);
35
35
  /*@doc Define o tamanho do texto da mensagem.*/
36
36
  --dialog__body--font-size: var(--text--medium, 14px);
37
37
  /*@doc Define a cor do texto da mensagem.*/
@@ -141,7 +141,7 @@ h2 {
141
141
  color: var(--dialog__body--color);
142
142
  max-height: 30vh;
143
143
  content-visibility: auto;
144
- margin-bottom: 24px;
144
+ margin-bottom: var(--space--medium);
145
145
  overflow-y: auto;
146
146
  }
147
147
 
@@ -1,6 +1,7 @@
1
1
  import { h, forceUpdate, } from '@stencil/core';
2
2
  import { DialogType } from "./DialogType";
3
3
  import { ElementIDUtils, FloatingManager } from "@sankhyalabs/core";
4
+ import FocusResolver from '../../utils/FocusResolver';
4
5
  class Message {
5
6
  constructor(title, message, dialogType, confirm, icon, labelCancel, labelConfirm, btnConfirmDanger, callBack, beforeClose) {
6
7
  this.title = title;
@@ -164,6 +165,7 @@ export class EzDialog {
164
165
  const dialog = this._element.shadowRoot.querySelector('.overlay .dialog');
165
166
  if (dialog instanceof HTMLDivElement) {
166
167
  dialog.style.outline = 'none';
168
+ this._lastActiveElement = document.activeElement;
167
169
  dialog.focus();
168
170
  }
169
171
  }
@@ -176,7 +178,13 @@ export class EzDialog {
176
178
  focusOnPrimaryButton() {
177
179
  const btnConfirm = this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`);
178
180
  const buttonElement = btnConfirm === null || btnConfirm === void 0 ? void 0 : btnConfirm.shadowRoot.querySelector('button');
179
- buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
181
+ requestAnimationFrame(() => {
182
+ buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
183
+ });
184
+ }
185
+ disconnectedCallback() {
186
+ FocusResolver.resolveFocus(this._lastActiveElement);
187
+ this._lastActiveElement = undefined;
180
188
  }
181
189
  render() {
182
190
  if (this.opened && this._currentMessage) {
@@ -1,15 +1,4 @@
1
1
  :host {
2
- /*@doc Define a largura do slot direito.*/
3
- --ez-filter-slot--right--width: 70px;
4
-
5
2
  display: block;
6
3
  width: 100%;
7
4
  }
8
-
9
- .pointerCursor {
10
- cursor: pointer;
11
- }
12
-
13
- ez-text-input {
14
- --ez-text-input__icon--right--width: var(--ez-filter-slot--right--width)
15
- }
@@ -5,16 +5,13 @@ export class EzFilterInput {
5
5
  constructor() {
6
6
  this._searchingText = "";
7
7
  this.handleFocus = () => {
8
- this.ezFocusIn.emit();
9
- if (!this.asyncSearch) {
10
- return;
11
- }
12
8
  if (this._searchingText === "") {
13
9
  this._textInput.value = "";
14
10
  }
15
11
  else {
16
12
  this._textInput.value = this._searchingText;
17
13
  }
14
+ this.ezFocusIn.emit();
18
15
  };
19
16
  this.label = undefined;
20
17
  this.value = undefined;
@@ -24,7 +21,7 @@ export class EzFilterInput {
24
21
  this.mode = "regular";
25
22
  this.asyncSearch = false;
26
23
  this.canShowError = true;
27
- this.enabledIconClick = false;
24
+ this.autoFocus = false;
28
25
  }
29
26
  observeLabel() {
30
27
  if (this._textInput) {
@@ -45,8 +42,8 @@ export class EzFilterInput {
45
42
  /**
46
43
  * Aplica o foco no campo.
47
44
  */
48
- async setFocus() {
49
- this._textInput.setFocus();
45
+ async setFocus(options) {
46
+ this._textInput.setFocus(options);
50
47
  }
51
48
  /**
52
49
  * Remove o foco do campo.
@@ -86,14 +83,6 @@ export class EzFilterInput {
86
83
  this._textInput.value = this.value;
87
84
  }
88
85
  }
89
- /**
90
- * Método usado para emitir o evento de clique no ícone
91
- */
92
- async handleIconClick() {
93
- if (this.enabledIconClick) {
94
- this.ezIconClick.emit(true);
95
- }
96
- }
97
86
  handleChange(evt) {
98
87
  const newValue = evt.detail;
99
88
  this.errorMessage = "";
@@ -107,10 +96,15 @@ export class EzFilterInput {
107
96
  }
108
97
  componentDidLoad() {
109
98
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
99
+ if (this.autoFocus) {
100
+ requestAnimationFrame(() => {
101
+ this.setFocus({ selectText: true });
102
+ });
103
+ }
110
104
  }
111
105
  render() {
112
106
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
113
- return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, h("ez-icon", { slot: "leftIcon", iconName: "search", onClick: () => this.handleIconClick(), class: this.enabledIconClick ? 'pointerCursor' : '' }), h("slot", { name: "right", slot: "rightIcon" })));
107
+ return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, h("ez-icon", { slot: "leftIcon", iconName: "search" })));
114
108
  }
115
109
  static get is() { return "ez-filter-input"; }
116
110
  static get encapsulation() { return "shadow"; }
@@ -266,7 +260,7 @@ export class EzFilterInput {
266
260
  "reflect": true,
267
261
  "defaultValue": "true"
268
262
  },
269
- "enabledIconClick": {
263
+ "autoFocus": {
270
264
  "type": "boolean",
271
265
  "mutable": false,
272
266
  "complexType": {
@@ -278,9 +272,9 @@ export class EzFilterInput {
278
272
  "optional": false,
279
273
  "docs": {
280
274
  "tags": [],
281
- "text": "Se true permite ao usu\u00E1rio interagir com o \u00EDcone de pesquisa"
275
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
282
276
  },
283
- "attribute": "enabled-icon-click",
277
+ "attribute": "auto-focus",
284
278
  "reflect": false,
285
279
  "defaultValue": "false"
286
280
  }
@@ -332,32 +326,24 @@ export class EzFilterInput {
332
326
  "resolved": "void",
333
327
  "references": {}
334
328
  }
335
- }, {
336
- "method": "ezIconClick",
337
- "name": "ezIconClick",
338
- "bubbles": true,
339
- "cancelable": true,
340
- "composed": true,
341
- "docs": {
342
- "tags": [],
343
- "text": "Emitido quando tem intera\u00E7\u00E3o com o \u00CDcone de pesquisa"
344
- },
345
- "complexType": {
346
- "original": "boolean",
347
- "resolved": "boolean",
348
- "references": {}
349
- }
350
329
  }];
351
330
  }
352
331
  static get methods() {
353
332
  return {
354
333
  "setFocus": {
355
334
  "complexType": {
356
- "signature": "() => Promise<void>",
357
- "parameters": [],
335
+ "signature": "(options?: TFocusOptions) => Promise<void>",
336
+ "parameters": [{
337
+ "tags": [],
338
+ "text": ""
339
+ }],
358
340
  "references": {
359
341
  "Promise": {
360
342
  "location": "global"
343
+ },
344
+ "TFocusOptions": {
345
+ "location": "import",
346
+ "path": "../ez-text-input/ez-text-input"
361
347
  }
362
348
  },
363
349
  "return": "Promise<void>"
@@ -433,22 +419,6 @@ export class EzFilterInput {
433
419
  "text": "M\u00E9todo respons\u00E1vel por resetar o valor do campo para o ultimo valor inputado.",
434
420
  "tags": []
435
421
  }
436
- },
437
- "handleIconClick": {
438
- "complexType": {
439
- "signature": "() => Promise<void>",
440
- "parameters": [],
441
- "references": {
442
- "Promise": {
443
- "location": "global"
444
- }
445
- },
446
- "return": "Promise<void>"
447
- },
448
- "docs": {
449
- "text": "M\u00E9todo usado para emitir o evento de clique no \u00EDcone",
450
- "tags": []
451
- }
452
422
  }
453
423
  };
454
424
  }
@@ -94,6 +94,7 @@ export class EzForm {
94
94
  if (this.dataUnit === undefined) {
95
95
  this.dataUnit = new DataUnit("ez-form");
96
96
  }
97
+ this.dataUnit.unsubscribe(this.onDataUnitAction);
97
98
  this.dataUnit.subscribe(this.onDataUnitAction);
98
99
  this._dataBinder = new DataBinder(this.dataUnit);
99
100
  this._store = createStore(formReducer);
@@ -56,7 +56,7 @@ export class EzCustomFormInput {
56
56
  }
57
57
  }
58
58
  getContent() {
59
- var _a, _b;
59
+ var _a, _b, _c, _d, _e;
60
60
  const fieldProps = new Map();
61
61
  for (const prop in this.formViewField.props) {
62
62
  fieldProps.set(prop, this.formViewField.props[prop]);
@@ -94,7 +94,8 @@ export class EzCustomFormInput {
94
94
  if (typeof gui === 'string') {
95
95
  gui = HTMLBuilder.parseElement(gui);
96
96
  }
97
- gui.setAttribute('value', this.value);
97
+ const value = (_e = (_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this.value) !== null && _e !== void 0 ? _e : '';
98
+ gui.setAttribute('value', value);
98
99
  this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
99
100
  }
100
101
  setValue(value) {
@@ -1,4 +1,4 @@
1
1
  import { h } from "@stencil/core";
2
- export const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
3
- return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
2
+ export const buildTextInput = ({ name, label, readOnly, contextName, canShowError, props }) => {
3
+ return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError, mask: props === null || props === void 0 ? void 0 : props.mask, "clean-value-mask": props === null || props === void 0 ? void 0 : props.cleanValueMask })));
4
4
  };
@@ -1,6 +1,6 @@
1
- import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
- import { Grid, } from 'ag-grid-community';
3
- import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
1
+ import { ApplicationContext, DataType, LockManager, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
+ import { Grid } from "@ag-grid-community/core";
3
+ import { LicenseManager } from '@ag-grid-enterprise/core';
4
4
  import DataSource from './DataSource';
5
5
  import { EzGridCustomHeader } from './components/EzGridCustomHeader';
6
6
  import { CellRendererStatus } from './components/cellRendererStatus';
@@ -8,6 +8,12 @@ import SelectionHeader from './components/selectionHeader';
8
8
  import gridTerms from './i18n/pt-BR';
9
9
  import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from '../../../../utils/constants';
10
10
  import GridEditionManager from './GridEditionManager';
11
+ import { ModuleRegistry } from '@ag-grid-community/core';
12
+ import { EnterpriseCoreModule } from '@ag-grid-enterprise/core';
13
+ import { RangeSelectionModule } from '@ag-grid-enterprise/range-selection';
14
+ import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model';
15
+ import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
16
+ import { MenuModule } from '@ag-grid-enterprise/menu';
11
17
  export default class AgGridController {
12
18
  configFilterColumn(filterColumn) {
13
19
  this._filterColumn = filterColumn;
@@ -27,7 +33,7 @@ export default class AgGridController {
27
33
  var _a;
28
34
  (_a = this._filterColumn) === null || _a === void 0 ? void 0 : _a.show(configs);
29
35
  }
30
- constructor(enterprise) {
36
+ constructor(_enterprise) {
31
37
  this.DEFAULT_ROW_HEIGHT = 30;
32
38
  this.DEFAULT_HEADER_ROW_HEIGHT = 32;
33
39
  this.CHECK_BOX_COL_ID = 'checkBoxColumn';
@@ -43,7 +49,13 @@ export default class AgGridController {
43
49
  this._customFormatters = new Map();
44
50
  this._gridShowDom = false;
45
51
  this.peddingExecutionsOnGridShow = [];
46
- this._enterprise = enterprise;
52
+ ModuleRegistry.registerModules([
53
+ EnterpriseCoreModule,
54
+ RangeSelectionModule,
55
+ ServerSideRowModelModule,
56
+ ClipboardModule,
57
+ MenuModule
58
+ ]);
47
59
  }
48
60
  getGridConfig() {
49
61
  return this._gridConfig;
@@ -121,6 +133,7 @@ export default class AgGridController {
121
133
  var _a;
122
134
  this._options = options;
123
135
  this._container = container;
136
+ const lockerId = options.enableLockManger ? LockManager.addLockManagerCtxId(this._container) : null;
124
137
  if (this._grid === undefined) {
125
138
  LicenseManager.setLicenseKey(ApplicationContext.getContextValue('__EZUI__GRID_LICENSE__'));
126
139
  this._columnStateChangeCallback = options.onColumnStateChange;
@@ -128,7 +141,7 @@ export default class AgGridController {
128
141
  this._doubleClickCallBack = options.onDoubleClick;
129
142
  this._multipleSelection = options.allowMultipleSelection;
130
143
  this._dataUnit = options.dataUnit;
131
- this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert, options.enableGridInsert);
144
+ this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert, options.enableGridInsert, lockerId);
132
145
  this._statusResolver = options.statusResolver;
133
146
  if (this._dataUnit) {
134
147
  this._dataUnit.sortingProvider = this;
@@ -175,12 +188,7 @@ export default class AgGridController {
175
188
  this.setOptionsEvents(this._gridOptions);
176
189
  this.setOptionsSupress(this._gridOptions);
177
190
  this._gridOptions = this._editionManager.configureGrid(this._gridOptions);
178
- if (this._enterprise) {
179
- this._grid = new EnterpriseGrid(container, this._gridOptions);
180
- }
181
- else {
182
- this._grid = new Grid(container, this._gridOptions);
183
- }
191
+ this._grid = new Grid(container, this._gridOptions);
184
192
  const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
185
193
  if (selection === null || selection === void 0 ? void 0 : selection.isAllRecords()) {
186
194
  this.selectAll(true);
@@ -340,7 +348,7 @@ export default class AgGridController {
340
348
  defineRowModelType(opt, sourceOptions) {
341
349
  if (this._dataUnit != undefined) {
342
350
  opt.rowModelType = 'serverSide';
343
- opt.serverSideDatasource = new DataSource(this._dataUnit, this, sourceOptions);
351
+ opt.serverSideDatasource = this._dataSource = new DataSource(this._dataUnit, this, sourceOptions);
344
352
  opt.serverSideSortOnServer = true;
345
353
  opt.columnDefs = this._colDefs;
346
354
  }
@@ -491,7 +499,7 @@ export default class AgGridController {
491
499
  r.setData(data);
492
500
  });
493
501
  this._gridOptions.api.refreshCells({ force: true });
494
- const invalidCell = this._editionManager.getInvalidCell();
502
+ const invalidCell = this._editionManager.getNextInvalidCell();
495
503
  if (invalidCell) {
496
504
  const rowNode = this._gridOptions.api.getRowNode(invalidCell.recordId);
497
505
  if (rowNode && invalidCell.field) {
@@ -511,6 +519,7 @@ export default class AgGridController {
511
519
  if (this._grid === undefined) {
512
520
  throw new Error('Erro interno: Grid ainda não inicializado.');
513
521
  }
522
+ this._gridOptions.api.clearRangeSelection();
514
523
  this._gridOptions.api.refreshServerSide({ purge: true });
515
524
  this._options.onRefresh();
516
525
  if (scrollToSelectedRow)
@@ -533,12 +542,15 @@ export default class AgGridController {
533
542
  }
534
543
  setFocus() {
535
544
  var _a, _b;
536
- if ((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) {
537
- this.setFocusFirstRow();
538
- }
539
- else {
545
+ if (!((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length)) {
540
546
  this.focusOnGridContainer();
547
+ return;
541
548
  }
549
+ if (!this._dataUnit.getSelectedRecord()) {
550
+ this.setFocusFirstRow();
551
+ return;
552
+ }
553
+ this.syncSelectWithDataUnit();
542
554
  }
543
555
  setAutoFocus(autoFocus) {
544
556
  var _a;
@@ -582,6 +594,23 @@ export default class AgGridController {
582
594
  this.startEditionOnRowByIndex(newRowIndex);
583
595
  }
584
596
  }
597
+ syncSelectWithDataUnit() {
598
+ const rowNode = this._gridOptions.api.getRowNode(this._dataUnit.getSelectedRecord().__record__id__);
599
+ if ((rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) < 0)
600
+ return;
601
+ const rowRange = this._gridOptions.api.getCellRanges().find(row => row.startRow.rowIndex === rowNode.rowIndex);
602
+ if ((rowRange === null || rowRange === void 0 ? void 0 : rowRange.columns.length) > 0) {
603
+ if (this._dataUnit.hasNewRecord()) {
604
+ this.startEdition(rowNode.rowIndex, rowRange.columns[0]);
605
+ return;
606
+ }
607
+ this.focusByCollAndRow(rowRange.columns[0], rowNode.rowIndex);
608
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowNode.rowIndex, rowEndIndex: rowNode.rowIndex, columns: rowRange.columns });
609
+ return;
610
+ }
611
+ this._gridOptions.api.clearRangeSelection();
612
+ this.setFocusOnRow(rowNode.rowIndex);
613
+ }
585
614
  startEdition(rowIndex, firstCol) {
586
615
  this._gridOptions.api.clearRangeSelection();
587
616
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
@@ -612,6 +641,7 @@ export default class AgGridController {
612
641
  let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
613
642
  let firstColl = displayedColumns.find(column => column.getColDef().headerName !== '');
614
643
  this.focusByCollAndRow(firstColl, rowIndex);
644
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstColl] });
615
645
  }
616
646
  focusByCollAndRow(firstCell, rowIndex) {
617
647
  this._gridOptions.api.ensureColumnVisible(firstCell);
@@ -651,6 +681,14 @@ export default class AgGridController {
651
681
  this._gridOptions.api.setColumnDefs(this._colDefs);
652
682
  }
653
683
  }
684
+ hideSelectionColumn() {
685
+ var _a, _b;
686
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi) === null || _b === void 0 ? void 0 : _b.setColumnVisible(this.CHECK_BOX_COL_ID, false);
687
+ }
688
+ showSelectionColumn() {
689
+ var _a, _b;
690
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi) === null || _b === void 0 ? void 0 : _b.setColumnVisible(this.CHECK_BOX_COL_ID, true);
691
+ }
654
692
  getColumnsDef() {
655
693
  if (this._grid === undefined) {
656
694
  throw new Error('Erro interno: Grid ainda não inicializado.');
@@ -935,18 +973,24 @@ export default class AgGridController {
935
973
  return false;
936
974
  }
937
975
  onSelectionChange(event) {
976
+ var _a, _b;
977
+ const selectedRowId = (_b = (_a = event.api.getSelectedNodes()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id;
978
+ const isNewRecord = this._dataUnit.isNewRecord(selectedRowId);
938
979
  if (!this._selectionChangeCallback)
939
980
  return;
940
981
  clearTimeout(this._selectionChangeDeboucing);
941
- this._selectionChangeDeboucing = window.setTimeout(() => {
942
- this.handleExecuteProceedAutosave();
982
+ this._selectionChangeDeboucing = window.setTimeout(async () => {
983
+ const saveSuccess = (!isNewRecord && selectedRowId) ? await this.handleExecuteProceedAutosave() : true;
984
+ if (!saveSuccess)
985
+ return;
943
986
  this.processBuildSelectionChangeCallback(event);
944
987
  }, 0);
945
988
  }
946
- handleExecuteProceedAutosave() {
989
+ async handleExecuteProceedAutosave() {
947
990
  if (this._gridShowDom) {
948
- this._editionManager.proceedAutoSave();
991
+ return await this._editionManager.proceedAutoSave();
949
992
  }
993
+ return true;
950
994
  }
951
995
  processBuildSelectionChangeCallback(event) {
952
996
  if (this._dataUnit) {
@@ -971,7 +1015,12 @@ export default class AgGridController {
971
1015
  });
972
1016
  }
973
1017
  onRowDoubleClick(evt) {
974
- if (this._doubleClickCallBack) {
1018
+ var _a, _b;
1019
+ if (this._doubleClickCallBack && (!this._options.enableGridInsert || !this._dataUnit.hasNewRecord())) {
1020
+ /**
1021
+ * Evita mudança de view e a grade permanecer no modo de edição.
1022
+ */
1023
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.stopEditing();
975
1024
  this._doubleClickCallBack(evt.data);
976
1025
  }
977
1026
  }
@@ -987,22 +1036,29 @@ export default class AgGridController {
987
1036
  }
988
1037
  }
989
1038
  setCellEditors(customEditors) {
990
- var _a;
1039
+ var _a, _b, _c, _d, _e;
991
1040
  if (!this._editionManager) {
992
1041
  this._customEditors = customEditors;
993
1042
  return;
994
1043
  }
1044
+ const currentEditingCells = (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getEditingCells();
995
1045
  this._editionManager.setCellEditors(customEditors);
996
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
1046
+ if ((currentEditingCells === null || currentEditingCells === void 0 ? void 0 : currentEditingCells.length) > 0) {
1047
+ this._gridOptions.api.startEditingCell({ colKey: (_d = (_c = currentEditingCells[0]) === null || _c === void 0 ? void 0 : _c.column) === null || _d === void 0 ? void 0 : _d.getColId(), rowIndex: (_e = currentEditingCells[0]) === null || _e === void 0 ? void 0 : _e.rowIndex });
1048
+ }
997
1049
  }
998
1050
  setCellRenders(customRenders) {
999
- var _a;
1051
+ var _a, _b, _c, _d, _e, _f;
1000
1052
  if (!this._editionManager) {
1001
1053
  this._customRenders = customRenders;
1002
1054
  return;
1003
1055
  }
1004
1056
  this._editionManager.setCellRenders(customRenders);
1005
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
1057
+ const currentEditingCells = (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getEditingCells();
1058
+ (_c = this._gridOptions) === null || _c === void 0 ? void 0 : _c.api.redrawRows();
1059
+ if ((currentEditingCells === null || currentEditingCells === void 0 ? void 0 : currentEditingCells.length) > 0) {
1060
+ this._gridOptions.api.startEditingCell({ colKey: (_e = (_d = currentEditingCells[0]) === null || _d === void 0 ? void 0 : _d.column) === null || _e === void 0 ? void 0 : _e.getColId(), rowIndex: (_f = currentEditingCells[0]) === null || _f === void 0 ? void 0 : _f.rowIndex });
1061
+ }
1006
1062
  }
1007
1063
  clearInvalidCells(stopEdition) {
1008
1064
  if (!this._editionManager)
@@ -1014,6 +1070,19 @@ export default class AgGridController {
1014
1070
  this._editionManager.processContinuousInsert();
1015
1071
  }
1016
1072
  destroy() {
1073
+ var _a;
1017
1074
  this.observer.disconnect();
1075
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.destroy();
1076
+ }
1077
+ registryListeners() {
1078
+ var _a;
1079
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.registryListeners();
1080
+ }
1081
+ resetPaginationState() {
1082
+ var _a, _b;
1083
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.clearRangeSelection();
1084
+ }
1085
+ stopEdit() {
1086
+ this._gridOptions.api.stopEditing();
1018
1087
  }
1019
1088
  }
@@ -6,12 +6,14 @@ export default class DataSource {
6
6
  this._controller.clearInvalidCells();
7
7
  this.handleRefreshOrReload(action);
8
8
  this._controller.processContinuousInsert();
9
+ this._controller.showSelectionColumn();
9
10
  }
10
11
  handleEditionCanceled(action) {
11
12
  if (this._options.enableGridInsert) {
12
13
  this._controller.processEditionCanceled();
13
14
  }
14
15
  this.handleRefreshOrReload(action);
16
+ this._controller.showSelectionColumn();
15
17
  }
16
18
  handleSavingCanceled(action) {
17
19
  var _a, _b, _c, _d;
@@ -66,6 +68,7 @@ export default class DataSource {
66
68
  }
67
69
  handleRecordsAdded() {
68
70
  if (this._options.enableGridInsert) {
71
+ this._controller.hideSelectionColumn();
69
72
  this._controller.refresh();
70
73
  this.focusOnNewRecord();
71
74
  }
@@ -213,6 +216,11 @@ export default class DataSource {
213
216
  destroy() {
214
217
  this._dataUnit.unsubscribe(this.duObserver);
215
218
  }
219
+ registryListeners() {
220
+ var _a, _b;
221
+ (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.unsubscribe(this.duObserver);
222
+ (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.subscribe(this.duObserver);
223
+ }
216
224
  buildColumnDefs() {
217
225
  const gridConfig = this._controller.getGridConfig() || [];
218
226
  const columnDefs = [];