@sankhyalabs/ezui 1.1.76 → 1.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/cjs/AssetsUtils-02db4f46.js +24 -0
  2. package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
  3. package/dist/cjs/DateUtils-716769e0.js +46 -0
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  6. package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
  7. package/dist/cjs/ez-calendar_13.cjs.entry.js +2417 -0
  8. package/dist/cjs/ez-date-time-input.cjs.entry.js +133 -0
  9. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-grid.cjs.entry.js +110375 -0
  11. package/dist/cjs/ez-icon.cjs.entry.js +30 -0
  12. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
  14. package/dist/cjs/ez-popover.cjs.entry.js +3 -3
  15. package/dist/cjs/ez-popup.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-time-input.cjs.entry.js +10 -28
  17. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  18. package/dist/cjs/ezui.cjs.js +3 -3
  19. package/dist/cjs/{index-9431aeeb.js → index-2003dec4.js} +1 -15
  20. package/dist/cjs/index-a2266984.js +7417 -0
  21. package/dist/cjs/loader.cjs.js +3 -3
  22. package/dist/collection/collection-manifest.json +8 -5
  23. package/dist/collection/components/ez-application/ez-application.css +3 -0
  24. package/dist/collection/components/ez-application/ez-application.js +35 -0
  25. package/dist/collection/components/ez-button/ez-button.css +16 -1
  26. package/dist/collection/components/ez-button/ez-button.js +27 -2
  27. package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
  28. package/dist/collection/components/ez-calendar/ez-calendar.js +173 -24
  29. package/dist/collection/components/ez-check/ez-check.css +78 -78
  30. package/dist/collection/components/ez-check/ez-check.js +3 -3
  31. package/dist/collection/components/ez-combo-box/ez-combo-box.css +65 -54
  32. package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -0
  33. package/dist/collection/components/ez-date-input/ez-date-input.css +2 -2
  34. package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
  35. package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  36. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +243 -0
  37. package/dist/collection/components/ez-form/DataBinder.js +44 -0
  38. package/dist/collection/components/ez-form/ez-form.css +1 -15
  39. package/dist/collection/components/ez-form/ez-form.js +109 -428
  40. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
  41. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
  42. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
  43. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
  44. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
  45. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
  46. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
  47. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
  48. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
  49. package/dist/collection/components/ez-form/store/form.slice.js +38 -0
  50. package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
  51. package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
  52. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
  53. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
  54. package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
  55. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
  56. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
  57. package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
  58. package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
  59. package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
  60. package/dist/collection/components/ez-grid/ez-grid.css +15 -0
  61. package/dist/collection/components/ez-grid/ez-grid.js +414 -0
  62. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
  63. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
  64. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
  65. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
  66. package/dist/collection/components/ez-icon/ez-icon.css +1 -1
  67. package/dist/collection/components/ez-list/ez-list.css +227 -44
  68. package/dist/collection/components/ez-list/ez-list.js +529 -149
  69. package/dist/collection/components/ez-modal/ez-modal.css +4 -4
  70. package/dist/collection/components/ez-modal/ez-modal.js +1 -1
  71. package/dist/collection/components/ez-number-input/ez-number-input.css +1 -165
  72. package/dist/collection/components/ez-number-input/ez-number-input.js +53 -339
  73. package/dist/collection/components/ez-popover/ez-popover.css +10 -6
  74. package/dist/collection/components/ez-popup/ez-popup.css +25 -27
  75. package/dist/collection/components/ez-search/ez-search.js +6 -1
  76. package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
  77. package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
  78. package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
  79. package/dist/collection/components/ez-text-input/ez-text-input.js +1 -0
  80. package/dist/collection/components/ez-upload/ez-upload.js +3 -3
  81. package/dist/collection/components/test-du/test-du.css +3 -0
  82. package/dist/collection/components/test-du/test-du.js +87 -0
  83. package/dist/collection/servidor.js +94 -94
  84. package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
  85. package/dist/collection/utils/CSSVarsUtils.js +6 -6
  86. package/dist/custom-elements/index.d.ts +32 -14
  87. package/dist/custom-elements/index.js +119419 -3209
  88. package/dist/esm/AssetsUtils-76ca41e1.js +22 -0
  89. package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
  90. package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
  91. package/dist/esm/ez-action-chip.entry.js +1 -1
  92. package/dist/esm/ez-application.entry.js +22 -0
  93. package/dist/esm/ez-button_3.entry.js +514 -0
  94. package/dist/esm/ez-calendar_13.entry.js +2401 -0
  95. package/dist/esm/ez-date-time-input.entry.js +129 -0
  96. package/dist/esm/ez-dialog.entry.js +1 -1
  97. package/dist/esm/ez-grid.entry.js +110371 -0
  98. package/dist/esm/ez-icon.entry.js +26 -0
  99. package/dist/esm/ez-label-chip.entry.js +1 -1
  100. package/dist/esm/ez-modal_2.entry.js +365 -0
  101. package/dist/esm/ez-popover.entry.js +3 -3
  102. package/dist/esm/ez-popup.entry.js +2 -2
  103. package/dist/esm/ez-time-input.entry.js +4 -22
  104. package/dist/esm/ez-toast.entry.js +1 -1
  105. package/dist/esm/ezui.js +3 -3
  106. package/dist/esm/{index-fd3c8023.js → index-077c7fcf.js} +1 -15
  107. package/dist/esm/index-afe19542.js +7410 -0
  108. package/dist/esm/loader.js +3 -3
  109. package/dist/ezui/ezui.esm.js +1 -1
  110. package/dist/ezui/p-00b837e2.js +1 -0
  111. package/dist/ezui/{p-a0b6eee2.entry.js → p-0a2056d9.entry.js} +1 -1
  112. package/dist/ezui/p-0d8368fc.entry.js +1 -0
  113. package/dist/ezui/p-1e36e3ff.entry.js +1 -0
  114. package/dist/ezui/p-446ec85b.js +1 -0
  115. package/dist/ezui/p-5509ee41.entry.js +369 -0
  116. package/dist/ezui/{p-d443f020.entry.js → p-57ea4b84.entry.js} +1 -1
  117. package/dist/ezui/{p-66954a04.entry.js → p-6d157776.entry.js} +1 -1
  118. package/dist/ezui/p-7a1f2e0e.entry.js +1 -0
  119. package/dist/ezui/p-7de3c95d.js +1 -0
  120. package/dist/ezui/p-857ead8e.entry.js +1 -0
  121. package/dist/ezui/p-8b099482.js +1 -0
  122. package/dist/ezui/p-920bb8c9.entry.js +1 -0
  123. package/dist/ezui/p-9be02ecf.entry.js +1 -0
  124. package/dist/ezui/p-a4a39579.entry.js +1 -0
  125. package/dist/ezui/p-c89629eb.js +1 -0
  126. package/dist/ezui/p-d5699f29.entry.js +1 -0
  127. package/dist/ezui/p-d64a3939.entry.js +1 -0
  128. package/dist/ezui/{p-823ff0a0.entry.js → p-da31cd21.entry.js} +1 -1
  129. package/dist/types/components/ez-application/ez-application.d.ts +10 -0
  130. package/dist/types/components/ez-button/ez-button.d.ts +5 -0
  131. package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
  132. package/dist/types/components/ez-check/ez-check.d.ts +1 -1
  133. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
  134. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
  135. package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
  136. package/dist/types/components/ez-form/ez-form.d.ts +24 -32
  137. package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
  138. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
  139. package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
  140. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  141. package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
  142. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
  143. package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
  144. package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
  145. package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
  146. package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
  147. package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
  148. package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
  149. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
  150. package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
  151. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
  152. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
  153. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
  154. package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
  155. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
  156. package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
  157. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
  158. package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
  159. package/dist/types/components/ez-list/ez-list.d.ts +70 -17
  160. package/dist/types/components/ez-number-input/ez-number-input.d.ts +29 -63
  161. package/dist/types/components/ez-search/ez-search.d.ts +2 -0
  162. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
  163. package/dist/types/components/test-du/test-du.d.ts +12 -0
  164. package/dist/types/components.d.ts +271 -175
  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/CSSVarsUtils.d.ts +1 -1
  168. package/package.json +10 -8
  169. package/react/components.d.ts +6 -3
  170. package/react/components.js +6 -3
  171. package/react/components.js.map +1 -1
  172. package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
  173. package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
  174. package/dist/cjs/ez-button_16.cjs.entry.js +0 -4079
  175. package/dist/cjs/ez-list.cjs.entry.js +0 -174
  176. package/dist/cjs/ez-modal.cjs.entry.js +0 -65
  177. package/dist/cjs/ez-number-input.cjs.entry.js +0 -250
  178. package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
  179. package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
  180. package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
  181. package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
  182. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
  183. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
  184. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
  185. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
  186. package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
  187. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
  188. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
  189. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
  190. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
  191. package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
  192. package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
  193. package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
  194. package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
  195. package/dist/esm/ez-button_16.entry.js +0 -4060
  196. package/dist/esm/ez-list.entry.js +0 -170
  197. package/dist/esm/ez-modal.entry.js +0 -61
  198. package/dist/esm/ez-number-input.entry.js +0 -246
  199. package/dist/ezui/assets/trash-can-outline.svg +0 -3
  200. package/dist/ezui/p-11ae4ae7.entry.js +0 -1
  201. package/dist/ezui/p-47fa3d6c.entry.js +0 -1
  202. package/dist/ezui/p-8ab6168f.entry.js +0 -1
  203. package/dist/ezui/p-9c1fb51c.entry.js +0 -1
  204. package/dist/ezui/p-9d85125b.entry.js +0 -1
  205. package/dist/ezui/p-9dfccb16.js +0 -1
  206. package/dist/ezui/p-a7b546b2.entry.js +0 -1
  207. package/dist/ezui/p-c833c94f.entry.js +0 -1
  208. package/dist/ezui/p-d1889704.js +0 -1
  209. package/dist/ezui/p-e0ab3746.js +0 -1
  210. package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
  211. package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
  212. package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
  213. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
  214. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
  215. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
  216. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
  217. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
  218. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
  219. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
  220. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
  221. package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
