@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-75609.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/cjs/DataBinder-aff1dcc7.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-card-item_3.cjs.entry.js +12 -19
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
  5. package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
  7. package/dist/cjs/ez-dialog.cjs.entry.js +9 -1
  8. package/dist/cjs/ez-form.cjs.entry.js +3 -324
  9. package/dist/cjs/ez-grid.cjs.entry.js +254 -62
  10. package/dist/cjs/ez-list.cjs.entry.js +151 -100
  11. package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
  12. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-popup.cjs.entry.js +2 -9
  14. package/dist/cjs/ez-search.cjs.entry.js +28 -12
  15. package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
  16. package/dist/cjs/ez-text-input.cjs.entry.js +8 -3
  17. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  18. package/dist/cjs/ezui.cjs.js +1 -1
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +1 -1
  21. package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
  22. package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
  23. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  24. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  25. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  26. package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
  27. package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
  28. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +52 -14
  29. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -0
  30. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +166 -45
  31. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  32. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  33. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  34. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  35. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  36. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  37. package/dist/collection/components/ez-grid/ez-grid.js +83 -1
  38. package/dist/collection/components/ez-list/ez-list.css +5 -5
  39. package/dist/collection/components/ez-list/ez-list.js +152 -170
  40. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  41. package/dist/collection/components/ez-popover/ez-popover.css +3 -10
  42. package/dist/collection/components/ez-popup/ez-popup.css +2 -6
  43. package/dist/collection/components/ez-popup/ez-popup.js +3 -10
  44. package/dist/collection/components/ez-search/ez-search.css +1 -1
  45. package/dist/collection/components/ez-search/ez-search.js +55 -14
  46. package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
  47. package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
  48. package/dist/collection/components/ez-text-input/ez-text-input.css +27 -53
  49. package/dist/collection/components/ez-text-input/ez-text-input.js +25 -2
  50. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  51. package/dist/collection/utils/FocusResolver.js +31 -0
  52. package/dist/collection/utils/form/DataBinder.js +18 -3
  53. package/dist/custom-elements/index.js +663 -237
  54. package/dist/esm/DataBinder-bd240826.js +441 -0
  55. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  56. package/dist/esm/ez-card-item_3.entry.js +12 -19
  57. package/dist/esm/ez-combo-box.entry.js +47 -11
  58. package/dist/esm/ez-date-input.entry.js +8 -2
  59. package/dist/esm/ez-date-time-input.entry.js +8 -2
  60. package/dist/esm/ez-dialog.entry.js +9 -1
  61. package/dist/esm/ez-form.entry.js +2 -323
  62. package/dist/esm/ez-grid.entry.js +253 -61
  63. package/dist/esm/ez-list.entry.js +152 -101
  64. package/dist/esm/ez-number-input.entry.js +7 -0
  65. package/dist/esm/ez-popover.entry.js +1 -1
  66. package/dist/esm/ez-popup.entry.js +2 -9
  67. package/dist/esm/ez-search.entry.js +28 -12
  68. package/dist/esm/ez-text-area.entry.js +66 -4
  69. package/dist/esm/ez-text-input.entry.js +8 -3
  70. package/dist/esm/ez-time-input.entry.js +6 -0
  71. package/dist/esm/ezui.js +1 -1
  72. package/dist/esm/loader.js +1 -1
  73. package/dist/ezui/ezui.esm.js +1 -1
  74. package/dist/ezui/p-03a2c7d1.entry.js +1 -0
  75. package/dist/ezui/p-0a75bb05.entry.js +1 -0
  76. package/dist/ezui/p-0db68715.entry.js +1 -0
  77. package/dist/ezui/p-19098a3f.entry.js +1 -0
  78. package/dist/ezui/p-1f830a2f.entry.js +1 -0
  79. package/dist/ezui/p-3dd919b7.entry.js +1 -0
  80. package/dist/ezui/p-7bfae0fc.entry.js +1 -0
  81. package/dist/ezui/p-81f06699.js +1 -0
  82. package/dist/ezui/p-97af4b13.entry.js +1 -0
  83. package/dist/ezui/p-9ceefe4d.entry.js +1 -0
  84. package/dist/ezui/p-a80b1287.entry.js +1 -0
  85. package/dist/ezui/{p-c3c3d640.entry.js → p-b0a5c2cd.entry.js} +2 -2
  86. package/dist/ezui/p-b54e17d2.entry.js +1 -0
  87. package/dist/ezui/p-bfad39eb.entry.js +1 -0
  88. package/dist/ezui/p-d0ca26fe.entry.js +1 -0
  89. package/dist/ezui/p-dc628ed3.js +1 -0
  90. package/dist/ezui/p-ffd246f5.entry.js +1 -0
  91. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  92. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  93. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  94. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  95. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
  96. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -0
  97. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
  98. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +18 -6
  99. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +2 -0
  100. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  101. package/dist/types/components/ez-grid/ez-grid.d.ts +10 -0
  102. package/dist/types/components/ez-list/ez-list.d.ts +3 -26
  103. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  104. package/dist/types/components/ez-popup/ez-popup.d.ts +2 -2
  105. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  106. package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
  107. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  108. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  109. package/dist/types/components.d.ts +101 -44
  110. package/dist/types/utils/FocusResolver.d.ts +5 -0
  111. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  112. package/package.json +1 -1
  113. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  114. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  115. package/dist/ezui/p-188f1c4c.entry.js +0 -1
  116. package/dist/ezui/p-25ac5376.entry.js +0 -1
  117. package/dist/ezui/p-49456b34.entry.js +0 -1
  118. package/dist/ezui/p-5a90d7d1.entry.js +0 -1
  119. package/dist/ezui/p-62732269.entry.js +0 -1
  120. package/dist/ezui/p-86b6aa01.entry.js +0 -1
  121. package/dist/ezui/p-b3b94f72.entry.js +0 -1
  122. package/dist/ezui/p-b95632e8.entry.js +0 -1
  123. package/dist/ezui/p-bcd47eda.entry.js +0 -1
  124. package/dist/ezui/p-d2c06f38.entry.js +0 -1
  125. package/dist/ezui/p-dc4ada32.entry.js +0 -1
  126. package/dist/ezui/p-e85c48d7.entry.js +0 -1
  127. package/dist/ezui/p-f299c608.entry.js +0 -1
  128. package/dist/ezui/p-f42855b9.js +0 -1
  129. package/dist/ezui/p-f80ac647.entry.js +0 -1
