@sankhyalabs/ezui 1.1.78 → 1.1.79

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 (150) hide show
  1. package/dist/cjs/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
  2. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
  5. package/dist/cjs/ez-calendar_13.cjs.entry.js +2417 -0
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -2
  7. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  8. package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
  9. package/dist/cjs/ez-icon.cjs.entry.js +30 -0
  10. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
  15. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  16. package/dist/cjs/ezui.cjs.js +2 -2
  17. package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
  18. package/dist/cjs/{index-40ebb2be.js → index-a2266984.js} +18 -23
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/collection/collection-manifest.json +0 -2
  21. package/dist/collection/components/ez-form/DataBinder.js +44 -0
  22. package/dist/collection/components/ez-form/ez-form.css +1 -15
  23. package/dist/collection/components/ez-form/ez-form.js +109 -428
  24. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
  25. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
  26. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
  27. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
  28. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
  29. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
  30. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
  31. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
  32. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
  33. package/dist/collection/components/ez-form/store/form.slice.js +38 -0
  34. package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
  35. package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
  36. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
  37. package/dist/collection/components/test-du/test-du.js +65 -23
  38. package/dist/custom-elements/index.d.ts +0 -12
  39. package/dist/custom-elements/index.js +380 -2065
  40. package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
  41. package/dist/esm/ez-action-chip.entry.js +1 -1
  42. package/dist/esm/ez-application.entry.js +1 -1
  43. package/dist/esm/ez-button_3.entry.js +514 -0
  44. package/dist/esm/ez-calendar_13.entry.js +2401 -0
  45. package/dist/esm/ez-date-time-input.entry.js +2 -2
  46. package/dist/esm/ez-dialog.entry.js +1 -1
  47. package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
  48. package/dist/esm/ez-icon.entry.js +26 -0
  49. package/dist/esm/ez-label-chip.entry.js +1 -1
  50. package/dist/esm/ez-modal_2.entry.js +365 -0
  51. package/dist/esm/ez-popover.entry.js +2 -2
  52. package/dist/esm/ez-popup.entry.js +1 -1
  53. package/dist/esm/ez-time-input.entry.js +3 -3
  54. package/dist/esm/ez-toast.entry.js +1 -1
  55. package/dist/esm/ezui.js +2 -2
  56. package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
  57. package/dist/esm/{index-ca8700cb.js → index-afe19542.js} +17 -21
  58. package/dist/esm/loader.js +2 -2
  59. package/dist/ezui/ezui.esm.js +1 -1
  60. package/dist/ezui/p-00b837e2.js +1 -0
  61. package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
  62. package/dist/ezui/{p-a15093e3.entry.js → p-0d8368fc.entry.js} +1 -1
  63. package/dist/ezui/p-1e36e3ff.entry.js +1 -0
  64. package/dist/ezui/p-446ec85b.js +1 -0
  65. package/dist/ezui/{p-74f978db.entry.js → p-5509ee41.entry.js} +46 -46
  66. package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
  67. package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
  68. package/dist/ezui/{p-f3c5f27e.entry.js → p-7a1f2e0e.entry.js} +1 -1
  69. package/dist/ezui/p-7de3c95d.js +1 -0
  70. package/dist/ezui/{p-8d6cdd3e.entry.js → p-857ead8e.entry.js} +1 -1
  71. package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
  72. package/dist/ezui/p-9be02ecf.entry.js +1 -0
  73. package/dist/ezui/p-a4a39579.entry.js +1 -0
  74. package/dist/ezui/p-d5699f29.entry.js +1 -0
  75. package/dist/ezui/p-d64a3939.entry.js +1 -0
  76. package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
  77. package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
  78. package/dist/types/components/ez-form/ez-form.d.ts +24 -32
  79. package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
  80. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
  81. package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
  82. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  83. package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
  84. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
  85. package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
  86. package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
  87. package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
  88. package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
  89. package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
  90. package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
  91. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
  92. package/dist/types/components/test-du/test-du.d.ts +8 -2
  93. package/dist/types/components.d.ts +9 -63
  94. package/package.json +1 -1
  95. package/react/components.d.ts +0 -2
  96. package/react/components.js +0 -2
  97. package/react/components.js.map +1 -1
  98. package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
  99. package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
  100. package/dist/cjs/ez-calendar.cjs.entry.js +0 -217
  101. package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -634
  102. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -254
  103. package/dist/cjs/ez-form.cjs.entry.js +0 -1838
  104. package/dist/cjs/ez-number-input.cjs.entry.js +0 -74
  105. package/dist/cjs/form-metadata.cjs.entry.js +0 -129
  106. package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
  107. package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
  108. package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
  109. package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
  110. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
  111. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
  112. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
  113. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
  114. package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
  115. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
  116. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
  117. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
  118. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
  119. package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
  120. package/dist/esm/DataUnit-1cd45202.js +0 -464
  121. package/dist/esm/ez-calendar.entry.js +0 -213
  122. package/dist/esm/ez-collapsible-box_6.entry.js +0 -625
  123. package/dist/esm/ez-combo-box.entry.js +0 -250
  124. package/dist/esm/ez-form.entry.js +0 -1834
  125. package/dist/esm/ez-number-input.entry.js +0 -70
  126. package/dist/esm/form-metadata.entry.js +0 -125
  127. package/dist/ezui/assets/trash-can-outline.svg +0 -3
  128. package/dist/ezui/p-14bee38e.entry.js +0 -1
  129. package/dist/ezui/p-37a611ea.js +0 -1
  130. package/dist/ezui/p-3a09c678.entry.js +0 -1
  131. package/dist/ezui/p-43c15c94.entry.js +0 -1
  132. package/dist/ezui/p-7107d7ef.js +0 -1
  133. package/dist/ezui/p-72ff3c95.entry.js +0 -1
  134. package/dist/ezui/p-88f45a83.entry.js +0 -1
  135. package/dist/ezui/p-8f4851a6.js +0 -1
  136. package/dist/ezui/p-9dfd537e.js +0 -1
  137. package/dist/ezui/p-a0331955.entry.js +0 -1
  138. package/dist/ezui/p-a19f2af3.entry.js +0 -1
  139. package/dist/ezui/p-da929c01.js +0 -1
  140. package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
  141. package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
  142. package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
  143. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
  144. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
  145. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
  146. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
  147. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
  148. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
  149. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
  150. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
