@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-75065.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 (62) hide show
  1. package/dist/cjs/ez-badge.cjs.entry.js +2 -14
  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-icon.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +186 -0
  7. package/dist/cjs/{ez-multi-selection-list_2.cjs.entry.js → ez-popover-core_2.cjs.entry.js} +115 -196
  8. package/dist/cjs/ezui.cjs.js +1 -1
  9. package/dist/cjs/index-a7b0c73d.js +8 -4
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/collection/collection-manifest.json +2 -0
  12. package/dist/collection/components/ez-badge/ez-badge.css +1 -12
  13. package/dist/collection/components/ez-badge/ez-badge.js +1 -31
  14. package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.css +205 -0
  15. package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +426 -0
  16. package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -250
  17. package/dist/collection/components/ez-combo-box/ez-combo-box.js +61 -194
  18. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -0
  19. package/dist/collection/components/ez-grid/ez-grid.js +56 -1
  20. package/dist/collection/components/ez-icon/ez-icon.css +4 -1
  21. package/dist/collection/components/ez-popover-plus/ez-popover-plus.css +0 -64
  22. package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +47 -127
  23. package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +67 -0
  24. package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +468 -0
  25. package/dist/custom-elements/index.d.ts +12 -0
  26. package/dist/custom-elements/index.js +395 -219
  27. package/dist/esm/ez-badge.entry.js +2 -14
  28. package/dist/esm/ez-combo-box-list_3.entry.js +381 -0
  29. package/dist/esm/ez-combo-box.entry.js +59 -185
  30. package/dist/esm/ez-grid.entry.js +59 -1
  31. package/dist/esm/ez-icon.entry.js +1 -1
  32. package/dist/esm/ez-multi-selection-list.entry.js +182 -0
  33. package/dist/esm/{ez-multi-selection-list_2.entry.js → ez-popover-core_2.entry.js} +116 -197
  34. package/dist/esm/ezui.js +1 -1
  35. package/dist/esm/index-baa5e267.js +8 -4
  36. package/dist/esm/loader.js +1 -1
  37. package/dist/ezui/ezui.esm.js +1 -1
  38. package/dist/ezui/p-3a009184.entry.js +1 -0
  39. package/dist/ezui/{p-a5950a0d.entry.js → p-53116373.entry.js} +46 -46
  40. package/dist/ezui/p-56fe5341.entry.js +1 -0
  41. package/dist/ezui/p-650e4b6d.entry.js +1 -0
  42. package/dist/ezui/p-7bd15498.entry.js +1 -0
  43. package/dist/ezui/p-dc73e1fe.entry.js +1 -0
  44. package/dist/ezui/p-f5931caa.entry.js +1 -0
  45. package/dist/types/components/ez-badge/ez-badge.d.ts +0 -5
  46. package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +104 -0
  47. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -16
  48. package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
  49. package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +6 -19
  50. package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +81 -0
  51. package/dist/types/components.d.ts +218 -11
  52. package/package.json +1 -1
  53. package/react/components.d.ts +2 -0
  54. package/react/components.js +2 -0
  55. package/react/components.js.map +1 -1
  56. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +0 -236
  57. package/dist/esm/ez-custom-form-input_2.entry.js +0 -231
  58. package/dist/ezui/p-0ca05a2f.entry.js +0 -1
  59. package/dist/ezui/p-64b461b3.entry.js +0 -1
  60. package/dist/ezui/p-cdac80f1.entry.js +0 -1
  61. package/dist/ezui/p-dc8b36c3.entry.js +0 -1
  62. package/dist/ezui/p-e75c7a23.entry.js +0 -1
@@ -15,7 +15,7 @@ var Sizes;
15
15
  Sizes["EXTRA_SMALL"] = "extra-small";
16
16
  })(Sizes || (Sizes = {}));
17
17
 
