@sankhyalabs/ezui 5.20.0-dev.1 → 5.20.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/ez-card-item_3.cjs.entry.js +182 -0
  2. package/dist/cjs/ez-combo-box.cjs.entry.js +11 -155
  3. package/dist/cjs/ez-search.cjs.entry.js +611 -31
  4. package/dist/cjs/ezui.cjs.js +1 -1
  5. package/dist/cjs/index-a7b0c73d.js +2 -6
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/components/ez-card-item/ez-card-item.css +16 -0
  9. package/dist/collection/components/ez-combo-box/ez-combo-box.js +12 -173
  10. package/dist/collection/components/ez-search/ez-search.css +330 -0
  11. package/dist/collection/components/ez-search/ez-search.js +689 -55
  12. package/dist/custom-elements/index.js +628 -195
  13. package/dist/esm/ez-card-item_3.entry.js +176 -0
  14. package/dist/esm/ez-combo-box.entry.js +12 -156
  15. package/dist/esm/ez-search.entry.js +613 -33
  16. package/dist/esm/ezui.js +1 -1
  17. package/dist/esm/index-baa5e267.js +2 -6
  18. package/dist/esm/loader.js +1 -1
  19. package/dist/ezui/ezui.esm.js +1 -1
  20. package/dist/ezui/p-133fae4a.entry.js +1 -0
  21. package/dist/ezui/p-43b03119.entry.js +1 -0
  22. package/dist/ezui/p-ba875f37.entry.js +1 -0
  23. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +0 -15
  24. package/dist/types/components/ez-search/ez-search.d.ts +100 -10
  25. package/dist/types/components.d.ts +23 -14
  26. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
  27. package/package.json +1 -1
  28. package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
  29. package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
  30. package/dist/esm/ez-card-item.entry.js +0 -48
  31. package/dist/esm/ez-filter-input_2.entry.js +0 -132
  32. package/dist/ezui/p-05f5a778.entry.js +0 -1
  33. package/dist/ezui/p-5613fe63.entry.js +0 -1
  34. package/dist/ezui/p-a32aaac6.entry.js +0 -1
  35. package/dist/ezui/p-a5ac7151.entry.js +0 -1
