@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.
- package/dist/cjs/DataBinder-aff1dcc7.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-card-item_3.cjs.entry.js +12 -19
- package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
- package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
- package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
- package/dist/cjs/ez-dialog.cjs.entry.js +9 -1
- package/dist/cjs/ez-form.cjs.entry.js +3 -324
- package/dist/cjs/ez-grid.cjs.entry.js +254 -62
- package/dist/cjs/ez-list.cjs.entry.js +151 -100
- package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +2 -9
- package/dist/cjs/ez-search.cjs.entry.js +28 -12
- package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
- package/dist/cjs/ez-text-input.cjs.entry.js +8 -3
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
- 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-grid/controller/ag-grid/AgGridController.js +52 -14
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +166 -45
- 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 +83 -1
- 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-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.css +2 -6
- package/dist/collection/components/ez-popup/ez-popup.js +3 -10
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +55 -14
- 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 +27 -53
- package/dist/collection/components/ez-text-input/ez-text-input.js +25 -2
- 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/form/DataBinder.js +18 -3
- package/dist/custom-elements/index.js +663 -237
- package/dist/esm/DataBinder-bd240826.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-card-item_3.entry.js +12 -19
- package/dist/esm/ez-combo-box.entry.js +47 -11
- package/dist/esm/ez-date-input.entry.js +8 -2
- package/dist/esm/ez-date-time-input.entry.js +8 -2
- package/dist/esm/ez-dialog.entry.js +9 -1
- package/dist/esm/ez-form.entry.js +2 -323
- package/dist/esm/ez-grid.entry.js +253 -61
- package/dist/esm/ez-list.entry.js +152 -101
- package/dist/esm/ez-number-input.entry.js +7 -0
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +2 -9
- package/dist/esm/ez-search.entry.js +28 -12
- package/dist/esm/ez-text-area.entry.js +66 -4
- package/dist/esm/ez-text-input.entry.js +8 -3
- package/dist/esm/ez-time-input.entry.js +6 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-03a2c7d1.entry.js +1 -0
- package/dist/ezui/p-0a75bb05.entry.js +1 -0
- package/dist/ezui/p-0db68715.entry.js +1 -0
- package/dist/ezui/p-19098a3f.entry.js +1 -0
- package/dist/ezui/p-1f830a2f.entry.js +1 -0
- package/dist/ezui/p-3dd919b7.entry.js +1 -0
- package/dist/ezui/p-7bfae0fc.entry.js +1 -0
- package/dist/ezui/p-81f06699.js +1 -0
- package/dist/ezui/p-97af4b13.entry.js +1 -0
- package/dist/ezui/p-9ceefe4d.entry.js +1 -0
- package/dist/ezui/p-a80b1287.entry.js +1 -0
- package/dist/ezui/{p-c3c3d640.entry.js → p-b0a5c2cd.entry.js} +2 -2
- package/dist/ezui/p-b54e17d2.entry.js +1 -0
- package/dist/ezui/p-bfad39eb.entry.js +1 -0
- package/dist/ezui/p-d0ca26fe.entry.js +1 -0
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/p-ffd246f5.entry.js +1 -0
- 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-grid/controller/EzGridController.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +18 -6
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +10 -0
- package/dist/types/components/ez-list/ez-list.d.ts +3 -26
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +2 -2
- package/dist/types/components/ez-search/ez-search.d.ts +6 -1
- 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 +4 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +101 -44
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
- package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
- package/dist/ezui/p-188f1c4c.entry.js +0 -1
- package/dist/ezui/p-25ac5376.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-62732269.entry.js +0 -1
- package/dist/ezui/p-86b6aa01.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-bcd47eda.entry.js +0 -1
- package/dist/ezui/p-d2c06f38.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,4 +1,4 @@
|
|
|
1
|
-
import { ElementIDUtils, FloatingManager, ObjectUtils } from "@sankhyalabs/core";
|
|
1
|
+
import { ElementIDUtils, FloatingManager, ObjectUtils, StringUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { h, Host } from "@stencil/core";
|
|
3
3
|
import { CSSVarsUtils } from "../../utils";
|
|
4
4
|
export class EzComboBox {
|
|
@@ -25,12 +25,13 @@ export class EzComboBox {
|
|
|
25
25
|
this.suppressSearch = false;
|
|
26
26
|
this.optionLoader = undefined;
|
|
27
27
|
this.suppressEmptyOption = false;
|
|
28
|
-
this.stopPropagateEnterKeyEvent =
|
|
28
|
+
this.stopPropagateEnterKeyEvent = true;
|
|
29
29
|
this.canShowError = true;
|
|
30
30
|
this.mode = "regular";
|
|
31
31
|
this.hideErrorOnFocusOut = true;
|
|
32
32
|
this.listOptionsPosition = undefined;
|
|
33
33
|
this.isTextSearch = false;
|
|
34
|
+
this.autoFocus = false;
|
|
34
35
|
}
|
|
35
36
|
observeErrorMessage() {
|
|
36
37
|
var _a;
|
|
@@ -93,9 +94,9 @@ export class EzComboBox {
|
|
|
93
94
|
/**
|
|
94
95
|
* Aplica o foco no campo.
|
|
95
96
|
*/
|
|
96
|
-
async setFocus() {
|
|
97
|
+
async setFocus(options) {
|
|
97
98
|
if (this._textInput) {
|
|
98
|
-
this._textInput.setFocus();
|
|
99
|
+
this._textInput.setFocus(options);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
@@ -255,11 +256,15 @@ export class EzComboBox {
|
|
|
255
256
|
: undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
|
|
256
257
|
}
|
|
257
258
|
showOptions() {
|
|
259
|
+
var _a, _b;
|
|
258
260
|
if (!this.enabled)
|
|
259
261
|
return;
|
|
260
262
|
if (this.isOptionsVisible()) {
|
|
261
263
|
return;
|
|
262
264
|
}
|
|
265
|
+
const valueString = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value;
|
|
266
|
+
const indexValue = this._visibleOptions.findIndex(option => option.value === valueString);
|
|
267
|
+
this._preSelection = indexValue === -1 ? 0 : indexValue;
|
|
263
268
|
if (!!this._resizeObserver)
|
|
264
269
|
this._resizeObserver.observe(this._textInput);
|
|
265
270
|
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
|
|
@@ -301,11 +306,26 @@ export class EzComboBox {
|
|
|
301
306
|
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
302
307
|
});
|
|
303
308
|
}
|
|
304
|
-
selectCurrentOption() {
|
|
309
|
+
selectCurrentOption(focusOnInput = true) {
|
|
305
310
|
if (this._preSelection !== undefined) {
|
|
306
|
-
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
311
|
+
this.selectOption(this._visibleOptions[this._preSelection], focusOnInput);
|
|
307
312
|
this._preSelection = undefined;
|
|
308
313
|
}
|
|
314
|
+
else {
|
|
315
|
+
this.controlListWithOnlyOne(focusOnInput);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
controlListWithOnlyOne(focusOnInput = true) {
|
|
319
|
+
var _a;
|
|
320
|
+
const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
|
|
321
|
+
if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
|
|
322
|
+
let title = StringUtils.decodeHtmlEntities(source[0].label);
|
|
323
|
+
const option = {
|
|
324
|
+
value: source[0].value,
|
|
325
|
+
label: title,
|
|
326
|
+
};
|
|
327
|
+
this.selectOption(option, focusOnInput);
|
|
328
|
+
}
|
|
309
329
|
}
|
|
310
330
|
updateSource(source) {
|
|
311
331
|
this._startLoading = false;
|
|
@@ -331,7 +351,7 @@ export class EzComboBox {
|
|
|
331
351
|
}
|
|
332
352
|
}
|
|
333
353
|
}
|
|
334
|
-
selectOption(newOption) {
|
|
354
|
+
selectOption(newOption, focusOnInput = true) {
|
|
335
355
|
var _a, _b;
|
|
336
356
|
const currentValue = this.getSelectedOption(this.value);
|
|
337
357
|
if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
|
|
@@ -342,6 +362,11 @@ export class EzComboBox {
|
|
|
342
362
|
else {
|
|
343
363
|
this.resetOptions();
|
|
344
364
|
}
|
|
365
|
+
if (focusOnInput) {
|
|
366
|
+
setTimeout(() => {
|
|
367
|
+
this.setFocus();
|
|
368
|
+
}, 0);
|
|
369
|
+
}
|
|
345
370
|
}
|
|
346
371
|
loadOptions(mode, argument = "") {
|
|
347
372
|
this._criteria = argument;
|
|
@@ -425,6 +450,11 @@ export class EzComboBox {
|
|
|
425
450
|
}
|
|
426
451
|
});
|
|
427
452
|
});
|
|
453
|
+
if (this.autoFocus) {
|
|
454
|
+
requestAnimationFrame(() => {
|
|
455
|
+
this.setFocus({ selectText: true });
|
|
456
|
+
});
|
|
457
|
+
}
|
|
428
458
|
}
|
|
429
459
|
//---------------------------------------------
|
|
430
460
|
// Event handlers
|
|
@@ -479,18 +509,24 @@ export class EzComboBox {
|
|
|
479
509
|
}
|
|
480
510
|
switch (event.key) {
|
|
481
511
|
case "ArrowDown":
|
|
512
|
+
event.stopPropagation();
|
|
513
|
+
if (this.canShowListOptions())
|
|
514
|
+
event.preventDefault();
|
|
482
515
|
this.showOptions();
|
|
483
516
|
this.nextOption();
|
|
484
|
-
event.stopPropagation();
|
|
485
517
|
break;
|
|
486
518
|
case "ArrowUp":
|
|
519
|
+
event.stopPropagation();
|
|
520
|
+
if (this.canShowListOptions())
|
|
521
|
+
event.preventDefault();
|
|
487
522
|
this.showOptions();
|
|
488
523
|
this.previousOption();
|
|
489
|
-
event.stopPropagation();
|
|
490
524
|
break;
|
|
491
525
|
case "Enter":
|
|
492
526
|
this.handleEventPropagation(event);
|
|
493
|
-
this.
|
|
527
|
+
if (this.isOptionsVisible()) {
|
|
528
|
+
this.selectCurrentOption();
|
|
529
|
+
}
|
|
494
530
|
break;
|
|
495
531
|
case "Escape":
|
|
496
532
|
if (this.isOptionsVisible()) {
|
|
@@ -502,7 +538,7 @@ export class EzComboBox {
|
|
|
502
538
|
case "Tab":
|
|
503
539
|
this._tabPressed = true;
|
|
504
540
|
if (this.isOptionsVisible()) {
|
|
505
|
-
this.selectCurrentOption();
|
|
541
|
+
this.selectCurrentOption(false);
|
|
506
542
|
}
|
|
507
543
|
this.resetOptions();
|
|
508
544
|
break;
|
|
@@ -778,7 +814,7 @@ export class EzComboBox {
|
|
|
778
814
|
},
|
|
779
815
|
"attribute": "stop-propagate-enter-key-event",
|
|
780
816
|
"reflect": false,
|
|
781
|
-
"defaultValue": "
|
|
817
|
+
"defaultValue": "true"
|
|
782
818
|
},
|
|
783
819
|
"canShowError": {
|
|
784
820
|
"type": "boolean",
|
|
@@ -870,6 +906,24 @@ export class EzComboBox {
|
|
|
870
906
|
"attribute": "is-text-search",
|
|
871
907
|
"reflect": false,
|
|
872
908
|
"defaultValue": "false"
|
|
909
|
+
},
|
|
910
|
+
"autoFocus": {
|
|
911
|
+
"type": "boolean",
|
|
912
|
+
"mutable": false,
|
|
913
|
+
"complexType": {
|
|
914
|
+
"original": "boolean",
|
|
915
|
+
"resolved": "boolean",
|
|
916
|
+
"references": {}
|
|
917
|
+
},
|
|
918
|
+
"required": false,
|
|
919
|
+
"optional": false,
|
|
920
|
+
"docs": {
|
|
921
|
+
"tags": [],
|
|
922
|
+
"text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
|
|
923
|
+
},
|
|
924
|
+
"attribute": "auto-focus",
|
|
925
|
+
"reflect": false,
|
|
926
|
+
"defaultValue": "false"
|
|
873
927
|
}
|
|
874
928
|
};
|
|
875
929
|
}
|
|
@@ -924,11 +978,18 @@ export class EzComboBox {
|
|
|
924
978
|
},
|
|
925
979
|
"setFocus": {
|
|
926
980
|
"complexType": {
|
|
927
|
-
"signature": "() => Promise<void>",
|
|
928
|
-
"parameters": [
|
|
981
|
+
"signature": "(options?: TFocusOptions) => Promise<void>",
|
|
982
|
+
"parameters": [{
|
|
983
|
+
"tags": [],
|
|
984
|
+
"text": ""
|
|
985
|
+
}],
|
|
929
986
|
"references": {
|
|
930
987
|
"Promise": {
|
|
931
988
|
"location": "global"
|
|
989
|
+
},
|
|
990
|
+
"TFocusOptions": {
|
|
991
|
+
"location": "import",
|
|
992
|
+
"path": "../ez-text-input/ez-text-input"
|
|
932
993
|
}
|
|
933
994
|
},
|
|
934
995
|
"return": "Promise<void>"
|
|
@@ -12,6 +12,7 @@ export class EzDateInput {
|
|
|
12
12
|
this.errorMessage = undefined;
|
|
13
13
|
this.mode = "regular";
|
|
14
14
|
this.canShowError = true;
|
|
15
|
+
this.autoFocus = false;
|
|
15
16
|
}
|
|
16
17
|
observeLabel() {
|
|
17
18
|
if (this._textInput) {
|
|
@@ -48,8 +49,8 @@ export class EzDateInput {
|
|
|
48
49
|
/**
|
|
49
50
|
* Aplica o foco no campo.
|
|
50
51
|
*/
|
|
51
|
-
async setFocus() {
|
|
52
|
-
this._textInput.setFocus();
|
|
52
|
+
async setFocus(options) {
|
|
53
|
+
this._textInput.setFocus(options);
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* Remove o foco do campo.
|
|
@@ -167,6 +168,11 @@ export class EzDateInput {
|
|
|
167
168
|
componentDidLoad() {
|
|
168
169
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
169
170
|
this.setInputValue();
|
|
171
|
+
if (this.autoFocus) {
|
|
172
|
+
requestAnimationFrame(() => {
|
|
173
|
+
this.setFocus({ selectText: true });
|
|
174
|
+
});
|
|
175
|
+
}
|
|
170
176
|
}
|
|
171
177
|
render() {
|
|
172
178
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
@@ -292,6 +298,24 @@ export class EzDateInput {
|
|
|
292
298
|
"attribute": "can-show-error",
|
|
293
299
|
"reflect": true,
|
|
294
300
|
"defaultValue": "true"
|
|
301
|
+
},
|
|
302
|
+
"autoFocus": {
|
|
303
|
+
"type": "boolean",
|
|
304
|
+
"mutable": false,
|
|
305
|
+
"complexType": {
|
|
306
|
+
"original": "boolean",
|
|
307
|
+
"resolved": "boolean",
|
|
308
|
+
"references": {}
|
|
309
|
+
},
|
|
310
|
+
"required": false,
|
|
311
|
+
"optional": false,
|
|
312
|
+
"docs": {
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
|
|
315
|
+
},
|
|
316
|
+
"attribute": "auto-focus",
|
|
317
|
+
"reflect": false,
|
|
318
|
+
"defaultValue": "false"
|
|
295
319
|
}
|
|
296
320
|
};
|
|
297
321
|
}
|
|
@@ -356,11 +380,18 @@ export class EzDateInput {
|
|
|
356
380
|
return {
|
|
357
381
|
"setFocus": {
|
|
358
382
|
"complexType": {
|
|
359
|
-
"signature": "() => Promise<void>",
|
|
360
|
-
"parameters": [
|
|
383
|
+
"signature": "(options?: TFocusOptions) => Promise<void>",
|
|
384
|
+
"parameters": [{
|
|
385
|
+
"tags": [],
|
|
386
|
+
"text": ""
|
|
387
|
+
}],
|
|
361
388
|
"references": {
|
|
362
389
|
"Promise": {
|
|
363
390
|
"location": "global"
|
|
391
|
+
},
|
|
392
|
+
"TFocusOptions": {
|
|
393
|
+
"location": "import",
|
|
394
|
+
"path": "../ez-text-input/ez-text-input"
|
|
364
395
|
}
|
|
365
396
|
},
|
|
366
397
|
"return": "Promise<void>"
|
|
@@ -13,6 +13,7 @@ export class EzDateTimeInput {
|
|
|
13
13
|
this.showSeconds = false;
|
|
14
14
|
this.mode = "regular";
|
|
15
15
|
this.canShowError = true;
|
|
16
|
+
this.autoFocus = false;
|
|
16
17
|
}
|
|
17
18
|
observeLabel() {
|
|
18
19
|
if (this._textInput) {
|
|
@@ -49,8 +50,8 @@ export class EzDateTimeInput {
|
|
|
49
50
|
/**
|
|
50
51
|
* Aplica o foco no campo.
|
|
51
52
|
*/
|
|
52
|
-
async setFocus() {
|
|
53
|
-
this._textInput.setFocus();
|
|
53
|
+
async setFocus(options) {
|
|
54
|
+
this._textInput.setFocus(options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Remove o foco do campo.
|
|
@@ -217,6 +218,11 @@ export class EzDateTimeInput {
|
|
|
217
218
|
componentDidLoad() {
|
|
218
219
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
219
220
|
this.setInputValue();
|
|
221
|
+
if (this.autoFocus) {
|
|
222
|
+
requestAnimationFrame(() => {
|
|
223
|
+
this.setFocus({ selectText: true });
|
|
224
|
+
});
|
|
225
|
+
}
|
|
220
226
|
}
|
|
221
227
|
render() {
|
|
222
228
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
@@ -360,6 +366,24 @@ export class EzDateTimeInput {
|
|
|
360
366
|
"attribute": "can-show-error",
|
|
361
367
|
"reflect": true,
|
|
362
368
|
"defaultValue": "true"
|
|
369
|
+
},
|
|
370
|
+
"autoFocus": {
|
|
371
|
+
"type": "boolean",
|
|
372
|
+
"mutable": false,
|
|
373
|
+
"complexType": {
|
|
374
|
+
"original": "boolean",
|
|
375
|
+
"resolved": "boolean",
|
|
376
|
+
"references": {}
|
|
377
|
+
},
|
|
378
|
+
"required": false,
|
|
379
|
+
"optional": false,
|
|
380
|
+
"docs": {
|
|
381
|
+
"tags": [],
|
|
382
|
+
"text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
|
|
383
|
+
},
|
|
384
|
+
"attribute": "auto-focus",
|
|
385
|
+
"reflect": false,
|
|
386
|
+
"defaultValue": "false"
|
|
363
387
|
}
|
|
364
388
|
};
|
|
365
389
|
}
|
|
@@ -424,11 +448,18 @@ export class EzDateTimeInput {
|
|
|
424
448
|
return {
|
|
425
449
|
"setFocus": {
|
|
426
450
|
"complexType": {
|
|
427
|
-
"signature": "() => Promise<void>",
|
|
428
|
-
"parameters": [
|
|
451
|
+
"signature": "(options?: TFocusOptions) => Promise<void>",
|
|
452
|
+
"parameters": [{
|
|
453
|
+
"tags": [],
|
|
454
|
+
"text": ""
|
|
455
|
+
}],
|
|
429
456
|
"references": {
|
|
430
457
|
"Promise": {
|
|
431
458
|
"location": "global"
|
|
459
|
+
},
|
|
460
|
+
"TFocusOptions": {
|
|
461
|
+
"location": "import",
|
|
462
|
+
"path": "../ez-text-input/ez-text-input"
|
|
432
463
|
}
|
|
433
464
|
},
|
|
434
465
|
"return": "Promise<void>"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, forceUpdate, } from '@stencil/core';
|
|
2
2
|
import { DialogType } from "./DialogType";
|
|
3
3
|
import { ElementIDUtils, FloatingManager } from "@sankhyalabs/core";
|
|
4
|
+
import FocusResolver from '../../utils/FocusResolver';
|
|
4
5
|
class Message {
|
|
5
6
|
constructor(title, message, dialogType, confirm, icon, labelCancel, labelConfirm, btnConfirmDanger, callBack, beforeClose) {
|
|
6
7
|
this.title = title;
|
|
@@ -164,6 +165,7 @@ export class EzDialog {
|
|
|
164
165
|
const dialog = this._element.shadowRoot.querySelector('.overlay .dialog');
|
|
165
166
|
if (dialog instanceof HTMLDivElement) {
|
|
166
167
|
dialog.style.outline = 'none';
|
|
168
|
+
this._lastActiveElement = document.activeElement;
|
|
167
169
|
dialog.focus();
|
|
168
170
|
}
|
|
169
171
|
}
|
|
@@ -176,7 +178,13 @@ export class EzDialog {
|
|
|
176
178
|
focusOnPrimaryButton() {
|
|
177
179
|
const btnConfirm = this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`);
|
|
178
180
|
const buttonElement = btnConfirm === null || btnConfirm === void 0 ? void 0 : btnConfirm.shadowRoot.querySelector('button');
|
|
179
|
-
|
|
181
|
+
requestAnimationFrame(() => {
|
|
182
|
+
buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
disconnectedCallback() {
|
|
186
|
+
FocusResolver.resolveFocus(this._lastActiveElement);
|
|
187
|
+
this._lastActiveElement = undefined;
|
|
180
188
|
}
|
|
181
189
|
render() {
|
|
182
190
|
if (this.opened && this._currentMessage) {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
/*@doc Define a largura do slot direito.*/
|
|
3
|
-
--ez-filter-slot--right--width: 70px;
|
|
4
|
-
|
|
5
2
|
display: block;
|
|
6
3
|
width: 100%;
|
|
7
4
|
}
|
|
8
|
-
|
|
9
|
-
.pointerCursor {
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
ez-text-input {
|
|
14
|
-
--ez-text-input__icon--right--width: var(--ez-filter-slot--right--width)
|
|
15
|
-
}
|
|
@@ -5,16 +5,13 @@ export class EzFilterInput {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this._searchingText = "";
|
|
7
7
|
this.handleFocus = () => {
|
|
8
|
-
this.ezFocusIn.emit();
|
|
9
|
-
if (!this.asyncSearch) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
8
|
if (this._searchingText === "") {
|
|
13
9
|
this._textInput.value = "";
|
|
14
10
|
}
|
|
15
11
|
else {
|
|
16
12
|
this._textInput.value = this._searchingText;
|
|
17
13
|
}
|
|
14
|
+
this.ezFocusIn.emit();
|
|
18
15
|
};
|
|
19
16
|
this.label = undefined;
|
|
20
17
|
this.value = undefined;
|
|
@@ -24,7 +21,7 @@ export class EzFilterInput {
|
|
|
24
21
|
this.mode = "regular";
|
|
25
22
|
this.asyncSearch = false;
|
|
26
23
|
this.canShowError = true;
|
|
27
|
-
this.
|
|
24
|
+
this.autoFocus = false;
|
|
28
25
|
}
|
|
29
26
|
observeLabel() {
|
|
30
27
|
if (this._textInput) {
|
|
@@ -45,8 +42,8 @@ export class EzFilterInput {
|
|
|
45
42
|
/**
|
|
46
43
|
* Aplica o foco no campo.
|
|
47
44
|
*/
|
|
48
|
-
async setFocus() {
|
|
49
|
-
this._textInput.setFocus();
|
|
45
|
+
async setFocus(options) {
|
|
46
|
+
this._textInput.setFocus(options);
|
|
50
47
|
}
|
|
51
48
|
/**
|
|
52
49
|
* Remove o foco do campo.
|
|
@@ -86,14 +83,6 @@ export class EzFilterInput {
|
|
|
86
83
|
this._textInput.value = this.value;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Método usado para emitir o evento de clique no ícone
|
|
91
|
-
*/
|
|
92
|
-
async handleIconClick() {
|
|
93
|
-
if (this.enabledIconClick) {
|
|
94
|
-
this.ezIconClick.emit(true);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
86
|
handleChange(evt) {
|
|
98
87
|
const newValue = evt.detail;
|
|
99
88
|
this.errorMessage = "";
|
|
@@ -107,10 +96,15 @@ export class EzFilterInput {
|
|
|
107
96
|
}
|
|
108
97
|
componentDidLoad() {
|
|
109
98
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
99
|
+
if (this.autoFocus) {
|
|
100
|
+
requestAnimationFrame(() => {
|
|
101
|
+
this.setFocus({ selectText: true });
|
|
102
|
+
});
|
|
103
|
+
}
|
|
110
104
|
}
|
|
111
105
|
render() {
|
|
112
106
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
113
|
-
return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, h("ez-icon", { slot: "leftIcon", iconName: "search"
|
|
107
|
+
return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, h("ez-icon", { slot: "leftIcon", iconName: "search" })));
|
|
114
108
|
}
|
|
115
109
|
static get is() { return "ez-filter-input"; }
|
|
116
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -266,7 +260,7 @@ export class EzFilterInput {
|
|
|
266
260
|
"reflect": true,
|
|
267
261
|
"defaultValue": "true"
|
|
268
262
|
},
|
|
269
|
-
"
|
|
263
|
+
"autoFocus": {
|
|
270
264
|
"type": "boolean",
|
|
271
265
|
"mutable": false,
|
|
272
266
|
"complexType": {
|
|
@@ -278,9 +272,9 @@ export class EzFilterInput {
|
|
|
278
272
|
"optional": false,
|
|
279
273
|
"docs": {
|
|
280
274
|
"tags": [],
|
|
281
|
-
"text": "Se true
|
|
275
|
+
"text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
|
|
282
276
|
},
|
|
283
|
-
"attribute": "
|
|
277
|
+
"attribute": "auto-focus",
|
|
284
278
|
"reflect": false,
|
|
285
279
|
"defaultValue": "false"
|
|
286
280
|
}
|
|
@@ -332,32 +326,24 @@ export class EzFilterInput {
|
|
|
332
326
|
"resolved": "void",
|
|
333
327
|
"references": {}
|
|
334
328
|
}
|
|
335
|
-
}, {
|
|
336
|
-
"method": "ezIconClick",
|
|
337
|
-
"name": "ezIconClick",
|
|
338
|
-
"bubbles": true,
|
|
339
|
-
"cancelable": true,
|
|
340
|
-
"composed": true,
|
|
341
|
-
"docs": {
|
|
342
|
-
"tags": [],
|
|
343
|
-
"text": "Emitido quando tem intera\u00E7\u00E3o com o \u00CDcone de pesquisa"
|
|
344
|
-
},
|
|
345
|
-
"complexType": {
|
|
346
|
-
"original": "boolean",
|
|
347
|
-
"resolved": "boolean",
|
|
348
|
-
"references": {}
|
|
349
|
-
}
|
|
350
329
|
}];
|
|
351
330
|
}
|
|
352
331
|
static get methods() {
|
|
353
332
|
return {
|
|
354
333
|
"setFocus": {
|
|
355
334
|
"complexType": {
|
|
356
|
-
"signature": "() => Promise<void>",
|
|
357
|
-
"parameters": [
|
|
335
|
+
"signature": "(options?: TFocusOptions) => Promise<void>",
|
|
336
|
+
"parameters": [{
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": ""
|
|
339
|
+
}],
|
|
358
340
|
"references": {
|
|
359
341
|
"Promise": {
|
|
360
342
|
"location": "global"
|
|
343
|
+
},
|
|
344
|
+
"TFocusOptions": {
|
|
345
|
+
"location": "import",
|
|
346
|
+
"path": "../ez-text-input/ez-text-input"
|
|
361
347
|
}
|
|
362
348
|
},
|
|
363
349
|
"return": "Promise<void>"
|
|
@@ -433,22 +419,6 @@ export class EzFilterInput {
|
|
|
433
419
|
"text": "M\u00E9todo respons\u00E1vel por resetar o valor do campo para o ultimo valor inputado.",
|
|
434
420
|
"tags": []
|
|
435
421
|
}
|
|
436
|
-
},
|
|
437
|
-
"handleIconClick": {
|
|
438
|
-
"complexType": {
|
|
439
|
-
"signature": "() => Promise<void>",
|
|
440
|
-
"parameters": [],
|
|
441
|
-
"references": {
|
|
442
|
-
"Promise": {
|
|
443
|
-
"location": "global"
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
"return": "Promise<void>"
|
|
447
|
-
},
|
|
448
|
-
"docs": {
|
|
449
|
-
"text": "M\u00E9todo usado para emitir o evento de clique no \u00EDcone",
|
|
450
|
-
"tags": []
|
|
451
|
-
}
|
|
452
422
|
}
|
|
453
423
|
};
|
|
454
424
|
}
|