@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-76625.0 → 0.0.0-bugfix-dev-KB-83282.0

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 (68) hide show
  1. package/dist/cjs/ez-card-item_2.cjs.entry.js +7 -1415
  2. package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +387 -0
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +58 -184
  4. package/dist/cjs/ez-grid.cjs.entry.js +58 -0
  5. package/dist/cjs/ez-popover-core_2.cjs.entry.js +1504 -0
  6. package/dist/cjs/ez-search.cjs.entry.js +158 -28
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/index-a7b0c73d.js +6 -6
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +2 -2
  11. package/dist/collection/components/ez-card-item/ez-card-item.css +3 -1
  12. package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.css +205 -0
  13. package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +426 -0
  14. package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -250
  15. package/dist/collection/components/ez-combo-box/ez-combo-box.js +61 -194
  16. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -0
  17. package/dist/collection/components/ez-grid/ez-grid.js +56 -1
  18. package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +27 -33
  19. package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +2 -2
  20. package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +18 -77
  21. package/dist/collection/components/ez-search/ez-search.css +219 -0
  22. package/dist/collection/components/ez-search/ez-search.js +167 -28
  23. package/dist/custom-elements/index.d.ts +6 -6
  24. package/dist/custom-elements/index.js +468 -359
  25. package/dist/esm/ez-card-item_2.entry.js +7 -1415
  26. package/dist/esm/ez-combo-box-list_3.entry.js +381 -0
  27. package/dist/esm/ez-combo-box.entry.js +59 -185
  28. package/dist/esm/ez-grid.entry.js +59 -1
  29. package/dist/esm/ez-popover-core_2.entry.js +1499 -0
  30. package/dist/esm/ez-search.entry.js +159 -29
  31. package/dist/esm/ezui.js +1 -1
  32. package/dist/esm/index-baa5e267.js +6 -6
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/ezui/ezui.esm.js +1 -1
  35. package/dist/ezui/p-3a009184.entry.js +1 -0
  36. package/dist/ezui/{p-a5950a0d.entry.js → p-53116373.entry.js} +46 -46
  37. package/dist/ezui/p-58783dcf.entry.js +1 -0
  38. package/dist/ezui/p-65f471bc.entry.js +1 -0
  39. package/dist/ezui/p-7bd15498.entry.js +1 -0
  40. package/dist/ezui/p-f5931caa.entry.js +1 -0
  41. package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +104 -0
  42. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -16
  43. package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
  44. package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +4 -5
  45. package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +2 -12
  46. package/dist/types/components/ez-search/ez-search.d.ts +13 -3
  47. package/dist/types/components.d.ts +127 -66
  48. package/package.json +1 -1
  49. package/react/components.d.ts +1 -1
  50. package/react/components.js +1 -1
  51. package/react/components.js.map +1 -1
  52. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +0 -236
  53. package/dist/cjs/ez-popover-plus_3.cjs.entry.js +0 -184
  54. package/dist/cjs/searchFormatters-b7e1ed1e.js +0 -23
  55. package/dist/collection/components/ez-search/subcomponent/search-list/search-list.css +0 -227
  56. package/dist/collection/components/ez-search/subcomponent/search-list/search-list.js +0 -289
  57. package/dist/collection/components/ez-search/utils/searchFormatters.js +0 -18
  58. package/dist/esm/ez-custom-form-input_2.entry.js +0 -231
  59. package/dist/esm/ez-popover-plus_3.entry.js +0 -178
  60. package/dist/esm/searchFormatters-8229207e.js +0 -20
  61. package/dist/ezui/p-31da1b57.entry.js +0 -1
  62. package/dist/ezui/p-37201156.entry.js +0 -1
  63. package/dist/ezui/p-40a60148.js +0 -1
  64. package/dist/ezui/p-64b461b3.entry.js +0 -1
  65. package/dist/ezui/p-b7706b43.entry.js +0 -1
  66. package/dist/ezui/p-dc8b36c3.entry.js +0 -1
  67. package/dist/types/components/ez-search/subcomponent/search-list/search-list.d.ts +0 -23
  68. package/dist/types/components/ez-search/utils/searchFormatters.d.ts +0 -2
