@sankhyalabs/ezui 1.1.4 → 1.1.5

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 (186) hide show
  1. package/README.md +72 -72
  2. package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-6a98d9de.js} +379 -369
  3. package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
  5. package/dist/cjs/ez-button_14.cjs.entry.js +3338 -0
  6. package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
  7. package/dist/cjs/ez-modal.cjs.entry.js +115 -0
  8. package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
  9. package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
  10. package/dist/cjs/ezui.cjs.js +19 -0
  11. package/dist/cjs/form-metadata.cjs.entry.js +74 -0
  12. package/dist/cjs/index-9403fe8f.js +1322 -0
  13. package/dist/cjs/index.cjs.js +2 -0
  14. package/dist/cjs/loader.cjs.js +21 -0
  15. package/dist/collection/collection-manifest.json +31 -0
  16. package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
  17. package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
  18. package/dist/collection/components/ez-button/ez-button.css +94 -0
  19. package/dist/collection/components/ez-button/ez-button.js +125 -0
  20. package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
  21. package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
  22. package/dist/collection/components/ez-check/ez-check.css +266 -0
  23. package/dist/collection/components/ez-check/ez-check.js +168 -0
  24. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
  25. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
  26. package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
  27. package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
  28. package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
  29. package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
  30. package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
  31. package/dist/collection/components/ez-form/ez-form.css +19 -0
  32. package/dist/collection/components/ez-form/ez-form.js +365 -0
  33. package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
  34. package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
  35. package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
  36. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +204 -0
  37. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
  38. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
  39. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
  40. package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
  41. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
  42. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
  43. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
  44. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
  45. package/dist/collection/components/ez-icon/ez-icon.css +37 -0
  46. package/dist/collection/components/ez-icon/ez-icon.js +56 -0
  47. package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
  48. package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
  49. package/dist/collection/components/ez-modal/ez-modal.css +87 -0
  50. package/dist/collection/components/ez-modal/ez-modal.js +224 -0
  51. package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
  52. package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
  53. package/dist/collection/components/ez-popover/ez-popover.css +39 -0
  54. package/dist/collection/components/ez-popover/ez-popover.js +323 -0
  55. package/dist/collection/components/ez-search/ez-search.css +296 -0
  56. package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
  57. package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
  58. package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
  59. package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
  60. package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
  61. package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
  62. package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
  63. package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
  64. package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
  65. package/dist/collection/index.js +1 -0
  66. package/dist/collection/servidor.js +101 -0
  67. package/dist/collection/utils/FloatingManager.js +16 -0
  68. package/dist/collection/utils/utils.js +6 -0
  69. package/dist/custom-elements/index.js +5065 -0
  70. package/dist/esm/DataUnit-ac4cc054.js +375 -0
  71. package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
  72. package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
  73. package/dist/esm/ez-button_14.entry.js +3321 -0
  74. package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
  75. package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
  76. package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
  77. package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
  78. package/dist/esm/ezui.js +17 -0
  79. package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
  80. package/dist/esm/index-95bb3fd9.js +1293 -0
  81. package/dist/esm/index.js +1 -0
  82. package/dist/esm/loader.js +17 -0
  83. package/dist/esm/polyfills/core-js.js +11 -0
  84. package/dist/esm/polyfills/css-shim.js +1 -0
  85. package/dist/esm/polyfills/dom.js +79 -0
  86. package/dist/esm/polyfills/es5-html-element.js +1 -0
  87. package/dist/esm/polyfills/index.js +34 -0
  88. package/dist/esm/polyfills/system.js +6 -0
  89. package/dist/ezui/ezui.esm.js +1 -122
  90. package/dist/ezui/index.esm.js +0 -1
  91. package/dist/ezui/p-185c57f4.js +1 -0
  92. package/dist/ezui/p-22b82efb.entry.js +1 -0
  93. package/dist/ezui/p-346050cf.entry.js +1 -0
  94. package/dist/ezui/p-593c03ba.js +1 -0
  95. package/dist/ezui/p-77fdb4fd.entry.js +1 -0
  96. package/dist/ezui/p-9dfccb16.js +1 -0
  97. package/dist/ezui/p-dd4331b7.entry.js +1 -0
  98. package/dist/ezui/p-f6fd31ab.entry.js +1 -0
  99. package/dist/ezui/p-f95e3c71.entry.js +1 -0
  100. package/dist/ezui/p-fa260f22.entry.js +1 -0
  101. package/dist/index.cjs.js +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
  104. package/dist/types/components/ez-button/ez-button.d.ts +20 -20
  105. package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
  106. package/dist/types/components/ez-check/ez-check.d.ts +32 -32
  107. package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
  108. package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
  109. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
  110. package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
  111. package/dist/types/components/ez-form/ez-form.d.ts +31 -27
  112. package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
  113. package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
  114. package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
  115. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
  116. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
  117. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
  118. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
  119. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
  120. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
  121. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
  122. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
  123. package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
  124. package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
  125. package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
  126. package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
  127. package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
  128. package/dist/types/components/ez-search/ez-search.d.ts +95 -95
  129. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
  130. package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
  131. package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
  132. package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
  133. package/dist/types/components.d.ts +8 -0
  134. package/dist/types/index.d.ts +1 -1
  135. package/dist/types/utils/utils.d.ts +2 -2
  136. package/loader/cdn.js +3 -0
  137. package/loader/index.cjs.js +3 -0
  138. package/loader/index.d.ts +13 -0
  139. package/loader/index.es2017.js +3 -0
  140. package/loader/index.js +4 -0
  141. package/loader/package.json +10 -0
  142. package/package.json +114 -114
  143. package/react/components.d.ts +22 -0
  144. package/react/components.js +25 -0
  145. package/react/components.js.map +1 -0
  146. package/react/react-component-lib/createComponent.d.ts +10 -0
  147. package/react/react-component-lib/createComponent.js +59 -0
  148. package/react/react-component-lib/createComponent.js.map +1 -0
  149. package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
  150. package/react/react-component-lib/createOverlayComponent.js +89 -0
  151. package/react/react-component-lib/createOverlayComponent.js.map +1 -0
  152. package/react/react-component-lib/index.d.ts +2 -0
  153. package/react/react-component-lib/index.js +3 -0
  154. package/react/react-component-lib/index.js.map +1 -0
  155. package/react/react-component-lib/interfaces.d.ts +29 -0
  156. package/react/react-component-lib/interfaces.js +1 -0
  157. package/react/react-component-lib/interfaces.js.map +1 -0
  158. package/react/react-component-lib/utils/attachProps.d.ts +12 -0
  159. package/react/react-component-lib/utils/attachProps.js +96 -0
  160. package/react/react-component-lib/utils/attachProps.js.map +1 -0
  161. package/react/react-component-lib/utils/case.d.ts +2 -0
  162. package/react/react-component-lib/utils/case.js +7 -0
  163. package/react/react-component-lib/utils/case.js.map +1 -0
  164. package/react/react-component-lib/utils/dev.d.ts +2 -0
  165. package/react/react-component-lib/utils/dev.js +13 -0
  166. package/react/react-component-lib/utils/dev.js.map +1 -0
  167. package/react/react-component-lib/utils/index.d.ts +7 -0
  168. package/react/react-component-lib/utils/index.js +21 -0
  169. package/react/react-component-lib/utils/index.js.map +1 -0
  170. package/dist/ezui/app-globals-0f993ce5.js +0 -3
  171. package/dist/ezui/css-shim-003e9264.js +0 -4
  172. package/dist/ezui/dom-1b195079.js +0 -73
  173. package/dist/ezui/ez-button.entry.js +0 -47
  174. package/dist/ezui/ez-calendar.entry.js +0 -102
  175. package/dist/ezui/ez-check.entry.js +0 -62
  176. package/dist/ezui/ez-collapsable-box.entry.js +0 -32
  177. package/dist/ezui/ez-combo-box.entry.js +0 -181
  178. package/dist/ezui/ez-date-input.entry.js +0 -77
  179. package/dist/ezui/ez-form.entry.js +0 -1907
  180. package/dist/ezui/ez-icon.entry.js +0 -17
  181. package/dist/ezui/ez-popover.entry.js +0 -112
  182. package/dist/ezui/ez-text-area.entry.js +0 -105
  183. package/dist/ezui/ez-text-input.entry.js +0 -202
  184. package/dist/ezui/index-39044be2.js +0 -2832
  185. package/dist/ezui/place-holder.entry.js +0 -15
  186. package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
