@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,35 @@
1
+ 'use strict';
2
+
3
+ class ApplicationUtils {
4
+ static async showDialog(title, message, icon = null, confirm, critical = false) {
5
+ return new Promise(resolve => {
6
+ let dialog = document.querySelector("ez-dialog");
7
+ if (!dialog) {
8
+ dialog = document.createElement("ez-dialog");
9
+ window.document.body.appendChild(dialog);
10
+ }
11
+ dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
12
+ });
13
+ }
14
+ static async alert(title, message, icon = null) {
15
+ return ApplicationUtils.showDialog(title, message, icon, false, false);
16
+ }
17
+ static async error(title, message, icon = null) {
18
+ return ApplicationUtils.showDialog(title, message, icon, false, true);
19
+ }
20
+ static async confirm(title, message, icon = null, critical = false) {
21
+ return ApplicationUtils.showDialog(title, message, icon, true, critical);
22
+ }
23
+ static async info(message) {
24
+ let toast = document.querySelector("ez-toast");
25
+ if (!toast) {
26
+ toast = document.createElement("ez-toast");
27
+ window.document.body.appendChild(toast);
28
+ }
29
+ toast.message = message;
30
+ toast.fadeTime = 4000;
31
+ toast.show();
32
+ }
33
+ }
34
+
35
+ exports.ApplicationUtils = ApplicationUtils;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-4e4bae01.js');
4
+
5
+ const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
6
+ let ctxLoaded = false;
7
+ function getContextAssetsPath(resource) {
8
+ if (!ctxLoaded) {
9
+ const scriptElem = document.querySelector("script[data-ezui-assets-url]");
10
+ if (scriptElem) {
11
+ let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
12
+ if (assetsPath) {
13
+ if (assetsPath.startsWith('/')) {
14
+ assetsPath = window.location.origin + assetsPath;
15
+ }
16
+ index.setAssetPath(assetsPath);
17
+ }
18
+ }
19
+ ctxLoaded = true;
20
+ }
21
+ return index.getAssetPath(resource);
22
+ }
23
+
24
+ exports.getSpritePath = getSpritePath;
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ class CSSVarsUtils {
4
+ static applyVarsTextInput(host, child) {
5
+ if (child) {
6
+ CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
7
+ CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
8
+ }
9
+ }
10
+ static applyIfExists(host, element, varName) {
11
+ const prop = getComputedStyle(host).getPropertyValue(varName);
12
+ if (prop) {
13
+ element.style.setProperty(varName, prop);
14
+ }
15
+ }
16
+ }
17
+
18
+ exports.CSSVarsUtils = CSSVarsUtils;
@@ -0,0 +1,474 @@
1
+ 'use strict';
2
+
3
+ const ApplicationUtils = require('./ApplicationUtils-d1c1db56.js');
4
+
5
+ function changeFieldValue(dataUnit, recordId, fieldName, value) {
6
+ return {
7
+ type: "FORM/CHANGEFIELD",
8
+ payload: { dataUnit, recordId, fieldName, value }
9
+ };
10
+ }
11
+ function changeTab(formId, index) {
12
+ return {
13
+ type: "FORM/CHANGETAB",
14
+ payload: { formId, index }
15
+ };
16
+ }
17
+ function clearEdition(dataUnit, recordsLimit) {
18
+ return {
19
+ type: "FORM/CLEAREDITION",
20
+ payload: {
21
+ dataUnit,
22
+ recordsLimit
23
+ }
24
+ };
25
+ }
26
+ function collapseExpandGroup(collapseId, collapsed) {
27
+ return {
28
+ type: "FORM/COLLAPSEGROUP",
29
+ payload: { collapseId, collapsed }
30
+ };
31
+ }
32
+ function previousRecord(dataUnit) {
33
+ return {
34
+ type: "FORM/NAVIGATE",
35
+ payload: {
36
+ dataUnit,
37
+ limit: 0,
38
+ backward: true
39
+ }
40
+ };
41
+ }
42
+ function nextRecord(dataUnit, limit) {
43
+ return {
44
+ type: "FORM/NAVIGATE",
45
+ payload: {
46
+ dataUnit,
47
+ limit,
48
+ backward: false
49
+ }
50
+ };
51
+ }
52
+ function insertRecord(dataUnit, insertionIndex) {
53
+ return {
54
+ type: "FORM/INSERT",
55
+ payload: {
56
+ dataUnit,
57
+ insertionIndex
58
+ }
59
+ };
60
+ }
61
+ function formLoad() {
62
+ return {
63
+ type: "FORM/LOAD"
64
+ };
65
+ }
66
+ function dataLoading(dataUnit) {
67
+ return {
68
+ type: "FORM/DATALOADING",
69
+ payload: {
70
+ dataUnit
71
+ }
72
+ };
73
+ }
74
+ function savingChanges(dataUnit) {
75
+ return {
76
+ type: "FORM/SAVINGCHANGES",
77
+ payload: {
78
+ dataUnit
79
+ }
80
+ };
81
+ }
82
+ function dataLoaded(dataUnit) {
83
+ return {
84
+ type: "FORM/DATALOADED",
85
+ payload: {
86
+ dataUnit
87
+ }
88
+ };
89
+ }
90
+ function changesSaved(dataUnit) {
91
+ return {
92
+ type: "FORM/CHANGESSAVED",
93
+ payload: {
94
+ dataUnit
95
+ }
96
+ };
97
+ }
98
+ function removingRecord(dataUnit) {
99
+ return {
100
+ type: "FORM/REMOVINGRECORD",
101
+ payload: {
102
+ dataUnit
103
+ }
104
+ };
105
+ }
106
+ function recordRemoved(dataUnit) {
107
+ return {
108
+ type: "FORM/RECORDREMOVED",
109
+ payload: {
110
+ dataUnit
111
+ }
112
+ };
113
+ }
114
+ function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
115
+ return {
116
+ type: "FORM/INVALIDFIELD",
117
+ payload: {
118
+ tabController,
119
+ tabIndex,
120
+ dataUnit,
121
+ recordId,
122
+ recordIndex,
123
+ fieldName,
124
+ errorMessage
125
+ }
126
+ };
127
+ }
128
+ function showHideNavigationButtons(buttonName, status) {
129
+ return {
130
+ type: "FORM/SHOWHIDENAVBTN",
131
+ payload: {
132
+ buttonName,
133
+ status
134
+ }
135
+ };
136
+ }
137
+
138
+ //histórico
139
+ const selectCurrentTab = (state, formName) => {
140
+ const data = state.hist.present.currentTabIndex;
141
+ return data[formName] || 0;
142
+ };
143
+ const selectIsCollapsedFieldSet = (state, fieldSetName) => {
144
+ const data = state.hist.present.collapsedGroups;
145
+ return data[fieldSetName];
146
+ };
147
+ const selectRecordChanges = (state, dataUnit, recordId) => {
148
+ const data = selectDataUnitChanges(state, dataUnit);
149
+ return data ? data[recordId] : undefined;
150
+ };
151
+ const selectDataUnitChanges = (state, dataUnit) => {
152
+ const data = state.hist.present.changes;
153
+ return data[dataUnit];
154
+ };
155
+ const selectCurrentRecordIndex = (state, dataUnit) => {
156
+ const data = state.hist.present.currentRecordIndex;
157
+ return data[dataUnit] || 0;
158
+ };
159
+ const selectNewRecordIndex = (state, dataUnit) => {
160
+ const data = state.hist.present.newRecordIndex;
161
+ return data[dataUnit] || 0;
162
+ };
163
+ //não histórico
164
+ const selectLoadingData = (state, dataUnit) => {
165
+ const data = state.nonhist.dataLoading;
166
+ return data[dataUnit];
167
+ };
168
+ const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
169
+ const data = state.nonhist.invalidFields;
170
+ const dataUnitMessages = data[dataUnit] || {};
171
+ const recordMessages = dataUnitMessages[recordId] || {};
172
+ return recordMessages[fieldName] || "";
173
+ };
174
+ const selectVisibleButtons = state => state.nonhist.visibleButtons;
175
+
176
+ class DataUnit {
177
+ constructor(name, unitLabel, cardinality = "1", parentDU = null) {
178
+ this.name = name;
179
+ this.unitLabel = unitLabel;
180
+ this.cardinality = cardinality;
181
+ this._children = [];
182
+ this._fields = new Map();
183
+ this._requiredFields = [];
184
+ if (parentDU != null) {
185
+ parentDU._children.push(this);
186
+ this.parentDU = parentDU;
187
+ this.parentDUName = parentDU.name;
188
+ }
189
+ }
190
+ set store(store) {
191
+ this._store = store;
192
+ }
193
+ set fields(value) {
194
+ if (value) {
195
+ value.forEach(f => this.addFieldMetadata(f));
196
+ }
197
+ }
198
+ addFieldMetadata(field) {
199
+ this._fields.set(field.name, field);
200
+ if (field.required) {
201
+ this._requiredFields.push(field);
202
+ }
203
+ }
204
+ getFieldMetadata(name) {
205
+ if (this._fields) {
206
+ return this._fields.get(name);
207
+ }
208
+ return undefined;
209
+ }
210
+ get requiredFields() {
211
+ return this._requiredFields;
212
+ }
213
+ isLoading() {
214
+ return selectLoadingData(this._store.getState(), this.name);
215
+ }
216
+ hasChanges() {
217
+ const state = this._store.getState();
218
+ return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
219
+ }
220
+ hasNext() {
221
+ return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
222
+ }
223
+ hasPrevious() {
224
+ return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
225
+ }
226
+ hasCurrentRecord() {
227
+ return this.getCurrentRecord() != undefined;
228
+ }
229
+ previous() {
230
+ this._store.dispatch(previousRecord(this.name));
231
+ }
232
+ next() {
233
+ this._store.dispatch(nextRecord(this.name, this.records.length));
234
+ }
235
+ getValue(fieldName) {
236
+ const currentRecord = this.getCurrentRecord();
237
+ if (!currentRecord) {
238
+ return undefined;
239
+ }
240
+ const changes = this.getRecordChanges(currentRecord);
241
+ return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
242
+ }
243
+ getErrorMessage(fieldName) {
244
+ const currentRecord = this.getCurrentRecord();
245
+ return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
246
+ }
247
+ changeValue(fieldName, newValue) {
248
+ if (this.records.length == 0) {
249
+ this.insert();
250
+ }
251
+ if (this._changeDeboucing) {
252
+ window.clearTimeout(this._changeDeboucing);
253
+ }
254
+ this._changeDeboucing = window.setTimeout(() => {
255
+ const currentRecord = this.getCurrentRecord();
256
+ this._store.dispatch(changeFieldValue(this.name, currentRecord.record__id, fieldName, newValue));
257
+ }, 100);
258
+ }
259
+ cancel() {
260
+ this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
261
+ this._store.dispatch(clearEdition(this.name, this.records.length - 1));
262
+ }
263
+ insert() {
264
+ const insertionIndex = this.records.length;
265
+ const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
266
+ const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
267
+ this.bindToParent(newRecord);
268
+ this.records.push(newRecord);
269
+ this._store.dispatch(insertRecord(this.name, insertionIndex));
270
+ }
271
+ buildChange(r) {
272
+ const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
273
+ let recordChanges;
274
+ if (duChanges) {
275
+ recordChanges = duChanges[r.record__id];
276
+ }
277
+ let subChanges = [];
278
+ this._children.forEach(duChild => {
279
+ subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
280
+ });
281
+ if (recordChanges || subChanges.length > 0) {
282
+ const change = {
283
+ "__data__unit": this.name,
284
+ "__record__id": r.record__id,
285
+ "__sub__changes": subChanges
286
+ };
287
+ if (recordChanges) {
288
+ Object.keys(recordChanges).forEach(fieldName => { });
289
+ }
290
+ return change;
291
+ }
292
+ return undefined;
293
+ }
294
+ getSubChanges(id) {
295
+ const result = [];
296
+ if (this._records) {
297
+ this._records.filter(r => r.parent__record__id === id).forEach(r => {
298
+ const c = this.buildChange(r);
299
+ if (c) {
300
+ result.push(c);
301
+ }
302
+ });
303
+ }
304
+ return result;
305
+ }
306
+ getChangesToSave() {
307
+ let result = [];
308
+ if (this._records) {
309
+ this._records.forEach(r => {
310
+ const change = this.buildChange(r);
311
+ if (change) {
312
+ result.push(change);
313
+ }
314
+ });
315
+ }
316
+ return result;
317
+ }
318
+ save() {
319
+ if (!this.validateRecords("SAVE")) {
320
+ return;
321
+ }
322
+ this._store.dispatch(savingChanges(this.name));
323
+ let saveResult;
324
+ if (this.saveExecutor) {
325
+ saveResult = this.saveExecutor(this.getChangesToSave());
326
+ }
327
+ if (saveResult instanceof Promise) {
328
+ saveResult
329
+ .then(r => this.processSaveResult(r))
330
+ .catch(e => {
331
+ this._store.dispatch(dataLoaded(this.name));
332
+ ApplicationUtils.ApplicationUtils.error("Falha ao tentar salvar", e);
333
+ });
334
+ }
335
+ else {
336
+ this.processSaveResult(saveResult);
337
+ }
338
+ }
339
+ load() {
340
+ this._store.dispatch(dataLoading(this.name));
341
+ let result;
342
+ if (this.loadExecutor) {
343
+ result = this.loadExecutor({ dataUnit: this.name });
344
+ }
345
+ if (result instanceof Promise) {
346
+ result.then(r => this.processLoadResult(r));
347
+ }
348
+ else {
349
+ this.processLoadResult(result);
350
+ }
351
+ }
352
+ remove() {
353
+ const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
354
+ this._store.dispatch(removingRecord(this.name));
355
+ let removeResult;
356
+ if (this.removeExecutor) {
357
+ const record = this.getCurrentRecord();
358
+ removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
359
+ }
360
+ else {
361
+ removeResult = true;
362
+ }
363
+ if (removeResult) {
364
+ if (removeResult instanceof Promise) {
365
+ removeResult.then(r => this.processRemoveResult(r, currentIndex));
366
+ }
367
+ else {
368
+ this.processRemoveResult(removeResult, currentIndex);
369
+ }
370
+ }
371
+ }
372
+ processSaveResult(result) {
373
+ if (result) {
374
+ if (result instanceof Array) {
375
+ result.forEach(item => this.processSaveResult(item));
376
+ }
377
+ else {
378
+ if (result.__data__unit === this.name) {
379
+ if (this.cardinality === "1") {
380
+ this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
381
+ }
382
+ }
383
+ }
384
+ }
385
+ //FIXME: Isso está errado! tem que limpar todas as edições
386
+ this._store.dispatch(clearEdition(this.name, this.records.length - 1));
387
+ this._store.dispatch(changesSaved(this.name));
388
+ }
389
+ buildRecordFromSaveResult(baseRecord, saveResult) {
390
+ const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
391
+ Object.keys(saveResult).forEach(attrib => {
392
+ if (!attrib.startsWith("__")) {
393
+ newRecord[attrib] = saveResult[attrib];
394
+ }
395
+ });
396
+ return newRecord;
397
+ }
398
+ processLoadResult(records) {
399
+ this.records = records;
400
+ this._store.dispatch(clearEdition(this.name, this.records.length - 1));
401
+ this._store.dispatch(dataLoaded(this.name));
402
+ }
403
+ processRemoveResult(removed, recordIndex) {
404
+ if (removed) {
405
+ this.records.splice(recordIndex, 1);
406
+ this._store.dispatch(clearEdition(this.name, this.records.length - 1));
407
+ }
408
+ this._store.dispatch(recordRemoved(this.name));
409
+ }
410
+ set records(records) {
411
+ this._records = records;
412
+ if (this.parentDU) {
413
+ this._records.forEach(r => this.bindToParent(r));
414
+ }
415
+ }
416
+ bindToParent(r) {
417
+ if (this.parentDU) {
418
+ const parentRecord = this.parentDU.getCurrentRecord();
419
+ if (parentRecord) {
420
+ r.parent__record__id = parentRecord.record__id;
421
+ }
422
+ }
423
+ }
424
+ get records() {
425
+ if (!this._records) {
426
+ this._records = [];
427
+ }
428
+ return this._records;
429
+ }
430
+ getCurrentRecord() {
431
+ const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
432
+ return this.records[currentIndex];
433
+ }
434
+ getRecordChanges(currentRecord = undefined) {
435
+ if (currentRecord === undefined) {
436
+ currentRecord = this.getCurrentRecord();
437
+ }
438
+ return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
439
+ }
440
+ validateRecords(triggedBy = "UNKNOWN") {
441
+ if (!this.recordsValidator) {
442
+ return true;
443
+ }
444
+ const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
445
+ const recordsToValidate = [];
446
+ this.records.forEach((record, i) => {
447
+ const changes = duChanges ? duChanges[record.record__id] : undefined;
448
+ if (changes) {
449
+ recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
450
+ }
451
+ });
452
+ const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
453
+ if (result.message) {
454
+ ApplicationUtils.ApplicationUtils.info(result.message);
455
+ }
456
+ return result.isValid;
457
+ }
458
+ }
459
+ exports.DependencyType = void 0;
460
+ (function (DependencyType) {
461
+ DependencyType["SEARCHING"] = "SEARCHING";
462
+ DependencyType["REQUIREMENT"] = "REQUIREMENT";
463
+ DependencyType["VISIBILITY"] = "REQUIREMENT";
464
+ })(exports.DependencyType || (exports.DependencyType = {}));
465
+
466
+ exports.DataUnit = DataUnit;
467
+ exports.changeTab = changeTab;
468
+ exports.collapseExpandGroup = collapseExpandGroup;
469
+ exports.formLoad = formLoad;
470
+ exports.invalidField = invalidField;
471
+ exports.selectCurrentTab = selectCurrentTab;
472
+ exports.selectIsCollapsedFieldSet = selectIsCollapsedFieldSet;
473
+ exports.selectVisibleButtons = selectVisibleButtons;
474
+ exports.showHideNavigationButtons = showHideNavigationButtons;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ class DateUtils {
4
+ static clearTime(date, adjustDayLightSavingTime = true) {
5
+ const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
6
+ return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
7
+ }
8
+ static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
9
+ /** monthYearMode é um booleano para usar o formato MM/YYYY.
10
+ * Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
11
+ * Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
12
+ let parts;
13
+ if (monthYearMode) {
14
+ parts = /^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
15
+ }
16
+ else {
17
+ parts = /^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
18
+ }
19
+ if (!parts) {
20
+ return undefined;
21
+ }
22
+ var day = monthYearMode ? 1 : Number(parts[1]);
23
+ var month = Number(parts[(monthYearMode ? 1 : 2)]);
24
+ var year = Number(parts[(monthYearMode ? 2 : 3)]);
25
+ var hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
26
+ var min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
27
+ var sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
28
+ if (year < 100) {
29
+ year += year < 30 ? 2000 : 1900;
30
+ }
31
+ let date = new Date(year, month - 1, day, hour, min, sec, 0);
32
+ if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
33
+ date = DateUtils.adjustDLST(date);
34
+ }
35
+ return date;
36
+ }
37
+ static adjustDLST(date) {
38
+ //Work around para corrigir o Bug do horário de verão.
39
+ if (date.getHours() == 23) {
40
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
41
+ }
42
+ return date;
43
+ }
44
+ }
45
+
46
+ exports.DateUtils = DateUtils;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-4d2896bb.js');
5
+ const index = require('./index-4e4bae01.js');
6
6
 
7
7
  const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
8
8
 
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4e4bae01.js');
6
+
7
+ const ezApplicationCss = "";
8
+
9
+ let EzApplication = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
13
+ }
14
+ componentWillLoad() {
15
+ //Initizalize application
16
+ }
17
+ componentDidLoad() {
18
+ this.applicationLoaded.emit(true);
19
+ }
20
+ render() {
21
+ return (index.h("div", null));
22
+ }
23
+ };
24
+ EzApplication.style = ezApplicationCss;
25
+
26
+ exports.ez_application = EzApplication;