@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-76362.1 → 0.0.0-bugfix-dev-KB-78242.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 (189) 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 +48 -12
  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 +14622 -70503
  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 +8 -1
  18. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-search.cjs.entry.js +67 -22
  21. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-split-panel.cjs.entry.js +14 -4
  23. package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
  24. package/dist/cjs/ez-text-input.cjs.entry.js +79 -7
  25. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  26. package/dist/cjs/ezui.cjs.js +1 -1
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/collection/collection-manifest.json +1 -1
  29. package/dist/collection/components/ez-button/ez-button.css +2 -2
  30. package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
  31. package/dist/collection/components/ez-combo-box/ez-combo-box.css +12 -0
  32. package/dist/collection/components/ez-combo-box/ez-combo-box.js +76 -15
  33. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  34. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  35. package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
  36. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  37. package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
  38. package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
  39. package/dist/collection/components/ez-form/ez-form.js +1 -0
  40. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
  41. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  42. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +100 -27
  43. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +8 -0
  44. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +164 -46
  45. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  46. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  47. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  48. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  49. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  50. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  51. package/dist/collection/components/ez-grid/ez-grid.css +11 -0
  52. package/dist/collection/components/ez-grid/ez-grid.js +110 -4
  53. package/dist/collection/components/ez-icon/ez-icon.css +153 -149
  54. package/dist/collection/components/ez-list/ez-list.css +5 -5
  55. package/dist/collection/components/ez-list/ez-list.js +152 -170
  56. package/dist/collection/components/ez-modal/ez-modal.css +4 -0
  57. package/dist/collection/components/ez-modal/ez-modal.js +2 -2
  58. package/dist/collection/components/ez-number-input/ez-number-input.css +8 -0
  59. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  60. package/dist/collection/components/ez-popover/ez-popover.css +3 -10
  61. package/dist/collection/components/ez-popup/ez-popup.css +4 -8
  62. package/dist/collection/components/ez-search/ez-search.css +1 -1
  63. package/dist/collection/components/ez-search/ez-search.js +94 -24
  64. package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
  65. package/dist/collection/components/ez-split-panel/ez-split-panel.js +35 -4
  66. package/dist/collection/components/ez-split-panel/interfaces/IPanelSizeInfo.js +1 -0
  67. package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
  68. package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
  69. package/dist/collection/components/ez-text-input/ez-text-input.css +33 -53
  70. package/dist/collection/components/ez-text-input/ez-text-input.js +88 -6
  71. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  72. package/dist/collection/utils/FocusResolver.js +31 -0
  73. package/dist/collection/utils/ResponsiveInputUtils.js +26 -0
  74. package/dist/collection/utils/form/DataBinder.js +18 -3
  75. package/dist/collection/utils/form/FormMetadata.js +1 -1
  76. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  77. package/dist/custom-elements/index.js +15381 -70913
  78. package/dist/esm/DataBinder-02fa9bb9.js +441 -0
  79. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  80. package/dist/esm/ez-button.entry.js +1 -1
  81. package/dist/esm/ez-card-item_3.entry.js +12 -19
  82. package/dist/esm/ez-chart.entry.js +1 -1
  83. package/dist/esm/ez-combo-box.entry.js +49 -13
  84. package/dist/esm/ez-custom-form-input_2.entry.js +3 -2
  85. package/dist/esm/ez-date-input.entry.js +8 -2
  86. package/dist/esm/ez-date-time-input.entry.js +8 -2
  87. package/dist/esm/ez-dialog.entry.js +10 -2
  88. package/dist/esm/ez-form-view.entry.js +2 -2
  89. package/dist/esm/ez-form.entry.js +4 -324
  90. package/dist/esm/ez-grid.entry.js +14591 -70472
  91. package/dist/esm/ez-icon.entry.js +1 -1
  92. package/dist/esm/ez-list.entry.js +152 -101
  93. package/dist/esm/ez-modal.entry.js +1 -1
  94. package/dist/esm/ez-number-input.entry.js +8 -1
  95. package/dist/esm/ez-popover.entry.js +1 -1
  96. package/dist/esm/ez-popup.entry.js +1 -1
  97. package/dist/esm/ez-search.entry.js +67 -22
  98. package/dist/esm/ez-split-button.entry.js +1 -1
  99. package/dist/esm/ez-split-panel.entry.js +15 -5
  100. package/dist/esm/ez-text-area.entry.js +66 -4
  101. package/dist/esm/ez-text-input.entry.js +79 -7
  102. package/dist/esm/ez-time-input.entry.js +6 -0
  103. package/dist/esm/ezui.js +1 -1
  104. package/dist/esm/loader.js +1 -1
  105. package/dist/ezui/ezui.esm.js +1 -1
  106. package/dist/ezui/p-16e21a40.entry.js +1 -0
  107. package/dist/ezui/p-1af7fae4.entry.js +1 -0
  108. package/dist/ezui/{p-3b546374.entry.js → p-2f53435e.entry.js} +1 -1
  109. package/dist/ezui/p-33675dae.entry.js +1 -0
  110. package/dist/ezui/p-397e3026.entry.js +1 -0
  111. package/dist/ezui/p-3af64edd.entry.js +1 -0
  112. package/dist/ezui/p-3c10cd94.entry.js +1 -0
  113. package/dist/ezui/p-3cc9b84a.entry.js +1 -0
  114. package/dist/ezui/p-3d38bfea.entry.js +1 -0
  115. package/dist/ezui/p-455e737c.js +1 -0
  116. package/dist/ezui/p-46a46507.entry.js +1 -0
  117. package/dist/ezui/p-6bda82d1.entry.js +1 -0
  118. package/dist/ezui/p-6d31c43c.entry.js +1 -0
  119. package/dist/ezui/p-7de7baa3.entry.js +1 -0
  120. package/dist/ezui/p-7f5afb1f.entry.js +1 -0
  121. package/dist/ezui/p-8f026744.entry.js +1 -0
  122. package/dist/ezui/p-aa7779d0.entry.js +1 -0
  123. package/dist/ezui/p-bfc30e61.entry.js +1 -0
  124. package/dist/ezui/p-bfc59380.entry.js +1 -0
  125. package/dist/ezui/p-d27b4b3e.entry.js +1 -0
  126. package/dist/ezui/p-d960a031.entry.js +1 -0
  127. package/dist/ezui/p-dc4b35fb.entry.js +309 -0
  128. package/dist/ezui/p-dc628ed3.js +1 -0
  129. package/dist/ezui/p-dfca5946.entry.js +1 -0
  130. package/dist/ezui/p-efbe0b73.entry.js +1 -0
  131. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  132. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  133. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  134. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  135. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
  136. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  137. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -0
  138. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +7 -2
  139. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
  140. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +19 -7
  141. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +3 -1
  142. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  143. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  144. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  145. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  146. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
  147. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  148. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  149. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  150. package/dist/types/components/ez-grid/ez-grid.d.ts +17 -1
  151. package/dist/types/components/ez-list/ez-list.d.ts +3 -26
  152. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  153. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  154. package/dist/types/components/ez-search/ez-search.d.ts +10 -2
  155. package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +4 -0
  156. package/dist/types/components/ez-split-panel/interfaces/IPanelSizeInfo.d.ts +9 -0
  157. package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
  158. package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
  159. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  160. package/dist/types/components.d.ts +122 -44
  161. package/dist/types/utils/FocusResolver.d.ts +5 -0
  162. package/dist/types/utils/ResponsiveInputUtils.d.ts +6 -0
  163. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  164. package/package.json +11 -4
  165. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  166. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  167. package/dist/ezui/p-00687830.entry.js +0 -1
  168. package/dist/ezui/p-044d46d5.entry.js +0 -1
  169. package/dist/ezui/p-11b09aa1.entry.js +0 -1
  170. package/dist/ezui/p-190c190f.entry.js +0 -304
  171. package/dist/ezui/p-2de9f0aa.entry.js +0 -1
  172. package/dist/ezui/p-36180f4d.entry.js +0 -1
  173. package/dist/ezui/p-3f8c33e0.entry.js +0 -1
  174. package/dist/ezui/p-52100a6e.entry.js +0 -1
  175. package/dist/ezui/p-5a40c77a.entry.js +0 -1
  176. package/dist/ezui/p-61059f6b.entry.js +0 -1
  177. package/dist/ezui/p-68267f59.entry.js +0 -1
  178. package/dist/ezui/p-823cc11b.entry.js +0 -1
  179. package/dist/ezui/p-85b500bb.entry.js +0 -1
  180. package/dist/ezui/p-8ac13678.entry.js +0 -1
  181. package/dist/ezui/p-940760bf.entry.js +0 -1
  182. package/dist/ezui/p-9e08ddb0.entry.js +0 -1
  183. package/dist/ezui/p-b2a1398f.entry.js +0 -1
  184. package/dist/ezui/p-ba5f4ee7.entry.js +0 -1
  185. package/dist/ezui/p-d40b93a7.entry.js +0 -1
  186. package/dist/ezui/p-d4aba783.entry.js +0 -1
  187. package/dist/ezui/p-e3ec7422.entry.js +0 -1
  188. package/dist/ezui/p-f291db18.entry.js +0 -1
  189. package/dist/ezui/p-f42855b9.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) {
@@ -501,6 +509,8 @@ export default class AgGridController {
501
509
  }
502
510
  }
