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