@@ -9,10 +9,6 @@
9
9
  --ez-popup__container--color: var(--title--primary, #2b3a54);
10
10
  /*@doc Define o espaçamento do container do popup.*/
11
11
  --ez-popup__container--padding: var(--space--large, 24px);
12
- /*@doc Define a largura do container do popup.*/
13
- --ez-popup__container--width: 100%;
14
- /*@doc Define a altura do container do popup.*/
15
- --ez-popup__container--height: 100%;
16
12
 
17
13
  /* Popup Header */
18
14
  /*@doc Define o espaçamento inferior do cabeçalho do popup.*/
@@ -60,9 +56,9 @@
60
56
  }
61
57
 
62
58
  .popup__container {
63
- width: var(--ez-popup__container--width);
59
+ width: 100%;
64
60
  max-height: 90%;
65
- height: var(--ez-popup__container--height);
61
+ height: 100%;
66
62
  display: flex;
67
63
  flex-wrap: wrap;
68
64
  overflow: hidden;
@@ -62,14 +62,7 @@ export class EzPopup {
62
62
  });
63
63
  }
64
64
  getGridSize() {
65
- if (!this.size) {
66
- return this._sizeClasses["medium"];
67
- }
68
- if (!this._sizeClasses[this.size]) {
69
- this._element.style.setProperty("--ez-popup__container--width", this.size);
70
- return "";
71
- }
72
- return this._sizeClasses[this.size];
65
+ return this._sizeClasses[this.size] || this._sizeClasses["medium"];
73
66
  }