@@ -0,0 +1,363 @@
1
+ import { Component, h, Element, Host, Prop, Method, State, Event, Watch } from '@stencil/core';
2
+ export class EzComboBox {
3
+ constructor() {
4
+ this._inputLabelValue = '';
5
+ /**
6
+ * Valor associado ao componente. Este é o valor que o componente recebe ao selecionar uma opção do combobox.
7
+ * Pode ser Label ou Value de acordo com a opção "labelasindex"
8
+ * Caso seja atribuído um valor ao componente que não esteja na relação das options, este vai lançar msg de erro
9
+ * (executo pala valor undefined)
10
+ */
11
+ this.value = undefined;
12
+ /**
13
+ * Label é o título do campo
14
+ */
15
+ this.label = undefined;
16
+ /**
17
+ * Deixa o campo disponível ou não para digitação.
18
+ */
19
+ this.enabled = true;
20
+ /**
21
+ * Ajusta a opção de mostrar o "value" para cada "label". Como default "value" não está presente (showvalue = false)
22
+ */
23
+ this.showvalue = false;
24
+ }
25
+ //---------------------------------------------
26
+ // Public methods
27
+ //---------------------------------------------
28
+ /**
29
+ * Faz o foco no componente de textarea
30
+ */
31
+ async setFocus() {
32
+ this._textInput.setFocus();
33
+ }
34
+ /**
35
+ * Remove o foco no componente de textarea
36
+ */
37
+ async setBlur() {
38
+ this._textInput.setBlur();
39
+ }
40
+ updateValue() {
41
+ const selectedOption = this.options.filter(opt => opt.value === this.value);
42
+ if (selectedOption && selectedOption.length > 0) {
43
+ this._textInput.value = selectedOption[0].label;
44
+ }
45
+ else {
46
+ this.value = null;
47
+ this._textInput.value = '';
48
+ }
49
+ }
50
+ setErrorMessage() {
51
+ this._textInput.errormessage = this.errormessage;
52
+ }
53
+ showOptions() {
54
+ if (this.enabled) {
55
+ this._criteria = undefined;
56
+ const top = this._textInput.errormessage ? '0px' : '-17px';
57
+ this._popover.show(top);
58
+ }
59
+ }
60
+ updateSelection() {
61
+ const selectedOption = this.options.filter(opt => opt.label === this._textInput.value);
62
+ this.selectOption((selectedOption && selectedOption.length > 0) ? selectedOption[0] : null);
63
+ }
64
+ selectOption(opt) {
65
+ this._popover.hide();
66
+ this.value = opt ? opt.value : null;
67
+ this.ezChange.emit();
68
+ }
69
+ buildItem(opt, index) {
70
+ const className = index === this._preSelection ? "--li--preselected" : "";
71
+ return h("li", { class: className, key: opt.value, id: 'item_' + opt.value, onMouseDown: () => this.selectOption(opt) },
72
+ this.highlightMatch(opt.label),
73
+ this.showvalue ? h("span", { class: '--li__spanvalue' }, opt.value) : null);
74
+ }
75
+ highlightMatch(label) {
76
+ const spanClassName = this.showvalue ? '--li__spanlabel' : '--li__spanlabel--full-width';
77
+ if (this._criteria) {
78
+ const criteriaLength = this._criteria.length;
79
+ const matchStart = label.toUpperCase().indexOf(this._criteria);
80
+ if (matchStart > -1) {
81
+ const strLabelStart = label.substr(0, matchStart);
82
+ const strLabelEnd = label.substr(matchStart + criteriaLength);
83
+ const strMatch = label.substr(matchStart, criteriaLength);
84
+ return (h("span", { class: spanClassName },
85
+ strLabelStart,
86
+ h("strong", null, strMatch),
87
+ strLabelEnd));
88
+ }
89
+ }
90
+ return (h("span", { class: spanClassName }, label));
91
+ }
92
+ matchOptions() {
93
+ this.showOptions();
94
+ this._criteria = this._textInput.value.toLocaleUpperCase();
95
+ this.filterOptions();
96
+ }
97
+ filterOptions() {
98
+ this._preSelection = undefined;
99
+ let opts = (this.options || []);
100
+ if (this._criteria) {
101
+ opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(this._criteria) > -1);
102
+ }
103
+ this._visibleOptions = [{ value: '', label: '' }].concat(opts);
104
+ }
105
+ nextOption() {
106
+ this.showOptions();
107
+ this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
108
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
109
+ }
110
+ previousOption() {
111
+ this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
112
+ this.scrollToOption(this._visibleOptions[this._preSelection]);
113
+ }
114
+ scrollToOption(opt) {
115
+ const liElem = this.el.shadowRoot.querySelector(`li#item_${opt.value}`);
116
+ if (liElem) {
117
+ const parent = liElem.parentElement;
118
+ const parentRect = parent.getBoundingClientRect();
119
+ const itemRect = liElem.getBoundingClientRect();
120
+ if (itemRect.bottom > parentRect.bottom || itemRect.top < parentRect.top) {
121
+ liElem.scrollIntoView();
122
+ }
123
+ }
124
+ }
125
+ selectCurrentOption() {
126
+ if (this._preSelection !== undefined) {
127
+ this.selectOption(this._visibleOptions[this._preSelection]);
128
+ this._preSelection = undefined;
129
+ }
130
+ }
131
+ keyDownHandler(event) {
132
+ switch (event.key) {
133
+ case "ArrowDown":
134
+ this.nextOption();
135
+ break;
136
+ case "ArrowUp":
137
+ this.previousOption();
138
+ break;
139
+ case "Enter":
140
+ this.selectCurrentOption();
141
+ break;
142
+ }
143
+ event.stopPropagation();
144
+ }
145
+ //---------------------------------------------
146
+ // Lifecycle web component
147
+ //---------------------------------------------
148
+ componentWillLoad() {
149
+ if (this.options === undefined) {
150
+ this.options = [];
151
+ const optionsTags = this.el.querySelectorAll('option');
152
+ if (optionsTags) {
153
+ optionsTags.forEach(e => {
154
+ let label = e.innerText;
155
+ let value = e.getAttribute('value');
156
+ if (!value) {
157
+ value = label;
158
+ }
159
+ this.options.push({ label, value });
160
+ e.hidden = true;
161
+ });
162
+ }
163
+ }
164
+ this.filterOptions();
165
+ }
166
+ componentDidLoad() {
167
+ this.updateValue();
168
+ }
169
+ render() {
170
+ return (h(Host, null,
171
+ h("ez-text-input", { ref: (el) => this._textInput = el, value: this._inputLabelValue, enabled: this.enabled, onInput: () => this.matchOptions(), onClick: () => this.showOptions(), onFocusout: () => this.updateSelection(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, errormessage: this.errormessage },
172
+ h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })),
173
+ h("ez-popover", { boxwidth: "100%", ref: el => this._popover = el, autoclose: true },
174
+ h("div", { class: "list-container" }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
175
+ }
176
+ ;
177
+ static get is() { return "ez-combo-box"; }
178
+ static get encapsulation() { return "shadow"; }
179
+ static get originalStyleUrls() { return {
180
+ "$": ["ez-combo-box.css"]
181
+ }; }
182
+ static get styleUrls() { return {
183
+ "$": ["ez-combo-box.css"]
184
+ }; }
185
+ static get properties() { return {
186
+ "value": {
187
+ "type": "string",
188
+ "mutable": true,
189
+ "complexType": {
190
+ "original": "string",
191
+ "resolved": "string",
192
+ "references": {}
193
+ },
194
+ "required": false,
195
+ "optional": false,
196
+ "docs": {
197
+ "tags": [],
198
+ "text": "Valor associado ao componente. Este \u00E9 o valor que o componente recebe ao selecionar uma op\u00E7\u00E3o do combobox.\nPode ser Label ou Value de acordo com a op\u00E7\u00E3o \"labelasindex\"\nCaso seja atribu\u00EDdo um valor ao componente que n\u00E3o esteja na rela\u00E7\u00E3o das options, este vai lan\u00E7ar msg de erro\n(executo pala valor undefined)"
199
+ },
200
+ "attribute": "value",
201
+ "reflect": true,
202
+ "defaultValue": "undefined"
203
+ },
204
+ "label": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "Label \u00E9 o t\u00EDtulo do campo"
217
+ },
218
+ "attribute": "label",
219
+ "reflect": true,
220
+ "defaultValue": "undefined"
221
+ },
222
+ "enabled": {
223
+ "type": "boolean",
224
+ "mutable": false,
225
+ "complexType": {
226
+ "original": "boolean",
227
+ "resolved": "boolean",
228
+ "references": {}
229
+ },
230
+ "required": false,
231
+ "optional": false,
232
+ "docs": {
233
+ "tags": [],
234
+ "text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
235
+ },
236
+ "attribute": "enabled",
237
+ "reflect": true,
238
+ "defaultValue": "true"
239
+ },
240
+ "showvalue": {
241
+ "type": "boolean",
242
+ "mutable": false,
243
+ "complexType": {
244
+ "original": "boolean",
245
+ "resolved": "boolean",
246
+ "references": {}
247
+ },
248
+ "required": false,
249
+ "optional": false,
250
+ "docs": {
251
+ "tags": [],
252
+ "text": "Ajusta a op\u00E7\u00E3o de mostrar o \"value\" para cada \"label\". Como default \"value\" n\u00E3o est\u00E1 presente (showvalue = false)"
253
+ },
254
+ "attribute": "showvalue",
255
+ "reflect": true,
256
+ "defaultValue": "false"
257
+ },
258
+ "options": {
259
+ "type": "unknown",
260
+ "mutable": true,
261
+ "complexType": {
262
+ "original": "Array<OptionsCombobox>",
263
+ "resolved": "OptionsCombobox[]",
264
+ "references": {
265
+ "Array": {
266
+ "location": "global"
267
+ },
268
+ "OptionsCombobox": {
269
+ "location": "import",
270
+ "path": "./ez-combo-box-interfaces"
271
+ }
272
+ }
273
+ },
274
+ "required": false,
275
+ "optional": false,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": "/**\n Array no formato \"{value: string, label: string} que alimenta as op\u00E7\u00F5es do Combobox\""
279
+ }
280
+ },
281
+ "errormessage": {
282
+ "type": "string",
283
+ "mutable": true,
284
+ "complexType": {
285
+ "original": "string",
286
+ "resolved": "string",
287
+ "references": {}
288
+ },
289
+ "required": false,
290
+ "optional": false,
291
+ "docs": {
292
+ "tags": [],
293
+ "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
294
+ },
295
+ "attribute": "errormessage",
296
+ "reflect": true
297
+ }
298
+ }; }
299
+ static get states() { return {
300
+ "_inputLabelValue": {},
301
+ "_criteria": {},
302
+ "_preSelection": {},
303
+ "_visibleOptions": {}
304
+ }; }
305
+ static get events() { return [{
306
+ "method": "ezChange",
307
+ "name": "ezChange",
308
+ "bubbles": true,
309
+ "cancelable": true,
310
+ "composed": true,
311
+ "docs": {
312
+ "tags": [],
313
+ "text": "Evento que \u00E9 disparado ao alterar o value do componente"
314
+ },
315
+ "complexType": {
316
+ "original": "string",
317
+ "resolved": "string",
318
+ "references": {}
319
+ }
320
+ }]; }
321
+ static get methods() { return {
322
+ "setFocus": {
323
+ "complexType": {
324
+ "signature": "() => Promise<void>",
325
+ "parameters": [],
326
+ "references": {
327
+ "Promise": {
328
+ "location": "global"
329
+ }
330
+ },
331
+ "return": "Promise<void>"
332
+ },
333
+ "docs": {
334
+ "text": "Faz o foco no componente de textarea",
335
+ "tags": []
336
+ }
337
+ },
338
+ "setBlur": {
339
+ "complexType": {
340
+ "signature": "() => Promise<void>",
341
+ "parameters": [],
342
+ "references": {
343
+ "Promise": {
344
+ "location": "global"
345
+ }
346
+ },
347
+ "return": "Promise<void>"
348
+ },
349
+ "docs": {
350
+ "text": "Remove o foco no componente de textarea",
351
+ "tags": []
352
+ }
353
+ }
354
+ }; }
355
+ static get elementRef() { return "el"; }
356
+ static get watchers() { return [{
357
+ "propName": "value",
358
+ "methodName": "updateValue"
359
+ }, {
360
+ "propName": "errormessage",
361
+ "methodName": "setErrorMessage"
362
+ }]; }
363
+ }
@@ -0,0 +1,39 @@
1
+ :host {
2
+ display: block;
3
+ width: 100%;
4
+ --it__input--background-color: var(--background--medium, #e0e0e0);
5
+ --it__input--border-color: var(--it__input--background-color);
6
+ }
7
+
8
+ .text-input{
9
+ --it__input--background-color: inherit;
10
+ --it__input--border-color: inherit;
11
+ }
12
+
13
+ .btn-open-cal{
14
+ outline: none;
15
+ border: none;
16
+ background-color: unset;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .btn-open-cal:disabled{
21
+ cursor: unset;
22
+ }
23
+
24
+ .btn-open-cal::after{
25
+ content: '';
26
+ display: flex;
27
+ background-color: var(--text--primary, #008561);
28
+ width: 15px;
29
+ height: 16px;
30
+ clip-path: path("M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z");
31
+ }
32
+
33
+ .btn-open-cal:disabled:after{
34
+ background-color: var(--text--disable, #AFB6C0);
35
+ }
36
+
37
+ .btn-open-cal:enabled:hover::after{
38
+ background-color: var(--color--primary, #4e4e4e);
39
+ }
@@ -0,0 +1,172 @@
1
+ import { Component, Host, h, Prop, Watch, Event } from '@stencil/core';
2
+ import { DateUtils } from '@sankhyalabs/core';
3
+ export class EzDateInput {
4
+ constructor() {
5
+ /**
6
+ * Deixa o campo disponível ou não para uso.
7
+ */
8
+ this.enabled = true;
9
+ }
10
+ setLabel() {
11
+ this._textInput.label = this.label;
12
+ }
13
+ setErrorMessage() {
14
+ this._textInput.errormessage = this.errormessage;
15
+ }
16
+ applyValueToInput() {
17
+ this._textInput.value = this.getTextValue(this.value);
18
+ }
19
+ changeValue(newValue) {
20
+ newValue = newValue == null ? null : DateUtils.clearTime(newValue);
21
+ this._textInput.errormessage = "";
22
+ if (this.getTextValue(newValue) !== this.getTextValue(this.value)) {
23
+ this.value = newValue;
24
+ this.ezChange.emit();
25
+ }
26
+ }
27
+ showCalendar() {
28
+ this.parseDate();
29
+ this._calendar.value = this.value;
30
+ //FIXME: Provavelmente isso fará com que o popup abra em uma
31
+ //posição errada no futuro. Preferi fazer simples no começo,
32
+ //porque não quis onerar o text input com essa funcionalidade...
33
+ const top = this._textInput.errormessage ? '0px' : '-17px';
34
+ this._calendar.show(top);
35
+ }
36
+ hideCalendar() {
37
+ this.changeValue(this._calendar.value);
38
+ this._calendar.hide();
39
+ }
40
+ parseDate() {
41
+ const strValue = this._textInput.value;
42
+ const parsedDate = DateUtils.strToDate(strValue);
43
+ if (parsedDate || !strValue) {
44
+ if (this.value === parsedDate) {
45
+ this.changeValue(this.value);
46
+ }
47
+ else {
48
+ this.changeValue(parsedDate);
49
+ }
50
+ }
51
+ else {
52
+ this._textInput.errormessage = "O valor digitado não é uma data válida";
53
+ }
54
+ }
55
+ getTextValue(d) {
56
+ return d ? new Intl.DateTimeFormat('pt-BR').format(d) : null;
57
+ }
58
+ render() {
59
+ return (h(Host, null,
60
+ h("ez-text-input", { class: "text-input", ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key === 'H' || event.key === 'h')
61
+ this.changeValue(new Date()); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errormessage: this.errormessage },
62
+ h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
63
+ h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
64
+ }
65
+ static get is() { return "ez-date-input"; }
66
+ static get encapsulation() { return "shadow"; }
67
+ static get originalStyleUrls() { return {
68
+ "$": ["ez-date-input.css"]
69
+ }; }
70
+ static get styleUrls() { return {
71
+ "$": ["ez-date-input.css"]
72
+ }; }
73
+ static get properties() { return {
74
+ "label": {
75
+ "type": "string",
76
+ "mutable": false,
77
+ "complexType": {
78
+ "original": "string",
79
+ "resolved": "string",
80
+ "references": {}
81
+ },
82
+ "required": false,
83
+ "optional": false,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": "Label \u00E9 o t\u00EDtulo do campo"
87
+ },
88
+ "attribute": "label",
89
+ "reflect": true
90
+ },
91
+ "value": {
92
+ "type": "unknown",
93
+ "mutable": true,
94
+ "complexType": {
95
+ "original": "Date",
96
+ "resolved": "Date",
97
+ "references": {
98
+ "Date": {
99
+ "location": "global"
100
+ }
101
+ }
102
+ },
103
+ "required": false,
104
+ "optional": false,
105
+ "docs": {
106
+ "tags": [],
107
+ "text": "A data informada pelo usu\u00E1rio"
108
+ }
109
+ },
110
+ "enabled": {
111
+ "type": "boolean",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "boolean",
115
+ "resolved": "boolean",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para uso."
123
+ },
124
+ "attribute": "enabled",
125
+ "reflect": true,
126
+ "defaultValue": "true"
127
+ },
128
+ "errormessage": {
129
+ "type": "string",
130
+ "mutable": true,
131
+ "complexType": {
132
+ "original": "string",
133
+ "resolved": "string",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
141
+ },
142
+ "attribute": "errormessage",
143
+ "reflect": true
144
+ }
145
+ }; }
146
+ static get events() { return [{
147
+ "method": "ezChange",
148
+ "name": "ezChange",
149
+ "bubbles": true,
150
+ "cancelable": true,
151
+ "composed": true,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": ""
155
+ },
156
+ "complexType": {
157
+ "original": "string",
158
+ "resolved": "string",
159
+ "references": {}
160
+ }
161
+ }]; }
162
+ static get watchers() { return [{
163
+ "propName": "label",
164
+ "methodName": "setLabel"
165
+ }, {
166
+ "propName": "errormessage",
167
+ "methodName": "setErrorMessage"
168
+ }, {
169
+ "propName": "value",
170
+ "methodName": "applyValueToInput"
171
+ }]; }
172
+ }