@sankhyalabs/ezui 1.1.75 → 1.1.78

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 (195) hide show
  1. package/dist/cjs/ApplicationUtils-d1c1db56.js +35 -0
  2. package/dist/cjs/AssetsUtils-dd585fba.js +24 -0
  3. package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
  4. package/dist/cjs/DataUnit-fdd7c70e.js +474 -0
  5. package/dist/cjs/DateUtils-716769e0.js +46 -0
  6. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  8. package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
  9. package/dist/cjs/ez-calendar.cjs.entry.js +217 -0
  10. package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +634 -0
  11. package/dist/cjs/ez-combo-box.cjs.entry.js +254 -0
  12. package/dist/cjs/ez-date-time-input.cjs.entry.js +133 -0
  13. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-form.cjs.entry.js +1838 -0
  15. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-number-input.cjs.entry.js +36 -212
  17. package/dist/cjs/ez-popover.cjs.entry.js +3 -3
  18. package/dist/cjs/ez-popup.cjs.entry.js +2 -2
  19. package/dist/cjs/ez-time-input.cjs.entry.js +10 -9
  20. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  21. package/dist/cjs/ezui.cjs.js +3 -3
  22. package/dist/cjs/form-metadata.cjs.entry.js +129 -0
  23. package/dist/cjs/index-40ebb2be.js +7422 -0
  24. package/dist/cjs/{index-4d2896bb.js → index-4e4bae01.js} +3 -5
  25. package/dist/cjs/loader.cjs.js +3 -3
  26. package/dist/collection/collection-manifest.json +8 -3
  27. package/dist/collection/components/ez-application/ez-application.css +3 -0
  28. package/dist/collection/components/ez-application/ez-application.js +35 -0
  29. package/dist/collection/components/ez-button/ez-button.css +78 -44
  30. package/dist/collection/components/ez-button/ez-button.js +36 -4
  31. package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
  32. package/dist/collection/components/ez-calendar/ez-calendar.js +173 -24
  33. package/dist/collection/components/ez-check/ez-check.css +78 -78
  34. package/dist/collection/components/ez-check/ez-check.js +3 -3
  35. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +34 -34
  36. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +12 -12
  37. package/dist/collection/components/ez-combo-box/ez-combo-box.css +65 -54
  38. package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -0
  39. package/dist/collection/components/ez-date-input/ez-date-input.css +17 -3
  40. package/dist/collection/components/ez-date-input/ez-date-input.js +3 -3
  41. package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  42. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +243 -0
  43. package/dist/collection/components/ez-form/ez-form.js +37 -35
  44. package/dist/collection/components/ez-form/store/Form.actions.js +16 -16
  45. package/dist/collection/components/ez-form/store/Form.reducer.js +17 -17
  46. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +11 -11
  47. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +12 -12
  48. package/dist/collection/components/ez-form/subcomponents/place-holder.js +1 -1
  49. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +21 -21
  50. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
  51. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +9 -9
  52. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
  53. package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
  54. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
  55. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
  56. package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
  57. package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
  58. package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
  59. package/dist/collection/components/ez-grid/ez-grid.css +15 -0
  60. package/dist/collection/components/ez-grid/ez-grid.js +414 -0
  61. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
  62. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
  63. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
  64. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
  65. package/dist/collection/components/ez-icon/ez-icon.css +1 -1
  66. package/dist/collection/components/ez-list/ez-list.css +227 -44
  67. package/dist/collection/components/ez-list/ez-list.js +529 -149
  68. package/dist/collection/components/ez-modal/ez-modal.css +4 -4
  69. package/dist/collection/components/ez-modal/ez-modal.js +1 -1
  70. package/dist/collection/components/ez-number-input/ez-number-input.css +1 -165
  71. package/dist/collection/components/ez-number-input/ez-number-input.js +53 -339
  72. package/dist/collection/components/ez-popover/ez-popover.css +10 -6
  73. package/dist/collection/components/ez-popup/ez-popup.css +25 -27
  74. package/dist/collection/components/ez-search/ez-search.js +6 -1
  75. package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
  76. package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
  77. package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
  78. package/dist/collection/components/ez-text-input/ez-text-input.css +60 -60
  79. package/dist/collection/components/ez-text-input/ez-text-input.js +17 -16
  80. package/dist/collection/components/ez-time-input/ez-time-input.js +3 -2
  81. package/dist/collection/components/ez-upload/ez-upload.js +3 -3
  82. package/dist/collection/components/test-du/test-du.css +3 -0
  83. package/dist/collection/components/test-du/test-du.js +45 -0
  84. package/dist/collection/servidor.js +94 -94
  85. package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
  86. package/dist/collection/utils/AssetsUtils.js +19 -0
  87. package/dist/collection/utils/CSSVarsUtils.js +6 -6
  88. package/dist/custom-elements/index.d.ts +36 -6
  89. package/dist/custom-elements/index.js +120886 -2964
  90. package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
  91. package/dist/esm/AssetsUtils-3803e935.js +22 -0
  92. package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
  93. package/dist/esm/DataUnit-1cd45202.js +464 -0
  94. package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
  95. package/dist/esm/ez-action-chip.entry.js +1 -1
  96. package/dist/esm/ez-application.entry.js +22 -0
  97. package/dist/esm/ez-button_11.entry.js +111757 -0
  98. package/dist/esm/ez-calendar.entry.js +213 -0
  99. package/dist/esm/ez-collapsible-box_6.entry.js +625 -0
  100. package/dist/esm/ez-combo-box.entry.js +250 -0
  101. package/dist/esm/ez-date-time-input.entry.js +129 -0
  102. package/dist/esm/ez-dialog.entry.js +1 -1
  103. package/dist/esm/ez-form.entry.js +1834 -0
  104. package/dist/esm/ez-label-chip.entry.js +1 -1
  105. package/dist/esm/ez-number-input.entry.js +36 -212
  106. package/dist/esm/ez-popover.entry.js +3 -3
  107. package/dist/esm/ez-popup.entry.js +2 -2
  108. package/dist/esm/ez-time-input.entry.js +5 -4
  109. package/dist/esm/ez-toast.entry.js +1 -1
  110. package/dist/esm/ezui.js +3 -3
  111. package/dist/esm/form-metadata.entry.js +125 -0
  112. package/dist/esm/{index-33153059.js → index-1dacecd3.js} +3 -6
  113. package/dist/esm/index-ca8700cb.js +7414 -0
  114. package/dist/esm/loader.js +3 -3
  115. package/dist/ezui/ezui.esm.js +1 -1
  116. package/dist/ezui/p-14bee38e.entry.js +1 -0
  117. package/dist/ezui/p-37a611ea.js +1 -0
  118. package/dist/ezui/p-3a09c678.entry.js +1 -0
  119. package/dist/ezui/p-43c15c94.entry.js +1 -0
  120. package/dist/ezui/{p-34d288d0.entry.js → p-516d0e0f.entry.js} +1 -1
  121. package/dist/ezui/{p-0d476efb.entry.js → p-5a86e18a.entry.js} +1 -1
  122. package/dist/ezui/{p-47406a6e.entry.js → p-5da66d3e.entry.js} +1 -1
  123. package/dist/ezui/p-7107d7ef.js +1 -0
  124. package/dist/ezui/p-72ff3c95.entry.js +1 -0
  125. package/dist/ezui/p-74f978db.entry.js +369 -0
  126. package/dist/ezui/p-88f45a83.entry.js +1 -0
  127. package/dist/ezui/p-8b099482.js +1 -0
  128. package/dist/ezui/p-8d6cdd3e.entry.js +1 -0
  129. package/dist/ezui/p-8f4851a6.js +1 -0
  130. package/dist/ezui/p-9dfd537e.js +1 -0
  131. package/dist/ezui/p-a0331955.entry.js +1 -0
  132. package/dist/ezui/p-a15093e3.entry.js +1 -0
  133. package/dist/ezui/{p-8818da66.entry.js → p-a18a2d7b.entry.js} +1 -1
  134. package/dist/ezui/p-a19f2af3.entry.js +1 -0
  135. package/dist/ezui/p-c6d469fc.entry.js +1 -0
  136. package/dist/ezui/p-c89629eb.js +1 -0
  137. package/dist/ezui/p-da929c01.js +1 -0
  138. package/dist/ezui/p-f3c5f27e.entry.js +1 -0
  139. package/dist/types/components/ez-application/ez-application.d.ts +10 -0
  140. package/dist/types/components/ez-button/ez-button.d.ts +5 -0
  141. package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
  142. package/dist/types/components/ez-check/ez-check.d.ts +1 -1
  143. package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +3 -3
  144. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
  145. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
  146. package/dist/types/components/ez-form/ez-form.d.ts +9 -9
  147. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +1 -1
  148. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +1 -1
  149. package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
  150. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
  151. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
  152. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
  153. package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
  154. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
  155. package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
  156. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
  157. package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
  158. package/dist/types/components/ez-list/ez-list.d.ts +70 -17
  159. package/dist/types/components/ez-number-input/ez-number-input.d.ts +29 -63
  160. package/dist/types/components/ez-search/ez-search.d.ts +2 -0
  161. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
  162. package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
  163. package/dist/types/components/test-du/test-du.d.ts +6 -0
  164. package/dist/types/components.d.ts +289 -139
  165. package/dist/types/stencil-public-runtime.d.ts +6 -4
  166. package/dist/types/utils/{Application.d.ts → ApplicationUtils.d.ts} +1 -1
  167. package/dist/types/utils/AssetsUtils.d.ts +1 -0
  168. package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
  169. package/package.json +10 -8
  170. package/react/components.d.ts +6 -1
  171. package/react/components.js +6 -1
  172. package/react/components.js.map +1 -1
  173. package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
  174. package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
  175. package/dist/cjs/ez-button_16.cjs.entry.js +0 -4071
  176. package/dist/cjs/ez-list.cjs.entry.js +0 -174
  177. package/dist/cjs/ez-modal.cjs.entry.js +0 -65
  178. package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
  179. package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
  180. package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
  181. package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
  182. package/dist/esm/ez-button_16.entry.js +0 -4052
  183. package/dist/esm/ez-list.entry.js +0 -170
  184. package/dist/esm/ez-modal.entry.js +0 -61
  185. package/dist/ezui/p-061d21ba.entry.js +0 -1
  186. package/dist/ezui/p-15743b09.entry.js +0 -1
  187. package/dist/ezui/p-46d07e59.entry.js +0 -1
  188. package/dist/ezui/p-4df6f855.js +0 -1
  189. package/dist/ezui/p-50464bdf.entry.js +0 -1
  190. package/dist/ezui/p-67410dfa.entry.js +0 -1
  191. package/dist/ezui/p-7be54779.entry.js +0 -1
  192. package/dist/ezui/p-7f3bc6d9.entry.js +0 -1
  193. package/dist/ezui/p-9dfccb16.js +0 -1
  194. package/dist/ezui/p-d1889704.js +0 -1
  195. package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
