@sankhyalabs/ezui 1.1.78 → 1.1.79
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/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
- package/dist/cjs/ez-calendar_13.cjs.entry.js +2417 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -2
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
- package/dist/cjs/ez-icon.cjs.entry.js +30 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
- package/dist/cjs/{index-40ebb2be.js → index-a2266984.js} +18 -23
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/ez-form/DataBinder.js +44 -0
- package/dist/collection/components/ez-form/ez-form.css +1 -15
- package/dist/collection/components/ez-form/ez-form.js +109 -428
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/store/form.slice.js +38 -0
- package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
- package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
- package/dist/collection/components/test-du/test-du.js +65 -23
- package/dist/custom-elements/index.d.ts +0 -12
- package/dist/custom-elements/index.js +380 -2065
- package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-button_3.entry.js +514 -0
- package/dist/esm/ez-calendar_13.entry.js +2401 -0
- package/dist/esm/ez-date-time-input.entry.js +2 -2
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
- package/dist/esm/ez-icon.entry.js +26 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +365 -0
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +3 -3
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
- package/dist/esm/{index-ca8700cb.js → index-afe19542.js} +17 -21
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-00b837e2.js +1 -0
- package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
- package/dist/ezui/{p-a15093e3.entry.js → p-0d8368fc.entry.js} +1 -1
- package/dist/ezui/p-1e36e3ff.entry.js +1 -0
- package/dist/ezui/p-446ec85b.js +1 -0
- package/dist/ezui/{p-74f978db.entry.js → p-5509ee41.entry.js} +46 -46
- package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
- package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
- package/dist/ezui/{p-f3c5f27e.entry.js → p-7a1f2e0e.entry.js} +1 -1
- package/dist/ezui/p-7de3c95d.js +1 -0
- package/dist/ezui/{p-8d6cdd3e.entry.js → p-857ead8e.entry.js} +1 -1
- package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
- package/dist/ezui/p-9be02ecf.entry.js +1 -0
- package/dist/ezui/p-a4a39579.entry.js +1 -0
- package/dist/ezui/p-d5699f29.entry.js +1 -0
- package/dist/ezui/p-d64a3939.entry.js +1 -0
- package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
- package/dist/types/components/ez-form/ez-form.d.ts +24 -32
- package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
- package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
- package/dist/types/components/test-du/test-du.d.ts +8 -2
- package/dist/types/components.d.ts +9 -63
- package/package.json +1 -1
- package/react/components.d.ts +0 -2
- package/react/components.js +0 -2
- package/react/components.js.map +1 -1
- package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
- package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -217
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -634
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -254
- package/dist/cjs/ez-form.cjs.entry.js +0 -1838
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -74
- package/dist/cjs/form-metadata.cjs.entry.js +0 -129
- package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
- package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
- package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
- package/dist/esm/DataUnit-1cd45202.js +0 -464
- package/dist/esm/ez-calendar.entry.js +0 -213
- package/dist/esm/ez-collapsible-box_6.entry.js +0 -625
- package/dist/esm/ez-combo-box.entry.js +0 -250
- package/dist/esm/ez-form.entry.js +0 -1834
- package/dist/esm/ez-number-input.entry.js +0 -70
- package/dist/esm/form-metadata.entry.js +0 -125
- package/dist/ezui/assets/trash-can-outline.svg +0 -3
- package/dist/ezui/p-14bee38e.entry.js +0 -1
- package/dist/ezui/p-37a611ea.js +0 -1
- package/dist/ezui/p-3a09c678.entry.js +0 -1
- package/dist/ezui/p-43c15c94.entry.js +0 -1
- package/dist/ezui/p-7107d7ef.js +0 -1
- package/dist/ezui/p-72ff3c95.entry.js +0 -1
- package/dist/ezui/p-88f45a83.entry.js +0 -1
- package/dist/ezui/p-8f4851a6.js +0 -1
- package/dist/ezui/p-9dfd537e.js +0 -1
- package/dist/ezui/p-a0331955.entry.js +0 -1
- package/dist/ezui/p-a19f2af3.entry.js +0 -1
- package/dist/ezui/p-da929c01.js +0 -1
- package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1dacecd3.js';
|
|
2
|
-
import './index-ca8700cb.js';
|
|
3
|
-
import { F as FloatingManager } from './FloatingManager-bb90ef41.js';
|
|
4
|
-
import { C as CSSVarsUtils } from './CSSVarsUtils-aeee9825.js';
|
|
5
|
-
|
|
6
|
-
const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box__drop-down-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"16px\"><path d=\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\"/></svg>');--ez-combo-box__search-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"22px\" width=\"22px\"><path d=\"m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z\"/></svg>');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}";
|
|
7
|
-
|
|
8
|
-
let EzComboBox = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
registerInstance(this, hostRef);
|
|
11
|
-
this.ezChange = createEvent(this, "ezChange", 7);
|
|
12
|
-
/**
|
|
13
|
-
* Deixa o campo disponível ou não para interação com usuário.
|
|
14
|
-
*/
|
|
15
|
-
this.enabled = true;
|
|
16
|
-
/**
|
|
17
|
-
* Ajusta a opção de mostrar o "value" ao selecionar uma opção. Por padrão não mostra.
|
|
18
|
-
*/
|
|
19
|
-
this.showSelectedValue = false;
|
|
20
|
-
/**
|
|
21
|
-
* Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
|
|
22
|
-
*/
|
|
23
|
-
this.showOptionValue = false;
|
|
24
|
-
}
|
|
25
|
-
internalUpdate() {
|
|
26
|
-
if (this._inputElement) {
|
|
27
|
-
this._inputElement.value = this.getText();
|
|
28
|
-
}
|
|
29
|
-
this.hideOptions();
|
|
30
|
-
this._criteria = undefined;
|
|
31
|
-
this._preSelection = undefined;
|
|
32
|
-
this.updateVisibleOptions();
|
|
33
|
-
}
|
|
34
|
-
getText() {
|
|
35
|
-
let text = "";
|
|
36
|
-
const selected = this.getSelectedOption();
|
|
37
|
-
if (selected) {
|
|
38
|
-
text = this.showSelectedValue ? `${selected.value} - ${selected.label}` : selected.label;
|
|
39
|
-
}
|
|
40
|
-
return text;
|
|
41
|
-
}
|
|
42
|
-
getSelectedOption() {
|
|
43
|
-
if (typeof this.value === "string" || this.value instanceof String) {
|
|
44
|
-
return this._visibleOptions.find(o => o.value === this.value);
|
|
45
|
-
}
|
|
46
|
-
return this.value;
|
|
47
|
-
}
|
|
48
|
-
updateVisibleOptions() {
|
|
49
|
-
let opts = this._source || [];
|
|
50
|
-
if (!this.searchMode && this._criteria) {
|
|
51
|
-
const upperCriteria = this._criteria.toUpperCase();
|
|
52
|
-
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
53
|
-
}
|
|
54
|
-
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
55
|
-
}
|
|
56
|
-
buildItem(opt, index) {
|
|
57
|
-
return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = undefined }, h("span", { class: "item--label", title: opt.label }, opt.label), this.showOptionValue ? h("span", { class: "item--value", title: opt.value }, opt.value) : undefined);
|
|
58
|
-
}
|
|
59
|
-
showOptions() {
|
|
60
|
-
if (!this.enabled) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
64
|
-
//posição errada no futuro. Preferi fazer simples no começo,
|
|
65
|
-
//porque não quis onerar o text input com essa funcionalidade...
|
|
66
|
-
const top = this.errorMessage ? "0px" : "-17px";
|
|
67
|
-
this._floatingID = FloatingManager.float(this._optionsList, this._listContainer, { autoClose: true, top });
|
|
68
|
-
window.requestAnimationFrame(() => {
|
|
69
|
-
this._optionsList.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
hideOptions() {
|
|
73
|
-
if (this._floatingID !== undefined) {
|
|
74
|
-
FloatingManager.close(this._floatingID);
|
|
75
|
-
}
|
|
76
|
-
this._floatingID = undefined;
|
|
77
|
-
}
|
|
78
|
-
isOptionsVisible() {
|
|
79
|
-
return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
|
|
80
|
-
}
|
|
81
|
-
nextOption() {
|
|
82
|
-
if (this.searchMode && !this.isOptionsVisible()) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
this.showOptions();
|
|
86
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
|
|
87
|
-
this.scrollToOption(this._visibleOptions[this._preSelection], true);
|
|
88
|
-
}
|
|
89
|
-
previousOption() {
|
|
90
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
|
|
91
|
-
this.scrollToOption(this._visibleOptions[this._preSelection], false);
|
|
92
|
-
}
|
|
93
|
-
scrollToOption(opt, down) {
|
|
94
|
-
window.requestAnimationFrame(() => {
|
|
95
|
-
const liElem = this._optionsList.querySelector(`li#item_${opt.value}`);
|
|
96
|
-
if (liElem) {
|
|
97
|
-
const parent = liElem.parentElement;
|
|
98
|
-
const parentRect = parent.getBoundingClientRect();
|
|
99
|
-
const itemRect = liElem.getBoundingClientRect();
|
|
100
|
-
if (down && itemRect.bottom > parentRect.bottom) {
|
|
101
|
-
parent.scrollTop = itemRect.top;
|
|
102
|
-
}
|
|
103
|
-
else if (!down && itemRect.top < parentRect.top) {
|
|
104
|
-
parent.scrollTop = 0;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
selectCurrentOption() {
|
|
110
|
-
if (this._preSelection !== undefined) {
|
|
111
|
-
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
112
|
-
this._preSelection = undefined;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
selectOption(opt) {
|
|
116
|
-
const currentOpt = this.getSelectedOption();
|
|
117
|
-
if (currentOpt !== opt) {
|
|
118
|
-
const adjustedOpt = !(opt === null || opt === void 0 ? void 0 : opt.value) ? undefined : opt;
|
|
119
|
-
this.value = adjustedOpt;
|
|
120
|
-
this.errorMessage = "";
|
|
121
|
-
this.ezChange.emit(adjustedOpt);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this.internalUpdate();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
updateSource(source) {
|
|
128
|
-
if (source instanceof Promise) {
|
|
129
|
-
source.then(result => this.updateSource(result));
|
|
130
|
-
this.updateVisibleOptions();
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
this._source = source;
|
|
134
|
-
this.updateVisibleOptions();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
loadOptions(mode, argument = "") {
|
|
138
|
-
this._criteria = argument;
|
|
139
|
-
if (this.optionLoader) {
|
|
140
|
-
this.updateSource(this.optionLoader({ mode, argument }));
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
this.updateSource(this.options);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
cancelPreselection() {
|
|
147
|
-
if (!this._inputElement.value && this.value) {
|
|
148
|
-
this.selectOption(undefined);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
this.internalUpdate();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
//---------------------------------------------
|
|
155
|
-
// Lifecycle web component
|
|
156
|
-
//---------------------------------------------
|
|
157
|
-
componentWillLoad() {
|
|
158
|
-
if (this.options === undefined) {
|
|
159
|
-
this.options = [];
|
|
160
|
-
const optionsTags = this.el.querySelectorAll("option");
|
|
161
|
-
if (optionsTags) {
|
|
162
|
-
optionsTags.forEach(e => {
|
|
163
|
-
let label = e.innerText;
|
|
164
|
-
let value = e.getAttribute("value");
|
|
165
|
-
if (!value) {
|
|
166
|
-
value = label;
|
|
167
|
-
}
|
|
168
|
-
this.options.push({ label, value });
|
|
169
|
-
e.hidden = true;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (this.searchMode) {
|
|
174
|
-
this.updateSource([]);
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
this.loadOptions("PRELOAD");
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
componentDidRender() {
|
|
181
|
-
if (this._floatingID === undefined) {
|
|
182
|
-
this._optionsList.remove();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
componentDidLoad() {
|
|
186
|
-
CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
|
|
187
|
-
}
|
|
188
|
-
//---------------------------------------------
|
|
189
|
-
// Event handlers
|
|
190
|
-
//---------------------------------------------
|
|
191
|
-
onTextInputChangeHandler(event) {
|
|
192
|
-
if (!this._criteria) {
|
|
193
|
-
this._inputElement.value = event.data;
|
|
194
|
-
}
|
|
195
|
-
const argument = event.target.value;
|
|
196
|
-
this._criteria = argument;
|
|
197
|
-
if (this._criteria) {
|
|
198
|
-
if (this.searchMode) {
|
|
199
|
-
if (this._changeDeboucingTimeout) {
|
|
200
|
-
window.clearTimeout(this._changeDeboucingTimeout);
|
|
201
|
-
}
|
|
202
|
-
this._changeDeboucingTimeout = window.setTimeout(() => {
|
|
203
|
-
this.loadOptions("PREDICTIVE", argument);
|
|
204
|
-
}, 200);
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
this.updateVisibleOptions();
|
|
208
|
-
}
|
|
209
|
-
this.showOptions();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
onTextInputClickHandler() {
|
|
213
|
-
if (!this.searchMode) {
|
|
214
|
-
this.showOptions();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
keyDownHandler(event) {
|
|
218
|
-
switch (event.key) {
|
|
219
|
-
case "ArrowDown":
|
|
220
|
-
this.nextOption();
|
|
221
|
-
break;
|
|
222
|
-
case "ArrowUp":
|
|
223
|
-
this.previousOption();
|
|
224
|
-
break;
|
|
225
|
-
case "Enter":
|
|
226
|
-
this.selectCurrentOption();
|
|
227
|
-
break;
|
|
228
|
-
case "Escape":
|
|
229
|
-
this.cancelPreselection();
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
event.stopPropagation();
|
|
233
|
-
}
|
|
234
|
-
onTextInputFocusOutHandler() {
|
|
235
|
-
this.cancelPreselection();
|
|
236
|
-
}
|
|
237
|
-
render() {
|
|
238
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._inputElement = elem, enabled: this.enabled, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), errorMessage: this.errorMessage }, this.searchMode ?
|
|
239
|
-
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-search", onClick: () => { this.loadOptions("ADVANCED"); }, slot: "leftIcon" })
|
|
240
|
-
:
|
|
241
|
-
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
|
|
242
|
-
}
|
|
243
|
-
get el() { return getElement(this); }
|
|
244
|
-
static get watchers() { return {
|
|
245
|
-
"value": ["internalUpdate"]
|
|
246
|
-
}; }
|
|
247
|
-
};
|
|
248
|
-
EzComboBox.style = ezComboBoxCss;
|
|
249
|
-
|
|
250
|
-
export { EzComboBox as ez_combo_box };
|