503
511
  savingCanceled(fields, recordId) {
512
+ if (!this._gridShowDom)
513
+ return;
504
514
  const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
505
515
  const rowIndex = this._gridOptions.api.getRowNode(recordId).rowIndex;
506
516
  const columnFocus = displayedColumns.find(column => this.isColumnEditable(rowIndex, column) && fields.find(field => field.name === column.getColId()));
@@ -511,6 +521,7 @@ export default class AgGridController {
511
521
  if (this._grid === undefined) {
512
522
  throw new Error('Erro interno: Grid ainda não inicializado.');
513
523
  }
524
+ this._gridOptions.api.clearRangeSelection();
514
525
  this._gridOptions.api.refreshServerSide({ purge: true });
515
526
  this._options.onRefresh();
516
527
  if (scrollToSelectedRow)
@@ -533,12 +544,15 @@ export default class AgGridController {
533
544
  }
534
545
  setFocus() {
535
546
  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 {
547
+ if (!((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length)) {
540
548
  this.focusOnGridContainer();
549
+ return;
541
550
  }
551
+ if (!this._dataUnit.getSelectedRecord()) {
552
+ this.setFocusFirstRow();
553
+ return;
554
+ }
555
+ this.syncSelectWithDataUnit();
542
556
  }
543
557
  setAutoFocus(autoFocus) {
544
558
  var _a;
@@ -582,7 +596,26 @@ export default class AgGridController {
582
596
  this.startEditionOnRowByIndex(newRowIndex);
583
597
  }
584
598
  }
599
+ syncSelectWithDataUnit() {
600
+ const rowNode = this._gridOptions.api.getRowNode(this._dataUnit.getSelectedRecord().__record__id__);
601
+ if ((rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) < 0)
602
+ return;
603
+ const rowRange = this._gridOptions.api.getCellRanges().find(row => row.startRow.rowIndex === rowNode.rowIndex);
604
+ if ((rowRange === null || rowRange === void 0 ? void 0 : rowRange.columns.length) > 0) {
605
+ if (this._dataUnit.hasNewRecord()) {
606
+ this.startEdition(rowNode.rowIndex, rowRange.columns[0]);
607
+ return;
608
+ }
609
+ this.focusByCollAndRow(rowRange.columns[0], rowNode.rowIndex);
610
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowNode.rowIndex, rowEndIndex: rowNode.rowIndex, columns: rowRange.columns });
611
+ return;
612
+ }
613
+ this._gridOptions.api.clearRangeSelection();
614
+ this.setFocusOnRow(rowNode.rowIndex);
615
+ }
585
616
  startEdition(rowIndex, firstCol) {
617
+ if (!this._gridShowDom)
618
+ return;
586
619
  this._gridOptions.api.clearRangeSelection();
587
620
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
588
621
  this._gridOptions.api.setFocusedCell(rowIndex, firstCol);
@@ -612,6 +645,7 @@ export default class AgGridController {
612
645
  let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
613
646
  let firstColl = displayedColumns.find(column => column.getColDef().headerName !== '');
614
647
  this.focusByCollAndRow(firstColl, rowIndex);
648
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstColl] });
615
649
  }
