@sankhyalabs/ezui 5.10.8 → 5.11.0-dev.10
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/README.md +8 -11
- package/dist/cjs/{CSSVarsUtils-af809e73.js → CSSVarsUtils-b136a156.js} +5 -0
- package/dist/cjs/RecordValidationProcessor-edd23705.js +102 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +34 -5
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +99 -16
- package/dist/cjs/ez-date-input.cjs.entry.js +53 -22
- package/dist/cjs/ez-date-time-input.cjs.entry.js +53 -19
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +42 -1
- package/dist/cjs/ez-form.cjs.entry.js +11 -84
- package/dist/cjs/ez-grid.cjs.entry.js +575 -44
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +39 -15
- package/dist/cjs/ez-search.cjs.entry.js +13 -2
- package/dist/cjs/ez-text-area.cjs.entry.js +6 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +7 -4
- package/dist/cjs/ez-time-input.cjs.entry.js +11 -7
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +30 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/ez-calendar/ez-calendar.js +63 -6
- package/dist/collection/components/ez-card-item/ez-card-item.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +6 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +168 -14
- package/dist/collection/components/ez-date-input/ez-date-input.js +71 -21
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +71 -18
- package/dist/collection/components/ez-form/ez-form.js +20 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
- package/dist/collection/components/ez-form-view/structure/index.js +34 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +41 -8
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +230 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +49 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.js +10 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.js +4 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +38 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +20 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +15 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +41 -0
- package/dist/collection/components/ez-grid/ez-grid.js +78 -39
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +62 -15
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +84 -1
- package/dist/collection/components/ez-text-area/ez-text-area.css +4 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
- package/dist/collection/components/ez-text-input/ez-text-input.css +8 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +14 -5
- package/dist/collection/components/ez-time-input/ez-time-input.css +4 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +18 -7
- package/dist/collection/utils/CSSVarsUtils.js +5 -0
- package/dist/collection/utils/form/DataBinder.js +8 -63
- package/dist/collection/utils/form/FormMetadata.js +3 -22
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +21 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationResult.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationSource.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +74 -0
- package/dist/custom-elements/index.js +1101 -256
- package/dist/esm/{CSSVarsUtils-00f67f32.js → CSSVarsUtils-a97cfa29.js} +5 -0
- package/dist/esm/RecordValidationProcessor-abc814af.js +99 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +35 -6
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +99 -16
- package/dist/esm/ez-date-input.entry.js +53 -22
- package/dist/esm/ez-date-time-input.entry.js +53 -19
- package/dist/esm/ez-filter-input_2.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +42 -1
- package/dist/esm/ez-form.entry.js +12 -85
- package/dist/esm/ez-grid.entry.js +576 -45
- package/dist/esm/ez-multi-selection-list.entry.js +3 -1
- package/dist/esm/ez-number-input.entry.js +39 -15
- package/dist/esm/ez-search.entry.js +13 -2
- package/dist/esm/ez-text-area.entry.js +6 -2
- package/dist/esm/ez-text-input.entry.js +7 -4
- package/dist/esm/ez-time-input.entry.js +11 -7
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +30 -7
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-028f264f.entry.js +1 -0
- package/dist/ezui/p-061f4d73.entry.js +1 -0
- package/dist/ezui/p-25562cf8.entry.js +1 -0
- package/dist/ezui/p-3078d25c.entry.js +1 -0
- package/dist/ezui/p-391de0e4.entry.js +1 -0
- package/dist/ezui/{p-68352e41.entry.js → p-47afb974.entry.js} +1 -1
- package/dist/ezui/p-5cef0264.entry.js +1 -0
- package/dist/ezui/p-5e55a42b.entry.js +1 -0
- package/dist/ezui/p-7526f2b6.entry.js +1 -0
- package/dist/ezui/p-7eb3e1a5.js +1 -0
- package/dist/ezui/p-86a2036d.js +1 -0
- package/dist/ezui/{p-12303d2e.entry.js → p-87e85160.entry.js} +1 -1
- package/dist/ezui/{p-c7a23be9.entry.js → p-964e5571.entry.js} +2 -2
- package/dist/ezui/p-ce035beb.entry.js +1 -0
- package/dist/ezui/p-d43b22f3.entry.js +1 -0
- package/dist/ezui/p-df93558d.entry.js +1 -0
- package/dist/ezui/p-e2dfd935.entry.js +1 -0
- package/dist/ezui/p-e67d0bd5.entry.js +1 -0
- package/dist/ezui/{p-f1a537e3.entry.js → p-ff82b176.entry.js} +1 -1
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +9 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +23 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +4 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +4 -0
- package/dist/types/components/ez-form/ez-form.d.ts +5 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
- package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +2 -14
- package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +18 -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 +38 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.d.ts +9 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.d.ts +5 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +16 -5
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +5 -1
- package/dist/types/components/ez-search/ez-search.d.ts +14 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -1
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +2 -1
- package/dist/types/components.d.ts +116 -6
- package/dist/types/utils/form/DataBinder.d.ts +1 -3
- package/dist/types/utils/form/interfaces/IFormConfig.d.ts +1 -1
- package/dist/types/utils/form/interfaces/index.d.ts +4 -4
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +17 -0
- package/dist/types/utils/{form/interfaces → interfaces}/IFieldConfig.d.ts +2 -2
- package/dist/types/utils/validators/recordvalidator/IValidationSource.d.ts +6 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +13 -0
- package/package.json +3 -3
- package/dist/ezui/p-00c7c25d.entry.js +0 -1
- package/dist/ezui/p-0b160fec.entry.js +0 -1
- package/dist/ezui/p-0bd54a6f.entry.js +0 -1
- package/dist/ezui/p-2a0e1679.entry.js +0 -1
- package/dist/ezui/p-39153935.entry.js +0 -1
- package/dist/ezui/p-4a5e37a7.js +0 -1
- package/dist/ezui/p-4c8b029b.entry.js +0 -1
- package/dist/ezui/p-4e31b69b.entry.js +0 -1
- package/dist/ezui/p-5782443e.entry.js +0 -1
- package/dist/ezui/p-5d45e384.entry.js +0 -1
- package/dist/ezui/p-70ea4beb.entry.js +0 -1
- package/dist/ezui/p-78a6e049.entry.js +0 -1
- package/dist/ezui/p-8bcb197f.entry.js +0 -1
- package/dist/ezui/p-a4c9f3c4.entry.js +0 -1
- /package/dist/collection/{utils/form/interfaces/IFieldConfig.js → components/ez-grid/controller/ag-grid/editor/IUICellEditor.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IInvalidField.js → interfaces/IFieldConfig.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IRecordValidator.js → validators/recordvalidator/IInvalidField.js} +0 -0
- /package/dist/collection/utils/{form/interfaces/IValidationResult.js → validators/recordvalidator/IRecordValidator.js} +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IInvalidField.d.ts +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IRecordValidator.d.ts +0 -0
- /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IValidationResult.d.ts +0 -0
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"./components/ez-breadcrumb/ez-breadcrumb.js",
|
|
7
7
|
"./components/ez-card-item/ez-card-item.js",
|
|
8
8
|
"./components/ez-list/ez-list.js",
|
|
9
|
+
"./components/ez-text-input/ez-text-input.js",
|
|
10
|
+
"./components/ez-popover/ez-popover.js",
|
|
9
11
|
"./components/ez-radio-button/ez-radio-button.js",
|
|
10
12
|
"./components/ez-tabselector/ez-tabselector.js",
|
|
11
13
|
"./components/ez-text-edit/ez-text-edit.js",
|
|
@@ -35,14 +37,12 @@
|
|
|
35
37
|
"./components/ez-multi-selection-list/ez-multi-selection-list.js",
|
|
36
38
|
"./components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js",
|
|
37
39
|
"./components/ez-number-input/ez-number-input.js",
|
|
38
|
-
"./components/ez-popover/ez-popover.js",
|
|
39
40
|
"./components/ez-popup/ez-popup.js",
|
|
40
41
|
"./components/ez-scroller/ez-scroller.js",
|
|
41
42
|
"./components/ez-search/ez-search.js",
|
|
42
43
|
"./components/ez-sidebar-button/ez-sidebar-button.js",
|
|
43
44
|
"./components/ez-skeleton/ez-skeleton.js",
|
|
44
45
|
"./components/ez-text-area/ez-text-area.js",
|
|
45
|
-
"./components/ez-text-input/ez-text-input.js",
|
|
46
46
|
"./components/ez-time-input/ez-time-input.js",
|
|
47
47
|
"./components/ez-toast/ez-toast.js",
|
|
48
48
|
"./components/ez-tree/ez-tree.js",
|
|
@@ -19,15 +19,24 @@ export class EzCalendar {
|
|
|
19
19
|
*/
|
|
20
20
|
async show(top, left, bottom, right) {
|
|
21
21
|
if (this.floating) {
|
|
22
|
-
this._floatingID = FloatingManager.float(this._box, this._container, {
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
this._floatingID = FloatingManager.float(this._box, this._container, {
|
|
23
|
+
isFixed: this.isFixed(),
|
|
24
|
+
autoClose: true,
|
|
25
|
+
top,
|
|
26
|
+
left,
|
|
27
|
+
bottom,
|
|
28
|
+
right
|
|
25
29
|
});
|
|
26
|
-
this.
|
|
30
|
+
if (!this.isFixed()) {
|
|
31
|
+
window.requestAnimationFrame(() => {
|
|
32
|
+
this._box.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
33
|
+
});
|
|
34
|
+
this.scroll();
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
30
|
-
* Ajusta o posicionamento do ez-calendar conforme a disponibilidade de espaço.
|
|
39
|
+
* Ajusta o posicionamento vertical do ez-calendar conforme a disponibilidade de espaço.
|
|
31
40
|
*/
|
|
32
41
|
async fitVertical(topOffset, bottomOffset) {
|
|
33
42
|
const neededHeight = this._container.getBoundingClientRect().bottom + this._calendarHeight;
|
|
@@ -39,6 +48,16 @@ export class EzCalendar {
|
|
|
39
48
|
this.show("unset", undefined, bottomOffset + "px");
|
|
40
49
|
}
|
|
41
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Ajusta o posicionamento horizontal do ez-calendar conforme a disponibilidade de espaço.
|
|
53
|
+
*/
|
|
54
|
+
async fitHorizontal(rightOffset) {
|
|
55
|
+
const neededWidth = this._container.getBoundingClientRect().right + this._calendarWidth;
|
|
56
|
+
const availableRight = (window.innerWidth || document.documentElement.clientWidth) > neededWidth;
|
|
57
|
+
if (!availableRight) {
|
|
58
|
+
this.show(undefined, "unset", undefined, rightOffset + "px");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
42
61
|
/**
|
|
43
62
|
* Oculta o ez-calendar.
|
|
44
63
|
*/
|
|
@@ -54,6 +73,14 @@ export class EzCalendar {
|
|
|
54
73
|
this._currentPosition.setDate(1);
|
|
55
74
|
}
|
|
56
75
|
}
|
|
76
|
+
scrollListener() {
|
|
77
|
+
if (this.floating && this.isFixed()) {
|
|
78
|
+
this.hide();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
isFixed() {
|
|
82
|
+
return this._hostElem.dataset.isFixed === "true";
|
|
83
|
+
}
|
|
57
84
|
getMonthLabel() {
|
|
58
85
|
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
59
86
|
}
|
|
@@ -118,6 +145,7 @@ export class EzCalendar {
|
|
|
118
145
|
componentDidRender() {
|
|
119
146
|
if (this.floating && this._firstRender) {
|
|
120
147
|
this._calendarHeight = this._box.clientHeight;
|
|
148
|
+
this._calendarWidth = this._box.clientWidth;
|
|
121
149
|
this._box.remove();
|
|
122
150
|
this._firstRender = false;
|
|
123
151
|
}
|
|
@@ -351,7 +379,26 @@ export class EzCalendar {
|
|
|
351
379
|
"return": "Promise<void>"
|
|
352
380
|
},
|
|
353
381
|
"docs": {
|
|
354
|
-
"text": "Ajusta o posicionamento do ez-calendar conforme a disponibilidade de espa\u00E7o.",
|
|
382
|
+
"text": "Ajusta o posicionamento vertical do ez-calendar conforme a disponibilidade de espa\u00E7o.",
|
|
383
|
+
"tags": []
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"fitHorizontal": {
|
|
387
|
+
"complexType": {
|
|
388
|
+
"signature": "(rightOffset: number) => Promise<void>",
|
|
389
|
+
"parameters": [{
|
|
390
|
+
"tags": [],
|
|
391
|
+
"text": ""
|
|
392
|
+
}],
|
|
393
|
+
"references": {
|
|
394
|
+
"Promise": {
|
|
395
|
+
"location": "global"
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"return": "Promise<void>"
|
|
399
|
+
},
|
|
400
|
+
"docs": {
|
|
401
|
+
"text": "Ajusta o posicionamento horizontal do ez-calendar conforme a disponibilidade de espa\u00E7o.",
|
|
355
402
|
"tags": []
|
|
356
403
|
}
|
|
357
404
|
},
|
|
@@ -373,10 +420,20 @@ export class EzCalendar {
|
|
|
373
420
|
}
|
|
374
421
|
};
|
|
375
422
|
}
|
|
423
|
+
static get elementRef() { return "_hostElem"; }
|
|
376
424
|
static get watchers() {
|
|
377
425
|
return [{
|
|
378
426
|
"propName": "value",
|
|
379
427
|
"methodName": "observeValue"
|
|
380
428
|
}];
|
|
381
429
|
}
|
|
430
|
+
static get listeners() {
|
|
431
|
+
return [{
|
|
432
|
+
"name": "scroll",
|
|
433
|
+
"method": "scrollListener",
|
|
434
|
+
"target": "window",
|
|
435
|
+
"capture": true,
|
|
436
|
+
"passive": true
|
|
437
|
+
}];
|
|
438
|
+
}
|
|
382
439
|
}
|
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
--ez-combo-box__list-text--primary: var(--text--primary, #626e82);
|
|
65
65
|
/*@doc Define a altura do box da lista de opções.*/
|
|
66
66
|
--ez-combo-box__list-height: calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);
|
|
67
|
+
/*@doc Define a largura mínima da lista de opções.*/
|
|
68
|
+
--ez-combo-box__list-min-width: 64px;
|
|
67
69
|
|
|
68
70
|
/* espaçamento */
|
|
69
71
|
/*@doc Define um espaçamento mediano entre elementos do componente.*/
|
|
@@ -112,6 +114,10 @@ ez-icon {
|
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
.list-container {
|
|
117
|
+
/*public*/
|
|
118
|
+
min-width: var(--ez-combo-box__list-min-width);
|
|
119
|
+
|
|
120
|
+
/*private*/
|
|
115
121
|
position: relative;
|
|
116
122
|
width: 100%;
|
|
117
123
|
}
|
|
@@ -30,6 +30,9 @@ export class EzComboBox {
|
|
|
30
30
|
this.suppressEmptyOption = false;
|
|
31
31
|
this.canShowError = true;
|
|
32
32
|
this.mode = "regular";
|
|
33
|
+
this.hideErrorOnFocusOut = true;
|
|
34
|
+
this.listOptionsPosition = undefined;
|
|
35
|
+
this.isTextSearch = false;
|
|
33
36
|
}
|
|
34
37
|
observeErrorMessage() {
|
|
35
38
|
var _a;
|
|
@@ -72,17 +75,38 @@ export class EzComboBox {
|
|
|
72
75
|
return;
|
|
73
76
|
this.loadOptions(SearchMode.PRELOAD);
|
|
74
77
|
}
|
|
78
|
+
/*
|
|
79
|
+
* Retorna uma promise com o valor da opção selecionada,
|
|
80
|
+
* que será resolvida quando o backend devolver este dado.
|
|
81
|
+
*/
|
|
82
|
+
async getValueAsync() {
|
|
83
|
+
if (!this._showLoading) {
|
|
84
|
+
return new Promise(resolve => resolve(this.value));
|
|
85
|
+
}
|
|
86
|
+
return new Promise(resolve => {
|
|
87
|
+
let id = setInterval(() => {
|
|
88
|
+
if (!this._showLoading) {
|
|
89
|
+
clearInterval(id);
|
|
90
|
+
resolve(this.value);
|
|
91
|
+
}
|
|
92
|
+
}, 100);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
75
95
|
/**
|
|
76
96
|
* Aplica o foco no campo.
|
|
77
97
|
*/
|
|
78
98
|
async setFocus() {
|
|
79
|
-
this._textInput
|
|
99
|
+
if (this._textInput) {
|
|
100
|
+
this._textInput.setFocus();
|
|
101
|
+
}
|
|
80
102
|
}
|
|
81
103
|
/**
|
|
82
104
|
* Remove o foco do campo.
|
|
83
105
|
*/
|
|
84
106
|
async setBlur() {
|
|
85
|
-
this._textInput
|
|
107
|
+
if (this._textInput) {
|
|
108
|
+
this._textInput.setBlur();
|
|
109
|
+
}
|
|
86
110
|
}
|
|
87
111
|
/**
|
|
88
112
|
* Retorna se o conteúdo é inválido.
|
|
@@ -97,16 +121,61 @@ export class EzComboBox {
|
|
|
97
121
|
this.clearSearch();
|
|
98
122
|
}
|
|
99
123
|
scrollListener() {
|
|
100
|
-
|
|
124
|
+
var _a;
|
|
125
|
+
if (this._floatingID == undefined) {
|
|
101
126
|
return;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
}
|
|
128
|
+
if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
|
|
129
|
+
this.hideOptions();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
window.requestAnimationFrame(() => {
|
|
133
|
+
this.updateListPosition();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
105
136
|
}
|
|
106
137
|
updateListPosition() {
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
this.
|
|
138
|
+
let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
|
|
139
|
+
const elementRect = this._listWrapper.getBoundingClientRect();
|
|
140
|
+
const containerRect = this._listContainer.getBoundingClientRect();
|
|
141
|
+
const textInputRect = this._textInput.getBoundingClientRect();
|
|
142
|
+
const limitHeight = bottomLimit || window.innerHeight;
|
|
143
|
+
const neededHeight = containerRect.bottom + elementRect.height;
|
|
144
|
+
if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
|
|
145
|
+
fromBottom = true;
|
|
146
|
+
}
|
|
147
|
+
if (!hardPosition) {
|
|
148
|
+
verticalPosition = verticalPosition || 0;
|
|
149
|
+
horizontalPosition = horizontalPosition || 0;
|
|
150
|
+
if (fromBottom) {
|
|
151
|
+
verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
verticalPosition += containerRect.top;
|
|
155
|
+
}
|
|
156
|
+
if (fromRight) {
|
|
157
|
+
horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
horizontalPosition += containerRect.left;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (verticalPosition != undefined) {
|
|
164
|
+
this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
|
|
165
|
+
this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
|
|
166
|
+
}
|
|
167
|
+
if (horizontalPosition != undefined) {
|
|
168
|
+
this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
|
|
169
|
+
this._listWrapper.style[fromRight ? "left" : "right"] = "";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
getListPosition() {
|
|
173
|
+
if (this.listOptionsPosition) {
|
|
174
|
+
return this.listOptionsPosition;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
verticalPosition: (this.errorMessage || !this.canShowError || this.mode === "slim") ? 6 : -13
|
|
178
|
+
};
|
|
110
179
|
}
|
|
111
180
|
isDifferentValues(firstValue, secondValue) {
|
|
112
181
|
return ObjectUtils.objectToString(firstValue || {}) !== ObjectUtils.objectToString(secondValue || {});
|
|
@@ -189,13 +258,18 @@ export class EzComboBox {
|
|
|
189
258
|
showOptions() {
|
|
190
259
|
if (!this.enabled)
|
|
191
260
|
return;
|
|
261
|
+
if (this.isOptionsVisible()) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
192
264
|
if (!!this._resizeObserver)
|
|
193
265
|
this._resizeObserver.observe(this._textInput);
|
|
194
|
-
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true });
|
|
266
|
+
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
|
|
195
267
|
this.setFocus();
|
|
196
268
|
window.requestAnimationFrame(() => {
|
|
197
269
|
this.updateListPosition();
|
|
198
|
-
this.
|
|
270
|
+
if (!this.listOptionsPosition) {
|
|
271
|
+
this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
272
|
+
}
|
|
199
273
|
});
|
|
200
274
|
}
|
|
201
275
|
hideOptions() {
|
|
@@ -225,7 +299,7 @@ export class EzComboBox {
|
|
|
225
299
|
window.requestAnimationFrame(() => {
|
|
226
300
|
const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`li#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
|
|
227
301
|
if (liElem)
|
|
228
|
-
liElem.scrollIntoView({ behavior: "smooth", block: "nearest"
|
|
302
|
+
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
229
303
|
});
|
|
230
304
|
}
|
|
231
305
|
selectCurrentOption() {
|
|
@@ -465,6 +539,12 @@ export class EzComboBox {
|
|
|
465
539
|
handlerIconClick() {
|
|
466
540
|
this.searchMode ? this.loadOptions(SearchMode.ADVANCED) : this.showOptions();
|
|
467
541
|
}
|
|
542
|
+
buildNumberArgument(argument) {
|
|
543
|
+
if (this.isTextSearch) {
|
|
544
|
+
return NaN;
|
|
545
|
+
}
|
|
546
|
+
return Number(argument || undefined);
|
|
547
|
+
}
|
|
468
548
|
onTextInputChangeHandler(event) {
|
|
469
549
|
var _a;
|
|
470
550
|
this.clearDeboucingTimeout();
|
|
@@ -475,7 +555,7 @@ export class EzComboBox {
|
|
|
475
555
|
return;
|
|
476
556
|
}
|
|
477
557
|
const argument = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
|
|
478
|
-
const argumentNumber =
|
|
558
|
+
const argumentNumber = this.buildNumberArgument(argument);
|
|
479
559
|
if (!this._criteria) {
|
|
480
560
|
this._textInput.value = event.data || argument;
|
|
481
561
|
}
|
|
@@ -538,9 +618,11 @@ export class EzComboBox {
|
|
|
538
618
|
switch (event.key) {
|
|
539
619
|
case "ArrowDown":
|
|
540
620
|
this.nextOption();
|
|
621
|
+
event.stopPropagation();
|
|
541
622
|
break;
|
|
542
623
|
case "ArrowUp":
|
|
543
624
|
this.previousOption();
|
|
625
|
+
event.stopPropagation();
|
|
544
626
|
break;
|
|
545
627
|
case "Enter":
|
|
546
628
|
this.selectCurrentOption();
|
|
@@ -560,7 +642,8 @@ export class EzComboBox {
|
|
|
560
642
|
//event.stopPropagation();
|
|
561
643
|
}
|
|
562
644
|
onTextInputFocusOutHandler() {
|
|
563
|
-
this.
|
|
645
|
+
if (this.hideErrorOnFocusOut)
|
|
646
|
+
this.cancelPreselection();
|
|
564
647
|
}
|
|
565
648
|
canShowListOptions() {
|
|
566
649
|
return !this._showLoading && this._visibleOptions.length > 0;
|
|
@@ -838,6 +921,61 @@ export class EzComboBox {
|
|
|
838
921
|
"attribute": "mode",
|
|
839
922
|
"reflect": true,
|
|
840
923
|
"defaultValue": "\"regular\""
|
|
924
|
+
},
|
|
925
|
+
"hideErrorOnFocusOut": {
|
|
926
|
+
"type": "boolean",
|
|
927
|
+
"mutable": false,
|
|
928
|
+
"complexType": {
|
|
929
|
+
"original": "boolean",
|
|
930
|
+
"resolved": "boolean",
|
|
931
|
+
"references": {}
|
|
932
|
+
},
|
|
933
|
+
"required": false,
|
|
934
|
+
"optional": false,
|
|
935
|
+
"docs": {
|
|
936
|
+
"tags": [],
|
|
937
|
+
"text": "Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente."
|
|
938
|
+
},
|
|
939
|
+
"attribute": "hide-error-on-focus-out",
|
|
940
|
+
"reflect": false,
|
|
941
|
+
"defaultValue": "true"
|
|
942
|
+
},
|
|
943
|
+
"listOptionsPosition": {
|
|
944
|
+
"type": "unknown",
|
|
945
|
+
"mutable": false,
|
|
946
|
+
"complexType": {
|
|
947
|
+
"original": "IEzCheckBoxListPosition",
|
|
948
|
+
"resolved": "IEzCheckBoxListPosition",
|
|
949
|
+
"references": {
|
|
950
|
+
"IEzCheckBoxListPosition": {
|
|
951
|
+
"location": "local"
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
"required": false,
|
|
956
|
+
"optional": false,
|
|
957
|
+
"docs": {
|
|
958
|
+
"tags": [],
|
|
959
|
+
"text": "Define um posicionamento fixo para a lista de op\u00E7\u00F5es do CheckBox."
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
"isTextSearch": {
|
|
963
|
+
"type": "boolean",
|
|
964
|
+
"mutable": false,
|
|
965
|
+
"complexType": {
|
|
966
|
+
"original": "boolean",
|
|
967
|
+
"resolved": "boolean",
|
|
968
|
+
"references": {}
|
|
969
|
+
},
|
|
970
|
+
"required": false,
|
|
971
|
+
"optional": false,
|
|
972
|
+
"docs": {
|
|
973
|
+
"tags": [],
|
|
974
|
+
"text": "Informa se a pesquisa \u00E9 do tipo texto."
|
|
975
|
+
},
|
|
976
|
+
"attribute": "is-text-search",
|
|
977
|
+
"reflect": false,
|
|
978
|
+
"defaultValue": "false"
|
|
841
979
|
}
|
|
842
980
|
};
|
|
843
981
|
}
|
|
@@ -874,6 +1012,22 @@ export class EzComboBox {
|
|
|
874
1012
|
}
|
|
875
1013
|
static get methods() {
|
|
876
1014
|
return {
|
|
1015
|
+
"getValueAsync": {
|
|
1016
|
+
"complexType": {
|
|
1017
|
+
"signature": "() => Promise<unknown>",
|
|
1018
|
+
"parameters": [],
|
|
1019
|
+
"references": {
|
|
1020
|
+
"Promise": {
|
|
1021
|
+
"location": "global"
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
"return": "Promise<unknown>"
|
|
1025
|
+
},
|
|
1026
|
+
"docs": {
|
|
1027
|
+
"text": "",
|
|
1028
|
+
"tags": []
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
877
1031
|
"setFocus": {
|
|
878
1032
|
"complexType": {
|
|
879
1033
|
"signature": "() => Promise<void>",
|
|
@@ -3,7 +3,9 @@ import { DateUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
|
3
3
|
import CSSVarsUtils from '../../utils/CSSVarsUtils';
|
|
4
4
|
export class EzDateInput {
|
|
5
5
|
constructor() {
|
|
6
|
+
this._changePending = false;
|
|
6
7
|
this._focused = false;
|
|
8
|
+
this._valuePromiseCallbacks = [];
|
|
7
9
|
this.label = undefined;
|
|
8
10
|
this.value = undefined;
|
|
9
11
|
this.enabled = true;
|
|
@@ -41,6 +43,7 @@ export class EzDateInput {
|
|
|
41
43
|
this.ezChange.emit(valueEmitted);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
46
|
+
this._changePending = false;
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* Aplica o foco no campo.
|
|
@@ -60,6 +63,18 @@ export class EzDateInput {
|
|
|
60
63
|
async isInvalid() {
|
|
61
64
|
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
62
65
|
}
|
|
66
|
+
/*
|
|
67
|
+
* Retorna uma promise com o valor da opção selecionada,
|
|
68
|
+
* que será resolvida quando o backend devolver este dado.
|
|
69
|
+
*/
|
|
70
|
+
async getValueAsync() {
|
|
71
|
+
if (this._changePending) {
|
|
72
|
+
return new Promise(accept => {
|
|
73
|
+
this._valuePromiseCallbacks.push(accept);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return Promise.resolve(this.value);
|
|
77
|
+
}
|
|
63
78
|
changeValue(newValue) {
|
|
64
79
|
const currentValue = DateUtils.validateDate(this.value);
|
|
65
80
|
const newValueValidated = DateUtils.validateDate(newValue);
|
|
@@ -70,10 +85,14 @@ export class EzDateInput {
|
|
|
70
85
|
showCalendar() {
|
|
71
86
|
this.handleBlur();
|
|
72
87
|
this._calendar.value = this.value;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
let top;
|
|
89
|
+
if (this.isFixed()) {
|
|
90
|
+
top = 29;
|
|
91
|
+
this._calendar.fitHorizontal(0);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
top = this.errorMessage || this.mode === "slim" ? 6 : -13;
|
|
95
|
+
}
|
|
77
96
|
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
78
97
|
}
|
|
79
98
|
hideCalendar() {
|
|
@@ -81,27 +100,35 @@ export class EzDateInput {
|
|
|
81
100
|
this._calendar.hide();
|
|
82
101
|
}
|
|
83
102
|
handleBlur() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (newValueValidated) {
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
try {
|
|
104
|
+
const strValue = this._textInput.value;
|
|
105
|
+
const newValue = DateUtils.strToDate(strValue);
|
|
106
|
+
if (newValue || !strValue) {
|
|
107
|
+
this.errorMessage = "";
|
|
108
|
+
const currentValue = DateUtils.validateDate(this.value);
|
|
109
|
+
const newValueValidated = DateUtils.validateDate(newValue);
|
|
110
|
+
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) === (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
111
|
+
if (newValueValidated) {
|
|
112
|
+
this._textInput.value = this.getTextValue(newValueValidated) || '';
|
|
113
|
+
this._focused = false;
|
|
114
|
+
}
|
|
115
|
+
this.ezCancelWaitingChange.emit();
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.changeValue(newValueValidated);
|
|
94
119
|
}
|
|
95
|
-
this.ezCancelWaitingChange.emit();
|
|
96
120
|
}
|
|
97
121
|
else {
|
|
98
|
-
this.changeValue(
|
|
122
|
+
this.changeValue(undefined);
|
|
123
|
+
this.ezCancelWaitingChange.emit();
|
|
124
|
+
this.errorMessage = "O valor digitado não é uma data válida";
|
|
99
125
|
}
|
|
100
126
|
}
|
|
101
|
-
|
|
102
|
-
this.
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
finally {
|
|
128
|
+
for (const callback of this._valuePromiseCallbacks) {
|
|
129
|
+
callback(this.value);
|
|
130
|
+
}
|
|
131
|
+
this._valuePromiseCallbacks = [];
|
|
105
132
|
}
|
|
106
133
|
}
|
|
107
134
|
getTextValue(d) {
|
|
@@ -113,6 +140,7 @@ export class EzDateInput {
|
|
|
113
140
|
const currentValue = DateUtils.validateDate(this.value);
|
|
114
141
|
const newValueValidated = DateUtils.validateDate(newValue);
|
|
115
142
|
if ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.getTime()) !== (newValueValidated === null || newValueValidated === void 0 ? void 0 : newValueValidated.getTime())) {
|
|
143
|
+
this._changePending = true;
|
|
116
144
|
this._focused = true;
|
|
117
145
|
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
118
146
|
}
|
|
@@ -126,13 +154,16 @@ export class EzDateInput {
|
|
|
126
154
|
this._textInput.value = textValue;
|
|
127
155
|
}
|
|
128
156
|
}
|
|
157
|
+
isFixed() {
|
|
158
|
+
return this._elem.dataset.isFixed === "true";
|
|
159
|
+
}
|
|
129
160
|
componentDidLoad() {
|
|
130
161
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
131
162
|
this.setInputValue();
|
|
132
163
|
}
|
|
133
164
|
render() {
|
|
134
165
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
135
|
-
return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: (evt) => this.handleInput(evt), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { "data-element-id": ElementIDUtils.getInternalIDInfo("calendar"), onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true,
|
|
166
|
+
return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: (evt) => this.handleInput(evt), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { ref: elem => this._calendar = elem, "data-element-id": ElementIDUtils.getInternalIDInfo("calendar"), onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, "data-is-fixed": this._elem.dataset.isFixed })));
|
|
136
167
|
}
|
|
137
168
|
static get is() { return "ez-date-input"; }
|
|
138
169
|
static get encapsulation() { return "shadow"; }
|
|
@@ -363,6 +394,25 @@ export class EzDateInput {
|
|
|
363
394
|
"text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
|
|
364
395
|
"tags": []
|
|
365
396
|
}
|
|
397
|
+
},
|
|
398
|
+
"getValueAsync": {
|
|
399
|
+
"complexType": {
|
|
400
|
+
"signature": "() => Promise<Date>",
|
|
401
|
+
"parameters": [],
|
|
402
|
+
"references": {
|
|
403
|
+
"Promise": {
|
|
404
|
+
"location": "global"
|
|
405
|
+
},
|
|
406
|
+
"Date": {
|
|
407
|
+
"location": "global"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
"return": "Promise<Date>"
|
|
411
|
+
},
|
|
412
|
+
"docs": {
|
|
413
|
+
"text": "",
|
|
414
|
+
"tags": []
|
|
415
|
+
}
|
|
366
416
|
}
|
|
367
417
|
};
|
|
368
418
|
}
|