@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
@@ -38,7 +38,8 @@ export class EzSearch {
38
38
  this.options = undefined;
39
39
  this.suppressSearch = false;
40
40
  this.ensureClearButtonVisible = false;
41
- this.suppressPreLoad = false;
41
+ this.suppressPreLoad = true;
42
+ this.autoFocus = false;
42
43
  }
43
44
  observeErrorMessage() {
44
45
  var _a;
@@ -49,12 +50,25 @@ export class EzSearch {
49
50
  }
50
51
  }
51
52
  }
53
+ getValue(val) {
54
+ return typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
55
+ }
52
56
  validateNewValue(newValue, oldValue) {
53
- const getValue = (val) => typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
54
- return (getValue(newValue) !== getValue(oldValue));
57
+ const parsedNewValue = this.getValue(newValue);
58
+ const parsedOldValue = this.getValue(oldValue);
59
+ const newValueIsValid = parsedNewValue !== "[object Object]" && !!parsedNewValue;
60
+ const oldValueIsValid = parsedOldValue !== "[object Object]" && !!parsedOldValue;
61
+ const valuesIsDifferent = parsedNewValue !== parsedOldValue;
62
+ if (!oldValueIsValid && newValueIsValid) {
63
+ return true;
64
+ }
65
+ if (newValueIsValid && oldValueIsValid && valuesIsDifferent) {
66
+ return true;
67
+ }
68
+ return false;
55
69
  }