616
650
  focusByCollAndRow(firstCell, rowIndex) {
617
651
  this._gridOptions.api.ensureColumnVisible(firstCell);
@@ -651,6 +685,14 @@ export default class AgGridController {
651
685
  this._gridOptions.api.setColumnDefs(this._colDefs);
652
686
  }
653
687
  }
688
+ hideSelectionColumn() {
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, false);
691
+ }
692
+ showSelectionColumn() {
693
+ var _a, _b;
694
+ (_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);
695
+ }
654
696
  getColumnsDef() {
655
697
  if (this._grid === undefined) {
656
698
  throw new Error('Erro interno: Grid ainda não inicializado.');
@@ -935,18 +977,24 @@ export default class AgGridController {
935
977
  return false;
936
978
  }
937
979
  onSelectionChange(event) {
980
+ var _a, _b;
981
+ const selectedRowId = (_b = (_a = event.api.getSelectedNodes()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id;
982
+ const isNewRecord = this._dataUnit.isNewRecord(selectedRowId);
938
983
  if (!this._selectionChangeCallback)
939
984
  return;
940
985
  clearTimeout(this._selectionChangeDeboucing);
941
- this._selectionChangeDeboucing = window.setTimeout(() => {
942
- this.handleExecuteProceedAutosave();
986
+ this._selectionChangeDeboucing = window.setTimeout(async () => {
987
+ const saveSuccess = (!isNewRecord && selectedRowId) ? await this.handleExecuteProceedAutosave() : true;
988
+ if (!saveSuccess)
989
+ return;
943
990
  this.processBuildSelectionChangeCallback(event);
944
991
  }, 0);
945
992
  }
946
- handleExecuteProceedAutosave() {
993
+ async handleExecuteProceedAutosave() {
947
994
  if (this._gridShowDom) {
948
- this._editionManager.proceedAutoSave();
995
+ return await this._editionManager.proceedAutoSave();
949
996
  }
997
+ return true;
950
998
  }
951
999
  processBuildSelectionChangeCallback(event) {
952
1000
  if (this._dataUnit) {
@@ -971,7 +1019,12 @@ export default class AgGridController {
971
1019
  });
972
1020
  }
973
1021
  onRowDoubleClick(evt) {
974
- if (this._doubleClickCallBack) {
1022
+ var _a, _b;
1023
+ if (this._doubleClickCallBack && (!this._options.enableGridInsert || !this._dataUnit.hasNewRecord())) {
1024
+ /**
1025
+ * Evita mudança de view e a grade permanecer no modo de edição.
1026
+ */
1027
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.stopEditing();
975
1028
  this._doubleClickCallBack(evt.data);
976
1029
  }
977
1030
  }
@@ -987,22 +1040,29 @@ export default class AgGridController {
987
1040
  }
988
1041
  }
989
1042
  setCellEditors(customEditors) {
990
- var _a;
1043
+ var _a, _b, _c, _d, _e;
991
1044
  if (!this._editionManager) {
992
1045
  this._customEditors = customEditors;
993
1046
  return;
994
1047
  }
1048
+ const currentEditingCells = (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getEditingCells();
995
1049
  this._editionManager.setCellEditors(customEditors);
996
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
1050
+ if ((currentEditingCells === null || currentEditingCells === void 0 ? void 0 : currentEditingCells.length) > 0) {
1051
+ 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 });
1052
+ }
997
1053
  }
998
1054
  setCellRenders(customRenders) {
999
- var _a;
1055
+ var _a, _b, _c, _d, _e, _f;
1000
1056
  if (!this._editionManager) {
1001
1057
  this._customRenders = customRenders;
1002
1058
  return;
1003
1059
  }
1004
1060
  this._editionManager.setCellRenders(customRenders);
1005
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
1061
+ const currentEditingCells = (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getEditingCells();
1062
+ (_c = this._gridOptions) === null || _c === void 0 ? void 0 : _c.api.redrawRows();
1063
+ if ((currentEditingCells === null || currentEditingCells === void 0 ? void 0 : currentEditingCells.length) > 0) {
1064
+ 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 });
1065
+ }
1006
1066
  }
1007
1067
  clearInvalidCells(stopEdition) {
1008
1068
  if (!this._editionManager)
@@ -1014,6 +1074,19 @@ export default class AgGridController {
1014
1074
  this._editionManager.processContinuousInsert();
1015
1075
  }
1016
1076
  destroy() {
1077
+ var _a;
1017
1078
  this.observer.disconnect();
1079
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.destroy();
1080
+ }
1081
+ registryListeners() {
1082
+ var _a;
1083
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.registryListeners();
1084
+ }
1085
+ resetPaginationState() {
1086
+ var _a, _b;
1087
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.clearRangeSelection();
1088
+ }
1089
+ stopEdit() {
1090
+ this._gridOptions.api.stopEditing();
1018
1091
  }
1019
1092
  }
@@ -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 = [];