@@ -1,12 +1,12 @@
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';
2
+ import { ObjectUtils, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import './ApplicationUtils-eaf91331.js';
4
4
  import { C as CSSVarsUtils } from './CSSVarsUtils-acba92d7.js';
5
5
  import './DialogType-54a62731.js';
6
6
  import './CheckMode-bdb2ec19.js';
7
7
  import './ICustomRender-875b5a40.js';
8
8
 
9
- const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box__min-width:0px;--ez-combo-box__max-width:100%;--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--small, 6px);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;padding:0px;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;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}.text-input-slot-container{--ez-text-input__icon--width:32px;--ez-text-input__min-width:var(--ez-combo-box__min-width);--ez-text-input__max-width:var(--ez-combo-box__max-width)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
9
+ const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--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__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);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)}.btn{outline:none;border:none;background:none;cursor:pointer;padding:0px;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;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}.text-input-slot-container{--ez-text-input__icon--width:32px;--ez-text-input__min-width:var(--ez-combo-box__min-width);--ez-text-input__max-width:var(--ez-combo-box__max-width)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
10
10
 
11
11
  const EzComboBox = class {
12
12
  constructor(hostRef) {
@@ -18,11 +18,13 @@ const EzComboBox = class {
18
18
  this._tabPressed = false;
19
19
  this._textEmptyList = "Nenhum resultado encontrado";
20
20
  this._lookupMode = false;
21
+ this.isOpen = false;
21
22
  this._preSelection = undefined;
22
23
  this._visibleOptions = undefined;
23
24
  this._startLoading = false;
24
25
  this._showLoading = true;
25
26
  this._criteria = undefined;
27
+ this._textInputReady = undefined;
26
28
  this.limitCharsToSearch = 3;
27
29
  this.value = undefined;
28
30
  this.label = undefined;
@@ -128,63 +130,6 @@ const EzComboBox = class {
128
130
  async clearValue() {
129
131
  this.clearSearch();
130
132
  }
131
- scrollListener() {
132
- var _a;
133
- if (this._floatingID == undefined) {
134
- return;
135
- }
136
- if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
137
- this.hideOptions();
138
- }
139
- else {
140
- window.requestAnimationFrame(() => {
141
- this.updateListPosition();
142
- });
143
- }
144
- }
145
- updateListPosition() {
146
- let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
147
- const elementRect = this._listWrapper.getBoundingClientRect();
148
- const containerRect = this._listContainer.getBoundingClientRect();
149
- const textInputRect = this._textInput.getBoundingClientRect();
150
- const limitHeight = bottomLimit || window.innerHeight;
151
- const neededHeight = containerRect.bottom + elementRect.height;
152
- if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
153
- fromBottom = true;
154
- }
155
- if (!hardPosition) {
156
- verticalPosition = verticalPosition || 0;
157
- horizontalPosition = horizontalPosition || 0;
158
- if (fromBottom) {
159
- verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
160
- }
161
- else {
162
- verticalPosition += containerRect.top;
163
- }
164
- if (fromRight) {
165
- horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
166
- }
167
- else {
168
- horizontalPosition += containerRect.left;
169
- }
170
- }
171
- if (verticalPosition != undefined) {
172
- this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
173
- this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
174
- }
175
- if (horizontalPosition != undefined) {
176
- this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
177
- this._listWrapper.style[fromRight ? "left" : "right"] = "";
178
- }
179
- }
180
- getListPosition() {
181
- if (this.listOptionsPosition) {
182
- return this.listOptionsPosition;
183
- }
184
- return {
185
- verticalPosition: 6
186
- };
187
- }
188
133
  isDifferentValues(firstValue, secondValue) {
189
134
  return ObjectUtils.objectToString(firstValue || {}) !== ObjectUtils.objectToString(secondValue || {});
190
135
  }
@@ -257,85 +202,24 @@ const EzComboBox = class {
257
202
  }
258
203
  return 0;
259
204
  }
260
- buildItem(opt, index) {
261
- const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
262
- opt.label = opt.label || opt.value;
263
- return h("li", { class: index === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index }, this.showOptionValue
264
- ? h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
265
- : undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
266
- }
267
205
  showOptions() {
268
206
  var _a, _b;
269
207
  if (!this.enabled)
270
208
  return;
271
- if (this.isOptionsVisible()) {
272
- return;
273
- }
209
+ this.openPopover();
274
210
  const valueString = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value;
275
211
  const indexValue = this._visibleOptions.findIndex(option => option.value === valueString);
276
212
  this._preSelection = indexValue === -1 ? 0 : indexValue;
277
213
  if (!!this._resizeObserver)
278
214
  this._resizeObserver.observe(this._textInput);
279
- this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
280
215
  this.setFocus();
281
- window.requestAnimationFrame(() => {
282
- this.updateListPosition();
283
- if (!this.listOptionsPosition) {
284
- this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
285
- }
286
- });
287
216
  }
288
217
  hideOptions() {
289
- if (this._floatingID !== undefined) {
290
- FloatingManager.close(this._floatingID);
291
- }
292
- this._floatingID = undefined;
218
+ var _a;
219
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.hide();
293
220
  if (!!this._resizeObserver)
294
221
  this._resizeObserver.unobserve(this._textInput);
295
222
  }
296
- isOptionsVisible() {
297
- return this._floatingID !== undefined && FloatingManager.isFloating(this._floatingID);
298
- }
299
- nextOption() {
300
- if (!this.isOptionsVisible()) {
301
- return;
302
- }
303
- this.showOptions();
304
- this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
305
- this.scrollToOption(this._visibleOptions[this._preSelection]);
306
- }
307
- previousOption() {
308
- this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
309
- this.scrollToOption(this._visibleOptions[this._preSelection]);
310
- }
311
- scrollToOption(opt) {
312
- window.requestAnimationFrame(() => {
313
- const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`li#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
314
- if (liElem)
315
- liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
316
- });
317
- }
318
- selectCurrentOption(focusOnInput = true) {
319
- if (this._preSelection !== undefined) {
320
- this.selectOption(this._visibleOptions[this._preSelection], focusOnInput);
321
- this._preSelection = undefined;
322
- }
323
- else {
324
- this.controlListWithOnlyOne(focusOnInput);
325
- }
326
- }
327
- controlListWithOnlyOne(focusOnInput = true) {
328
- var _a;
329
- const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
330
- if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
331
- let title = StringUtils.decodeHtmlEntities(source[0].label);
332
- const option = {
333
- value: source[0].value,
334
- label: title,
335
- };
336
- this.selectOption(option, focusOnInput);
337
- }
338
- }
339
223
  updateSource(source) {
340
224
  this._startLoading = false;
341
225
  if (source instanceof Promise) {
@@ -361,12 +245,13 @@ const EzComboBox = class {
361
245
  }
362
246
  }
363
247
  selectOption(newOption, focusOnInput = true) {
364
- var _a, _b;
248
+ var _a, _b, _c;
365
249
  const currentValue = this.getSelectedOption(this.value);
366
250
  if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
367
251
  || (currentValue == undefined && newOption != undefined && "value" in newOption)) {
368
252
  const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
369
253
  this.value = adjustedOpt;
254
+ (_c = this._popover) === null || _c === void 0 ? void 0 : _c.hide();
370
255
  }
371
256
  else {
372
257
  this.resetOptions();
@@ -419,6 +304,11 @@ const EzComboBox = class {
419
304
  //---------------------------------------------
420
305
  // Lifecycle web component
421
306
  //---------------------------------------------
307
+ componentDidRender() {
308
+ if (this._textInput) {
309
+ this._textInputReady = true;
310
+ }
311
+ }
422
312
  componentWillLoad() {
423
313
  if (this.options === undefined) {
424
314
  this.options = [];
@@ -437,15 +327,6 @@ const EzComboBox = class {
437
327
  }
438
328
  this.loadOptions(SearchMode.PRELOAD);
439
329
  }
440
- componentDidRender() {
441
- var _a;
442
- if (this._floatingID === undefined) {
443
- this._listWrapper.remove();
444
- }
445
- (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
446
- ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
447
- });
448
- }
449
330
  componentDidLoad() {
450
331
  CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
451
332
  this.setInputValue(false);
@@ -453,10 +334,12 @@ const EzComboBox = class {
453
334
  window.requestAnimationFrame(() => {
454
335
  if (!Array.isArray(entries) || !entries.length)
455
336
  return;
456
- const { clientWidth } = this._listContainer;
457
- if (clientWidth > 0 && !!this._listWrapper) {
458
- this._listWrapper.style.width = `${clientWidth}px`;
459
- }
337
+ if (!this._textInput)
338
+ return;
339
+ if (!this._comboBoxList)
340
+ return;
341
+ const textInputWidth = this._textInput.clientWidth;
342
+ this._comboBoxList.width = textInputWidth;
460
343
  });
461
344
  });
462
345
  if (this.autoFocus) {
@@ -465,6 +348,13 @@ const EzComboBox = class {
465
348
  });
466
349
  }
467
350
  }
351
+ disconnectedCallback() {
352
+ var _a;
353
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.remove();
354
+ if (this._resizeObserver) {
355
+ this._resizeObserver.disconnect();
356
+ }
357
+ }
468
358
  //---------------------------------------------
469
359
  // Event handlers
470
360
  //---------------------------------------------
@@ -504,65 +394,48 @@ const EzComboBox = class {
504
394
  this.showOptions();
505
395
  }
506
396
  keyDownHandler(event) {
507
- this._tabPressed = false;
508
- if (event.ctrlKey) {
509
- if (event.key === "f" || event.key === "F") {
510
- this.loadOptions(SearchMode.ADVANCED);
511
- //ATENÇÃO: Ctrl + F tem ação específica nos browsers
512
- //nesse caso, como vamos abrir o popup de busca avançada,
513
- //não é interessante deixar o evento propagar;
514
- event.stopPropagation();
515
- event.stopImmediatePropagation();
516
- event.preventDefault();
517
- }
397
+ var _a, _b, _c, _d, _e, _f;
398
+ if (event.ctrlKey && (event.key === "f" || event.key === "F")) {
399
+ this.loadOptions(SearchMode.ADVANCED);
400
+ event.preventDefault();
401
+ event.stopPropagation();
402
+ return;
518
403
  }
519
404
  switch (event.key) {
520
405
  case "ArrowDown":
521
- event.stopPropagation();
522
- if (this.canShowListOptions())
523
- event.preventDefault();
524
- this.showOptions();
525
- this.nextOption();
406
+ event.preventDefault();
407
+ if (this.canShowListOptions()) {
408
+ this.showOptions();
409
+ (_a = this._comboBoxList) === null || _a === void 0 ? void 0 : _a.nextOption();
410
+ }
526
411
  break;
527
412
  case "ArrowUp":
528
- event.stopPropagation();
529
- if (this.canShowListOptions())
530
- event.preventDefault();
531
- this.showOptions();
532
- this.previousOption();
413
+ event.preventDefault();
414
+ if (this.canShowListOptions()) {
415
+ this.showOptions();
416
+ (_b = this._comboBoxList) === null || _b === void 0 ? void 0 : _b.previousOption();
417
+ }
533
418
  break;
534
419
  case "Enter":
535
- this.handleEventPropagation(event);
536
- if (this.isOptionsVisible()) {
537
- this.selectCurrentOption();
420
+ if (this.isOpen) {
421
+ event.preventDefault();
422
+ (_c = this._comboBoxList) === null || _c === void 0 ? void 0 : _c.selectCurrentOption();
538
423
  }
539
424
  break;
540
425
  case "Escape":
541
- if (this.isOptionsVisible()) {
542
- event.stopPropagation();
426
+ if (this.isOpen) {
427
+ event.preventDefault();
428
+ (_d = this._popover) === null || _d === void 0 ? void 0 : _d.hide();
543
429
  }
544
- this.cancelPreselection();
545
- this.resetOptions();
546
430
  break;
547
431
  case "Tab":
548
432
  this._tabPressed = true;
549
- if (this.isOptionsVisible()) {
550
- this.selectCurrentOption(false);
433
+ if (this.isOpen) {
434
+ (_e = this._comboBoxList) === null || _e === void 0 ? void 0 : _e.selectCurrentOption();
435
+ (_f = this._popover) === null || _f === void 0 ? void 0 : _f.hide();
551
436
  }
552
- this.resetOptions();
553
437
  break;
554
438
  }
555
- //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
556
- //Por exemplo, quando o usuário dá um Enter, além de selecionar
557
- //um valor, também significa que a ateração finalizou,
558
- //e o contexto pode reagir (fechar um popup por exemplo).
559
- //event.stopPropagation();
560
- }
561
- //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
562
- handleEventPropagation(event) {
563
- if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
564
- event.stopPropagation();
565
- }
566
439
  }
567
440
  onTextInputFocusOutHandler() {
568
441
  if (this.hideErrorOnFocusOut)
@@ -571,14 +444,15 @@ const EzComboBox = class {
571
444
  canShowListOptions() {
572
445
  return !this._showLoading && this._visibleOptions.length > 0;
573
446
  }
447
+ openPopover() {
448
+ var _a;
449
+ this.isOpen = true;
450
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.show();
451
+ }
574
452
  render() {
453
+ var _a;
575
454
  ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
576
- return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: `text-input-slot-container ${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
577
- && this._visibleOptions.length === 0
578
- && h("div", { class: "message" }, h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
579
- && h("div", { class: "message" }, h("div", { class: "message__loading" })), this.showOptionValue
580
- ? h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem })
581
- : undefined, this.canShowListOptions() && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
455
+ return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: `text-input-slot-container ${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("ez-popover-plus", { ref: elem => this._popover = elem, anchorElement: this._textInput, autoClose: true, boxWidth: 'fit-content', overlayType: 'none', onEzVisibilityChange: event => this.isOpen = event.detail }, h("ez-combo-box-list", { ref: ref => this._comboBoxList = ref, showLoading: this._showLoading, visibleOptions: this._visibleOptions, textEmptyList: this._textEmptyList, showOptionValue: this.showOptionValue, preSelection: this._preSelection, maxWidth: this._maxWidthValue, width: (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.clientWidth, onOptionSelect: (opt) => this.selectOption(opt), onOptionHover: (index) => this._preSelection = index }))));
582
456
  }
583
457
  get el() { return getElement(this); }
584
458
  static get watchers() { return {
@@ -1,5 +1,5 @@
1
1
  import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-baa5e267.js';
2
- import { Action, DataUnit, ObjectUtils as ObjectUtils$1, HTMLBuilder, ApplicationContext, StringUtils as StringUtils$1, UserInterface, LockManager, LockManagerOperation, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, ElementIDUtils, FieldComparator, DateUtils as DateUtils$1, ArrayUtils as ArrayUtils$1, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME } from '@sankhyalabs/core';
2
+ import { Action, DataUnit, ObjectUtils as ObjectUtils$1, HTMLBuilder, ApplicationContext, StringUtils as StringUtils$1, UserInterface, LockManager, LockManagerOperation, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, ElementIDUtils, FieldComparator, DateUtils as DateUtils$1, ArrayUtils as ArrayUtils$1, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME, KeyboardManager } from '@sankhyalabs/core';
3
3
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
4
4
  import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
5
5
  import './DialogType-54a62731.js';
@@ -65829,6 +65829,9 @@ class AgGridController {
65829
65829
  if (cfgColumn.customWidth != undefined) {
65830
65830
  return cfgColumn.customWidth;
65831
65831
  }
65832
+ if (cfgColumn.width != undefined) {
65833
+ return cfgColumn.width;
65834
+ }
65832
65835
  const field = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(cfgColumn.name);
65833
65836
  if ((field === null || field === void 0 ? void 0 : field.userInterface) === UserInterface.SEARCH) {
65834
65837
  return this.DEFAULT_MAX_SIZE;
@@ -66408,6 +66411,20 @@ const EzGrid = class {
66408
66411
  .then(() => this.resetPaginationState());
66409
66412
  }
66410
66413
  }
66414
+ nextRecord() {
66415
+ if (this.dataUnit) {
66416
+ if (this.dataUnit.getSelectionInfo().records.length === 0) {
66417
+ this.dataUnit.selectFirst();
66418
+ return;
66419
+ }
66420
+ this.dataUnit.nextRecord();
66421
+ }
66422
+ }
66423
+ previousRecord() {
66424
+ if (this.dataUnit) {
66425
+ this.dataUnit.previousRecord();
66426
+ }
66427
+ }
66411
66428
  resetPaginationState() {
66412
66429
  var _a;
66413
66430
  this._paginationChangedByKeyboard = false;
@@ -66490,6 +66507,7 @@ const EzGrid = class {
66490
66507
  this._gridController.configFilterColumn(this._filterColumn);
66491
66508
  if (this.paginationCounterMode === 'auto')
66492
66509
  this._initHeaderOverflowWatcher();
66510
+ this.initKeyboardManager();
66493
66511
  }
66494
66512
  handlePaginationChange(selectFirstRecord, paginationInfo) {
66495
66513
  var _a;
@@ -66556,6 +66574,7 @@ const EzGrid = class {
66556
66574
  var _a, _b;
66557
66575
  (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
66558
66576
  (_b = this._gridController) === null || _b === void 0 ? void 0 : _b.destroy();
66577
+ this.removeShortcuts();
66559
66578
  }
66560
66579
  connectedCallback() {
66561
66580
  var _a;
@@ -66594,6 +66613,45 @@ const EzGrid = class {
66594
66613
  return "left__header-expanded";
66595
66614
  return "left__header-contracted";
66596
66615
  }
66616
+ async initKeyboardManager() {
66617
+ this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
66618
+ this._keyboardManager
66619
+ .bind("ctrl + .", () => {
66620
+ if (!this._paginationInfo)
66621
+ return;
66622
+ this.nextRecord();
66623
+ }, { description: "Avança para o próximo registro.", element: this._element })
66624
+ .bind("ctrl + ,", () => {
66625
+ if (!this._paginationInfo)
66626
+ return;
66627
+ this.previousRecord();
66628
+ }, { description: "Retorna ao registro anterior.", element: this._element })
66629
+ .bind("ctrl + alt + ArrowLeft", () => {
66630
+ if (!this._paginationInfo)
66631
+ return;
66632
+ const { currentPage } = this._paginationInfo;
66633
+ if (currentPage > 0) {
66634
+ this.previousPage();
66635
+ }
66636
+ }, { description: "Retorna a pagina anterior.", element: this._element })
66637
+ .bind("ctrl + alt + ArrowRight", () => {
66638
+ if (!this._paginationInfo)
66639
+ return;
66640
+ const { hasMore } = this._paginationInfo;
66641
+ if (hasMore) {
66642
+ this.nextPage();
66643
+ }
66644
+ }, { description: "Avança para a próxima página.", element: this._element });
66645
+ }
66646
+ async removeShortcuts() {
66647
+ if (this._keyboardManager) {
66648
+ this._keyboardManager
66649
+ .unbind("ctrl + .")
66650
+ .unbind("ctrl + ,")
66651
+ .unbind("ctrl + alt + ArrowLeft")
66652
+ .unbind("ctrl + alt + ArrowRight");
66653
+ }
66654
+ }
66597
66655
  render() {
66598
66656
  var _a;
66599
66657
  return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: {