56
70
  async observeValue(newValue, oldValue) {
57
- if (this._textInput && newValue !== oldValue && this.validateNewValue(newValue, oldValue)) {
71
+ if (this._textInput && this.validateNewValue(newValue, oldValue)) {
58
72
  if (typeof newValue === "string") {
59
73
  await this.handleValueAsString(newValue);
60
74
  return;
@@ -97,9 +111,9 @@ export class EzSearch {
97
111
  /**
98
112
  * Aplica o foco no campo.
99
113
  */
100
- async setFocus() {
114
+ async setFocus(options) {
101
115
  if (this._textInput) {
102
- this._textInput.setFocus();
116
+ this._textInput.setFocus(options);
103
117
  }
104
118
  }
105
119
  /**
@@ -142,6 +156,9 @@ export class EzSearch {
142
156
  return;
143
157
  }
144
158
  await this.loadDescriptionValue(value);
159
+ if (!this._currentValue) {
160
+ return;
161
+ }
145
162
  this.setInputValue();
146
163
  this.ezChange.emit(this.value);
147
164
  this._currentValue = this.value;
@@ -197,7 +214,7 @@ export class EzSearch {
197
214
  return;
198
215
  }
199
216
  let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
200
- text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
217
+ text = text === null || text === void 0 ? void 0 : text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
201
218
  return text;
202
219
  }
203
220
  getText() {
@@ -357,7 +374,7 @@ export class EzSearch {
357
374
  this.updateVisibleOptions();
358
375
  if (this._tabPressed) {
359
376
  this._tabPressed = false;
360
- this.controlEmptySearch();
377
+ this.controlEmptySearch(false);
361
378
  }
362
379
  }
363
380
  else {
@@ -372,15 +389,16 @@ export class EzSearch {
372
389
  replaceHighlight(value) {
373
390
  const startHighlight = new RegExp(this._startHighlightTag, 'g');
374
391
  const endHighlight = new RegExp(this._endHighlightTag, 'g');
375
- return (value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
392
+ return String(value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
376
393
  }
377
- selectOption(newOption) {
394
+ selectOption(newOption, focusOnInput = true) {
378
395
  var _a, _b;
379
396
  const currentValue = this.getSelectedOption(this.value);
380
397
  const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
381
- if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) === null || _b === void 0 ? void 0 : _b.toString()))
382
- || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
383
- const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
398
+ const newOptionsFormatted = Object.assign(Object.assign({}, newOptionsReplaced), { value: this.replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value), label: this.replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.label) });
399
+ if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) === null || _b === void 0 ? void 0 : _b.toString()))
400
+ || (currentValue == undefined && newOptionsFormatted != undefined && "value" in newOptionsFormatted)) {
401
+ const adjustedOpt = !(newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) ? undefined : newOptionsFormatted;
384
402
  this.value = adjustedOpt;
385
403
  this._currentValue = adjustedOpt;
386
404
  }
@@ -390,6 +408,11 @@ export class EzSearch {
390
408
  }
391
409
  this._visibleOptions = [];
392
410
  this.clearSource();
411
+ if (focusOnInput) {
412
+ setTimeout(() => {
413
+ this.setFocus();
414
+ }, 0);
415
+ }
393
416
  }
394
417
  loadOptions(mode, argument = "") {
395
418
  this._criteria = argument;
@@ -426,7 +449,7 @@ export class EzSearch {
426
449
  this.value = null;
427
450
  this._currentValue = null;
428
451
  }
429
- controlListWithOnlyOne() {
452
+ controlListWithOnlyOne(focusOnInput = true) {
430
453
  var _a, _b;
431
454
  const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
432
455
  if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
@@ -437,17 +460,17 @@ export class EzSearch {
437
460
  value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
438
461
  label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
439
462
  };
440
- this.selectOption(option);
463
+ this.selectOption(option, focusOnInput);
441
464
  }
442
465
  }
443
- controlEmptySearch() {
466
+ controlEmptySearch(focusOnInput = true) {
444
467
  var _a;
445
468
  if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
446
469
  this.clearSearch();
447
470
  ApplicationUtils.info(this._textEmptyList);
448
471
  }
449
472
  else {
450
- this.controlListWithOnlyOne();
473
+ this.controlListWithOnlyOne(focusOnInput);
451
474
  }
452
475
  }
453
476
  async loadDescriptionValue(argument) {
@@ -518,6 +541,19 @@ export class EzSearch {
518
541
  this._preSelection = undefined;
519
542
  this.updateVisibleOptions();
520
543
  }
544
+ async handleInitialValue() {
545
+ const valueIsValid = !!this.getValue(this.value);
546
+ if (!valueIsValid) {
547
+ return;
548
+ }
549
+ if (typeof this.value === "string") {
550
+ await this.handleValueAsString(this.value);
551
+ return;
552
+ }
553
+ let text = this.getFormattedText(this.value);
554
+ text = this.replaceQuotes(text);
555
+ this._textInput.value = text;
556
+ }
521
557
  //---------------------------------------------
522
558
  // Lifecycle web component
523
559
  //---------------------------------------------
@@ -549,10 +585,9 @@ export class EzSearch {
549
585
  ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
550
586
  });
551
587
  }
552
- componentDidLoad() {
588
+ async componentDidLoad() {
553
589
  this._currentValue = this.value;
554
590
  CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
555
- this.setInputValue(false);
556
591
  this._resizeObserver = new ResizeObserver((entries) => {
557
592
  window.requestAnimationFrame(() => {
558
593
  if (!Array.isArray(entries) || !entries.length)
@@ -563,6 +598,16 @@ export class EzSearch {
563
598
  }
564
599
  });
565
600
  });
601
+ await this.handleInitialValue();
602
+ if (this.autoFocus) {
603
+ requestAnimationFrame(() => {
604
+ this.setFocus({ selectText: true });
605
+ });
606
+ }
607
+ }
608
+ disconnectedCallback() {
609
+ var _a;
610
+ (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
566
611
  }
567
612
  //---------------------------------------------
568
613
  // Event handlers
@@ -632,12 +677,16 @@ export class EzSearch {
632
677
  }
633
678
  switch (event.key) {
634
679
  case "ArrowDown":
635
- this.nextOption();
636
680
  event.stopPropagation();
681
+ if (this.canShowListOptions())
682
+ event.preventDefault();
683
+ this.nextOption();
637
684
  break;
638
685
  case "ArrowUp":
639
- this.previousOption();
640
686
  event.stopPropagation();
687
+ if (this.canShowListOptions())
688
+ event.preventDefault();
689
+ this.previousOption();
641
690
  break;
642
691
  case "Enter":
643
692
  this.handleEventPropagation(event);
@@ -648,7 +697,7 @@ export class EzSearch {
648
697
  break;
649
698
  case "Tab":
650
699
  this._tabPressed = true;
651
- this.controlListWithOnlyOne();
700
+ this.controlListWithOnlyOne(false);
652
701
  break;
653
702
  }
654
703
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -1054,6 +1103,24 @@ export class EzSearch {
1054
1103
  },
1055
1104
  "attribute": "suppress-pre-load",
1056
1105
  "reflect": false,
1106
+ "defaultValue": "true"
1107
+ },
1108
+ "autoFocus": {
1109
+ "type": "boolean",
1110
+ "mutable": false,
1111
+ "complexType": {
1112
+ "original": "boolean",
1113
+ "resolved": "boolean",
1114
+ "references": {}
1115
+ },
1116
+ "required": false,
1117
+ "optional": false,
1118
+ "docs": {
1119
+ "tags": [],
1120
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
1121
+ },
1122
+ "attribute": "auto-focus",
1123
+ "reflect": false,
1057
1124
  "defaultValue": "false"
1058
1125
  }
1059
1126
  };
@@ -1110,11 +1177,18 @@ export class EzSearch {
1110
1177
  },
1111
1178
  "setFocus": {
1112
1179
  "complexType": {
1113
- "signature": "() => Promise<void>",
1114
- "parameters": [],
1180
+ "signature": "(options?: TFocusOptions) => Promise<void>",
1181
+ "parameters": [{
1182
+ "tags": [],
1183
+ "text": ""
1184
+ }],
1115
1185
  "references": {
1116
1186
  "Promise": {
1117
1187
  "location": "global"
1188
+ },
1189
+ "TFocusOptions": {
1190
+ "location": "import",
1191
+ "path": "../ez-text-input/ez-text-input"
1118
1192
  }
1119
1193
  },
1120
1194
  "return": "Promise<void>"
@@ -41,9 +41,9 @@
41
41
  /*@doc Define a cor de fundo quando o cursor está sobre o botão.*/
42
42
  --ez-split-button--hover--background-color: var(--background--light, #ffffff);
43
43
  /*@doc Define a cor do texto quando o botão está desabilitado.*/
44
- --ez-split-button--disabled-color: var(--text--disable);
44
+ --ez-split-button--disabled-color: var(--text--primary);
45
45
  /*@doc Define a cor de fundo quando o botão está desabilitado.*/
46
- --ez-split-button--disabled--background-color: var(--color--disable-secondary);
46
+ --ez-split-button--disabled--background-color: var(--background--medium);
47
47
  /*@doc Define o estido da borda quando o botão está selecionado.*/
48
48
  --ez-split-button--focus--border: var(--border--medium, 2px) var(--color--primary-300);
49
49
  /*@doc Define a sombra do botão quando selecionado.*/
@@ -51,6 +51,20 @@
51
51
  /*@doc Define o espaçamento direito do label.*/
52
52
  --text-area__label--padding-right: 12px;
53
53
 
54
+ /* scrollbar */
55
+ /*@doc Define a cor da barra de rolagem do componente.*/
56
+ --text-area__scrollbar--color-default: var(--scrollbar--default, #626e82);
57
+ /*@doc Define a cor de fundo da barra de rolagem do componente.*/
58
+ --text-area__scrollbar--color-background: var(--scrollbar--background, #E5EAF0);
59
+ /*@doc Define a cor do hover na barra de rolagem do componente.*/
60
+ --text-area__scrollbar--color-hover: var(--scrollbar--hover, #2B3A54);
61
+ /*@doc Define a cor do active na barra de rolagem do componente.*/
62
+ --text-area__scrollbar--color-clicked: var(--scrollbar--clicked, #a2abb9);
63
+ /*@doc Define o raio da borda da barra de rolagem do componente.*/
64
+ --text-area__scrollbar--border-radius: var(--border--radius-small, 6px);
65
+ /*@doc Define a largura da barra de rolagem do componente.*/
66
+ --text-area__scrollbar--width: var(--space--medium, 12px);
67
+
54
68
  /***************
55
69
  host style
56
70
  ***************/
@@ -77,6 +91,9 @@ textarea {
77
91
  font-size: var(--text-area--font-size);
78
92
  color: var(--text-area--color);
79
93
  margin-top: calc(var(--space--medium, 12px) + 4px);
94
+
95
+ scrollbar-width: thin;
96
+ scrollbar-color: var(--text-area__scrollbar--color-clicked) var(--text-area__scrollbar--color-background);
80
97
  }
81
98
 
82
99
  textarea:focus {
@@ -92,6 +109,38 @@ textarea:disabled {
92
109
  cursor: not-allowed;
93
110
  }
94
111
 
112
+ textarea::-webkit-scrollbar {
113
+ background-color: var(--text-area__scrollbar--color-background);
114
+
115
+ width: var(--text-area__scrollbar--width);
116
+ max-width: var(--text-area__scrollbar--width);
117
+ min-width: var(--text-area__scrollbar--width);
118
+ }
119
+
120
+ textarea::-webkit-scrollbar-thumb {
121
+ /*public*/
122
+ background-color: var(--text-area__scrollbar--color-default);
123
+ border-radius: var(--text-area__scrollbar--border-radius);
124
+ }
125
+
126
+ textarea::-webkit-scrollbar-track {
127
+ /*public*/
128
+ background-color: var(--text-area__scrollbar--color-background);
129
+ border-radius: var(--text-area__scrollbar--border-radius);
130
+ }
131
+
132
+ textarea::-webkit-scrollbar-thumb:vertical:hover,
133
+ textarea::-webkit-scrollbar-thumb:horizontal:hover {
134
+ /*public*/
135
+ background-color: var(--text-area__scrollbar--color-hover);
136
+ }
137
+
138
+ textarea::-webkit-scrollbar-thumb:vertical:active,
139
+ textarea::-webkit-scrollbar-thumb:horizontal:active {
140
+ /*public*/
141
+ background-color: var(--text-area__scrollbar--color-clicked);
142
+ }
143
+
95
144
  .textarea {
96
145
  /*private*/
97
146
  width: 100%;
@@ -2,6 +2,8 @@ import { ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
3
  export class EzTextArea {
4
4
  constructor() {
5
+ this.LINE_HEIGHT = 24;
6
+ this.HEIGHT_RATIO = 1.4;
5
7
  this.label = undefined;
6
8
  this.value = undefined;
7
9
  this.enabled = true;
@@ -10,6 +12,8 @@ export class EzTextArea {
10
12
  this.canShowError = true;
11
13
  this.mode = "regular";
12
14
  this.enableResize = false;
15
+ this.autoRows = false;
16
+ this.autoFocus = false;
13
17
  }
14
18
  observeErrorMessage() {
15
19
  var _a, _b, _c, _d;
@@ -47,8 +51,17 @@ export class EzTextArea {
47
51
  observeRows() {
48
52
  const rows = this.rows > 0 ? this.rows : this.mode != "slim" ? 4 : 2;
49
53
  if (rows !== this.rows) {
50
- this.rows = rows;
51
- this._initialRows = rows;
54
+ this.updateRows(rows);
55
+ }
56
+ }
57
+ observeAutoRows() {
58
+ var _a, _b;
59
+ if (this.autoRows) {
60
+ (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
61
+ this.initializeResizeObserver();
62
+ }
63
+ else {
64
+ (_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
52
65
  }
53
66
  }
54
67
  //---------------------------------------------
@@ -117,6 +130,42 @@ export class EzTextArea {
117
130
  isFocused() {
118
131
  return this._hostElement.shadowRoot.activeElement !== null;
119
132
  }
133
+ updateRows(newRows) {
134
+ this.rows = newRows;
135
+ this._initialRows = newRows;
136
+ }
137
+ calculateMaxRows() {
138
+ const parentElement = this._hostElement.parentElement;
139
+ if (!parentElement) {
140
+ return;
141
+ }
142
+ const height = Math.max((parentElement === null || parentElement === void 0 ? void 0 : parentElement.clientHeight) || 0, this.LINE_HEIGHT);
143
+ if (height > 0) {
144
+ const maxRows = Math.floor(height / this.LINE_HEIGHT * this.HEIGHT_RATIO);
145
+ if (maxRows !== this.rows) {
146
+ this.updateRows(maxRows);
147
+ }
148
+ }
149
+ }
150
+ initializeResizeObserver() {
151
+ if (!this.autoRows) {
152
+ return;
153
+ }
154
+ const parentElement = this._hostElement.parentElement;
155
+ if (parentElement) {
156
+ try {
157
+ if (this._resizeObserver != undefined) {
158
+ this._resizeObserver.unobserve(parentElement);
159
+ }
160
+ this._resizeObserver = new ResizeObserver(this.calculateMaxRows.bind(this));
161
+ this._resizeObserver.observe(parentElement);
162
+ }
163
+ catch (e) {
164
+ console.warn(e);
165
+ }
166
+ this.calculateMaxRows();
167
+ }
168
+ }
120
169
  //---------------------------------------------
121
170
  // Event handlers
122
171
  //---------------------------------------------
@@ -139,6 +188,13 @@ export class EzTextArea {
139
188
  this._container.classList.add("textarea--focus");
140
189
  }
141
190
  }
191
+ connectedCallback() {
192
+ this.initializeResizeObserver();
193
+ }
194
+ disconnectedCallback() {
195
+ var _a;
196
+ (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
197
+ }
142
198
  //---------------------------------------------
143
199
  // Lifecycle web component
144
200
  //---------------------------------------------
@@ -146,6 +202,11 @@ export class EzTextArea {
146
202
  this.observeErrorMessage();
147
203
  this.adjustFloatingLabel();
148
204
  this.observeMode();
205
+ if (this.autoFocus) {
206
+ requestAnimationFrame(() => {
207
+ this.setFocus();
208
+ });
209
+ }
149
210
  }
150
211
  render() {
151
212
  ElementIDUtils.addIDInfoIfNotExists(this._hostElement, 'input');
@@ -311,6 +372,42 @@ export class EzTextArea {
311
372
  "attribute": "enable-resize",
312
373
  "reflect": true,
313
374
  "defaultValue": "false"
375
+ },
376
+ "autoRows": {
377
+ "type": "boolean",
378
+ "mutable": false,
379
+ "complexType": {
380
+ "original": "boolean",
381
+ "resolved": "boolean",
382
+ "references": {}
383
+ },
384
+ "required": false,
385
+ "optional": false,
386
+ "docs": {
387
+ "tags": [],
388
+ "text": "Ativa a op\u00E7\u00E3o de fazer as linhas do componente serem baseados na altura m\u00E1xima."
389
+ },
390
+ "attribute": "auto-rows",
391
+ "reflect": true,
392
+ "defaultValue": "false"
393
+ },
394
+ "autoFocus": {
395
+ "type": "boolean",
396
+ "mutable": false,
397
+ "complexType": {
398
+ "original": "boolean",
399
+ "resolved": "boolean",
400
+ "references": {}
401
+ },
402
+ "required": false,
403
+ "optional": false,
404
+ "docs": {
405
+ "tags": [],
406
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
407
+ },
408
+ "attribute": "auto-focus",
409
+ "reflect": false,
410
+ "defaultValue": "false"
314
411
  }
315
412
  };
316
413
  }
@@ -423,6 +520,9 @@ export class EzTextArea {
423
520
  }, {
424
521
  "propName": "rows",
425
522
  "methodName": "observeRows"
523
+ }, {
524
+ "propName": "autoRows",
525
+ "methodName": "observeAutoRows"
426
526
  }];
427
527
  }
428
528
  }
@@ -6,8 +6,6 @@
6
6
  --ez-text-input--width: 100%;
7
7
  /*@doc Define a largura do slot que contém o ícone.*/
8
8
  --ez-text-input__icon--width: 48px;
9
- --ez-text-input__icon--left--width: var(--ez-text-input__icon--width);
10
- --ez-text-input__icon--right--width: var(--ez-text-input__icon--width);
11
9
  /*@doc Define a altura do componente em modo "slim".*/
12
10
  --ez-text-input--height--slim: 32px;
13
11
 
@@ -48,6 +46,9 @@
48
46
  --ez-text-input__input--noborder-color: white;
49
47
  /*@doc Define o padding do input*/
50
48
  --ez-text-input__input--padding: var(--space--medium, 6px);
49
+ /*@doc Define a cor do placeholder do input.*/
50
+ --ez-text-input__placeholder--color: var(--text--secondary, #a2abb9);
51
+
51
52
 
52
53
  /* message box */
53
54
  /*@doc Define o tamanho da fonte da mensagem abaixo do input.*/
@@ -104,8 +105,6 @@ input {
104
105
  color: var(--ez-text-input--color);
105
106
  font-weight: var(--ez-text-input--font-weight);
106
107
  padding: var(--ez-text-input__input--padding);
107
- text-overflow: ellipsis;
108
- overflow: hidden;
109
108
  }
110
109
 
111
110
  input:disabled {
@@ -123,11 +122,11 @@ input:focus {
123
122
  }
124
123
 
125
124
  input.icon--left {
126
- padding-left: var(--ez-text-input__icon--left--width);
125
+ padding-left: var(--ez-text-input__icon--width);
127
126
  }
128
127
 
129
128
  input.icon--right {
130
- padding-right: var(--ez-text-input__icon--right--width);
129
+ padding-right: var(--ez-text-input__icon--width);
131
130
  }
132
131
 
133
132
  input.hasError {
@@ -204,23 +203,25 @@ input:read-only {
204
203
  cursor: not-allowed;
205
204
  }
206
205
 
207
- .input__label--left.input__label--right {
208
- left: calc(var(--ez-text-input__icon--left--width) + 2px);
209
- /*borda*/
210
- width: calc(100% - (var(--ez-text-input__icon--right--width) + var(--ez-text-input__icon--left--width)));
211
- }
212
206
  .input__label--left {
213
207
  /*public*/
214
208
  text-align: left;
215
- left: calc(var(--ez-text-input__icon--left--width) + 2px);
209
+ left: calc(var(--ez-text-input__icon--width) + 2px);
216
210
  /*borda*/
217
- width: calc(100% - var(--ez-text-input__icon--left--width));
211
+ width: calc(100% - var(--ez-text-input__icon--width));
218
212
  }
219
213
 
220
214
  .input__label--right {
221
215
  /*public*/
222
- right: var(--ez-text-input__icon--right--width);
223
- width: calc(100% - var(--ez-text-input__icon--right--width));
216
+ right: var(--ez-text-input__icon--width);
217
+ width: calc(100% - var(--ez-text-input__icon--width));
218
+ }
219
+
220
+ /* ISSO TA ERRADO CRIAR INPUT__LABEL--BOTH */
221
+ .input__label--left.input__label--right {
222
+ left: calc(var(--ez-text-input__icon--width) + 2px);
223
+ /*borda*/
224
+ width: calc(100% - var(--ez-text-input__icon--width) * 2);
224
225
  }
225
226
 
226
227
  .input--with--label {
@@ -240,45 +241,18 @@ input:read-only {
240
241
  font-weight: bold;
241
242
  }
242
243
 
243
- .input--slim::-webkit-input-placeholder { /* Edge */
244
- /*public*/
245
- font-family: var(--ez-text-input--font-family);
246
- font-size: var(--ez-text-input--font-size);
247
- font-weight: var(--ez-text-input--font-weight);
248
- color: var(--ez-text-input--color);
249
- }
244
+ .input--slim::-webkit-input-placeholder, /* Edge */
245
+ .input--slim:-moz-placeholder, /* Firefox 4-18 */
246
+ .input--slim::-moz-placeholder, /* Firefox 19+ */
247
+ .input--slim:-ms-input-placeholder, /* IE 10-11 */
248
+ .input--slim::placeholder { /* Modern browsers */
249
+ /*public*/
250
+ font-family: var(--ez-text-input--font-family);
251
+ font-size: var(--ez-text-input--font-size);
252
+ font-weight: var(--ez-text-input--font-weight);
253
+ color: var(--ez-text-input__placeholder--color);
254
+ }
250
255
 
251
- .input--slim:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
252
- /*public*/
253
- font-family: var(--ez-text-input--font-family);
254
- font-size: var(--ez-text-input--font-size);
255
- font-weight: var(--ez-text-input--font-weight);
256
- color: var(--ez-text-input--color);
257
- }
258
-
259
- .input--slim::-moz-placeholder { /* Mozilla Firefox 19+ */
260
- /*public*/
261
- font-family: var(--ez-text-input--font-family);
262
- font-size: var(--ez-text-input--font-size);
263
- font-weight: var(--ez-text-input--font-weight);
264
- color: var(--ez-text-input--color);
265
- }
266
-
267
- .input--slim:-ms-input-placeholder { /* Internet Explorer 10-11 */
268
- /*public*/
269
- font-family: var(--ez-text-input--font-family);
270
- font-size: var(--ez-text-input--font-size);
271
- font-weight: var(--ez-text-input--font-weight);
272
- color: var(--ez-text-input--color);
273
- }
274
-
275
- .input--slim::placeholder {
276
- /*public*/
277
- font-family: var(--ez-text-input--font-family);
278
- font-size: var(--ez-text-input--font-size);
279
- font-weight: var(--ez-text-input--font-weight);
280
- color: var(--ez-text-input--color);
281
- }
282
256
 
283
257
  .input--slim:disabled::-webkit-input-placeholder, /* WebKit browsers */
284
258
  .input--slim:disabled:-moz-placeholder, /* Mozilla Firefox 4 to 18 */