@sankhyalabs/ezui 5.22.0-dev.96 → 5.22.0-dev.97
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/ez-card-item_2.cjs.entry.js +1416 -7
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover-plus_3.cjs.entry.js +198 -0
- package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +28 -158
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/searchFormatters-b7e1ed1e.js +23 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ez-card-item/ez-card-item.css +1 -3
- package/dist/collection/components/ez-chip/ez-chip.css +5 -1
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +49 -2
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +2 -2
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +72 -12
- package/dist/collection/components/ez-scroller/ez-scroller.css +3 -0
- package/dist/collection/components/ez-search/ez-search.css +0 -219
- package/dist/collection/components/ez-search/ez-search.js +28 -167
- package/dist/collection/components/ez-search/subcomponent/search-list/search-list.css +227 -0
- package/dist/collection/components/ez-search/subcomponent/search-list/search-list.js +289 -0
- package/dist/collection/components/ez-search/utils/searchFormatters.js +18 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +169 -177
- package/dist/esm/ez-card-item_2.entry.js +1416 -7
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-popover-plus_3.entry.js +192 -0
- package/dist/esm/ez-scroller_2.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +29 -159
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/searchFormatters-8229207e.js +20 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-288631d1.entry.js +1 -0
- package/dist/ezui/p-31da1b57.entry.js +1 -0
- package/dist/ezui/p-40a60148.js +1 -0
- package/dist/ezui/p-5aca7386.entry.js +1 -0
- package/dist/ezui/p-b7706b43.entry.js +1 -0
- package/dist/ezui/{p-17be134a.entry.js → p-e06a9886.entry.js} +1 -1
- package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +9 -1
- package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +12 -2
- package/dist/types/components/ez-search/ez-search.d.ts +3 -13
- package/dist/types/components/ez-search/subcomponent/search-list/search-list.d.ts +23 -0
- package/dist/types/components/ez-search/utils/searchFormatters.d.ts +2 -0
- package/dist/types/components.d.ts +72 -4
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-popover-core_2.cjs.entry.js +0 -1504
- package/dist/esm/ez-popover-core_2.entry.js +0 -1499
- package/dist/ezui/p-58783dcf.entry.js +0 -1
- package/dist/ezui/p-65f471bc.entry.js +0 -1
- package/dist/ezui/p-7bd15498.entry.js +0 -1
- package/dist/ezui/p-990b4318.entry.js +0 -1
|
@@ -56,36 +56,12 @@
|
|
|
56
56
|
/*@doc Define a cor do label.*/
|
|
57
57
|
--ez-search__label--color: var(--title--primary, #2B3A54);
|
|
58
58
|
|
|
59
|
-
/* list */
|
|
60
|
-
/*@doc Define a cor do texto da lista de opções.*/
|
|
61
|
-
--ez-search__list-title--primary: var(--title--primary, #2B3A54);
|
|
62
|
-
/*@doc Define a cor do texto do value da lista de opções.*/
|
|
63
|
-
--ez-search__list-text--primary: var(--text--primary, #626e82);
|
|
64
|
-
/*@doc Define a altura do box da lista de opções.*/
|
|
65
|
-
--ez-search__list-height: calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);
|
|
66
|
-
/*@doc Define a largura mínima da lista de opções.*/
|
|
67
|
-
--ez-search__list-min-width: 64px;
|
|
68
|
-
|
|
69
59
|
/* espaçamento */
|
|
70
60
|
/*@doc Define um espaçamento mediano entre elementos do componente.*/
|
|
71
61
|
--ez-search--space--medium: var(--space--medium, 12px);
|
|
72
62
|
/*@doc Define um espaçamento pequeno entre elementos do componente.*/
|
|
73
63
|
--ez-search--space--small: var(--space--small, 6px);
|
|
74
64
|
|
|
75
|
-
/* scrollbar */
|
|
76
|
-
/*@doc Define a cor da barra de rolagem do componente.*/
|
|
77
|
-
--ez-search__scrollbar--color-default: var(--scrollbar--default, #626e82);
|
|
78
|
-
/*@doc Define a cor de fundo da barra de rolagem do componente.*/
|
|
79
|
-
--ez-search__scrollbar--color-background: var(--scrollbar--background, #E5EAF0);
|
|
80
|
-
/*@doc Define a cor do hover na barra de rolagem do componente.*/
|
|
81
|
-
--ez-search__scrollbar--color-hover: var(--scrollbar--hover, #2B3A54);
|
|
82
|
-
/*@doc Define a cor do active na barra de rolagem do componente.*/
|
|
83
|
-
--ez-search__scrollbar--color-clicked: var(--scrollbar--clicked, #a2abb9);
|
|
84
|
-
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
85
|
-
--ez-search__scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
86
|
-
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
87
|
-
--ez-search__scrollbar--width: var(--space--small, 6px);
|
|
88
|
-
|
|
89
65
|
/***************
|
|
90
66
|
host style
|
|
91
67
|
***************/
|
|
@@ -112,182 +88,6 @@ ez-icon {
|
|
|
112
88
|
--ez-text-input__input--disabled--color: var(--title--primary, #2B3A54);
|
|
113
89
|
}
|
|
114
90
|
|
|
115
|
-
.list-container {
|
|
116
|
-
/*public*/
|
|
117
|
-
min-width: var(--ez-search__list-min-width);
|
|
118
|
-
overflow: auto;
|
|
119
|
-
|
|
120
|
-
/*private*/
|
|
121
|
-
position: relative;
|
|
122
|
-
width: 100%;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.list-wrapper {
|
|
126
|
-
display: flex;
|
|
127
|
-
flex-direction: column;
|
|
128
|
-
box-sizing: border-box;
|
|
129
|
-
width: 0;
|
|
130
|
-
|
|
131
|
-
/*public*/
|
|
132
|
-
z-index: var(--more-visible, 2);
|
|
133
|
-
max-height: 350px;
|
|
134
|
-
min-width: 150px;
|
|
135
|
-
background-color: var(--ez-search--background-color--xlight);
|
|
136
|
-
border-radius: var(--ez-search--border-radius);
|
|
137
|
-
box-shadow: var(--shadow, 0px 0px 16px 0px #000);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.list-options {
|
|
141
|
-
margin-top: 0px;
|
|
142
|
-
box-sizing: border-box;
|
|
143
|
-
width: 100%;
|
|
144
|
-
height: 100%;
|
|
145
|
-
padding: 0;
|
|
146
|
-
display: flex;
|
|
147
|
-
flex-direction: column;
|
|
148
|
-
scroll-behavior: smooth;
|
|
149
|
-
overflow-y: auto;
|
|
150
|
-
overflow-x: hidden;
|
|
151
|
-
scrollbar-width: thin;
|
|
152
|
-
|
|
153
|
-
/*public*/
|
|
154
|
-
scrollbar-color: var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background);
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.list-options::-webkit-scrollbar {
|
|
159
|
-
/*public*/
|
|
160
|
-
background-color: var(--scrollbar--background);
|
|
161
|
-
width: var(--space--small);
|
|
162
|
-
max-width: var(--space--small);
|
|
163
|
-
min-width: var(--space--small);
|
|
164
|
-
height: var(--space--small);
|
|
165
|
-
max-height: var(--space--small);
|
|
166
|
-
min-height: var(--space--small);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.list-options::-webkit-scrollbar-track {
|
|
170
|
-
/*public*/
|
|
171
|
-
background-color: var(--ez-search__scrollbar--color-background);
|
|
172
|
-
border-radius: var(--ez-search__scrollbar--border-radius);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.list-options::-webkit-scrollbar-thumb {
|
|
176
|
-
/*public*/
|
|
177
|
-
background-color: var(--ez-search__scrollbar--color-default);
|
|
178
|
-
border-radius: var(--ez-search__scrollbar--border-radius);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.list-options::-webkit-scrollbar-thumb:vertical:hover,
|
|
182
|
-
.list-options::-webkit-scrollbar-thumb:horizontal:hover {
|
|
183
|
-
/*public*/
|
|
184
|
-
background-color: var(--ez-search__scrollbar--color-hover);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.list-options::-webkit-scrollbar-thumb:vertical:active,
|
|
188
|
-
.list-options::-webkit-scrollbar-thumb:horizontal:active {
|
|
189
|
-
/*public*/
|
|
190
|
-
background-color: var(--ez-search__scrollbar--color-clicked);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.item {
|
|
194
|
-
display: flex;
|
|
195
|
-
align-items: center;
|
|
196
|
-
width: 100%;
|
|
197
|
-
box-sizing: border-box;
|
|
198
|
-
list-style-type: none;
|
|
199
|
-
cursor: pointer;
|
|
200
|
-
|
|
201
|
-
/*public*/
|
|
202
|
-
border-radius: var(--ez-search--border-radius-small);
|
|
203
|
-
gap: var(--space--small, 6px);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.item__value,
|
|
207
|
-
.item__label {
|
|
208
|
-
flex-basis: auto;
|
|
209
|
-
white-space: nowrap;
|
|
210
|
-
overflow: hidden;
|
|
211
|
-
text-overflow: ellipsis;
|
|
212
|
-
|
|
213
|
-
/*public*/
|
|
214
|
-
color: var(--ez-search__list-title--primary);
|
|
215
|
-
font-family: var(--ez-search--font-family);
|
|
216
|
-
font-size: var(--ez-search--font-size);
|
|
217
|
-
line-height: var(--ez-search--line-height);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.item__label {
|
|
221
|
-
/*public*/
|
|
222
|
-
font-weight: var(--ez-search--font-weight--medium);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.item__label--bold {
|
|
226
|
-
/*public*/
|
|
227
|
-
font-weight: var(--ez-search--font-weight--large);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.item__value {
|
|
231
|
-
text-align: center;
|
|
232
|
-
|
|
233
|
-
/*public*/
|
|
234
|
-
color: var(--ez-search__list-text--primary);
|
|
235
|
-
font-weight: var(--ez-search--font-weight--large);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.item__value--hidden {
|
|
239
|
-
visibility: hidden;
|
|
240
|
-
position: absolute;
|
|
241
|
-
white-space: nowrap;
|
|
242
|
-
z-index: -1;
|
|
243
|
-
top: 0;
|
|
244
|
-
left: 0;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.item__label {
|
|
248
|
-
text-align: left;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.message {
|
|
252
|
-
text-align: center;
|
|
253
|
-
display: flex;
|
|
254
|
-
justify-content: center;
|
|
255
|
-
align-items: center;
|
|
256
|
-
list-style-type: none;
|
|
257
|
-
|
|
258
|
-
/*public*/
|
|
259
|
-
min-height: var(--ez-search__list-height);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.message__no-result {
|
|
263
|
-
/*public*/
|
|
264
|
-
color: var(--ez-search__list-title--primary);
|
|
265
|
-
font-family: var(--ez-search--font-family);
|
|
266
|
-
font-size: var(--ez-search--font-size);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.message__loading {
|
|
270
|
-
border-radius: 50%;
|
|
271
|
-
width: 14px;
|
|
272
|
-
height: 14px;
|
|
273
|
-
-webkit-animation: spin 1s linear infinite;
|
|
274
|
-
animation: spin 1s linear infinite;
|
|
275
|
-
|
|
276
|
-
/*public*/
|
|
277
|
-
border: 3px solid var(--ez-search__list-title--primary);
|
|
278
|
-
border-top: 3px solid transparent;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.item__list > li:hover {
|
|
282
|
-
/*public*/
|
|
283
|
-
background-color: var(--ez-search--background-medium);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.preselected {
|
|
287
|
-
/*public*/
|
|
288
|
-
background-color: var(--background--medium);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
91
|
.btn {
|
|
292
92
|
outline: none;
|
|
293
93
|
border: none;
|
|
@@ -323,23 +123,4 @@ ez-icon {
|
|
|
323
123
|
|
|
324
124
|
ez-text-input:hover .btn__close, ez-text-input:focus .btn__close {
|
|
325
125
|
visibility: visible;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
@-webkit-keyframes spin {
|
|
330
|
-
0% { -webkit-transform: rotate(0deg); }
|
|
331
|
-
100% { -webkit-transform: rotate(360deg); }
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
@keyframes spin {
|
|
335
|
-
0% { transform: rotate(0deg); }
|
|
336
|
-
100% { transform: rotate(360deg); }
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
@supports not (scrollbar-width: thin) {
|
|
340
|
-
/* Estilos para navegadores que NÃO suportam scrollbar-width */
|
|
341
|
-
.item {
|
|
342
|
-
/* Estilos alternativos, por exemplo, para navegadores que não suportam scrollbar-width */
|
|
343
|
-
padding-right: 8px;
|
|
344
|
-
}
|
|
345
126
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
3
|
-
import { ElementIDUtils,
|
|
3
|
+
import { ElementIDUtils, ObjectUtils, StringUtils } from "@sankhyalabs/core";
|
|
4
4
|
import { ApplicationUtils } from "../../utils";
|
|
5
5
|
import { REQUIRED_INFO } from "../../utils/constants";
|
|
6
|
+
import { replaceHighlight, replaceQuotes } from "./utils/searchFormatters";
|
|
6
7
|
export class EzSearch {
|
|
7
8
|
constructor() {
|
|
8
9
|
this._changeDeboucingTimeout = null;
|
|
@@ -133,20 +134,6 @@ export class EzSearch {
|
|
|
133
134
|
async clearValue() {
|
|
134
135
|
this.clearSearch();
|
|
135
136
|
}
|
|
136
|
-
scrollListener() {
|
|
137
|
-
var _a;
|
|
138
|
-
if (this._floatingID == undefined) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
|
|
142
|
-
this.hideOptions();
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
window.requestAnimationFrame(() => {
|
|
146
|
-
this.updateListPosition();
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
137
|
async handleValueAsString(value) {
|
|
151
138
|
if (this.getSelectedOption(value)) {
|
|
152
139
|
this.setInputValue();
|
|
@@ -160,49 +147,6 @@ export class EzSearch {
|
|
|
160
147
|
this.ezChange.emit(this.value);
|
|
161
148
|
this._currentValue = this.value;
|
|
162
149
|
}
|
|
163
|
-
updateListPosition() {
|
|
164
|
-
let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
|
|
165
|
-
const elementRect = this._listWrapper.getBoundingClientRect();
|
|
166
|
-
const containerRect = this._listContainer.getBoundingClientRect();
|
|
167
|
-
const textInputRect = this._textInput.getBoundingClientRect();
|
|
168
|
-
const limitHeight = bottomLimit || window.innerHeight;
|
|
169
|
-
const neededHeight = containerRect.bottom + elementRect.height;
|
|
170
|
-
if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
|
|
171
|
-
fromBottom = true;
|
|
172
|
-
}
|
|
173
|
-
if (!hardPosition) {
|
|
174
|
-
verticalPosition = verticalPosition || 0;
|
|
175
|
-
horizontalPosition = horizontalPosition || 0;
|
|
176
|
-
if (fromBottom) {
|
|
177
|
-
verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
verticalPosition += containerRect.top;
|
|
181
|
-
}
|
|
182
|
-
if (fromRight) {
|
|
183
|
-
horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
horizontalPosition += containerRect.left;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (verticalPosition != undefined) {
|
|
190
|
-
this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
|
|
191
|
-
this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
|
|
192
|
-
}
|
|
193
|
-
if (horizontalPosition != undefined) {
|
|
194
|
-
this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
|
|
195
|
-
this._listWrapper.style[fromRight ? "left" : "right"] = "";
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
getListPosition() {
|
|
199
|
-
if (this.listOptionsPosition) {
|
|
200
|
-
return this.listOptionsPosition;
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
verticalPosition: 6
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
150
|
isDifferentValues(firstValue, secondValue) {
|
|
207
151
|
return ObjectUtils.objectToString(firstValue || {}) !== ObjectUtils.objectToString(secondValue || {});
|
|
208
152
|
}
|
|
@@ -217,24 +161,14 @@ export class EzSearch {
|
|
|
217
161
|
getText() {
|
|
218
162
|
const currentValue = this.getSelectedOption(this._currentValue);
|
|
219
163
|
const text = this.getFormattedText(currentValue);
|
|
220
|
-
return
|
|
221
|
-
}
|
|
222
|
-
replaceQuotes(text) {
|
|
223
|
-
if (text == undefined) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
return String(text)
|
|
227
|
-
.replace(/&/g, '&')
|
|
228
|
-
.replace(/</g, '<')
|
|
229
|
-
.replace(/>/g, '>')
|
|
230
|
-
.replace(/"/g, '"');
|
|
164
|
+
return replaceQuotes(text);
|
|
231
165
|
}
|
|
232
166
|
getSelectedOption(value) {
|
|
233
167
|
if (typeof value === "string" || value instanceof String) {
|
|
234
168
|
return this._visibleOptions.find(o => o.value === value);
|
|
235
169
|
}
|
|
236
170
|
if (value) {
|
|
237
|
-
return Object.assign(Object.assign({}, value), { value:
|
|
171
|
+
return Object.assign(Object.assign({}, value), { value: replaceHighlight(value === null || value === void 0 ? void 0 : value.value), label: replaceHighlight(value === null || value === void 0 ? void 0 : value.label) });
|
|
238
172
|
}
|
|
239
173
|
return value;
|
|
240
174
|
}
|
|
@@ -272,75 +206,19 @@ export class EzSearch {
|
|
|
272
206
|
}
|
|
273
207
|
return 0;
|
|
274
208
|
}
|
|
275
|
-
createOption(detail) {
|
|
276
|
-
let { key, title } = detail;
|
|
277
|
-
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
278
|
-
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
279
|
-
title = StringUtils.decodeHtmlEntities(title);
|
|
280
|
-
const option = {
|
|
281
|
-
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
282
|
-
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
283
|
-
};
|
|
284
|
-
this.selectOption(option);
|
|
285
|
-
}
|
|
286
|
-
buildItem(opt, index) {
|
|
287
|
-
opt.label = opt.label || opt.value;
|
|
288
|
-
const card = {
|
|
289
|
-
key: opt.value,
|
|
290
|
-
title: opt.label,
|
|
291
|
-
details: opt.details
|
|
292
|
-
};
|
|
293
|
-
return h("div", { style: { "height": "100%" }, class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.createOption(card), onMouseOver: () => this._preSelection = index }, h("ez-card-item", { item: card, compacted: true, enableKey: this.showOptionValue }));
|
|
294
|
-
}
|
|
295
209
|
showOptions() {
|
|
296
210
|
if (!this.enabled)
|
|
297
211
|
return;
|
|
298
212
|
if (this.isOptionsVisible()) {
|
|
299
213
|
return;
|
|
300
214
|
}
|
|
301
|
-
|
|
302
|
-
this._resizeObserver.observe(this._textInput);
|
|
303
|
-
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: false, isFixed: true, backClickListener: () => this.hideOptions() });
|
|
304
|
-
this.setFocus();
|
|
305
|
-
window.requestAnimationFrame(() => {
|
|
306
|
-
this.updateListPosition();
|
|
307
|
-
if (!this.listOptionsPosition) {
|
|
308
|
-
this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
309
|
-
}
|
|
310
|
-
});
|
|
215
|
+
this._ezPopOverPlusElement.showUnder(this._textInput);
|
|
311
216
|
}
|
|
312
217
|
hideOptions() {
|
|
313
|
-
|
|
314
|
-
FloatingManager.close(this._floatingID);
|
|
315
|
-
}
|
|
316
|
-
this._floatingID = undefined;
|
|
317
|
-
if (!!this._resizeObserver)
|
|
318
|
-
this._resizeObserver.unobserve(this._textInput);
|
|
218
|
+
this._ezPopOverPlusElement.hide();
|
|
319
219
|
}
|
|
320
220
|
isOptionsVisible() {
|
|
321
|
-
return this.
|
|
322
|
-
}
|
|
323
|
-
nextOption() {
|
|
324
|
-
if (!this.isOptionsVisible()) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
this.showOptions();
|
|
328
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
|
|
329
|
-
this.scrollToOption(this._visibleOptions[this._preSelection]);
|
|
330
|
-
}
|
|
331
|
-
previousOption() {
|
|
332
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
|
|
333
|
-
this.scrollToOption(this._visibleOptions[this._preSelection]);
|
|
334
|
-
}
|
|
335
|
-
scrollToOption(opt) {
|
|
336
|
-
window.requestAnimationFrame(() => {
|
|
337
|
-
const liElem = (opt === null || opt === void 0 ? void 0 : opt.value)
|
|
338
|
-
? this._optionsList.querySelector(`div#item_${opt.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g, '\\$1')}`)
|
|
339
|
-
: undefined;
|
|
340
|
-
if (liElem) {
|
|
341
|
-
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
342
|
-
}
|
|
343
|
-
});
|
|
221
|
+
return this._ezPopOverPlusElement.opened;
|
|
344
222
|
}
|
|
345
223
|
selectCurrentOption() {
|
|
346
224
|
if (this._preSelection !== undefined) {
|
|
@@ -383,17 +261,11 @@ export class EzSearch {
|
|
|
383
261
|
this._source = [];
|
|
384
262
|
this.updateVisibleOptions();
|
|
385
263
|
}
|
|
386
|
-
replaceHighlight(value) {
|
|
387
|
-
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
388
|
-
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
389
|
-
const newValue = String(value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
|
|
390
|
-
return this.replaceQuotes(newValue);
|
|
391
|
-
}
|
|
392
264
|
selectOption(newOption, focusOnInput = true) {
|
|
393
265
|
var _a, _b;
|
|
394
266
|
const currentValue = this.getSelectedOption(this.value);
|
|
395
|
-
const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value:
|
|
396
|
-
const newOptionsFormatted = Object.assign(Object.assign({}, newOptionsReplaced), { value:
|
|
267
|
+
const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
|
|
268
|
+
const newOptionsFormatted = Object.assign(Object.assign({}, newOptionsReplaced), { value: replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value), label: replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.label) });
|
|
397
269
|
if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) === null || _b === void 0 ? void 0 : _b.toString()))
|
|
398
270
|
|| (currentValue == undefined && newOptionsFormatted != undefined && "value" in newOptionsFormatted)) {
|
|
399
271
|
const adjustedOpt = !(newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) ? undefined : newOptionsFormatted;
|
|
@@ -503,7 +375,7 @@ export class EzSearch {
|
|
|
503
375
|
this.showNoResultMessage();
|
|
504
376
|
return;
|
|
505
377
|
}
|
|
506
|
-
this._currentValue = value ? Object.assign(Object.assign({}, value), { value:
|
|
378
|
+
this._currentValue = value ? Object.assign(Object.assign({}, value), { value: replaceHighlight(value.value), label: replaceHighlight(value.label) }) : value;
|
|
507
379
|
this.value = this._currentValue;
|
|
508
380
|
this.setTextInputValue();
|
|
509
381
|
}
|
|
@@ -512,7 +384,7 @@ export class EzSearch {
|
|
|
512
384
|
if (this.value === undefined || this.value === null)
|
|
513
385
|
return;
|
|
514
386
|
const textValue = (typeof this.value === 'string') ? this.value : this.getFormattedText(this.value);
|
|
515
|
-
this._textInput.value =
|
|
387
|
+
this._textInput.value = replaceQuotes(textValue);
|
|
516
388
|
}
|
|
517
389
|
}
|
|
518
390
|
loadOptionValue(argument) {
|
|
@@ -549,7 +421,7 @@ export class EzSearch {
|
|
|
549
421
|
return;
|
|
550
422
|
}
|
|
551
423
|
let text = this.getFormattedText(this.value);
|
|
552
|
-
text =
|
|
424
|
+
text = replaceQuotes(text);
|
|
553
425
|
this._textInput.value = text;
|
|
554
426
|
}
|
|
555
427
|
//---------------------------------------------
|
|
@@ -576,9 +448,6 @@ export class EzSearch {
|
|
|
576
448
|
}
|
|
577
449
|
componentDidRender() {
|
|
578
450
|
var _a;
|
|
579
|
-
if (this._floatingID === undefined) {
|
|
580
|
-
this._listWrapper.remove();
|
|
581
|
-
}
|
|
582
451
|
(_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
|
|
583
452
|
ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
|
|
584
453
|
});
|
|
@@ -590,10 +459,6 @@ export class EzSearch {
|
|
|
590
459
|
window.requestAnimationFrame(() => {
|
|
591
460
|
if (!Array.isArray(entries) || !entries.length)
|
|
592
461
|
return;
|
|
593
|
-
const { clientWidth } = this._listContainer;
|
|
594
|
-
if (clientWidth > 0 && !!this._listWrapper) {
|
|
595
|
-
this._listWrapper.style.width = `${clientWidth}px`;
|
|
596
|
-
}
|
|
597
462
|
});
|
|
598
463
|
});
|
|
599
464
|
await this.handleInitialValue();
|
|
@@ -660,7 +525,7 @@ export class EzSearch {
|
|
|
660
525
|
this._changeDeboucingTimeout = null;
|
|
661
526
|
}
|
|
662
527
|
}
|
|
663
|
-
keyDownHandler(event) {
|
|
528
|
+
async keyDownHandler(event) {
|
|
664
529
|
this._tabPressed = false;
|
|
665
530
|
if (event.ctrlKey) {
|
|
666
531
|
if (event.key === "f" || event.key === "F") {
|
|
@@ -676,15 +541,20 @@ export class EzSearch {
|
|
|
676
541
|
switch (event.key) {
|
|
677
542
|
case "ArrowDown":
|
|
678
543
|
event.stopPropagation();
|
|
679
|
-
if (this.canShowListOptions())
|
|
544
|
+
if (this.canShowListOptions()) {
|
|
680
545
|
event.preventDefault();
|
|
681
|
-
|
|
546
|
+
}
|
|
547
|
+
if (!this.isOptionsVisible()) {
|
|
548
|
+
this.showOptions();
|
|
549
|
+
}
|
|
550
|
+
await this._searchList.nextOption();
|
|
682
551
|
break;
|
|
683
552
|
case "ArrowUp":
|
|
684
553
|
event.stopPropagation();
|
|
685
|
-
if (this.canShowListOptions())
|
|
554
|
+
if (this.canShowListOptions()) {
|
|
686
555
|
event.preventDefault();
|
|
687
|
-
|
|
556
|
+
}
|
|
557
|
+
await this._searchList.previousOption();
|
|
688
558
|
break;
|
|
689
559
|
case "Enter":
|
|
690
560
|
this.handleEventPropagation(event);
|
|
@@ -706,7 +576,7 @@ export class EzSearch {
|
|
|
706
576
|
}
|
|
707
577
|
//O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
|
|
708
578
|
handleEventPropagation(event) {
|
|
709
|
-
if (this.
|
|
579
|
+
if (this._ezPopOverPlusElement.opened && this.stopPropagateEnterKeyEvent) {
|
|
710
580
|
event.stopPropagation();
|
|
711
581
|
}
|
|
712
582
|
}
|
|
@@ -718,17 +588,17 @@ export class EzSearch {
|
|
|
718
588
|
return !this._showLoading && this._visibleOptions.length > 0;
|
|
719
589
|
}
|
|
720
590
|
canShowLoadSpinDescription() {
|
|
721
|
-
return this._showLoadingDescription && this.
|
|
591
|
+
return this._showLoadingDescription && !this._ezPopOverPlusElement.opened;
|
|
592
|
+
}
|
|
593
|
+
onChangePreSelection(value) {
|
|
594
|
+
this._preSelection = value;
|
|
722
595
|
}
|
|
723
596
|
render() {
|
|
724
597
|
var _a;
|
|
725
598
|
ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
|
|
726
599
|
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), 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: "leftIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, this.canShowLoadSpinDescription() ? h("div", { class: "message__loading" }) : h("ez-icon", { iconName: "search" })), (((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value) || this.ensureClearButtonVisible)
|
|
727
600
|
? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
728
|
-
: undefined), h("
|
|
729
|
-
&& this._visibleOptions.length === 0
|
|
730
|
-
&& h("div", { class: "message" }, h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
|
|
731
|
-
&& h("div", { class: "message" }, h("div", { class: "message__loading" })), h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem }), this.canShowListOptions() && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
|
|
601
|
+
: undefined), h("ez-popover-plus", { ref: elem => this._ezPopOverPlusElement = elem, autoClose: false, overlayType: "none", useAnchorSize: true, anchorElement: [this._textInput, this.el] }, h("search-list", { ref: (ref) => this._searchList = ref, showLoading: this._showLoading, visibleOptions: this._visibleOptions, textEmptyList: this._textEmptyList, canShowListOptions: this.canShowListOptions(), value: this.value, showOptionValue: this.showOptionValue, preSelection: this._preSelection, onChangeValue: ({ detail }) => this.selectOption(detail), onChangePreSelection: ({ detail }) => this.onChangePreSelection(detail) }))));
|
|
732
602
|
}
|
|
733
603
|
static get is() { return "ez-search"; }
|
|
734
604
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1276,15 +1146,6 @@ export class EzSearch {
|
|
|
1276
1146
|
"methodName": "observeOptions"
|
|
1277
1147
|
}];
|
|
1278
1148
|
}
|
|
1279
|
-
static get listeners() {
|
|
1280
|
-
return [{
|
|
1281
|
-
"name": "scroll",
|
|
1282
|
-
"method": "scrollListener",
|
|
1283
|
-
"target": "window",
|
|
1284
|
-
"capture": true,
|
|
1285
|
-
"passive": true
|
|
1286
|
-
}];
|
|
1287
|
-
}
|
|
1288
1149
|
}
|
|
1289
1150
|
var SearchMode;
|
|
1290
1151
|
(function (SearchMode) {
|