74
67
  handlePopupHeight() {
75
68
  return this.heightMode === 'auto' ? 'popup__container--auto' : '';
@@ -103,8 +96,8 @@ export class EzPopup {
103
96
  "type": "string",
104
97
  "mutable": false,
105
98
  "complexType": {
106
- "original": "\"x-small\" | \"small\" | \"medium\" | \"large\" | \"x-large\" | string",
107
- "resolved": "string",
99
+ "original": "\"x-small\" | \"small\" | \"medium\" | \"large\" | \"x-large\"",
100
+ "resolved": "\"large\" | \"medium\" | \"small\" | \"x-large\" | \"x-small\"",
108
101
  "references": {}
109
102
  },
110
103
  "required": false,
@@ -85,7 +85,7 @@
85
85
  --ez-search__scrollbar--border-radius: var(--border--radius-small, 6px);
86
86
  /*@doc Define a largura da barra de rolagem do componente.*/
87
87
  --ez-search__scrollbar--width: var(--space--medium, 12px);
88
-
88
+
89
89
  /***************
90
90
  host style
91
91
  ***************/
@@ -39,6 +39,7 @@ export class EzSearch {
39
39
  this.suppressSearch = false;
40
40
  this.ensureClearButtonVisible = false;
41
41
  this.suppressPreLoad = false;
42
+ this.autoFocus = false;
42
43
  }
43
44
  observeErrorMessage() {
44
45
  var _a;
@@ -97,9 +98,9 @@ export class EzSearch {
97
98
  /**
98
99
  * Aplica o foco no campo.
99
100
  */
100
- async setFocus() {
101
+ async setFocus(options) {
101
102
  if (this._textInput) {
102
- this._textInput.setFocus();
103
+ this._textInput.setFocus(options);
103
104
  }
104
105
  }
105
106
  /**
@@ -372,15 +373,16 @@ export class EzSearch {
372
373
  replaceHighlight(value) {
373
374
  const startHighlight = new RegExp(this._startHighlightTag, 'g');
374
375
  const endHighlight = new RegExp(this._endHighlightTag, 'g');
375
- return (value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
376
+ return String(value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
376
377
  }
377
- selectOption(newOption) {
378
+ selectOption(newOption, focusOnInput = true) {
378
379
  var _a, _b;
379
380
  const currentValue = this.getSelectedOption(this.value);
380
381
  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;
382
+ 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) });
383
+ 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()))
384
+ || (currentValue == undefined && newOptionsFormatted != undefined && "value" in newOptionsFormatted)) {
385
+ const adjustedOpt = !(newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) ? undefined : newOptionsFormatted;
384
386
  this.value = adjustedOpt;
385
387
  this._currentValue = adjustedOpt;
386
388
  }
@@ -390,6 +392,11 @@ export class EzSearch {
390
392
  }
391
393
  this._visibleOptions = [];
392
394
  this.clearSource();
395
+ if (focusOnInput) {
396
+ setTimeout(() => {
397
+ this.setFocus();
398
+ }, 0);
399
+ }
393
400
  }
394
401
  loadOptions(mode, argument = "") {
395
402
  this._criteria = argument;
@@ -426,7 +433,7 @@ export class EzSearch {
426
433
  this.value = null;
427
434
  this._currentValue = null;
428
435
  }
429
- controlListWithOnlyOne() {
436
+ controlListWithOnlyOne(focusOnInput = true) {
430
437
  var _a, _b;
431
438
  const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
432
439
  if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
@@ -437,7 +444,7 @@ export class EzSearch {
437
444
  value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
438
445
  label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
439
446
  };
440
- this.selectOption(option);
447
+ this.selectOption(option, focusOnInput);
441
448
  }
442
449
  }
443
450
  controlEmptySearch() {
@@ -563,6 +570,11 @@ export class EzSearch {
563
570
  }
564
571
  });
565
572
  });
573
+ if (this.autoFocus) {
574
+ requestAnimationFrame(() => {
575
+ this.setFocus({ selectText: true });
576
+ });
577
+ }
566
578
  }
567
579
  //---------------------------------------------
568
580
  // Event handlers
@@ -632,12 +644,16 @@ export class EzSearch {
632
644
  }
633
645
  switch (event.key) {
634
646
  case "ArrowDown":
635
- this.nextOption();
636
647
  event.stopPropagation();
648
+ if (this.canShowListOptions())
649
+ event.preventDefault();
650
+ this.nextOption();
637
651
  break;
638
652
  case "ArrowUp":
639
- this.previousOption();
640
653
  event.stopPropagation();
654
+ if (this.canShowListOptions())
655
+ event.preventDefault();
656
+ this.previousOption();
641
657
  break;
642
658
  case "Enter":
643
659
  this.handleEventPropagation(event);
@@ -648,7 +664,7 @@ export class EzSearch {
648
664
  break;
649
665
  case "Tab":
650
666
  this._tabPressed = true;
651
- this.controlListWithOnlyOne();
667
+ this.controlListWithOnlyOne(false);
652
668
  break;
653
669
  }
654
670
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -1055,6 +1071,24 @@ export class EzSearch {
1055
1071
  "attribute": "suppress-pre-load",
1056
1072
  "reflect": false,
1057
1073
  "defaultValue": "false"
1074
+ },
1075
+ "autoFocus": {
1076
+ "type": "boolean",
1077
+ "mutable": false,
1078
+ "complexType": {
1079
+ "original": "boolean",
1080
+ "resolved": "boolean",
1081
+ "references": {}
1082
+ },
1083
+ "required": false,
1084
+ "optional": false,
1085
+ "docs": {
1086
+ "tags": [],
1087
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
1088
+ },
1089
+ "attribute": "auto-focus",
1090
+ "reflect": false,
1091
+ "defaultValue": "false"
1058
1092
  }
1059
1093
  };
1060
1094
  }
@@ -1110,11 +1144,18 @@ export class EzSearch {
1110
1144
  },
1111
1145
  "setFocus": {
1112
1146
  "complexType": {
1113
- "signature": "() => Promise<void>",
1114
- "parameters": [],
1147
+ "signature": "(options?: TFocusOptions) => Promise<void>",
1148
+ "parameters": [{
1149
+ "tags": [],
1150
+ "text": ""
1151
+ }],
1115
1152
  "references": {
1116
1153
  "Promise": {
1117
1154
  "location": "global"
1155
+ },
1156
+ "TFocusOptions": {
1157
+ "location": "import",
1158
+ "path": "../ez-text-input/ez-text-input"
1118
1159
  }
1119
1160
  },
1120
1161
  "return": "Promise<void>"
@@ -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 */
@@ -12,6 +12,7 @@ export class EzTextInput {
12
12
  this.mode = "regular";
13
13
  this.noBorder = false;
14
14
  this.password = false;
15
+ this.autoFocus = false;
15
16
  }
16
17
  observeErrorMessage() {
17
18
  if (this._inputElem) {
@@ -165,9 +166,9 @@ export class EzTextInput {
165
166
  content.style.justifyContent = "center";
166
167
  content.style.overflow = "hidden";
167
168
  content.style.top = "0px";
169
+ content.style.width = "var(--ez-text-input__icon--width)";
168
170
  content.style.height = this.mode != "slim" ? "var(--ez-text-input--height)" : "var(--ez-text-input--height--slim)";
169
171
  if (slot.name == "leftIcon") {
170
- content.style.width = "var(--ez-text-input__icon--left--width)";
171
172
  content.style.left = "0px";
172
173
  content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
173
174
  this._inputElem.classList.add("icon--left");
@@ -177,7 +178,6 @@ export class EzTextInput {
177
178
  this._contentLeftSlot = content;
178
179
  }
179
180
  else if (slot.name == "rightIcon") {
180
- content.style.width = "var(--ez-text-input__icon--right--width)";
181
181
  content.style.right = "0px";
182
182
  content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
183
183
  this._inputElem.classList.add("icon--right");
@@ -203,6 +203,11 @@ export class EzTextInput {
203
203
  this.observeMask();
204
204
  this.adjustFloatingLabel();
205
205
  this.adjustBorderInput();
206
+ if (this.autoFocus) {
207
+ requestAnimationFrame(() => {
208
+ this.setFocus({ selectText: true });
209
+ });
210
+ }
206
211
  this._inputElem.addEventListener('focus', () => {
207
212
  this._inputElem.setSelectionRange(0, this._inputElem.value.length);
208
213
  });
@@ -419,6 +424,24 @@ export class EzTextInput {
419
424
  "attribute": "password",
420
425
  "reflect": false,
421
426
  "defaultValue": "false"
427
+ },
428
+ "autoFocus": {
429
+ "type": "boolean",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "boolean",
433
+ "resolved": "boolean",
434
+ "references": {}
435
+ },
436
+ "required": false,
437
+ "optional": false,
438
+ "docs": {
439
+ "tags": [],
440
+ "text": "Se true o campo receber\u00E1 o foco ao ser renderizado."
441
+ },
442
+ "attribute": "auto-focus",
443
+ "reflect": false,
444
+ "defaultValue": "false"
422
445
  }
423
446
  };
424
447
  }
@@ -10,6 +10,7 @@ export class EzTimeInput {
10
10
  this.showSeconds = false;
11
11
  this.mode = "regular";
12
12
  this.canShowError = true;
13
+ this.autoFocus = false;
13
14
  }
14
15
  observeErrorMessage() {
15
16
  var _a;
@@ -130,6 +131,11 @@ export class EzTimeInput {
130
131
  //---------------------------------------------
131
132
  componentDidLoad() {
132
133
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
134
+ if (this.autoFocus) {
135
+ requestAnimationFrame(() => {
136
+ this.setFocus({ selectText: true });
137
+ });
138
+ }
133
139
  }
134
140
  componentWillLoad() {
135
141
  this.observeShowSeconds();
@@ -281,6 +287,24 @@ export class EzTimeInput {
281
287
  "attribute": "can-show-error",
282
288
  "reflect": true,
283
289
  "defaultValue": "true"
290
+ },
291
+ "autoFocus": {
292
+ "type": "boolean",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "boolean",
296
+ "resolved": "boolean",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
304
+ },
305
+ "attribute": "auto-focus",
306
+ "reflect": false,
307
+ "defaultValue": "false"
284
308
  }
285
309
  };
286
310
  }