18
- const ezBadgeCss = ":host{--ez-badge--size-2xs:var(--space--2xs, 8px);--ez-badge--size-xs:var(--space--xs, 12px);--ez-badge--size-sm:var(--space--sm, 16px);--ez-badge--size-md:var(--space--md, 20px);--ez-badge--size-lg:var(--space--lg, 24px);--ez-badge--size-xl:var(--space--xl, 32px);--ez-badge--padding-2xs:0;--ez-badge--padding-xs:var(--space--nano, 2px);--ez-badge--padding-sm:calc(var(--space--nano, 2px) + 1px);--ez-badge--padding-md:var(--space--3xs, 4px);--ez-badge--padding-lg:calc(var(--space--3xs, 4px) + 2px);--ez-badge--padding-xl:var(--space--2xs);--ez-badge--border-radius:calc(var(--border--radius-medium, 12px) + 8px);--ez-badge--font-family:var(--font-pattern, Roboto);--ez-badge--font-weight-medium:var(--text-weight--medium, 400);--ez-badge--background-color:var(--color--primary, #008561);--ez-badge--border-none:0;--ez-badge--color:var(--text--inverted, #ffffff);--ez-badge--gap:calc(var(--ez-badge--padding-xs) + 1px);--ez-badge--font-size-md:var(--text--medium);--ez-badge--font-size-sm:var(--text--medium);--ez-badge--font-size-xs:var(--text--small)}ez-icon{--ez-icon--color:inherit}.badge{display:flex;justify-content:center;align-items:center;position:relative}.badge__content{font-family:var(--ez-badge--font-family, Roboto);font-weight:var(--ez-badge--font-weight-medium, 400);background-color:var(--ez-badge--background-color, #008561);border:var(--ez-badge--border-none, 0);color:var(--ez-badge--color, #ffffff);border-radius:var(--ez-badge--border-radius, 20px);gap:var(--ez-badge--gap, 3px);display:flex;justify-content:center}.badge__content--fill-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px)}.badge__content--fill-2xs{height:var(--ez-badge--size-2xs, 8px);min-width:var(--ez-badge--size-2xs, 8px)}.badge__content--text-md{height:calc(var(--ez-badge--size-md, 20px) - 2px);min-width:var(--ez-badge--size-sm, 20px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-md)}.badge__content--text-sm{height:calc(var(--ez-badge--size-sm, 16px) - 2px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-sm)}.badge__content--text-xs{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-2xs);padding-bottom:var(--ez-badge--padding-2xs);padding-right:var(--ez-badge--padding-lg);padding-left:var(--ez-badge--padding-lg);font-size:var(--ez-badge--font-size-xs)}.badge__content--icon-lg{height:var(--ez-badge--size-lg, 24px);min-width:var(--ez-badge--size-lg, 24px);padding:var(--ez-badge--padding-md)}.badge__content--icon-md{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-md)}.badge__content--icon-sm{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-xs)}.badge__content--icon-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px);padding:var(--ez-badge--padding-xs)}.badge__content--icon-align-center{align-items:center}.badge__content--icon-align-start{align-items:flex-start}.badge__content--icon-align-end{align-items:flex-end}.badge__content--fill{position:absolute;top:0;inset-inline-end:0;z-index:var(--most-visible, 2)}.badge__content--fill-top-right{transform:translate(50%, -50%);position:absolute;top:0;right:0}.badge__content--fill-top-left{transform:translate(-50%, -50%);position:absolute;top:0;left:0}.badge__content--fill-bottom-left{transform:translate(-50%, 50%);position:absolute;bottom:0;left:0}.badge__content--fill-bottom-right{transform:translate(50%, 50%);position:absolute;bottom:0;right:0}";
18
+ const ezBadgeCss = ":host{--ez-badge--size-2xs:var(--space--2xs, 8px);--ez-badge--size-xs:var(--space--xs, 12px);--ez-badge--size-sm:var(--space--sm, 16px);--ez-badge--size-md:var(--space--md, 20px);--ez-badge--size-lg:var(--space--lg, 24px);--ez-badge--size-xl:var(--space--xl, 32px);--ez-badge--padding-2xs:0;--ez-badge--padding-xs:var(--space--nano, 2px);--ez-badge--padding-sm:calc(var(--space--nano, 2px) + 1px);--ez-badge--padding-md:var(--space--3xs, 4px);--ez-badge--padding-lg:calc(var(--space--3xs, 4px) + 2px);--ez-badge--padding-xl:var(--space--2xs);--ez-badge--border-radius:calc(var(--border--radius-medium, 12px) + 8px);--ez-badge--font-family:var(--font-pattern, Roboto);--ez-badge--font-weight-medium:var(--text-weight--medium, 400);--ez-badge--background-color:var(--color--primary, #008561);--ez-badge--border-none:0;--ez-badge--color:var(--text--inverted, #ffffff);--ez-badge--gap:calc(var(--ez-badge--padding-xs) + 1px);--ez-badge--font-size-md:var(--text--medium);--ez-badge--font-size-sm:var(--text--medium);--ez-badge--font-size-xs:var(--text--small)}ez-icon{--ez-icon--color:inherit}.badge{display:flex;justify-content:center;align-items:center;position:relative}.badge__content{font-family:var(--ez-badge--font-family, Roboto);font-weight:var(--ez-badge--font-weight-medium, 400);background-color:var(--ez-badge--background-color, #008561);border:var(--ez-badge--border-none, 0);color:var(--ez-badge--color, #ffffff);border-radius:var(--ez-badge--border-radius, 20px);gap:var(--ez-badge--gap, 3px);display:flex;justify-content:center;align-items:center}.badge__content--fill-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px)}.badge__content--fill-2xs{height:var(--ez-badge--size-2xs, 8px);min-width:var(--ez-badge--size-2xs, 8px)}.badge__content--text-md{height:calc(var(--ez-badge--size-md, 20px) - 2px);min-width:var(--ez-badge--size-sm, 20px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-md)}.badge__content--text-sm{height:calc(var(--ez-badge--size-sm, 16px) - 2px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-sm)}.badge__content--text-xs{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-2xs);padding-bottom:var(--ez-badge--padding-2xs);padding-right:var(--ez-badge--padding-lg);padding-left:var(--ez-badge--padding-lg);font-size:var(--ez-badge--font-size-xs)}.badge__content--icon-lg{height:var(--ez-badge--size-lg, 24px);min-width:var(--ez-badge--size-lg, 24px);padding:var(--ez-badge--padding-md)}.badge__content--icon-md{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-md)}.badge__content--icon-sm{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-xs)}.badge__content--icon-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px);padding:var(--ez-badge--padding-xs)}.badge__content--fill{position:absolute;top:0;inset-inline-end:0;z-index:var(--most-visible, 2)}.badge__content--fill-top-right{transform:translate(50%, -50%);position:absolute;top:0;right:0}.badge__content--fill-top-left{transform:translate(-50%, -50%);position:absolute;top:0;left:0}.badge__content--fill-bottom-left{transform:translate(-50%, 50%);position:absolute;bottom:0;left:0}.badge__content--fill-bottom-right{transform:translate(50%, 50%);position:absolute;bottom:0;right:0}";
19
19
 