@@ -1,194 +0,0 @@
1
- const inicialHistState = {
2
- currentTabIndex: {},
3
- currentRecordIndex: {},
4
- changes: {},
5
- collapsedGroups: {},
6
- newRecordIndex: {}
7
- };
8
- const inicialNonHistState = {
9
- dataLoading: {},
10
- invalidFields: {},
11
- visibleButtons: {
12
- previousVisible: true,
13
- nextVisible: true,
14
- addVisible: true,
15
- removeVisible: true,
16
- saveVisible: true,
17
- cancelVisible: true,
18
- reloadVisible: false
19
- }
20
- };
21
- export default function formReducer(state = inicialHistState, action) {
22
- switch (action.type) {
23
- case "FORM/COLLAPSEGROUP":
24
- return collapseGroup(state, action.payload);
25
- case "FORM/CHANGETAB":
26
- return changeTab(state, action.payload.formId, action.payload.index);
27
- case "FORM/NAVIGATE":
28
- return navigate(state, action.payload);
29
- case "FORM/INSERT":
30
- return insertRecord(state, action.payload);
31
- case "FORM/CHANGEFIELD":
32
- return changeFieldValue(state, action.payload);
33
- case "FORM/CLEAREDITION":
34
- return clearEdition(state, action.payload);
35
- case "FORM/INVALIDFIELD":
36
- return navigateToInvalid(state, action.payload);
37
- default:
38
- return state;
39
- }
40
- }
41
- export function formNonHistoricReducer(state = inicialNonHistState, action) {
42
- switch (action.type) {
43
- case "FORM/DATALOADING":
44
- return dataLoading(state, action.payload);
45
- case "FORM/DATALOADED":
46
- return dataLoaded(state, action.payload);
47
- case "FORM/SAVINGCHANGES":
48
- return savingChanges(state, action.payload);
49
- case "FORM/CHANGESSAVED":
50
- return changesSaved(state, action.payload);
51
- case "FORM/REMOVINGRECORD":
52
- return removingRecord(state, action.payload);
53
- case "FORM/RECORDREMOVED":
54
- return recordRemoved(state, action.payload);
55
- case "FORM/INVALIDFIELD":
56
- return invalidField(state, action.payload);
57
- case "FORM/CLEAREDITION":
58
- return clearAllInvalidFields(state, action.payload);
59
- case "FORM/CHANGEFIELD":
60
- return clearInvalidField(state, action.payload);
61
- case "FORM/SHOWHIDENAVBTN":
62
- return showHideNavBtn(state, action.payload);
63
- default:
64
- return state;
65
- }
66
- }
67
- function collapseGroup(state, { collapseId, collapsed }) {
68
- const currentCollapsed = Object.assign({}, state.collapsedGroups);
69
- if (collapsed) {
70
- currentCollapsed[collapseId] = true;
71
- }
72
- else {
73
- delete currentCollapsed[collapseId];
74
- }
75
- return Object.assign(Object.assign({}, state), { collapsedGroups: currentCollapsed });
76
- }
77
- function changeTab(state, formId, index) {
78
- const currentTabIndex = Object.assign({}, state.currentTabIndex);
79
- currentTabIndex[formId] = index;
80
- return Object.assign(Object.assign({}, state), { currentTabIndex });
81
- }
82
- function navigate(state, { dataUnit, limit, backward }) {
83
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
84
- const recIndex = currentRecordIndex[dataUnit] || 0;
85
- return gotoIndex(state, dataUnit, backward ? Math.max(limit, recIndex - 1) : Math.min(limit, recIndex + 1));
86
- }
87
- function gotoIndex(state, dataUnit, index) {
88
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
89
- currentRecordIndex[dataUnit] = index;
90
- return Object.assign(Object.assign({}, state), { currentRecordIndex });
91
- }
92
- function insertRecord(state, { dataUnit, insertionIndex }) {
93
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
94
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
95
- currentRecordIndex[dataUnit] = insertionIndex;
96
- newRecordIndex[dataUnit] = (state.newRecordIndex[dataUnit] || 0) + 1;
97
- return Object.assign(Object.assign({}, state), { currentRecordIndex,
98
- newRecordIndex });
99
- }
100
- function changeFieldValue(state, { dataUnit, recordId, fieldName, value }) {
101
- const changes = Object.assign({}, state.changes);
102
- const dataUnitChanges = Object.assign({}, changes[dataUnit]);
103
- const recordChanges = Object.assign({}, dataUnitChanges[recordId]);
104
- recordChanges[fieldName] = value;
105
- dataUnitChanges[recordId] = recordChanges;
106
- changes[dataUnit] = dataUnitChanges;
107
- const invalidFields = Object.assign({}, state.invalidFields);
108
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
109
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
110
- delete errorMessages[fieldName];
111
- dataUnitInvalidRecords[recordId] = errorMessages;
112
- invalidFields[dataUnit] = dataUnitInvalidRecords;
113
- return Object.assign(Object.assign({}, state), { changes,
114
- invalidFields, invalidFieldSelected: undefined });
115
- }
116
- function clearEdition(state, { dataUnit, recordsLimit }) {
117
- const changes = Object.assign({}, state.changes);
118
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
119
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
120
- delete changes[dataUnit];
121
- delete newRecordIndex[dataUnit];
122
- const recIndex = currentRecordIndex[dataUnit] || 0;
123
- currentRecordIndex[dataUnit] = Math.min(recordsLimit, recIndex);
124
- return Object.assign(Object.assign({}, state), { changes,
125
- newRecordIndex,
126
- currentRecordIndex });
127
- }
128
- function navigateToInvalid(state, payload) {
129
- let newState = Object.assign({}, state);
130
- if (newState.invalidFieldSelected === undefined) {
131
- newState.invalidFieldSelected = true;
132
- newState = gotoIndex(newState, payload.dataUnit, payload.recordIndex);
133
- newState = changeTab(newState, payload.tabController, payload.tabIndex);
134
- }
135
- return newState;
136
- }
137
- function dataLoading(state, { dataUnit }) {
138
- const dataLoading = Object.assign({}, state.dataLoading);
139
- dataLoading[dataUnit] = true;
140
- return Object.assign(Object.assign({}, state), { dataLoading });
141
- }
142
- function dataLoaded(state, { dataUnit }) {
143
- const dataLoading = Object.assign({}, state.dataLoading);
144
- delete dataLoading[dataUnit];
145
- return Object.assign(Object.assign({}, state), { dataLoading });
146
- }
147
- function savingChanges(state, { dataUnit }) {
148
- const dataLoading = Object.assign({}, state.dataLoading);
149
- dataLoading[dataUnit] = true;
150
- return Object.assign(Object.assign({}, state), { dataLoading });
151
- }
152
- function changesSaved(state, { dataUnit }) {
153
- const dataLoading = Object.assign({}, state.dataLoading);
154
- delete dataLoading[dataUnit];
155
- return Object.assign(Object.assign({}, state), { dataLoading });
156
- }
157
- function removingRecord(state, { dataUnit }) {
158
- const dataLoading = Object.assign({}, state.dataLoading);
159
- dataLoading[dataUnit] = true;
160
- return Object.assign(Object.assign({}, state), { dataLoading });
161
- }
162
- function recordRemoved(state, { dataUnit }) {
163
- const dataLoading = Object.assign({}, state.dataLoading);
164
- delete dataLoading[dataUnit];
165
- return Object.assign(Object.assign({}, state), { dataLoading });
166
- }
167
- function invalidField(state, { dataUnit, recordId, fieldName, errorMessage }) {
168
- const invalidFields = Object.assign({}, state.invalidFields);
169
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
170
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
171
- errorMessages[fieldName] = errorMessage;
172
- dataUnitInvalidRecords[recordId] = errorMessages;
173
- invalidFields[dataUnit] = dataUnitInvalidRecords;
174
- return Object.assign(Object.assign({}, state), { invalidFields });
175
- }
176
- function clearAllInvalidFields(state, { dataUnit }) {
177
- const invalidFields = Object.assign({}, state.invalidFields);
178
- delete invalidFields[dataUnit];
179
- return Object.assign(Object.assign({}, state), { invalidFields });
180
- }
181
- function clearInvalidField(state, { dataUnit, recordId, fieldName }) {
182
- const invalidFields = Object.assign({}, state.invalidFields);
183
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
184
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
185
- delete errorMessages[fieldName];
186
- dataUnitInvalidRecords[recordId] = errorMessages;
187
- invalidFields[dataUnit] = dataUnitInvalidRecords;
188
- return Object.assign(Object.assign({}, state), { invalidFields });
189
- }
190
- function showHideNavBtn(state, { buttonName, status }) {
191
- const visibleButtons = Object.assign({}, state.visibleButtons);
192
- visibleButtons[buttonName] = status;
193
- return Object.assign(Object.assign({}, state), { visibleButtons });
194
- }
@@ -1,44 +0,0 @@
1
- //histórico
2
- export const selectCurrentTab = (state, formName) => {
3
- const data = state.hist.present.currentTabIndex;
4
- return data[formName] || 0;
5
- };
6
- export const selectIsCollapsedFieldSet = (state, fieldSetName) => {
7
- const data = state.hist.present.collapsedGroups;
8
- return data[fieldSetName];
9
- };
10
- export const selectRecordChanges = (state, dataUnit, recordId) => {
11
- const data = selectDataUnitChanges(state, dataUnit);
12
- return data ? data[recordId] : undefined;
13
- };
14
- export const selectDataUnitChanges = (state, dataUnit) => {
15
- const data = state.hist.present.changes;
16
- return data[dataUnit];
17
- };
18
- export const selectCurrentRecordIndex = (state, dataUnit) => {
19
- const data = state.hist.present.currentRecordIndex;
20
- return data[dataUnit] || 0;
21
- };
22
- export const selectNewRecordIndex = (state, dataUnit) => {
23
- const data = state.hist.present.newRecordIndex;
24
- return data[dataUnit] || 0;
25
- };
26
- export const selectUndoState = state => { return { canUndo: state.hist.past.length > 0, canRedo: state.hist.future.length > 0 }; };
27
- //não histórico
28
- export const selectLoadingData = (state, dataUnit) => {
29
- const data = state.nonhist.dataLoading;
30
- return data[dataUnit];
31
- };
32
- export const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
33
- const data = state.nonhist.invalidFields;
34
- const dataUnitMessages = data[dataUnit] || {};
35
- const recordMessages = dataUnitMessages[recordId] || {};
36
- return recordMessages[fieldName] || "";
37
- };
38
- export const selectInvalidFields = (state, dataUnit, recordId) => {
39
- const data = state.nonhist.invalidFields;
40
- const dataUnitMessages = data[dataUnit] || {};
41
- const recordMessages = dataUnitMessages[recordId] || {};
42
- return Object.keys(recordMessages);
43
- };
44
- export const selectVisibleButtons = state => state.nonhist.visibleButtons;
@@ -1,301 +0,0 @@
1
- import { changeFieldValue, changesSaved, clearEdition, dataLoaded, dataLoading, insertRecord, nextRecord, previousRecord, recordRemoved, removingRecord, savingChanges } from "../store/Form.actions";
2
- import { selectRecordChanges, selectCurrentRecordIndex, selectLoadingData, selectNewRecordIndex, selectDataUnitChanges, selectErrorMessage } from "../store/Form.selectors";
3
- import Application from "../../../utils/Application";
4
- export default class DataUnit {
5
- constructor(name, unitLabel, cardinality = "1", parentDU = null) {
6
- this.name = name;
7
- this.unitLabel = unitLabel;
8
- this.cardinality = cardinality;
9
- this._children = [];
10
- this._fields = new Map();
11
- this._requiredFields = [];
12
- if (parentDU != null) {
13
- parentDU._children.push(this);
14
- this.parentDU = parentDU;
15
- this.parentDUName = parentDU.name;
16
- }
17
- }
18
- set store(store) {
19
- this._store = store;
20
- }
21
- set fields(value) {
22
- if (value) {
23
- value.forEach(f => this.addFieldMetadata(f));
24
- }
25
- }
26
- addFieldMetadata(field) {
27
- this._fields.set(field.name, field);
28
- if (field.required) {
29
- this._requiredFields.push(field);
30
- }
31
- }
32
- getFieldMetadata(name) {
33
- if (this._fields) {
34
- return this._fields.get(name);
35
- }
36
- return undefined;
37
- }
38
- get requiredFields() {
39
- return this._requiredFields;
40
- }
41
- isLoading() {
42
- return selectLoadingData(this._store.getState(), this.name);
43
- }
44
- hasChanges() {
45
- const state = this._store.getState();
46
- return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
47
- }
48
- hasNext() {
49
- return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
50
- }
51
- hasPrevious() {
52
- return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
53
- }
54
- hasCurrentRecord() {
55
- return this.getCurrentRecord() != undefined;
56
- }
57
- previous() {
58
- this._store.dispatch(previousRecord(this.name));
59
- }
60
- next() {
61
- this._store.dispatch(nextRecord(this.name, this.records.length));
62
- }
63
- getValue(fieldName) {
64
- const currentRecord = this.getCurrentRecord();
65
- if (!currentRecord) {
66
- return undefined;
67
- }
68
- const changes = this.getRecordChanges(currentRecord);
69
- return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
70
- }
71
- getErrorMessage(fieldName) {
72
- const currentRecord = this.getCurrentRecord();
73
- return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
74
- }
75
- changeValue(fieldName, newValue) {
76
- if (this.records.length == 0) {
77
- this.insert();
78
- }
79
- if (this._changeDeboucing) {
80
- window.clearTimeout(this._changeDeboucing);
81
- }
82
- this._changeDeboucing = window.setTimeout(() => {
83
- const currentRecord = this.getCurrentRecord();
84
- this._store.dispatch(changeFieldValue(this.name, currentRecord.record__id, fieldName, newValue));
85
- }, 100);
86
- }
87
- cancel() {
88
- this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
89
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
90
- }
91
- insert() {
92
- const insertionIndex = this.records.length;
93
- const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
94
- const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
95
- this.bindToParent(newRecord);
96
- this.records.push(newRecord);
97
- this._store.dispatch(insertRecord(this.name, insertionIndex));
98
- }
99
- buildChange(r) {
100
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
101
- let recordChanges;
102
- if (duChanges) {
103
- recordChanges = duChanges[r.record__id];
104
- }
105
- let subChanges = [];
106
- this._children.forEach(duChild => {
107
- subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
108
- });
109
- if (recordChanges || subChanges.length > 0) {
110
- const change = {
111
- "__data__unit": this.name,
112
- "__record__id": r.record__id,
113
- "__sub__changes": subChanges
114
- };
115
- if (recordChanges) {
116
- Object.keys(recordChanges).forEach(fieldName => { change[fieldName] = recordChanges[fieldName]; });
117
- }
118
- return change;
119
- }
120
- return undefined;
121
- }
122
- getSubChanges(id) {
123
- const result = [];
124
- if (this._records) {
125
- this._records.filter(r => r.parent__record__id === id).forEach(r => {
126
- const c = this.buildChange(r);
127
- if (c) {
128
- result.push(c);
129
- }
130
- });
131
- }
132
- return result;
133
- }
134
- getChangesToSave() {
135
- let result = [];
136
- if (this._records) {
137
- this._records.forEach(r => {
138
- const change = this.buildChange(r);
139
- if (change) {
140
- result.push(change);
141
- }
142
- });
143
- }
144
- return result;
145
- }
146
- save() {
147
- if (!this.validateRecords("SAVE")) {
148
- return;
149
- }
150
- this._store.dispatch(savingChanges(this.name));
151
- let saveResult;
152
- if (this.saveExecutor) {
153
- saveResult = this.saveExecutor(this.getChangesToSave());
154
- }
155
- if (saveResult instanceof Promise) {
156
- saveResult
157
- .then(r => this.processSaveResult(r))
158
- .catch(e => {
159
- this._store.dispatch(dataLoaded(this.name));
160
- Application.error("Falha ao tentar salvar", e);
161
- });
162
- }
163
- else {
164
- this.processSaveResult(saveResult);
165
- }
166
- }
167
- load() {
168
- this._store.dispatch(dataLoading(this.name));
169
- let result;
170
- if (this.loadExecutor) {
171
- result = this.loadExecutor({ dataUnit: this.name });
172
- }
173
- if (result instanceof Promise) {
174
- result.then(r => this.processLoadResult(r));
175
- }
176
- else {
177
- this.processLoadResult(result);
178
- }
179
- }
180
- remove() {
181
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
182
- this._store.dispatch(removingRecord(this.name));
183
- let removeResult;
184
- if (this.removeExecutor) {
185
- const record = this.getCurrentRecord();
186
- removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
187
- }
188
- else {
189
- removeResult = true;
190
- }
191
- if (removeResult) {
192
- if (removeResult instanceof Promise) {
193
- removeResult.then(r => this.processRemoveResult(r, currentIndex));
194
- }
195
- else {
196
- this.processRemoveResult(removeResult, currentIndex);
197
- }
198
- }
199
- }
200
- processSaveResult(result) {
201
- if (result) {
202
- if (result instanceof Array) {
203
- result.forEach(item => this.processSaveResult(item));
204
- }
205
- else {
206
- if (result.__data__unit === this.name) {
207
- if (this.cardinality === "1") {
208
- this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
209
- }
210
- else {
211
- //NÃO IPLEMENTADO AINDA
212
- }
213
- }
214
- }
215
- }
216
- //FIXME: Isso está errado! tem que limpar todas as edições
217
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
218
- this._store.dispatch(changesSaved(this.name));
219
- }
220
- buildRecordFromSaveResult(baseRecord, saveResult) {
221
- const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
222
- Object.keys(saveResult).forEach(attrib => {
223
- if (!attrib.startsWith("__")) {
224
- newRecord[attrib] = saveResult[attrib];
225
- }
226
- });
227
- return newRecord;
228
- }
229
- processLoadResult(records) {
230
- this.records = records;
231
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
232
- this._store.dispatch(dataLoaded(this.name));
233
- }
234
- processRemoveResult(removed, recordIndex) {
235
- if (removed) {
236
- this.records.splice(recordIndex, 1);
237
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
238
- }
239
- this._store.dispatch(recordRemoved(this.name));
240
- }
241
- set records(records) {
242
- this._records = records;
243
- if (this.parentDU) {
244
- this._records.forEach(r => this.bindToParent(r));
245
- }
246
- }
247
- bindToParent(r) {
248
- if (this.parentDU) {
249
- const parentRecord = this.parentDU.getCurrentRecord();
250
- if (parentRecord) {
251
- r.parent__record__id = parentRecord.record__id;
252
- }
253
- }
254
- }
255
- get records() {
256
- if (!this._records) {
257
- this._records = [];
258
- }
259
- return this._records;
260
- }
261
- getCurrentRecord() {
262
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
263
- return this.records[currentIndex];
264
- }
265
- getRecordChanges(currentRecord = undefined) {
266
- if (currentRecord === undefined) {
267
- currentRecord = this.getCurrentRecord();
268
- }
269
- return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
270
- }
271
- validateRecords(triggedBy = "UNKNOWN") {
272
- if (!this.recordsValidator) {
273
- return true;
274
- }
275
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
276
- const recordsToValidate = [];
277
- this.records.forEach((record, i) => {
278
- const changes = duChanges ? duChanges[record.record__id] : undefined;
279
- if (changes) {
280
- recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
281
- }
282
- });
283
- const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
284
- if (result.message) {
285
- Application.info(result.message);
286
- }
287
- return result.isValid;
288
- }
289
- }
290
- export class FieldMetadata {
291
- }
292
- export class UIProperty {
293
- }
294
- export class FieldDependency {
295
- }
296
- export var DependencyType;
297
- (function (DependencyType) {
298
- DependencyType["SEARCHING"] = "SEARCHING";
299
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
300
- DependencyType["VISIBILITY"] = "REQUIREMENT";
301
- })(DependencyType || (DependencyType = {}));
@@ -1,8 +0,0 @@
1
- export class Form {
2
- }
3
- export class FormField {
4
- }
5
- export class FieldSet {
6
- }
7
- export class TabPosition {
8
- }
@@ -1,24 +0,0 @@
1
- :host {
2
- display: flex;
3
- width: 100%;
4
- height: 42px;
5
- border-radius: 12px;
6
- background: var(--background--medium);
7
- background-image: linear-gradient(to right, var(--background--medium) 0%, var(--background--strong) 20%, var(--background--medium) 40%, var(--background--medium) 100%);
8
- background-repeat: no-repeat;
9
- background-size: 800px 1000px;
10
- animation-duration: 1s;
11
- animation-fill-mode: forwards;
12
- animation-iteration-count: infinite;
13
- animation-name: placeholderShimmer;
14
- animation-timing-function: linear;
15
- }
16
-
17
- @keyframes placeholderShimmer{
18
- 0%{
19
- background-position: -800px 0;
20
- }
21
- 100%{
22
- background-position: 800px 0;
23
- }
24
- }