@@ -0,0 +1,176 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
2
+ import { StringUtils, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { C as CSSVarsUtils } from './CSSVarsUtils-a97cfa29.js';
4
+
5
+ const ezCardItemCss = ":host {\n /*@doc Define o tamanho da fonte do componente.*/\n --ez-card-item--font-size: var(--text--medium, 14px);\n\n /*@doc Define a família da fonte do componente.*/\n --ez-card-item--font-family: var(--font-pattern, Arial);\n\n /*@doc Define o peso da fonte do componente.*/\n --ez-card-item--font-weight: var(--text-weight--medium, 400);\n\n /*@doc Define o peso da fonte do title do componente.*/\n --ez-card-item--font-weight-large: var(--text-weight--large, 600);\n\n /*@doc Define a cor da fonte do componente.*/\n --ez-card-item--color: var(--title--primary, #2B3A54);\n\n /*@doc Define a cor da fonte da key do componente.*/\n --ez-card-item__key--color: var(--text--primary, #626e82);\n\n /*@doc Define a cor da fonte do label do detalhe do componente.*/\n --ez-card-item__detail-label--color: var(--text--secondary, #A2ABB9);\n\n /*@doc Define o espaçamento inferior dos detalhes do componente.*/\n --ez-card-item__detail--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define o espaçamento inferior do title do componente.*/\n --ez-card-item__title--padding-bottom: var(--space--extra-small, 3px);\n\n /*@doc Define a cor do highlight / marcação nos textos do componente.*/\n --ez-card-item__highlight--color: var(--color--primary-300, #E2F4EF);\n\n width: 100%;\n display: flex;\n cursor: pointer;\n}\n\n.card-item {\n display: flex;\n flex-direction: column;\n width: 100%;\n cursor: pointer;\n padding: 12px;\n z-index: 0;\n position: relative;\n container-type: inline-size;\n container-name: box;\n}\n\n.card-item:hover {\n background: #F0F3F7;\n border-radius: 12px;\n}\n\n.card-item__title {\n display: flex;\n align-items: center;\n line-height: 18px;\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight-large);\n color: var(--ez-card-item--color);\n padding-bottom: var(--ez-card-item__title--padding-bottom);\n gap: var(--space--small, 6px);\n}\n\n.card-item__key {\n /*public*/\n color: var(--ez-card-item__key--color);\n}\n\n.card-item__details {\n display: flex;\n cursor: pointer;\n justify-content: space-between;\n gap: var(--space--small, 6px);\n}\n\n.card-item__details-left {\n cursor: pointer;\n width: 50%;\n}\n\n.card-item__details-right {\n width: 50%;\n cursor: pointer;\n}\n\n.card-item__detail:not(:last-child) {\n cursor: pointer;\n\n /*public*/\n padding-bottom: var(--ez-card-item__detail--padding-bottom);\n}\n\n.card-item__detail-label {\n cursor: pointer;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight);\n color: var(--ez-card-item__detail-label--color);\n}\n\n.card-item__detail-value {\n cursor: pointer;\n line-break: anywhere;\n\n /*public*/\n font-size: var(--ez-card-item--font-size);\n font-family: var(--ez-card-item--font-family);\n font-weight: var(--ez-card-item--font-weight);\n color: var(--ez-card-item--color);\n}\n\n.card-item__highlight {\n position: relative;\n border-radius: 8px;\n z-index: -1;\n\n /*public*/\n background-color: var(--ez-card-item__highlight--color);\n outline: 2px solid var(--ez-card-item__highlight--color);\n box-shadow: -4px 0px 0px 0px var(--ez-card-item__highlight--color), \n 4px 0px 0px 0px var(--ez-card-item__highlight--color);\n}\n\n@container box (max-width: 500px) {\n .card-item__details {\n flex-direction: column;\n }\n\n .card-item__details-left {\n width: 100%;\n }\n \n .card-item__details-right {\n width: 100%;\n }\n}";
6
+
7
+ const EzCardItem = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.ezClick = createEvent(this, "ezClick", 7);
11
+ this.item = undefined;
12
+ }
13
+ componentWillRender() {
14
+ this.createDetailList();
15
+ }
16
+ componentDidLoad() {
17
+ var _a, _b;
18
+ const dataInfo = { id: StringUtils.toCamelCase(((_a = this.item) === null || _a === void 0 ? void 0 : _a.key) || ((_b = this.item) === null || _b === void 0 ? void 0 : _b.title) || "") };
19
+ ElementIDUtils.addIDInfo(this._element, null, dataInfo);
20
+ }
21
+ createDetailList() {
22
+ var _a, _b, _c;
23
+ this._details = { detailsLeft: [], detailsRight: [] };
24
+ let cont = 0;
25
+ if ((_a = this.item) === null || _a === void 0 ? void 0 : _a.details) {
26
+ for (const attribute in this.item.details) {
27
+ cont < 3 ?
28
+ this._details.detailsLeft.push({ label: attribute, value: (_b = this.item.details[attribute]) === null || _b === void 0 ? void 0 : _b.toString() }) :
29
+ this._details.detailsRight.push({ label: attribute, value: (_c = this.item.details[attribute]) === null || _c === void 0 ? void 0 : _c.toString() });
30
+ cont++;
31
+ }
32
+ }
33
+ }
34
+ buildDetailContent(detail) {
35
+ return h("div", { class: "card-item__detail" }, h("label", { class: "card-item__detail-label" }, detail.label), ": ", h("label", { class: "card-item__detail-value", innerHTML: detail.value }));
36
+ }
37
+ render() {
38
+ return (h(Host, null, this.item &&
39
+ h("div", { class: "card-item", onClick: () => { this.ezClick.emit(this.item); } }, h("label", { class: "card-item__title" }, h("span", { class: "card-item__key", innerHTML: this.item.key }), h("span", { innerHTML: this.item.title })), h("div", { class: "card-item__details" }, h("div", { class: "card-item__details-left" }, this._details.detailsLeft.map(detail => {
40
+ return this.buildDetailContent(detail);
41
+ })), h("div", { class: "card-item__details-right" }, this._details.detailsRight.map(detail => {
42
+ return this.buildDetailContent(detail);
43
+ }))))));
44
+ }
45
+ get _element() { return getElement(this); }
46
+ };
47
+ EzCardItem.style = ezCardItemCss;
48
+
49
+ const ezFilterInputCss = ":host{display:block;width:100%}";
50
+
51
+ const EzFilterInput = class {
52
+ constructor(hostRef) {
53
+ registerInstance(this, hostRef);
54
+ this.ezChange = createEvent(this, "ezChange", 7);
55
+ this.ezSearching = createEvent(this, "ezSearching", 7);
56
+ this.ezFocusIn = createEvent(this, "ezFocusIn", 7);
57
+ this._searchingText = "";
58
+ this.handleFocus = () => {
59
+ if (this._searchingText === "") {
60
+ this._textInput.value = "";
61
+ }
62
+ else {
63
+ this._textInput.value = this._searchingText;
64
+ }
65
+ this.ezFocusIn.emit();
66
+ };
67
+ this.label = undefined;
68
+ this.value = undefined;
69
+ this.enabled = true;
70
+ this.errorMessage = undefined;
71
+ this.restrict = undefined;
72
+ this.mode = "regular";
73
+ this.asyncSearch = false;
74
+ this.canShowError = true;
75
+ }
76
+ observeLabel() {
77
+ if (this._textInput) {
78
+ this._textInput.label = this.label;
79
+ }
80
+ }
81
+ observeErrorMessage() {
82
+ if (this._textInput) {
83
+ this._textInput.errorMessage = this.errorMessage;
84
+ }
85
+ }
86
+ observeValue(newValue, oldValue) {
87
+ if (this._textInput && newValue != oldValue) {
88
+ this._textInput.value = newValue;
89
+ this.ezChange.emit(newValue);
90
+ }
91
+ }
92
+ /**
93
+ * Aplica o foco no campo.
94
+ */
95
+ async setFocus() {
96
+ this._textInput.setFocus();
97
+ }
98
+ /**
99
+ * Remove o foco do campo.
100
+ */
101
+ async setBlur() {
102
+ this._textInput.setBlur();
103
+ }
104
+ /**
105
+ * Retorna se o conteúdo é inválido.
106
+ */
107
+ async isInvalid() {
108
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
109
+ }
110
+ /**
111
+ * Método responsável por setar um novo valor ao campo.
112
+ */
113
+ async setValue(newValue) {
114
+ if (!this.asyncSearch || this._textInput == undefined) {
115
+ return;
116
+ }
117
+ if (newValue !== this.value) {
118
+ this.value = newValue;
119
+ this._searchingText = "";
120
+ }
121
+ else {
122
+ this._textInput.value = newValue;
123
+ }
124
+ }
125
+ /**
126
+ * Método responsável por resetar o valor do campo para o ultimo valor inputado.
127
+ */
128
+ async endSearch() {
129
+ if (!this.asyncSearch || this._textInput == undefined) {
130
+ return;
131
+ }
132
+ if (this._textInput.value !== this.value) {
133
+ this._textInput.value = this.value;
134
+ }
135
+ }
136
+ handleChange(evt) {
137
+ const newValue = evt.detail;
138
+ this.errorMessage = "";
139
+ if (this.asyncSearch) {
140
+ this._searchingText = newValue;
141
+ this.ezSearching.emit(newValue);
142
+ }
143
+ else if (newValue !== this.value) {
144
+ this.value = newValue;
145
+ }
146
+ }
147
+ componentDidLoad() {
148
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
149
+ }
150
+ render() {
151
+ ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
152
+ 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" })));
153
+ }
154
+ get _elem() { return getElement(this); }
155
+ static get watchers() { return {
156
+ "label": ["observeLabel"],
157
+ "errorMessage": ["observeErrorMessage"],
158
+ "value": ["observeValue"]
159
+ }; }
160
+ };
161
+ EzFilterInput.style = ezFilterInputCss;
162
+
163
+ const multiSelectionBoxMessageCss = ".multi-selection__message{display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%;min-height:320px;text-align:center}.multi-selection__text-message{margin-top:-30px;font-family:var(--font-pattern);font-size:var(--text--meduim);padding:var(--space-xs);color:var(--text--primary)}";
164
+
165
+ const MultiSelectionBoxMessage = class {
166
+ constructor(hostRef) {
167
+ registerInstance(this, hostRef);
168
+ this.message = undefined;
169
+ }
170
+ render() {
171
+ return (h("div", { class: "multi-selection__message" }, h("span", { class: "multi-selection__text-message" }, this.message)));
172
+ }
173
+ };
174
+ MultiSelectionBoxMessage.style = multiSelectionBoxMessageCss;
175
+
176
+ export { EzCardItem as ez_card_item, EzFilterInput as ez_filter_input, MultiSelectionBoxMessage as multi_selection_box_message };
@@ -1,10 +1,9 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
2
- import { ObjectUtils, FloatingManager, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
2
+ import { ObjectUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
3
+ import './ApplicationUtils-eaf91331.js';
4
4
  import { C as CSSVarsUtils } from './CSSVarsUtils-a97cfa29.js';
5
5
  import './DialogType-54a62731.js';
6
6
  import './CheckMode-bdb2ec19.js';
7
- import { R as REQUIRED_INFO } from './constants-4e0d35b7.js';
8
7
 
9
8
  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--line-height:calc(var(--text--medium, 14px) + 4px);--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--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--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) + 4px);--ez-combo-box__list-min-width:64px;--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-combo-box__list-min-width);position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