@@ -1,254 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-4e4bae01.js');
6
- require('./index-40ebb2be.js');
7
- const FloatingManager = require('./FloatingManager-6cfeb947.js');
8
- const CSSVarsUtils = require('./CSSVarsUtils-66e86394.js');
9
-
10
- const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__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-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--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));--ez-combo-box__drop-down-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"16px\"><path d=\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\"/></svg>');--ez-combo-box__search-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"22px\" width=\"22px\"><path d=\"m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z\"/></svg>');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}";
11
-
12
- let EzComboBox = class {
13
- constructor(hostRef) {
14
- index.registerInstance(this, hostRef);
15
- this.ezChange = index.createEvent(this, "ezChange", 7);
16
- /**
17
- * Deixa o campo disponível ou não para interação com usuário.
18
- */
19
- this.enabled = true;
20
- /**
21
- * Ajusta a opção de mostrar o "value" ao selecionar uma opção. Por padrão não mostra.
22
- */
23
- this.showSelectedValue = false;
24
- /**
25
- * Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
26
- */
27
- this.showOptionValue = false;
28
- }
29
- internalUpdate() {
30
- if (this._inputElement) {
31
- this._inputElement.value = this.getText();
32
- }
33
- this.hideOptions();
34
- this._criteria = undefined;
35
- this._preSelection = undefined;
36
- this.updateVisibleOptions();
37
- }
38
- getText() {
39
- let text = "";
40
- const selected = this.getSelectedOption();
41
- if (selected) {
42
- text = this.showSelectedValue ? `${selected.value} - ${selected.label}` : selected.label;
43
- }
44
- return text;
45
- }
46
- getSelectedOption() {
47
- if (typeof this.value === "string" || this.value instanceof String) {
48
- return this._visibleOptions.find(o => o.value === this.value);
49
- }
50
- return this.value;
51
- }
52
- updateVisibleOptions() {
53
- let opts = this._source || [];
54
- if (!this.searchMode && this._criteria) {
55
- const upperCriteria = this._criteria.toUpperCase();
56
- opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
57
- }
58
- this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
59
- }
60
- buildItem(opt, index$1) {
61
- return index.h("li", { class: index$1 === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = undefined }, index.h("span", { class: "item--label", title: opt.label }, opt.label), this.showOptionValue ? index.h("span", { class: "item--value", title: opt.value }, opt.value) : undefined);
62
- }
63
- showOptions() {
64
- if (!this.enabled) {
65
- return;
66
- }
67
- //FIXME: Provavelmente isso fará com que o popup abra em uma
68
- //posição errada no futuro. Preferi fazer simples no começo,
69
- //porque não quis onerar o text input com essa funcionalidade...
70
- const top = this.errorMessage ? "0px" : "-17px";
71
- this._floatingID = FloatingManager.FloatingManager.float(this._optionsList, this._listContainer, { autoClose: true, top });
72
- window.requestAnimationFrame(() => {
73
- this._optionsList.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
74
- });
75
- }
76
- hideOptions() {
77
- if (this._floatingID !== undefined) {
78
- FloatingManager.FloatingManager.close(this._floatingID);
79
- }
80
- this._floatingID = undefined;
81
- }
82
- isOptionsVisible() {
83
- return this._floatingID !== undefined && FloatingManager.FloatingManager.isFloating(this._floatingID);
84
- }
85
- nextOption() {
86
- if (this.searchMode && !this.isOptionsVisible()) {
87
- return;
88
- }
89
- this.showOptions();
90
- this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
91
- this.scrollToOption(this._visibleOptions[this._preSelection], true);
92
- }
93
- previousOption() {
94
- this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
95
- this.scrollToOption(this._visibleOptions[this._preSelection], false);
96
- }
97
- scrollToOption(opt, down) {
98
- window.requestAnimationFrame(() => {
99
- const liElem = this._optionsList.querySelector(`li#item_${opt.value}`);
100
- if (liElem) {
101
- const parent = liElem.parentElement;
102
- const parentRect = parent.getBoundingClientRect();
103
- const itemRect = liElem.getBoundingClientRect();
104
- if (down && itemRect.bottom > parentRect.bottom) {
105
- parent.scrollTop = itemRect.top;
106
- }
107
- else if (!down && itemRect.top < parentRect.top) {
108
- parent.scrollTop = 0;
109
- }
110
- }
111
- });
112
- }
113
- selectCurrentOption() {
114
- if (this._preSelection !== undefined) {
115
- this.selectOption(this._visibleOptions[this._preSelection]);
116
- this._preSelection = undefined;
117
- }
118
- }
119
- selectOption(opt) {
120
- const currentOpt = this.getSelectedOption();
121
- if (currentOpt !== opt) {
122
- const adjustedOpt = !(opt === null || opt === void 0 ? void 0 : opt.value) ? undefined : opt;
123
- this.value = adjustedOpt;
124
- this.errorMessage = "";
125
- this.ezChange.emit(adjustedOpt);
126
- }
127
- else {
128
- this.internalUpdate();
129
- }
130
- }
131
- updateSource(source) {
132
- if (source instanceof Promise) {
133
- source.then(result => this.updateSource(result));
134
- this.updateVisibleOptions();
135
- }
136
- else {
137
- this._source = source;
138
- this.updateVisibleOptions();
139
- }
140
- }
141
- loadOptions(mode, argument = "") {
142
- this._criteria = argument;
143
- if (this.optionLoader) {
144
- this.updateSource(this.optionLoader({ mode, argument }));
145
- }
146
- else {
147
- this.updateSource(this.options);
148
- }
149
- }
150
- cancelPreselection() {
151
- if (!this._inputElement.value && this.value) {
152
- this.selectOption(undefined);
153
- }
154
- else {
155
- this.internalUpdate();
156
- }
157
- }
158
- //---------------------------------------------
159
- // Lifecycle web component
160
- //---------------------------------------------
161
- componentWillLoad() {
162
- if (this.options === undefined) {
163
- this.options = [];
164
- const optionsTags = this.el.querySelectorAll("option");
165
- if (optionsTags) {
166
- optionsTags.forEach(e => {
167
- let label = e.innerText;
168
- let value = e.getAttribute("value");
169
- if (!value) {
170
- value = label;
171
- }
172
- this.options.push({ label, value });
173
- e.hidden = true;
174
- });
175
- }
176
- }
177
- if (this.searchMode) {
178
- this.updateSource([]);
179
- }
180
- else {
181
- this.loadOptions("PRELOAD");
182
- }
183
- }
184
- componentDidRender() {
185
- if (this._floatingID === undefined) {
186
- this._optionsList.remove();
187
- }
188
- }
189
- componentDidLoad() {
190
- CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
191
- }
192
- //---------------------------------------------
193
- // Event handlers
194
- //---------------------------------------------
195
- onTextInputChangeHandler(event) {
196
- if (!this._criteria) {
197
- this._inputElement.value = event.data;
198
- }
199
- const argument = event.target.value;
200
- this._criteria = argument;
201
- if (this._criteria) {
202
- if (this.searchMode) {
203
- if (this._changeDeboucingTimeout) {
204
- window.clearTimeout(this._changeDeboucingTimeout);
205
- }
206
- this._changeDeboucingTimeout = window.setTimeout(() => {
207
- this.loadOptions("PREDICTIVE", argument);
208
- }, 200);
209
- }
210
- else {
211
- this.updateVisibleOptions();
212
- }
213
- this.showOptions();
214
- }
215
- }
216
- onTextInputClickHandler() {
217
- if (!this.searchMode) {
218
- this.showOptions();
219
- }
220
- }
221
- keyDownHandler(event) {
222
- switch (event.key) {
223
- case "ArrowDown":
224
- this.nextOption();
225
- break;
226
- case "ArrowUp":
227
- this.previousOption();
228
- break;
229
- case "Enter":
230
- this.selectCurrentOption();
231
- break;
232
- case "Escape":
233
- this.cancelPreselection();
234
- break;
235
- }
236
- event.stopPropagation();
237
- }
238
- onTextInputFocusOutHandler() {
239
- this.cancelPreselection();
240
- }
241
- render() {
242
- return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._inputElement = elem, enabled: this.enabled, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), errorMessage: this.errorMessage }, this.searchMode ?
243
- index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-search", onClick: () => { this.loadOptions("ADVANCED"); }, slot: "leftIcon" })
244
- :
245
- index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
246
- }
247
- get el() { return index.getElement(this); }
248
- static get watchers() { return {
249
- "value": ["internalUpdate"]
250
- }; }
251
- };
252
- EzComboBox.style = ezComboBoxCss;
253
-
254
- exports.ez_combo_box = EzComboBox;