@@ -0,0 +1,243 @@
1
+ import { Component, Element, Host, h, Prop, Watch, Event } from '@stencil/core';
2
+ import { DateUtils, TimeFormatter } from '@sankhyalabs/core';
3
+ import CSSVarsUtils from '../../utils/CSSVarsUtils';
4
+ export class EzDateTimeInput {
5
+ constructor() {
6
+ /**
7
+ * Deixa o campo disponível ou não para uso.
8
+ */
9
+ this.enabled = true;
10
+ /**
11
+ * Exibe ou não os segundos no input
12
+ */
13
+ this.showSeconds = false;
14
+ }
15
+ setLabel() {
16
+ this._textInput.label = this.label;
17
+ }
18
+ setErrorMessage() {
19
+ this._textInput.errorMessage = this.errorMessage;
20
+ }
21
+ applyValueToInput() {
22
+ if (this._textInput) {
23
+ this._textInput.value = this.getTextValue(this.value);
24
+ }
25
+ }
26
+ onChangeKeyDown(ev) {
27
+ const input = this._textInput.shadowRoot.querySelector('input');
28
+ if (ev.key === "H" || ev.key === "h") {
29
+ this.changeValue(new Date());
30
+ }
31
+ else if (ev.shiftKey && ev.key === "Tab") {
32
+ if (input.selectionStart > 0) {
33
+ let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
34
+ if (selectIni !== -1) {
35
+ input.setSelectionRange(0, selectIni);
36
+ ev.preventDefault();
37
+ }
38
+ }
39
+ }
40
+ else if (ev.key === "Tab") {
41
+ if (input.value.length !== input.selectionEnd) {
42
+ let selectIni = input.value.indexOf(" ", input.selectionEnd);
43
+ selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
44
+ input.setSelectionRange(selectIni, input.value.length);
45
+ ev.preventDefault();
46
+ }
47
+ }
48
+ }
49
+ onFocused() {
50
+ const input = this._textInput.shadowRoot.querySelector('input');
51
+ if (input.selectionStart !== input.selectionEnd) {
52
+ let selectIni = input.value.indexOf(" ", input.selectionStart);
53
+ selectIni = selectIni === -1 ? input.value.length : selectIni;
54
+ input.setSelectionRange(0, selectIni);
55
+ }
56
+ }
57
+ onClicked() {
58
+ const input = this._textInput.shadowRoot.querySelector('input');
59
+ let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
60
+ selectIni = selectIni === -1 ? 0 : selectIni + 1;
61
+ selectIni = selectIni > input.selectionEnd ? 0 : selectIni;
62
+ let selectFin = selectIni === 0 ? input.value.indexOf(" ") : input.value.length;
63
+ input.setSelectionRange(selectIni, selectFin);
64
+ }
65
+ changeValue(newValue) {
66
+ this._textInput.errorMessage = "";
67
+ if (newValue !== this.value) {
68
+ this.value = newValue;
69
+ this.ezChange.emit();
70
+ }
71
+ }
72
+ showCalendar() {
73
+ const top = this._textInput.errorMessage ? 0 : -17;
74
+ this._calendar.fitVertical(top, this._elem.clientHeight);
75
+ this._calendar.style.visibility = 'inherit';
76
+ }
77
+ parseDate() {
78
+ const strValue = this._textInput.value;
79
+ const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
80
+ const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
81
+ const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
82
+ const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
83
+ const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
84
+ const parsedDate = DateUtils.strToDate(strDateTime);
85
+ if (parsedDate || !strValue) {
86
+ if (this.value === parsedDate) {
87
+ this.changeValue(this.value);
88
+ }
89
+ else {
90
+ this.changeValue(parsedDate);
91
+ }
92
+ }
93
+ else {
94
+ this._textInput.errorMessage = "O valor digitado não é uma data válida";
95
+ }
96
+ }
97
+ getTextValue(d) {
98
+ const options = {
99
+ year: 'numeric', month: 'numeric', day: 'numeric',
100
+ hour: 'numeric', minute: 'numeric'
101
+ };
102
+ const optionsSecond = {
103
+ year: 'numeric', month: 'numeric', day: 'numeric',
104
+ hour: 'numeric', minute: 'numeric', second: 'numeric'
105
+ };
106
+ return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : null;
107
+ }
108
+ componentDidLoad() {
109
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
110
+ }
111
+ render() {
112
+ return (h(Host, null,
113
+ h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, onFocus: () => this.onFocused(), onClick: () => this.onClicked() },
114
+ h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
115
+ h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
116
+ }
117
+ static get is() { return "ez-date-time-input"; }
118
+ static get encapsulation() { return "shadow"; }
119
+ static get originalStyleUrls() { return {
120
+ "$": ["ez-date-time-input.css"]
121
+ }; }
122
+ static get styleUrls() { return {
123
+ "$": ["ez-date-time-input.css"]
124
+ }; }
125
+ static get properties() { return {
126
+ "label": {
127
+ "type": "string",
128
+ "mutable": false,
129
+ "complexType": {
130
+ "original": "string",
131
+ "resolved": "string",
132
+ "references": {}
133
+ },
134
+ "required": false,
135
+ "optional": false,
136
+ "docs": {
137
+ "tags": [],
138
+ "text": "T\u00EDtulo do campo"
139
+ },
140
+ "attribute": "label",
141
+ "reflect": true
142
+ },
143
+ "value": {
144
+ "type": "unknown",
145
+ "mutable": true,
146
+ "complexType": {
147
+ "original": "Date",
148
+ "resolved": "Date",
149
+ "references": {
150
+ "Date": {
151
+ "location": "global"
152
+ }
153
+ }
154
+ },
155
+ "required": false,
156
+ "optional": false,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": "A data informada pelo usu\u00E1rio"
160
+ }
161
+ },
162
+ "enabled": {
163
+ "type": "boolean",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "boolean",
167
+ "resolved": "boolean",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para uso."
175
+ },
176
+ "attribute": "enabled",
177
+ "reflect": true,
178
+ "defaultValue": "true"
179
+ },
180
+ "errorMessage": {
181
+ "type": "string",
182
+ "mutable": true,
183
+ "complexType": {
184
+ "original": "string",
185
+ "resolved": "string",
186
+ "references": {}
187
+ },
188
+ "required": false,
189
+ "optional": false,
190
+ "docs": {
191
+ "tags": [],
192
+ "text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
193
+ },
194
+ "attribute": "error-message",
195
+ "reflect": true
196
+ },
197
+ "showSeconds": {
198
+ "type": "boolean",
199
+ "mutable": false,
200
+ "complexType": {
201
+ "original": "boolean",
202
+ "resolved": "boolean",
203
+ "references": {}
204
+ },
205
+ "required": false,
206
+ "optional": false,
207
+ "docs": {
208
+ "tags": [],
209
+ "text": "Exibe ou n\u00E3o os segundos no input"
210
+ },
211
+ "attribute": "show-seconds",
212
+ "reflect": true,
213
+ "defaultValue": "false"
214
+ }
215
+ }; }
216
+ static get events() { return [{
217
+ "method": "ezChange",
218
+ "name": "ezChange",
219
+ "bubbles": true,
220
+ "cancelable": true,
221
+ "composed": true,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": "Evento disparado ao mudar o estado do componente(onEzChange)."
225
+ },
226
+ "complexType": {
227
+ "original": "string",
228
+ "resolved": "string",
229
+ "references": {}
230
+ }
231
+ }]; }
232
+ static get elementRef() { return "_elem"; }
233
+ static get watchers() { return [{
234
+ "propName": "label",
235
+ "methodName": "setLabel"
236
+ }, {
237
+ "propName": "errorMessage",
238
+ "methodName": "setErrorMessage"
239
+ }, {
240
+ "propName": "value",
241
+ "methodName": "applyValueToInput"
242
+ }]; }
243
+ }
@@ -1,11 +1,11 @@
1
- import { Component, h, Element, forceUpdate, Prop, Method, Watch } from '@stencil/core';
2
- import { createStore, applyMiddleware, combineReducers } from 'redux';
3
- import thunk from 'redux-thunk';
4
- import { formLoad, invalidField, showHideNavigationButtons } from './store/Form.actions';
5
- import undoable from 'redux-undo';
6
- import formReducer, { formNonHistoricReducer } from './store/Form.reducer';
7
- import { FormSheet } from './subcomponents/structure/FormSheet';
8
- import DataUnit from './subcomponents/DataUnit';
1
+ import { Component, h, Element, forceUpdate, Prop, Method, Watch } from "@stencil/core";
2
+ import { createStore, applyMiddleware, combineReducers } from "redux";
3
+ import thunk from "redux-thunk";
4
+ import { formLoad, invalidField, showHideNavigationButtons } from "./store/Form.actions";
5
+ import undoable from "redux-undo";
6
+ import formReducer, { formNonHistoricReducer } from "./store/Form.reducer";
7
+ import { FormSheet } from "./subcomponents/structure/FormSheet";
8
+ import DataUnit from "./subcomponents/DataUnit";
9
9
  export class EzForm {
10
10
  constructor() {
11
11
  this.enabled = true;
@@ -19,8 +19,9 @@ export class EzForm {
19
19
  this._preparedMetadata = undefined;
20
20
  }
21
21
  async validate() {
22
+ const duSourcesNames = Array.from(this._duSources.keys());
22
23
  for (let i = 0; i < this._duSources.size; i++) {
23
- const duName = Array.from(this._duSources.keys())[i];
24
+ const duName = duSourcesNames[i];
24
25
  let du = this._dataUnits.get(duName);
25
26
  if (du === undefined) {
26
27
  const source = this._duSources.get(duName);
@@ -34,8 +35,9 @@ export class EzForm {
34
35
  }
35
36
  async getChanges() {
36
37
  let allChanges = [];
38
+ const dataUnits = Array.from(this._dataUnits.values());
37
39
  for (let i = 0; i < this._dataUnits.size; i++) {
38
- const du = Array.from(this._dataUnits.values())[i];
40
+ const du = dataUnits[i];
39
41
  //Só devemos buscar as alterações de DU raiz, pois os sub DUs serão enviados junto.
40
42
  if (!du.parentDU) {
41
43
  const duChanges = du.getChangesToSave();
@@ -53,15 +55,15 @@ export class EzForm {
53
55
  }
54
56
  }
55
57
  validateRecords(dataUnit, records, triggedBy) {
56
- const result = { isValid: true, message: '' };
57
- if (this.ignoresavevalidation && triggedBy === "SAVE") {
58
+ const result = { isValid: true, message: "" };
59
+ if (this.ignoreSaveValidation && triggedBy === "SAVE") {
58
60
  return result;
59
61
  }
60
62
  const validateField = (field) => {
61
63
  if (field.readOnly) {
62
64
  return false;
63
65
  }
64
- if (field.userInterface === 'SWITCH' || field.userInterface === 'CHECKBOX') {
66
+ if (field.userInterface === "SWITCH" || field.userInterface === "CHECKBOX") {
65
67
  return false;
66
68
  }
67
69
  return true;
@@ -72,7 +74,7 @@ export class EzForm {
72
74
  const recordIndex = record["record__index"];
73
75
  const fieldName = field.name;
74
76
  const fieldValue = record[fieldName];
75
- if (fieldValue === null || fieldValue === undefined || fieldValue === '') {
77
+ if (fieldValue === null || fieldValue === undefined || fieldValue === "") {
76
78
  const tabPosition = this._tabPositionByField.get(dataUnit.name + field.name);
77
79
  this._store.dispatch(invalidField(tabPosition.tabName, tabPosition.index, dataUnit.name, recordIndex, record.record__id, field.name, "Essa informação é obrigatória"));
78
80
  result.isValid = false;
@@ -99,7 +101,7 @@ export class EzForm {
99
101
  return result;
100
102
  }
101
103
  loadMDFromExecutor(callBack) {
102
- const loadMetadataFunction = this.parseExecutor(this.metadataexecutor);
104
+ const loadMetadataFunction = this.parseExecutor(this.metadataExecutor);
103
105
  if (loadMetadataFunction) {
104
106
  const result = loadMetadataFunction();
105
107
  if (result) {
@@ -179,7 +181,7 @@ export class EzForm {
179
181
  });
180
182
  this._store = createStore(rootReducer, applyMiddleware(thunk));
181
183
  this._store.subscribe(() => { forceUpdate(this); });
182
- if (this.slavemode) {
184
+ if (this.slaveMode) {
183
185
  this._store.dispatch(showHideNavigationButtons("saveVisible", false));
184
186
  this._store.dispatch(showHideNavigationButtons("cancelVisible", false));
185
187
  this._store.dispatch(showHideNavigationButtons("reloadVisible", false));
@@ -202,12 +204,12 @@ export class EzForm {
202
204
  this._duToLoad = [];
203
205
  }
204
206
  loadSearch(argument, context) {
205
- const fieldSearchExecutor = this.parseExecutor(this.fieldsearchexecutor);
207
+ const fieldSearchExecutor = this.parseExecutor(this.fieldSearchExecutor);
206
208
  if (fieldSearchExecutor) {
207
209
  return fieldSearchExecutor(argument, context);
208
210
  }
209
211
  else {
210
- return [{ value: 0, label: 'Sem resultados' }];
212
+ return [{ value: 0, label: "Sem resultados" }];
211
213
  }
212
214
  }
213
215
  buildDataUnit(dataUnit, parentDataUnit) {
@@ -234,9 +236,9 @@ export class EzForm {
234
236
  }
235
237
  decorateDU(dataUnit) {
236
238
  dataUnit.store = this._store;
237
- dataUnit.loadExecutor = this.parseExecutor(this.loadexecutor);
238
- dataUnit.saveExecutor = this.parseExecutor(this.saveexecutor);
239
- dataUnit.removeExecutor = this.parseExecutor(this.removeexecutor);
239
+ dataUnit.loadExecutor = this.parseExecutor(this.loadExecutor);
240
+ dataUnit.saveExecutor = this.parseExecutor(this.saveExecutor);
241
+ dataUnit.removeExecutor = this.parseExecutor(this.removeExecutor);
240
242
  dataUnit.recordsValidator = this;
241
243
  }
242
244
  render() {
@@ -256,7 +258,7 @@ export class EzForm {
256
258
  }; }
257
259
  static get assetsDirs() { return ["assets"]; }
258
260
  static get properties() { return {
259
- "metadataexecutor": {
261
+ "metadataExecutor": {
260
262
  "type": "string",
261
263
  "mutable": false,
262
264
  "complexType": {
@@ -274,10 +276,10 @@ export class EzForm {
274
276
  "tags": [],
275
277
  "text": ""
276
278
  },
277
- "attribute": "metadataexecutor",
279
+ "attribute": "metadata-executor",
278
280
  "reflect": false
279
281
  },
280
- "loadexecutor": {
282
+ "loadExecutor": {
281
283
  "type": "string",
282
284
  "mutable": false,
283
285
  "complexType": {
@@ -295,10 +297,10 @@ export class EzForm {
295
297
  "tags": [],
296
298
  "text": ""
297
299
  },
298
- "attribute": "loadexecutor",
300
+ "attribute": "load-executor",
299
301
  "reflect": false
300
302
  },
301
- "saveexecutor": {
303
+ "saveExecutor": {
302
304
  "type": "string",
303
305
  "mutable": false,
304
306
  "complexType": {
@@ -316,10 +318,10 @@ export class EzForm {
316
318
  "tags": [],
317
319
  "text": ""
318
320
  },
319
- "attribute": "saveexecutor",
321
+ "attribute": "save-executor",
320
322
  "reflect": false
321
323
  },
322
- "removeexecutor": {
324
+ "removeExecutor": {
323
325
  "type": "string",
324
326
  "mutable": false,
325
327
  "complexType": {
@@ -337,10 +339,10 @@ export class EzForm {
337
339
  "tags": [],
338
340
  "text": ""
339
341
  },
340
- "attribute": "removeexecutor",
342
+ "attribute": "remove-executor",
341
343
  "reflect": false
342
344
  },
343
- "fieldsearchexecutor": {
345
+ "fieldSearchExecutor": {
344
346
  "type": "string",
345
347
  "mutable": false,
346
348
  "complexType": {
@@ -358,10 +360,10 @@ export class EzForm {
358
360
  "tags": [],
359
361
  "text": ""
360
362
  },
361
- "attribute": "fieldsearchexecutor",
363
+ "attribute": "field-search-executor",
362
364
  "reflect": false
363
365
  },
364
- "ignoresavevalidation": {
366
+ "ignoreSaveValidation": {
365
367
  "type": "boolean",
366
368
  "mutable": false,
367
369
  "complexType": {
@@ -375,7 +377,7 @@ export class EzForm {
375
377
  "tags": [],
376
378
  "text": ""
377
379
  },
378
- "attribute": "ignoresavevalidation",
380
+ "attribute": "ignore-save-validation",
379
381
  "reflect": false
380
382
  },
381
383
  "metadata": {
@@ -401,7 +403,7 @@ export class EzForm {
401
403
  "text": ""
402
404
  }
403
405
  },
404
- "slavemode": {
406
+ "slaveMode": {
405
407
  "type": "boolean",
406
408
  "mutable": false,
407
409
  "complexType": {
@@ -415,7 +417,7 @@ export class EzForm {
415
417
  "tags": [],
416
418
  "text": ""
417
419
  },
418
- "attribute": "slavemode",
420
+ "attribute": "slave-mode",
419
421
  "reflect": false
420
422
  },
421
423
  "enabled": {
@@ -1,18 +1,18 @@
1
1
  export function changeFieldValue(dataUnit, recordId, fieldName, value) {
2
2
  return {
3
- type: 'FORM/CHANGEFIELD',
3
+ type: "FORM/CHANGEFIELD",
4
4
  payload: { dataUnit, recordId, fieldName, value }
5
5
  };
6
6
  }
7
7
  export function changeTab(formId, index) {
8
8
  return {
9
- type: 'FORM/CHANGETAB',
9
+ type: "FORM/CHANGETAB",
10
10
  payload: { formId, index }
11
11
  };
12
12
  }
13
13
  export function clearEdition(dataUnit, recordsLimit) {
14
14
  return {
15
- type: 'FORM/CLEAREDITION',
15
+ type: "FORM/CLEAREDITION",
16
16
  payload: {
17
17
  dataUnit,
18
18
  recordsLimit
@@ -21,13 +21,13 @@ export function clearEdition(dataUnit, recordsLimit) {
21
21
  }
22
22
  export function collapseExpandGroup(collapseId, collapsed) {
23
23
  return {
24
- type: 'FORM/COLLAPSEGROUP',
24
+ type: "FORM/COLLAPSEGROUP",
25
25
  payload: { collapseId, collapsed }
26
26
  };
27
27
  }
28
28
  export function previousRecord(dataUnit) {
29
29
  return {
30
- type: 'FORM/NAVIGATE',
30
+ type: "FORM/NAVIGATE",
31
31
  payload: {
32
32
  dataUnit,
33
33
  limit: 0,
@@ -37,7 +37,7 @@ export function previousRecord(dataUnit) {
37
37
  }
38
38
  export function nextRecord(dataUnit, limit) {
39
39
  return {
40
- type: 'FORM/NAVIGATE',
40
+ type: "FORM/NAVIGATE",
41
41
  payload: {
42
42
  dataUnit,
43
43
  limit,
@@ -47,7 +47,7 @@ export function nextRecord(dataUnit, limit) {
47
47
  }
48
48
  export function insertRecord(dataUnit, insertionIndex) {
49
49
  return {
50
- type: 'FORM/INSERT',
50
+ type: "FORM/INSERT",
51
51
  payload: {
52
52
  dataUnit,
53
53
  insertionIndex
@@ -56,12 +56,12 @@ export function insertRecord(dataUnit, insertionIndex) {
56
56
  }
57
57
  export function formLoad() {
58
58
  return {
59
- type: 'FORM/LOAD'
59
+ type: "FORM/LOAD"
60
60
  };
61
61
  }
62
62
  export function dataLoading(dataUnit) {
63
63
  return {
64
- type: 'FORM/DATALOADING',
64
+ type: "FORM/DATALOADING",
65
65
  payload: {
66
66
  dataUnit
67
67
  }
@@ -69,7 +69,7 @@ export function dataLoading(dataUnit) {
69
69
  }
70
70
  export function savingChanges(dataUnit) {
71
71
  return {
72
- type: 'FORM/SAVINGCHANGES',
72
+ type: "FORM/SAVINGCHANGES",
73
73
  payload: {
74
74
  dataUnit
75
75
  }
@@ -77,7 +77,7 @@ export function savingChanges(dataUnit) {
77
77
  }
78
78
  export function dataLoaded(dataUnit) {
79
79
  return {
80
- type: 'FORM/DATALOADED',
80
+ type: "FORM/DATALOADED",
81
81
  payload: {
82
82
  dataUnit
83
83
  }
@@ -85,7 +85,7 @@ export function dataLoaded(dataUnit) {
85
85
  }
86
86
  export function changesSaved(dataUnit) {
87
87
  return {
88
- type: 'FORM/CHANGESSAVED',
88
+ type: "FORM/CHANGESSAVED",
89
89
  payload: {
90
90
  dataUnit
91
91
  }
@@ -93,7 +93,7 @@ export function changesSaved(dataUnit) {
93
93
  }
94
94
  export function removingRecord(dataUnit) {
95
95
  return {
96
- type: 'FORM/REMOVINGRECORD',
96
+ type: "FORM/REMOVINGRECORD",
97
97
  payload: {
98
98
  dataUnit
99
99
  }
@@ -101,7 +101,7 @@ export function removingRecord(dataUnit) {
101
101
  }
102
102
  export function recordRemoved(dataUnit) {
103
103
  return {
104
- type: 'FORM/RECORDREMOVED',
104
+ type: "FORM/RECORDREMOVED",
105
105
  payload: {
106
106
  dataUnit
107
107
  }
@@ -109,7 +109,7 @@ export function recordRemoved(dataUnit) {
109
109
  }
110
110
  export function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
111
111
  return {
112
- type: 'FORM/INVALIDFIELD',
112
+ type: "FORM/INVALIDFIELD",
113
113
  payload: {
114
114
  tabController,
115
115
  tabIndex,
@@ -123,7 +123,7 @@ export function invalidField(tabController, tabIndex, dataUnit, recordIndex, rec
123
123
  }
124
124
  export function showHideNavigationButtons(buttonName, status) {
125
125
  return {
126
- type: 'FORM/SHOWHIDENAVBTN',
126
+ type: "FORM/SHOWHIDENAVBTN",
127
127
  payload: {
128
128
  buttonName,
129
129
  status
@@ -20,19 +20,19 @@ const inicialNonHistState = {
20
20
  };
21
21
  export default function formReducer(state = inicialHistState, action) {
22
22
  switch (action.type) {
23
- case 'FORM/COLLAPSEGROUP':
23
+ case "FORM/COLLAPSEGROUP":
24
24
  return collapseGroup(state, action.payload);
25
- case 'FORM/CHANGETAB':
25
+ case "FORM/CHANGETAB":
26
26
  return changeTab(state, action.payload.formId, action.payload.index);
27
- case 'FORM/NAVIGATE':
27
+ case "FORM/NAVIGATE":
28
28
  return navigate(state, action.payload);
29
- case 'FORM/INSERT':
29
+ case "FORM/INSERT":
30
30
  return insertRecord(state, action.payload);
31
- case 'FORM/CHANGEFIELD':
31
+ case "FORM/CHANGEFIELD":
32
32
  return changeFieldValue(state, action.payload);
33
- case 'FORM/CLEAREDITION':
33
+ case "FORM/CLEAREDITION":
34
34
  return clearEdition(state, action.payload);
35
- case 'FORM/INVALIDFIELD':
35
+ case "FORM/INVALIDFIELD":
36
36
  return navigateToInvalid(state, action.payload);
37
37
  default:
38
38
  return state;
@@ -40,25 +40,25 @@ export default function formReducer(state = inicialHistState, action) {
40
40
  }
41
41
  export function formNonHistoricReducer(state = inicialNonHistState, action) {
42
42
  switch (action.type) {
43
- case 'FORM/DATALOADING':
43
+ case "FORM/DATALOADING":
44
44
  return dataLoading(state, action.payload);
45
- case 'FORM/DATALOADED':
45
+ case "FORM/DATALOADED":
46
46
  return dataLoaded(state, action.payload);
47
- case 'FORM/SAVINGCHANGES':
47
+ case "FORM/SAVINGCHANGES":
48
48
  return savingChanges(state, action.payload);
49
- case 'FORM/CHANGESSAVED':
49
+ case "FORM/CHANGESSAVED":
50
50
  return changesSaved(state, action.payload);
51
- case 'FORM/REMOVINGRECORD':
51
+ case "FORM/REMOVINGRECORD":
52
52
  return removingRecord(state, action.payload);
53
- case 'FORM/RECORDREMOVED':
53
+ case "FORM/RECORDREMOVED":
54
54
  return recordRemoved(state, action.payload);
55
- case 'FORM/INVALIDFIELD':
55
+ case "FORM/INVALIDFIELD":
56
56
  return invalidField(state, action.payload);
57
- case 'FORM/CLEAREDITION':
57
+ case "FORM/CLEAREDITION":
58
58
  return clearAllInvalidFields(state, action.payload);
59
- case 'FORM/CHANGEFIELD':
59
+ case "FORM/CHANGEFIELD":
60
60
  return clearInvalidField(state, action.payload);
61
- case 'FORM/SHOWHIDENAVBTN':
61
+ case "FORM/SHOWHIDENAVBTN":
62
62
  return showHideNavBtn(state, action.payload);
63
63
  default:
64
64
  return state;