20
20
  const EzBadge = class {
21
21
  constructor(hostRef) {
@@ -46,7 +46,6 @@ const EzBadge = class {
46
46
  this.iconLeft = undefined;
47
47
  this.iconRight = undefined;
48
48
  this.position = { horizontal: "right", vertical: "top" };
49
- this.alignItems = "center";
50
49
  }
51
50
  getIconSize() {
52
51
  switch (this.size) {
@@ -61,16 +60,6 @@ const EzBadge = class {
61
60
  return null;
62
61
  }
63
62
  }
64
- getAlignItemsClass() {
65
- switch (this.alignItems) {
66
- case "flex-end":
67
- return "end";
68
- case "flex-start":
69
- return "start";
70
- default:
71
- return "center";
72
- }
73
- }
74
63
  componentDidLoad() {
75
64
  if (this._element) {
76
65
  core.ElementIDUtils.addIDInfo(this._element);
@@ -94,8 +83,7 @@ const EzBadge = class {
94
83
  }
95
84
  createContainerClassName() {
96
85
  let sizeSufix = this._sizes[this.size].sufix;
97
- let alignItemsClass = "badge__content--icon-align-" + this.getAlignItemsClass();
98
- let containerClassNames = ["badge__content", alignItemsClass];
86
+ let containerClassNames = ["badge__content"];
99
87
  if (this.hasSlot) {
100
88
  containerClassNames.push("badge__content--fill-" + sizeSufix);
101
89
  if (this.position.vertical == "bottom" && this.position.horizontal == "right") {
@@ -0,0 +1,387 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const ICustomRender = require('./ICustomRender-6fafffce.js');
8
+ const ApplicationUtils = require('./ApplicationUtils-c9d1205c.js');
9
+ require('./DialogType-2114c337.js');
10
+ require('./CheckMode-ecb90b87.js');
11
+
12
+ const ezComboBoxListCss = ":host{--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--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__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--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.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--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));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)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
13
+
14
+ const EzComboBoxList = class {
15
+ constructor(hostRef) {
16
+ index.registerInstance(this, hostRef);
17
+ this.showLoading = undefined;
18
+ this.visibleOptions = undefined;
19
+ this.textEmptyList = "Nenhum resultado encontrado";
20
+ this.showOptionValue = undefined;
21
+ this.preSelection = undefined;
22
+ this.maxWidth = undefined;
23
+ this.width = undefined;
24
+ this.onOptionSelect = undefined;
25
+ this.onOptionHover = undefined;
26
+ }
27
+ /**
28
+ * Move a seleção para a próxima opção na lista.
29
+ */
30
+ async nextOption() {
31
+ var _a;
32
+ if (!this.visibleOptions || this.visibleOptions.length === 0)
33
+ return;
34
+ const isAtLastOption = this.preSelection !== undefined && this.preSelection >= this.visibleOptions.length - 1;
35
+ if (!isAtLastOption) {
36
+ this.preSelection = this.preSelection === undefined ? 0 : this.preSelection + 1;
37
+ this.scrollToOption(this.visibleOptions[this.preSelection]);
38
+ (_a = this.onOptionHover) === null || _a === void 0 ? void 0 : _a.call(this, this.preSelection);
39
+ }
40
+ }
41
+ /**
42
+ * Move a seleção para a opção anterior na lista, sem ultrapassar o início.
43
+ */
44
+ async previousOption() {
45
+ var _a;
46
+ if (!this.visibleOptions || this.visibleOptions.length === 0)
47
+ return;
48
+ const isAtFirstOption = this.preSelection !== undefined && this.preSelection <= 0;
49
+ if (!isAtFirstOption) {
50
+ this.preSelection = this.preSelection === undefined ? this.visibleOptions.length - 1 : this.preSelection - 1;
51
+ this.scrollToOption(this.visibleOptions[this.preSelection]);
52
+ (_a = this.onOptionHover) === null || _a === void 0 ? void 0 : _a.call(this, this.preSelection);
53
+ }
54
+ }
55
+ /**
56
+ * Seleciona a opção atualmente pré-selecionada.
57
+ */
58
+ async selectCurrentOption() {
59
+ if (this.preSelection !== undefined) {
60
+ this.onOptionSelect(this.visibleOptions[this.preSelection]);
61
+ this.preSelection = undefined;
62
+ }
63
+ }
64
+ /**
65
+ * Observa mudanças na propriedade `width` e ajusta a largura da lista.
66
+ *
67
+ * @param newValue O novo valor da largura.
68
+ * @param oldValue O valor anterior da largura.
69
+ */
70
+ observeWidth(newValue, oldValue) {
71
+ if (newValue === oldValue)
72
+ return;
73
+ if (!this._listWrapper)
74
+ return;
75
+ this._listWrapper.style.width = `${this.width}px`;
76
+ }
77
+ /**
78
+ * Observa mudanças na propriedade `maxWidth` e ajusta a largura máxima da lista.
79
+ *
80
+ * @param newValue O novo valor da largura máxima.
81
+ * @param oldValue O valor anterior da largura máxima.
82
+ */
83
+ observeMaxWidth(newValue, oldValue) {
84
+ if (newValue === oldValue)
85
+ return;
86
+ if (!this._listWrapper)
87
+ return;
88
+ this._listWrapper.style.maxWidth = this.maxWidth ? `${this.maxWidth}px` : '';
89
+ }
90
+ /**
91
+ * Gerencia a navegação por teclado na lista do combo box.
92
+ *
93
+ * - `ArrowDown`: Move para a próxima opção.
94
+ * - `ArrowUp`: Move para a opção anterior.
95
+ * - `Enter`: Seleciona a opção atual.
96
+ * - `Escape`: Limpa a pré-seleção.
97
+ *
98
+ * @param event O evento de teclado.
99
+ */
100
+ handleKeyDown(event) {
101
+ switch (event.key) {
102
+ case "ArrowDown":
103
+ event.preventDefault();
104
+ event.stopPropagation();
105
+ this.nextOption();
106
+ break;
107
+ case "ArrowUp":
108
+ event.preventDefault();
109
+ event.stopPropagation();
110
+ this.previousOption();
111
+ break;
112
+ case "Enter":
113
+ this.selectCurrentOption();
114
+ break;
115
+ case "Escape":
116
+ this.preSelection = undefined;
117
+ break;
118
+ }
119
+ }
120
+ buildItem(opt, index$1) {
121
+ const widthValue = this.showOptionValue && this.maxWidth > 0 ? `${this.maxWidth}px` : '';
122
+ opt.label = opt.label || opt.value;
123
+ return index.h("li", { tabIndex: 1, class: index$1 === this.preSelection ? "item preselected" : "item", id: `item_${opt.value}_${index$1}`, key: `item_${opt.value}_${index$1}`, onMouseDown: () => this.onOptionSelect(opt), onMouseOver: () => this.preSelection = index$1 }, this.showOptionValue
124
+ ? index.h("span", { class: "item__value", title: opt.value, style: { width: widthValue, minWidth: widthValue, maxWidth: widthValue } }, opt.value)
125
+ : undefined, index.h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
126
+ }
127
+ scrollToOption(opt) {
128
+ if (!opt || !opt.value || !this._optionsList)
129
+ return;
130
+ const index = this.visibleOptions.indexOf(opt);
131
+ if (index === -1)
132
+ return;
133
+ const liElem = this._optionsList.querySelector(`li#item_${CSS.escape(opt.value)}_${CSS.escape(String(index))}`);
134
+ if (liElem) {
135
+ liElem.scrollIntoView({
136
+ behavior: "smooth",
137
+ block: "nearest"
138
+ });
139
+ }
140
+ }
141
+ componentDidLoad() {
142
+ this._listWrapper.style.width = `${this.width}px`;
143
+ this._listWrapper.style.maxWidth = this.maxWidth ? `${this.maxWidth}px` : '';
144
+ }
145
+ componentDidRender() {
146
+ var _a;
147
+ (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
148
+ core.ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
149
+ });
150
+ }
151
+ render() {
152
+ return (index.h("section", { class: "list-container" }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this.showLoading && this.visibleOptions.length === 0 && (index.h("div", { class: "message" }, index.h("span", { class: "message__no-result" }, this.textEmptyList))), this.showLoading && (index.h("div", { class: "message" }, index.h("div", { class: "message__loading" }))), this.showOptionValue && (index.h("span", { class: "item__value item__value--hidden" })), !this.showLoading && this.visibleOptions.length > 0 &&
153
+ this.visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
154
+ }
155
+ static get watchers() { return {
156
+ "width": ["observeWidth"],
157
+ "maxWidth": ["observeMaxWidth"]
158
+ }; }
159
+ };
160
+ EzComboBoxList.style = ezComboBoxListCss;
161
+
162
+ const EzCustomFormInput = class {
163
+ constructor(hostRef) {
164
+ index.registerInstance(this, hostRef);
165
+ this.gui = undefined;
166
+ this.customEditor = undefined;
167
+ this.formViewField = undefined;
168
+ this.value = undefined;
169
+ this.detailContext = undefined;
170
+ this.builderFallback = undefined;
171
+ this.selectedRecord = undefined;
172
+ }
173
+ /**
174
+ * Aplica foco no campo.
175
+ */
176
+ async setFocus() {
177
+ var _a, _b;
178
+ (_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
179
+ }
180
+ /**
181
+ * Remove o foco do campo.
182
+ */
183
+ async setBlur() {
184
+ var _a, _b;
185
+ (_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setBlur"]) === null || _b === void 0 ? void 0 : _b.call(_a);
186
+ }
187
+ /**
188
+ * Retorna se o conteúdo é inválido.
189
+ */
190
+ async isInvalid() {
191
+ var _a, _b;
192
+ return ((_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["isInvalid"]) === null || _b === void 0 ? void 0 : _b.call(_a)) || false;
193
+ }
194
+ watchValue() {
195
+ this.handleValue(this.gui);
196
+ }
197
+ watchCustomEditor() {
198
+ this.getContent();
199
+ }
200
+ watchFormViewField(newValue, oldValue) {
201
+ if (!core.ObjectUtils.equals(newValue, oldValue))
202
+ this.getContent();
203
+ }
204
+ watchDetailContext() {
205
+ this.getContent();
206
+ }
207
+ watchBuilderFallback() {
208
+ this.getContent();
209
+ }
210
+ watchSelectedRecord(newValue, oldValue) {
211
+ const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
212
+ const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
213
+ if (newRecordId !== oldRecordId) {
214
+ this.getContent();
215
+ }
216
+ }
217
+ getContent() {
218
+ var _a, _b, _c, _d, _e;
219
+ const fieldProps = new Map();
220
+ for (const prop in this.formViewField.props) {
221
+ fieldProps.set(prop, this.formViewField.props[prop]);
222
+ }
223
+ const params = {
224
+ value: this.value,
225
+ name: this.formViewField.name,
226
+ currentEditor: this.builderFallback(this.formViewField),
227
+ setValue: (value) => this.setValue(value),
228
+ getValue: this.getValue,
229
+ record: this.selectedRecord,
230
+ editorMetadata: {
231
+ label: this.formViewField.label,
232
+ hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
233
+ userInterface: this.formViewField.userInterface,
234
+ options: (_b = this.formViewField.props) === null || _b === void 0 ? void 0 : _b.options,
235
+ props: this.formViewField.props ? fieldProps : undefined,
236
+ optionLoader: this.formViewField.optionLoader
237
+ },
238
+ source: ICustomRender.CustomEditorSource.FORM,
239
+ detailContext: this.detailContext
240
+ };
241
+ let gui = this.customEditor.getEditorElement(params);
242
+ if (!gui) {
243
+ gui = this.builderFallback(this.formViewField);
244
+ this.handleValue(gui);
245
+ this.gui = gui;
246
+ return;
247
+ }
248
+ if (!(gui instanceof HTMLElement) && typeof gui !== 'string') {
249
+ this.handleValue(gui);
250
+ this.gui = gui;
251
+ return;
252
+ }
253
+ if (typeof gui === 'string') {
254
+ gui = core.HTMLBuilder.parseElement(gui);
255
+ }
256
+ const value = (_e = (_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this.value) !== null && _e !== void 0 ? _e : '';
257
+ gui.setAttribute('value', value);
258
+ this.gui = index.h("div", { key: core.StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
259
+ }
260
+ setValue(value) {
261
+ this.value = value;
262
+ }
263
+ getValue() {
264
+ return this.value;
265
+ }
266
+ handleValue(gui) {
267
+ var _a;
268
+ //@ts-ignore
269
+ (_a = gui.$children$) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
270
+ child.$attrs$.value = this.value;
271
+ });
272
+ }
273
+ componentWillLoad() {
274
+ this.getContent();
275
+ }
276
+ render() {
277
+ return (index.h(index.Host, null, this.gui));
278
+ }
279
+ static get watchers() { return {
280
+ "value": ["watchValue"],
281
+ "customEditor": ["watchCustomEditor"],
282
+ "formViewField": ["watchFormViewField"],
283
+ "detailContext": ["watchDetailContext"],
284
+ "builderFallback": ["watchBuilderFallback"],
285
+ "selectedRecord": ["watchSelectedRecord"]
286
+ }; }
287
+ };
288
+
289
+ const ezTextEditCss = ":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";
290
+
291
+ const EzTextEdit = class {
292
+ constructor(hostRef) {
293
+ index.registerInstance(this, hostRef);
294
+ this.saveEdition = index.createEvent(this, "saveEdition", 7);
295
+ this.cancelEdition = index.createEvent(this, "cancelEdition", 7);
296
+ this._newValue = undefined;
297
+ this.value = undefined;
298
+ this.styled = undefined;
299
+ }
300
+ /**
301
+ * Aplica foco no campo.
302
+ */
303
+ async applyFocusSelect() {
304
+ this.calcSizeInput(this.value, true);
305
+ }
306
+ calcSizeInput(value, setSelect = false) {
307
+ var _a, _b;
308
+ const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
309
+ if (textInput != undefined) {
310
+ const sizeText = this.getWidthValue(value);
311
+ textInput.style.width = sizeText + 'px';
312
+ if (setSelect) {
313
+ setTimeout(() => textInput.select(), 100);
314
+ }
315
+ }
316
+ }
317
+ getWidthValue(value) {
318
+ if (this._valueBasis != undefined) {
319
+ const span = this._valueBasis;
320
+ if (value != undefined) {
321
+ const cursorSpace = 2;
322
+ span.innerHTML = value;
323
+ return span.clientWidth > 0 ? (span.clientWidth + cursorSpace) : cursorSpace;
324
+ }
325
+ else {
326
+ span.innerHTML = "";
327
+ }
328
+ }
329
+ return 0;
330
+ }
331
+ setStyledInput() {
332
+ var _a, _b;
333
+ let fontSize = "";
334
+ let fontWeight = "";
335
+ let fontFamily = "";
336
+ if (this.styled != undefined) {
337
+ fontSize = this.styled.fontSize;
338
+ fontWeight = this.styled.fontWeight;
339
+ fontFamily = this.styled.fontFamily;
340
+ }
341
+ const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
342
+ if (textInput != undefined) {
343
+ textInput.style.fontSize = fontSize;
344
+ textInput.style.fontWeight = fontWeight;
345
+ textInput.style.fontFamily = fontFamily;
346
+ }
347
+ const span = this._valueBasis;
348
+ if (span != undefined) {
349
+ span.style.fontSize = fontSize;
350
+ span.style.fontWeight = fontWeight;
351
+ span.style.fontFamily = fontFamily;
352
+ }
353
+ }
354
+ handleSaveEdition() {
355
+ if (!this._newValue) {
356
+ ApplicationUtils.ApplicationUtils.alert("Aviso", "Não é possível salvar um campo em branco.").then(() => {
357
+ this.setNewValue(this.value, true);
358
+ });
359
+ return;
360
+ }
361
+ this.saveEdition.emit({ value: this.value, newValue: this._newValue });
362
+ }
363
+ handleCancelEdition() {
364
+ this.cancelEdition.emit();
365
+ }
366
+ setNewValue(value, setSelect = false) {
367
+ this._newValue = value;
368
+ this.calcSizeInput(this._newValue, setSelect);
369
+ }
370
+ componentDidLoad() {
371
+ this.applyFocusSelect();
372
+ this.setNewValue(this.value);
373
+ }
374
+ componentDidRender() {
375
+ this.setStyledInput();
376
+ }
377
+ render() {
378
+ core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'input');
379
+ return (index.h(index.Host, null, index.h("span", { class: "text-edit__hidden-value", ref: elem => this._valueBasis = elem }), index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), onInput: () => { this.calcSizeInput(this._newValue); }, class: "text-edit__form-input", value: this._newValue, ref: (elem) => this._inputElement = elem, mode: "slim", onEzChange: (evt) => this.setNewValue(evt === null || evt === void 0 ? void 0 : evt.detail), noBorder: true }), index.h("ez-button", { class: "text-edit__icon-check", mode: "icon", iconName: "check", size: "small", onClick: () => { this.handleSaveEdition(); } }), index.h("ez-button", { class: "text-edit__icon-close", mode: "icon", iconName: "close", size: "small", onClick: () => { this.handleCancelEdition(); } })));
380
+ }
381
+ get _element() { return index.getElement(this); }
382
+ };
383
+ EzTextEdit.style = ezTextEditCss;
384
+
385
+ exports.ez_combo_box_list = EzComboBoxList;
386
+ exports.ez_custom_form_input = EzCustomFormInput;
387
+ exports.ez_text_edit = EzTextEdit;