@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
@@ -10,7 +10,7 @@ require('./DialogType-2114c337.js');
10
10
  require('./CheckMode-ecb90b87.js');
11
11
  require('./ICustomRender-6fafffce.js');
12
12
 
13
- 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)}}";
13
+ 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)}}";
14
14
 
15
15
  const EzComboBox = class {
16
16
  constructor(hostRef) {
@@ -22,11 +22,13 @@ const EzComboBox = class {
22
22
  this._tabPressed = false;
23
23
  this._textEmptyList = "Nenhum resultado encontrado";
24
24
  this._lookupMode = false;
25
+ this.isOpen = false;
25
26
  this._preSelection = undefined;
26
27
  this._visibleOptions = undefined;
27
28
  this._startLoading = false;
28
29
  this._showLoading = true;
29
30
  this._criteria = undefined;
31
+ this._textInputReady = undefined;
30
32
  this.limitCharsToSearch = 3;
31
33
  this.value = undefined;
32
34
  this.label = undefined;
@@ -132,63 +134,6 @@ const EzComboBox = class {
132
134
  async clearValue() {
133
135
  this.clearSearch();
134
136
  }
135
- scrollListener() {
136
- var _a;
137
- if (this._floatingID == undefined) {
138
- return;
139
- }
140
- if ((_a = this.listOptionsPosition) === null || _a === void 0 ? void 0 : _a.hardPosition) {
141
- this.hideOptions();
142
- }
143
- else {
144
- window.requestAnimationFrame(() => {
145
- this.updateListPosition();
146
- });
147
- }
148
- }
149
- updateListPosition() {
150
- let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
151
- const elementRect = this._listWrapper.getBoundingClientRect();
152
- const containerRect = this._listContainer.getBoundingClientRect();
153
- const textInputRect = this._textInput.getBoundingClientRect();
154
- const limitHeight = bottomLimit || window.innerHeight;
155
- const neededHeight = containerRect.bottom + elementRect.height;
156
- if (!fromBottom && (elementRect.top < 0 || neededHeight > limitHeight)) {
157
- fromBottom = true;
158
- }
159
- if (!hardPosition) {
160
- verticalPosition = verticalPosition || 0;
161
- horizontalPosition = horizontalPosition || 0;
162
- if (fromBottom) {
163
- verticalPosition = window.innerHeight - textInputRect.top + verticalPosition;
164
- }
165
- else {
166
- verticalPosition += containerRect.top;
167
- }
168
- if (fromRight) {
169
- horizontalPosition = window.innerWidth - textInputRect.right + horizontalPosition;
170
- }
171
- else {
172
- horizontalPosition += containerRect.left;
173
- }
174
- }
175
- if (verticalPosition != undefined) {
176
- this._listWrapper.style[fromBottom ? "bottom" : "top"] = `${verticalPosition}px`;
177
- this._listWrapper.style[fromBottom ? "top" : "bottom"] = "";
178
- }
179
- if (horizontalPosition != undefined) {
180
- this._listWrapper.style[fromRight ? "right" : "left"] = `${horizontalPosition}px`;
181
- this._listWrapper.style[fromRight ? "left" : "right"] = "";
182
- }
183
- }
184
- getListPosition() {
185
- if (this.listOptionsPosition) {
186
- return this.listOptionsPosition;
187
- }
188
- return {
189
- verticalPosition: 6
190
- };
191
- }
192
137
  isDifferentValues(firstValue, secondValue) {
193
138
  return core.ObjectUtils.objectToString(firstValue || {}) !== core.ObjectUtils.objectToString(secondValue || {});
194
139
  }
@@ -261,85 +206,24 @@ const EzComboBox = class {
261
206
  }
262
207
  return 0;
263
208
  }
264
- buildItem(opt, index$1) {
265
- const widthValue = this.showOptionValue && this._maxWidthValue > 0 ? `${this._maxWidthValue}px` : '';
266
- opt.label = opt.label || opt.value;
267
- return index.h("li", { class: index$1 === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = index$1 }, this.showOptionValue
268
- ? index.h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
269
- : undefined, index.h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
270
- }
271
209
  showOptions() {
272
210
  var _a, _b;
273
211
  if (!this.enabled)
274
212
  return;
275
- if (this.isOptionsVisible()) {
276
- return;
277
- }
213
+ this.openPopover();
278
214
  const valueString = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value;
279
215
  const indexValue = this._visibleOptions.findIndex(option => option.value === valueString);
280
216
  this._preSelection = indexValue === -1 ? 0 : indexValue;
281
217
  if (!!this._resizeObserver)
282
218
  this._resizeObserver.observe(this._textInput);
283
- this._floatingID = core.FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
284
219
  this.setFocus();
285
- window.requestAnimationFrame(() => {
286
- this.updateListPosition();
287
- if (!this.listOptionsPosition) {
288
- this._listWrapper.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
289
- }
290
- });
291
220
  }
292
221
  hideOptions() {
293
- if (this._floatingID !== undefined) {
294
- core.FloatingManager.close(this._floatingID);
295
- }
296
- this._floatingID = undefined;
222
+ var _a;
223
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.hide();
297
224
  if (!!this._resizeObserver)
298
225
  this._resizeObserver.unobserve(this._textInput);
299
226
  }
300
- isOptionsVisible() {
301
- return this._floatingID !== undefined && core.FloatingManager.isFloating(this._floatingID);
302
- }
303
- nextOption() {
304
- if (!this.isOptionsVisible()) {
305
- return;
306
- }
307
- this.showOptions();
308
- this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
309
- this.scrollToOption(this._visibleOptions[this._preSelection]);
310
- }
311
- previousOption() {
312
- this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
313
- this.scrollToOption(this._visibleOptions[this._preSelection]);
314
- }
315
- scrollToOption(opt) {
316
- window.requestAnimationFrame(() => {
317
- const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`li#item_${opt.value.replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
318
- if (liElem)
319
- liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
320
- });
321
- }
322
- selectCurrentOption(focusOnInput = true) {
323
- if (this._preSelection !== undefined) {
324
- this.selectOption(this._visibleOptions[this._preSelection], focusOnInput);
325
- this._preSelection = undefined;
326
- }
327
- else {
328
- this.controlListWithOnlyOne(focusOnInput);
329
- }
330
- }
331
- controlListWithOnlyOne(focusOnInput = true) {
332
- var _a;
333
- const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
334
- if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
335
- let title = core.StringUtils.decodeHtmlEntities(source[0].label);
336
- const option = {
337
- value: source[0].value,
338
- label: title,
339
- };
340
- this.selectOption(option, focusOnInput);
341
- }
342
- }
343
227
  updateSource(source) {
344
228
  this._startLoading = false;
345
229
  if (source instanceof Promise) {
@@ -365,12 +249,13 @@ const EzComboBox = class {
365
249
  }
366
250
  }
367
251
  selectOption(newOption, focusOnInput = true) {
368
- var _a, _b;
252
+ var _a, _b, _c;
369
253
  const currentValue = this.getSelectedOption(this.value);
370
254
  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()))
371
255
  || (currentValue == undefined && newOption != undefined && "value" in newOption)) {
372
256
  const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
373
257
  this.value = adjustedOpt;
258
+ (_c = this._popover) === null || _c === void 0 ? void 0 : _c.hide();
374
259
  }
375
260
  else {
376
261
  this.resetOptions();
@@ -423,6 +308,11 @@ const EzComboBox = class {
423
308
  //---------------------------------------------
424
309
  // Lifecycle web component
425
310
  //---------------------------------------------
311
+ componentDidRender() {
312
+ if (this._textInput) {
313
+ this._textInputReady = true;
314
+ }
315
+ }
426
316
  componentWillLoad() {
427
317
  if (this.options === undefined) {
428
318
  this.options = [];
@@ -441,15 +331,6 @@ const EzComboBox = class {
441
331
  }
442
332
  this.loadOptions(SearchMode.PRELOAD);
443
333
  }
444
- componentDidRender() {
445
- var _a;
446
- if (this._floatingID === undefined) {
447
- this._listWrapper.remove();
448
- }
449
- (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
450
- core.ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
451
- });
452
- }
453
334
  componentDidLoad() {
454
335
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
455
336
  this.setInputValue(false);
@@ -457,10 +338,12 @@ const EzComboBox = class {
457
338
  window.requestAnimationFrame(() => {
458
339
  if (!Array.isArray(entries) || !entries.length)
459
340
  return;
460
- const { clientWidth } = this._listContainer;
461
- if (clientWidth > 0 && !!this._listWrapper) {
462
- this._listWrapper.style.width = `${clientWidth}px`;
463
- }
341
+ if (!this._textInput)
342
+ return;
343
+ if (!this._comboBoxList)
344
+ return;
345
+ const textInputWidth = this._textInput.clientWidth;
346
+ this._comboBoxList.width = textInputWidth;
464
347
  });
465
348
  });
466
349
  if (this.autoFocus) {
@@ -469,6 +352,13 @@ const EzComboBox = class {
469
352
  });
470
353
  }
471
354
  }
355
+ disconnectedCallback() {
356
+ var _a;
357
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.remove();
358
+ if (this._resizeObserver) {
359
+ this._resizeObserver.disconnect();
360
+ }
361
+ }
472
362
  //---------------------------------------------
473
363
  // Event handlers
474
364
  //---------------------------------------------
@@ -508,65 +398,48 @@ const EzComboBox = class {
508
398
  this.showOptions();
509
399
  }
510
400
  keyDownHandler(event) {
511
- this._tabPressed = false;
512
- if (event.ctrlKey) {
513
- if (event.key === "f" || event.key === "F") {
514
- this.loadOptions(SearchMode.ADVANCED);
515
- //ATENÇÃO: Ctrl + F tem ação específica nos browsers
516
- //nesse caso, como vamos abrir o popup de busca avançada,
517
- //não é interessante deixar o evento propagar;
518
- event.stopPropagation();
519
- event.stopImmediatePropagation();
520
- event.preventDefault();
521
- }
401
+ var _a, _b, _c, _d, _e, _f;
402
+ if (event.ctrlKey && (event.key === "f" || event.key === "F")) {
403
+ this.loadOptions(SearchMode.ADVANCED);
404
+ event.preventDefault();
405
+ event.stopPropagation();
406
+ return;
522
407
  }
523
408
  switch (event.key) {
524
409
  case "ArrowDown":
525
- event.stopPropagation();
526
- if (this.canShowListOptions())
527
- event.preventDefault();
528
- this.showOptions();
529
- this.nextOption();
410
+ event.preventDefault();
411
+ if (this.canShowListOptions()) {
412
+ this.showOptions();
413
+ (_a = this._comboBoxList) === null || _a === void 0 ? void 0 : _a.nextOption();
414
+ }
530
415
  break;
531
416
  case "ArrowUp":
532
- event.stopPropagation();
533
- if (this.canShowListOptions())
534
- event.preventDefault();
535
- this.showOptions();
536
- this.previousOption();
417
+ event.preventDefault();
418
+ if (this.canShowListOptions()) {
419
+ this.showOptions();
420
+ (_b = this._comboBoxList) === null || _b === void 0 ? void 0 : _b.previousOption();
421
+ }
537
422
  break;
538
423
  case "Enter":
539
- this.handleEventPropagation(event);
540
- if (this.isOptionsVisible()) {
541
- this.selectCurrentOption();
424
+ if (this.isOpen) {
425
+ event.preventDefault();
426
+ (_c = this._comboBoxList) === null || _c === void 0 ? void 0 : _c.selectCurrentOption();
542
427
  }
543
428
  break;
544
429
  case "Escape":
545
- if (this.isOptionsVisible()) {
546
- event.stopPropagation();
430
+ if (this.isOpen) {
431
+ event.preventDefault();
432
+ (_d = this._popover) === null || _d === void 0 ? void 0 : _d.hide();
547
433
  }
548
- this.cancelPreselection();
549
- this.resetOptions();
550
434
  break;
551
435
  case "Tab":
552
436
  this._tabPressed = true;
553
- if (this.isOptionsVisible()) {
554
- this.selectCurrentOption(false);
437
+ if (this.isOpen) {
438
+ (_e = this._comboBoxList) === null || _e === void 0 ? void 0 : _e.selectCurrentOption();
439
+ (_f = this._popover) === null || _f === void 0 ? void 0 : _f.hide();
555
440
  }
556
- this.resetOptions();
557
441
  break;
558
442
  }
559
- //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
560
- //Por exemplo, quando o usuário dá um Enter, além de selecionar
561
- //um valor, também significa que a ateração finalizou,
562
- //e o contexto pode reagir (fechar um popup por exemplo).
563
- //event.stopPropagation();
564
- }
565
- //O evento deve ter sua propagação interrompida, apenas se a lista de opções estiver sendo exibida.
566
- handleEventPropagation(event) {
567
- if (this._listContainer.hasChildNodes() && this.stopPropagateEnterKeyEvent) {
568
- event.stopPropagation();
569
- }
570
443
  }
571
444
  onTextInputFocusOutHandler() {
572
445
  if (this.hideErrorOnFocusOut)
@@ -575,14 +448,15 @@ const EzComboBox = class {
575
448
  canShowListOptions() {
576
449
  return !this._showLoading && this._visibleOptions.length > 0;
577
450
  }
451
+ openPopover() {
452
+ var _a;
453
+ this.isOpen = true;
454
+ (_a = this._popover) === null || _a === void 0 ? void 0 : _a.show();
455
+ }
578
456
  render() {
457
+ var _a;
579
458
  core.ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
580
- return (index.h(index.Host, null, index.h("ez-text-input", { "data-element-id": core.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 }, index.h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: "chevron-down" }))), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
581
- && this._visibleOptions.length === 0
582
- && index.h("div", { class: "message" }, index.h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
583
- && index.h("div", { class: "message" }, index.h("div", { class: "message__loading" })), this.showOptionValue
584
- ? index.h("span", { class: "item__value item__value--hidden", ref: elem => this._itemValueBasis = elem })
585
- : undefined, this.canShowListOptions() && this._visibleOptions.map((opt, index) => this.buildItem(opt, index)))))));
459
+ return (index.h(index.Host, null, index.h("ez-text-input", { "data-element-id": core.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 }, index.h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: "chevron-down" }))), index.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 }, index.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 }))));
586
460
  }
587
461
  get el() { return index.getElement(this); }
588
462
  static get watchers() { return {
@@ -65833,6 +65833,9 @@ class AgGridController {
65833
65833
  if (cfgColumn.customWidth != undefined) {
65834
65834
  return cfgColumn.customWidth;
65835
65835
  }
65836
+ if (cfgColumn.width != undefined) {
65837
+ return cfgColumn.width;
65838
+ }
65836
65839
  const field = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(cfgColumn.name);
65837
65840
  if ((field === null || field === void 0 ? void 0 : field.userInterface) === core.UserInterface.SEARCH) {
65838
65841
  return this.DEFAULT_MAX_SIZE;
@@ -66412,6 +66415,20 @@ const EzGrid = class {
66412
66415
  .then(() => this.resetPaginationState());
66413
66416
  }
66414
66417
  }
66418
+ nextRecord() {
66419
+ if (this.dataUnit) {
66420
+ if (this.dataUnit.getSelectionInfo().records.length === 0) {
66421
+ this.dataUnit.selectFirst();
66422
+ return;
66423
+ }
66424
+ this.dataUnit.nextRecord();
66425
+ }
66426
+ }
66427
+ previousRecord() {
66428
+ if (this.dataUnit) {
66429
+ this.dataUnit.previousRecord();
66430
+ }
66431
+ }
66415
66432
  resetPaginationState() {
66416
66433
  var _a;
66417
66434
  this._paginationChangedByKeyboard = false;
@@ -66494,6 +66511,7 @@ const EzGrid = class {
66494
66511
  this._gridController.configFilterColumn(this._filterColumn);
66495
66512
  if (this.paginationCounterMode === 'auto')
66496
66513
  this._initHeaderOverflowWatcher();
66514
+ this.initKeyboardManager();
66497
66515
  }
66498
66516
  handlePaginationChange(selectFirstRecord, paginationInfo) {
66499
66517
  var _a;
@@ -66560,6 +66578,7 @@ const EzGrid = class {
66560
66578
  var _a, _b;
66561
66579
  (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
66562
66580
  (_b = this._gridController) === null || _b === void 0 ? void 0 : _b.destroy();
66581
+ this.removeShortcuts();
66563
66582
  }
66564
66583
  connectedCallback() {
66565
66584
  var _a;
@@ -66598,6 +66617,45 @@ const EzGrid = class {
66598
66617
  return "left__header-expanded";
66599
66618
  return "left__header-contracted";
66600
66619
  }
66620
+ async initKeyboardManager() {
66621
+ this._keyboardManager = new core.KeyboardManager({ propagate: false, element: this._element });
66622
+ this._keyboardManager
66623
+ .bind("ctrl + .", () => {
66624
+ if (!this._paginationInfo)
66625
+ return;
66626
+ this.nextRecord();
66627
+ }, { description: "Avança para o próximo registro.", element: this._element })
66628
+ .bind("ctrl + ,", () => {
66629
+ if (!this._paginationInfo)
66630
+ return;
66631
+ this.previousRecord();
66632
+ }, { description: "Retorna ao registro anterior.", element: this._element })
66633
+ .bind("ctrl + alt + ArrowLeft", () => {
66634
+ if (!this._paginationInfo)
66635
+ return;
66636
+ const { currentPage } = this._paginationInfo;
66637
+ if (currentPage > 0) {
66638
+ this.previousPage();
66639
+ }
66640
+ }, { description: "Retorna a pagina anterior.", element: this._element })
66641
+ .bind("ctrl + alt + ArrowRight", () => {
66642
+ if (!this._paginationInfo)
66643
+ return;
66644
+ const { hasMore } = this._paginationInfo;
66645
+ if (hasMore) {
66646
+ this.nextPage();
66647
+ }
66648
+ }, { description: "Avança para a próxima página.", element: this._element });
66649
+ }
66650
+ async removeShortcuts() {
66651
+ if (this._keyboardManager) {
66652
+ this._keyboardManager
66653
+ .unbind("ctrl + .")
66654
+ .unbind("ctrl + ,")
66655
+ .unbind("ctrl + alt + ArrowLeft")
66656
+ .unbind("ctrl + alt + ArrowRight");
66657
+ }
66658
+ }
66601
66659
  render() {
66602
66660
  var _a;
66603
66661
  return (index.h(index.Host, { "no-header": this.hideHeader() }, index.h("div", { class: {