@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77074.0 → 0.0.0-bugfix-dev-KB-75047.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.
- package/dist/cjs/DataBinder-3b083480.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-badge.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +13 -20
- package/dist/cjs/ez-chart.cjs.entry.js +2 -2
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +49 -13
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +5 -4
- package/dist/cjs/ez-date-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
- package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +3 -3
- package/dist/cjs/ez-form.cjs.entry.js +6 -326
- package/dist/cjs/ez-grid.cjs.entry.js +14615 -70501
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +152 -101
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +2 -2
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +9 -2
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +69 -20
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +67 -5
- package/dist/cjs/ez-text-input.cjs.entry.js +80 -8
- package/dist/cjs/ez-time-input.cjs.entry.js +7 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-tree.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/filter-column.cjs.entry.js +1 -1
- package/dist/cjs/{index-a7b0c73d.js → index-9e5554cb.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-button/ez-button.css +2 -2
- package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +12 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +76 -15
- package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
- package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
- package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
- package/dist/collection/components/ez-form/ez-form.js +1 -0
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +96 -27
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +164 -46
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
- package/dist/collection/components/ez-grid/ez-grid.js +90 -3
- package/dist/collection/components/ez-list/ez-list.css +5 -5
- package/dist/collection/components/ez-list/ez-list.js +152 -170
- package/dist/collection/components/ez-modal/ez-modal.css +4 -0
- package/dist/collection/components/ez-modal/ez-modal.js +2 -2
- package/dist/collection/components/ez-number-input/ez-number-input.css +8 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
- package/dist/collection/components/ez-popover/ez-popover.css +3 -10
- package/dist/collection/components/ez-popup/ez-popup.js +1 -1
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +95 -21
- package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
- package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
- package/dist/collection/components/ez-text-input/ez-text-input.css +33 -53
- package/dist/collection/components/ez-text-input/ez-text-input.js +88 -6
- package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
- package/dist/collection/utils/FocusResolver.js +31 -0
- package/dist/collection/utils/ResponsiveInputUtils.js +26 -0
- package/dist/collection/utils/form/DataBinder.js +18 -3
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
- package/dist/custom-elements/index.js +15360 -70903
- package/dist/esm/DataBinder-02fa9bb9.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-alert-list.entry.js +1 -1
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-badge.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +1 -1
- package/dist/esm/ez-button.entry.js +2 -2
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +13 -20
- package/dist/esm/ez-chart.entry.js +2 -2
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +50 -14
- package/dist/esm/ez-custom-form-input_2.entry.js +5 -4
- package/dist/esm/ez-date-input.entry.js +9 -3
- package/dist/esm/ez-date-time-input.entry.js +9 -3
- package/dist/esm/ez-dialog.entry.js +10 -2
- package/dist/esm/ez-dropdown_2.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +3 -3
- package/dist/esm/ez-form.entry.js +5 -325
- package/dist/esm/ez-grid.entry.js +14585 -70471
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +153 -102
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +2 -2
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +9 -2
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-scroller_2.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +69 -20
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +2 -2
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ez-split-panel.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +67 -5
- package/dist/esm/ez-text-input.entry.js +80 -8
- package/dist/esm/ez-time-input.entry.js +7 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-tree.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +1 -1
- package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +3 -1
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-44caad9a.entry.js → p-0378416a.entry.js} +1 -1
- package/dist/ezui/p-076e868b.entry.js +1 -0
- package/dist/ezui/p-0e1cc2d1.entry.js +1 -0
- package/dist/ezui/{p-1285c902.entry.js → p-11b09aa1.entry.js} +1 -1
- package/dist/ezui/{p-77a4bd35.entry.js → p-11bfeca3.entry.js} +1 -1
- package/dist/ezui/p-16e21a40.entry.js +1 -0
- package/dist/ezui/p-1af7fae4.entry.js +1 -0
- package/dist/ezui/{p-8888d9ed.entry.js → p-1b08bf3c.entry.js} +1 -1
- package/dist/ezui/{p-a2e5b8c3.entry.js → p-2f53435e.entry.js} +1 -1
- package/dist/ezui/{p-baf80b13.entry.js → p-30951bd7.entry.js} +1 -1
- package/dist/ezui/p-33675dae.entry.js +1 -0
- package/dist/ezui/p-3af64edd.entry.js +1 -0
- package/dist/ezui/p-3cc9b84a.entry.js +1 -0
- package/dist/ezui/p-3d38bfea.entry.js +1 -0
- package/dist/ezui/{p-7bc07c31.entry.js → p-3f8c33e0.entry.js} +1 -1
- package/dist/ezui/p-455e737c.js +1 -0
- package/dist/ezui/{p-6d79930d.entry.js → p-554522db.entry.js} +1 -1
- package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
- package/dist/ezui/p-6bda82d1.entry.js +1 -0
- package/dist/ezui/p-6d31c43c.entry.js +1 -0
- package/dist/ezui/p-6ec40dec.entry.js +1 -0
- package/dist/ezui/p-6f0422ff.entry.js +309 -0
- package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
- package/dist/ezui/{p-f9e551de.entry.js → p-70f1c812.entry.js} +1 -1
- package/dist/ezui/{p-555c9018.entry.js → p-7567ccdd.entry.js} +1 -1
- package/dist/ezui/p-7de7baa3.entry.js +1 -0
- package/dist/ezui/p-7f5afb1f.entry.js +1 -0
- package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
- package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
- package/dist/ezui/{p-bcb53f27.entry.js → p-868b56f7.entry.js} +1 -1
- package/dist/ezui/p-8f026744.entry.js +1 -0
- package/dist/ezui/{p-09de35a2.entry.js → p-91ccae0c.entry.js} +1 -1
- package/dist/ezui/{p-c0d9c4f8.entry.js → p-92748142.entry.js} +1 -1
- package/dist/ezui/{p-c4320a39.entry.js → p-a563df31.entry.js} +1 -1
- package/dist/ezui/{p-990b4318.entry.js → p-a921e3e7.entry.js} +1 -1
- package/dist/ezui/{p-17be134a.entry.js → p-b2f6bc0a.entry.js} +1 -1
- package/dist/ezui/{p-c3045972.entry.js → p-b858fc6e.entry.js} +1 -1
- package/dist/ezui/{p-e347df9c.entry.js → p-bef7daac.entry.js} +1 -1
- package/dist/ezui/p-bfc30e61.entry.js +1 -0
- package/dist/ezui/p-bfc59380.entry.js +1 -0
- package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
- package/dist/ezui/p-d27b4b3e.entry.js +1 -0
- package/dist/ezui/p-d960a031.entry.js +1 -0
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/p-dfca5946.entry.js +1 -0
- package/dist/ezui/{p-7fdd479f.entry.js → p-e18d9e6a.entry.js} +1 -1
- package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
- package/dist/ezui/{p-0306dff7.entry.js → p-e6b38ade.entry.js} +1 -1
- package/dist/ezui/{p-90bcd2ba.entry.js → p-e7395eae.entry.js} +1 -1
- package/dist/ezui/p-e80dcf86.entry.js +1 -0
- package/dist/ezui/{p-650e4b6d.entry.js → p-f1c2c19e.entry.js} +1 -1
- package/dist/ezui/{p-6e429cff.entry.js → p-fc194825.entry.js} +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +7 -2
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +19 -7
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +3 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +11 -1
- package/dist/types/components/ez-list/ez-list.d.ts +3 -26
- package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
- package/dist/types/components/ez-search/ez-search.d.ts +10 -2
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +109 -44
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/ResponsiveInputUtils.d.ts +6 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/package.json +11 -4
- package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
- package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
- package/dist/ezui/p-10820c20.entry.js +0 -1
- package/dist/ezui/p-188f1c4c.entry.js +0 -1
- package/dist/ezui/p-49456b34.entry.js +0 -1
- package/dist/ezui/p-5a90d7d1.entry.js +0 -1
- package/dist/ezui/p-5b205c80.entry.js +0 -1
- package/dist/ezui/p-62732269.entry.js +0 -1
- package/dist/ezui/p-86b6aa01.entry.js +0 -1
- package/dist/ezui/p-9d9ecb7c.entry.js +0 -1
- package/dist/ezui/p-abce5219.entry.js +0 -1
- package/dist/ezui/p-b3b94f72.entry.js +0 -1
- package/dist/ezui/p-b95632e8.entry.js +0 -1
- package/dist/ezui/p-bc2f844e.entry.js +0 -1
- package/dist/ezui/p-bcd47eda.entry.js +0 -1
- package/dist/ezui/p-c3c3d640.entry.js +0 -304
- package/dist/ezui/p-cdc472cc.entry.js +0 -1
- package/dist/ezui/p-d2c06f38.entry.js +0 -1
- package/dist/ezui/p-d8f64bb7.entry.js +0 -1
- package/dist/ezui/p-dc4ada32.entry.js +0 -1
- package/dist/ezui/p-e85c48d7.entry.js +0 -1
- package/dist/ezui/p-f299c608.entry.js +0 -1
- package/dist/ezui/p-f42855b9.js +0 -1
- package/dist/ezui/p-f80ac647.entry.js +0 -1
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
:host {
|
|
2
|
+
/*@doc Define a largura maxima do componente.*/
|
|
3
|
+
--ez-number-input__min-width: 0px;
|
|
4
|
+
/*@doc Define a largura minima do componente.*/
|
|
5
|
+
--ez-number-input__max-width: 100%;
|
|
6
|
+
|
|
2
7
|
display: block;
|
|
3
8
|
width: 100%;
|
|
4
9
|
}
|
|
5
10
|
|
|
6
11
|
.number__input {
|
|
7
12
|
height: 100%;
|
|
13
|
+
|
|
14
|
+
min-width: var(--ez-number-input__min-width);
|
|
15
|
+
max-width: var(--ez-number-input__max-width);
|
|
8
16
|
}
|
|
@@ -16,6 +16,7 @@ export class EzNumberInput {
|
|
|
16
16
|
this.precision = undefined;
|
|
17
17
|
this.prettyPrecision = undefined;
|
|
18
18
|
this.mode = "regular";
|
|
19
|
+
this.autoFocus = false;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Aplica o foco no campo.
|
|
@@ -156,11 +157,17 @@ export class EzNumberInput {
|
|
|
156
157
|
const textValue = this.getTextValue(this.value) || '';
|
|
157
158
|
if ((this._value || '') !== textValue) {
|
|
158
159
|
this._value = textValue;
|
|
160
|
+
this._textInput.value = this._value;
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
componentDidLoad() {
|
|
162
164
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
163
165
|
this.setInputValue();
|
|
166
|
+
if (this.autoFocus) {
|
|
167
|
+
requestAnimationFrame(() => {
|
|
168
|
+
this.setFocus({ selectText: true });
|
|
169
|
+
});
|
|
170
|
+
}
|
|
164
171
|
}
|
|
165
172
|
render() {
|
|
166
173
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
@@ -340,6 +347,24 @@ export class EzNumberInput {
|
|
|
340
347
|
"attribute": "mode",
|
|
341
348
|
"reflect": true,
|
|
342
349
|
"defaultValue": "\"regular\""
|
|
350
|
+
},
|
|
351
|
+
"autoFocus": {
|
|
352
|
+
"type": "boolean",
|
|
353
|
+
"mutable": false,
|
|
354
|
+
"complexType": {
|
|
355
|
+
"original": "boolean",
|
|
356
|
+
"resolved": "boolean",
|
|
357
|
+
"references": {}
|
|
358
|
+
},
|
|
359
|
+
"required": false,
|
|
360
|
+
"optional": false,
|
|
361
|
+
"docs": {
|
|
362
|
+
"tags": [],
|
|
363
|
+
"text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
|
|
364
|
+
},
|
|
365
|
+
"attribute": "auto-focus",
|
|
366
|
+
"reflect": false,
|
|
367
|
+
"defaultValue": "false"
|
|
343
368
|
}
|
|
344
369
|
};
|
|
345
370
|
}
|
|
@@ -9,12 +9,6 @@
|
|
|
9
9
|
--ez-popover__box--background-color: var(--background--xlight, #fff);
|
|
10
10
|
/*@doc Define a camada de visibilidade do popover.*/
|
|
11
11
|
--ez-popover__box--z-index: var(--most-visible, 3);
|
|
12
|
-
/*@doc Define a altura do popover.*/
|
|
13
|
-
--ez-popover__height: fit-content;
|
|
14
|
-
/*@doc Define a altura máxima do popover.*/
|
|
15
|
-
--ez-popover__max-height: fit-content;
|
|
16
|
-
/*@doc Define a margin do popover.*/
|
|
17
|
-
--ez-popover__margin: 0;
|
|
18
12
|
|
|
19
13
|
/***************
|
|
20
14
|
host style
|
|
@@ -30,14 +24,13 @@
|
|
|
30
24
|
z-index: var(--ez-popover__box--z-index);
|
|
31
25
|
display: flex;
|
|
32
26
|
flex-direction: column;
|
|
33
|
-
|
|
27
|
+
|
|
28
|
+
height: fit-content;
|
|
29
|
+
|
|
34
30
|
/*public*/
|
|
35
|
-
height: var(--ez-popover__height);
|
|
36
|
-
max-height: var(--ez-popover__max-height);
|
|
37
31
|
background-color: var(--ez-popover__box--background-color);
|
|
38
32
|
border-radius: var(--ez-popover__box--border-radius);
|
|
39
33
|
box-shadow: var(--ez-popover__box--box-shadow);
|
|
40
|
-
margin: var(--ez-popover__margin);
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
.popover__box--fit-content {
|
|
@@ -25,7 +25,7 @@ export class EzPopup {
|
|
|
25
25
|
this._popupRef.focus();
|
|
26
26
|
}
|
|
27
27
|
new KeyboardManager({ propagate: false, element: this._element })
|
|
28
|
-
.bind("Enter",
|
|
28
|
+
.bind("Enter", this.ezPopupAction.emit.bind("OK"))
|
|
29
29
|
.bind("Escape", () => this.closePopup())
|
|
30
30
|
.bind("Esc", () => this.closePopup());
|
|
31
31
|
}
|
|
@@ -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
|
***************/
|
|
@@ -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 =
|
|
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
|
|
54
|
-
|
|
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 &&
|
|
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() {
|
|
@@ -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
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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,7 +460,7 @@ 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
466
|
controlEmptySearch() {
|
|
@@ -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--
|
|
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(--
|
|
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
|
|
51
|
-
|
|
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
|
}
|