10
9
 
@@ -17,7 +16,6 @@ const EzComboBox = class {
17
16
  this._maxWidthValue = 0;
18
17
  this._tabPressed = false;
19
18
  this._textEmptyList = "Nenhum resultado encontrado";
20
- this._textEmptySearch = "Nenhum resultado de {0} encontrado";
21
19
  this._lookupMode = false;
22
20
  this._preSelection = undefined;
23
21
  this._visibleOptions = undefined;
@@ -30,7 +28,6 @@ const EzComboBox = class {
30
28
  this.enabled = true;
31
29
  this.options = undefined;
32
30
  this.errorMessage = undefined;
33
- this.searchMode = undefined;
34
31
  this.showSelectedValue = false;
35
32
  this.showOptionValue = false;
36
33
  this.suppressSearch = false;
@@ -54,7 +51,7 @@ const EzComboBox = class {
54
51
  observeValue(newValue, oldValue) {
55
52
  if (this._textInput && newValue != oldValue) {
56
53
  try {
57
- if (this.searchMode && typeof newValue === "string") {
54
+ if (typeof newValue === "string") {
58
55
  this.setInputValue();
59
56
  return;
60
57
  }
@@ -217,7 +214,7 @@ const EzComboBox = class {
217
214
  }
218
215
  updateVisibleOptions() {
219
216
  let opts = this._source || [];
220
- if (!this.searchMode && this._criteria) {
217
+ if (this._criteria) {
221
218
  const upperCriteria = this._criteria.toUpperCase();
222
219
  opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
223
220
  }
@@ -292,7 +289,7 @@ const EzComboBox = class {
292
289
  return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
293
290
  }
294
291
  nextOption() {
295
- if (this.searchMode && !this.isOptionsVisible()) {
292
+ if (!this.isOptionsVisible()) {
296
293
  return;
297
294
  }
298
295
  this.showOptions();
@@ -315,9 +312,6 @@ const EzComboBox = class {
315
312
  this.selectOption(this._visibleOptions[this._preSelection]);
316
313
  this._preSelection = undefined;
317
314
  }
318
- else {
319
- this.controlListWithOnlyOne();
320
- }
321
315
  }
322
316
  updateSource(source) {
323
317
  this._startLoading = false;
@@ -336,7 +330,6 @@ const EzComboBox = class {
336
330
  this.updateVisibleOptions();
337
331
  if (this._tabPressed) {
338
332
  this._tabPressed = false;
339
- this.controlEmptySearch();
340
333
  }
341
334
  }
342
335
  else {
@@ -344,10 +337,6 @@ const EzComboBox = class {
344
337
  }
345
338
  }
346
339
  }
347
- clearSource() {
348
- this._source = [];
349
- this.updateVisibleOptions();
350
- }
351
340
  selectOption(newOption) {
352
341
  var _a, _b;
353
342
  const currentValue = this.getSelectedOption(this.value);
@@ -359,10 +348,6 @@ const EzComboBox = class {
359
348
  else {
360
349
  this.resetOptions();
361
350
  }
362
- if (this.searchMode) {
363
- this._visibleOptions = [];
364
- this.clearSource();
365
- }
366
351
  }
367
352
  loadOptions(mode, argument = "") {
368
353
  this._criteria = argument;
@@ -398,93 +383,6 @@ const EzComboBox = class {
398
383
  clearSearch() {
399
384
  this.value = null;
400
385
  }
401
- controlListWithOnlyOne() {
402
- var _a;
403
- if (this.searchMode) {
404
- const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
405
- if ((source === null || source === void 0 ? void 0 : source.length) === 1) {
406
- this.selectOption(source[0]);
407
- }
408
- }
409
- }
410
- controlEmptySearch() {
411
- var _a;
412
- if (this.searchMode) {
413
- if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
414
- this.clearSearch();
415
- ApplicationUtils.info(this._textEmptyList);
416
- }
417
- else {
418
- this.controlListWithOnlyOne();
419
- }
420
- }
421
- }
422
- validateDescriptionValue() {
423
- if (!this.searchMode || StringUtils.isEmpty(this.value)) {
424
- return;
425
- }
426
- let value = this.value;
427
- if (typeof value === "object") {
428
- return;
429
- }
430
- if (StringUtils.isEmpty(value)) {
431
- return;
432
- }
433
- this.loadDescriptionValue(value);
434
- }
435
- async loadDescriptionValue(argument) {
436
- var _a, _b;
437
- if (argument == undefined) {
438
- return;
439
- }
440
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
441
- this.loadOptionValue(argument);
442
- return;
443
- }
444
- const searchArgument = {
445
- mode: SearchMode.PREDICTIVE,
446
- argument
447
- };
448
- const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
449
- if (source == undefined) {
450
- return;
451
- }
452
- if (source instanceof Promise) {
453
- source.then((result) => {
454
- this.setDescriptionValue(result);
455
- });
456
- }
457
- else {
458
- this.setDescriptionValue(source);
459
- }
460
- }
461
- setDescriptionValue(source) {
462
- const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
463
- if (value == undefined || !Object.keys(value).length) {
464
- this.showNoResultMessage();
465
- return;
466
- }
467
- this._lookupMode = true;
468
- this.value = value;
469
- }
470
- loadOptionValue(argument) {
471
- var _a;
472
- const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
473
- if (source != undefined) {
474
- this.selectOption(source);
475
- }
476
- else {
477
- this.showNoResultMessage();
478
- }
479
- }
480
- async showNoResultMessage() {
481
- this.clearSearch();
482
- ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
483
- }
484
- getFieldLabel() {
485
- var _a;
486
- return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(REQUIRED_INFO, "").toUpperCase();
487
- }
488
386
  resetOptions() {
489
387
  this.hideOptions();
490
388
  this._criteria = undefined;
@@ -510,12 +408,7 @@ const EzComboBox = class {
510
408
  });
511
409
  }
512
410
  }
513
- if (this.searchMode) {
514
- this.updateSource([]);
515
- }
516
- else {
517
- this.loadOptions(SearchMode.PRELOAD);
518
- }
411
+ this.loadOptions(SearchMode.PRELOAD);
519
412
  }
520
413
  componentDidRender() {
521
414
  var _a;
@@ -525,7 +418,6 @@ const EzComboBox = class {
525
418
  (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
526
419
  ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
527
420
  });
528
- this.validateDescriptionValue();
529
421
  }
530
422
  componentDidLoad() {
531
423
  CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
@@ -545,13 +437,7 @@ const EzComboBox = class {
545
437
  // Event handlers
546
438
  //---------------------------------------------
547
439
  handlerIconClick() {
548
- this.searchMode ? this.loadOptions(SearchMode.ADVANCED) : this.showOptions();
549
- }
550
- buildNumberArgument(argument) {
551
- if (this.isTextSearch) {
552
- return NaN;
553
- }
554
- return Number(argument || undefined);
440
+ this.showOptions();
555
441
  }
556
442
  onTextInputChangeHandler(event) {
557
443
  var _a;
@@ -568,36 +454,12 @@ const EzComboBox = class {
568
454
  }
569
455
  this._criteria = argument;
570
456
  if (argument) {
571
- if (this.searchMode) {
572
- this._showLoading = false;
573
- this.clearSource();
574
- const enoughChars = argument.length >= this.limitCharsToSearch;
575
- const argumentNumber = this.buildNumberArgument(argument);
576
- if (enoughChars || !isNaN(argumentNumber)) {
577
- this._showLoading = true;
578
- this._changeDeboucingTimeout = window.setTimeout(() => {
579
- this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
580
- }, this._deboucingTime);
581
- this.showOptions();
582
- }
583
- else {
584
- this.hideOptions();
585
- }
586
- }
587
- else {
588
- this.updateVisibleOptions();
589
- this.showOptions();
590
- }
457
+ this.updateVisibleOptions();
458
+ this.showOptions();
591
459
  }
592
460
  else {
593
461
  this.hideOptions();
594
- if (this.searchMode) {
595
- this._showLoading = false;
596
- this.clearSource();
597
- }
598
- else {
599
- this.updateVisibleOptions();
600
- }
462
+ this.updateVisibleOptions();
601
463
  }
602
464
  }
603
465
  clearDeboucingTimeout() {
@@ -607,9 +469,7 @@ const EzComboBox = class {
607
469
  }
608
470
  }
609
471
  onTextInputClickHandler() {
610
- if (!this.searchMode) {
611
- this.showOptions();
612
- }
472
+ this.showOptions();
613
473
  }
614
474
  keyDownHandler(event) {
615
475
  this._tabPressed = false;
@@ -641,7 +501,6 @@ const EzComboBox = class {
641
501
  break;
642
502
  case "Tab":
643
503
  this._tabPressed = true;
644
- this.controlListWithOnlyOne();
645
504
  break;
646
505
  }
647
506
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -658,11 +517,8 @@ const EzComboBox = class {
658
517
  return !this._showLoading && this._visibleOptions.length > 0;
659
518
  }
660
519
  render() {
661
- var _a;
662
520
  ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
663
- return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
664
- ? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
665
- : undefined), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
521
+ return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: "chevron-down" }))), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
666
522
  && this._visibleOptions.length === 0
667
523
  && h("div", { class: "message" }, h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
668
524
  && h("div", { class: "message" }, h("div", { class: "message__loading" })), this.showOptionValue