@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-08202.0

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 (531) hide show
  1. package/README.md +78 -0
  2. package/dist/assets/actions-sprite.svg +257 -0
  3. package/dist/cjs/ApplicationUtils-2e444734.js +162 -0
  4. package/dist/cjs/CSSVarsUtils-b136a156.js +77 -0
  5. package/dist/cjs/CheckMode-ecb90b87.js +7 -0
  6. package/dist/cjs/DialogType-2114c337.js +9 -0
  7. package/dist/cjs/EzScrollDirection-b2c99895.js +8 -0
  8. package/dist/cjs/RecordValidationProcessor-edd23705.js +102 -0
  9. package/dist/cjs/constants-3a1d64fb.js +7 -0
  10. package/dist/cjs/ez-actions-button.cjs.entry.js +212 -0
  11. package/dist/cjs/ez-alert.cjs.entry.js +30 -0
  12. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  13. package/dist/cjs/ez-badge.cjs.entry.js +120 -0
  14. package/dist/cjs/ez-breadcrumb.cjs.entry.js +285 -0
  15. package/dist/cjs/ez-button.cjs.entry.js +87 -0
  16. package/dist/cjs/ez-calendar.cjs.entry.js +238 -0
  17. package/dist/cjs/ez-card-item.cjs.entry.js +52 -0
  18. package/dist/cjs/ez-check.cjs.entry.js +95 -0
  19. package/dist/cjs/ez-chip.cjs.entry.js +116 -0
  20. package/dist/cjs/ez-collapsible-box.cjs.entry.js +133 -0
  21. package/dist/cjs/ez-combo-box.cjs.entry.js +690 -0
  22. package/dist/cjs/ez-date-input.cjs.entry.js +188 -0
  23. package/dist/cjs/ez-date-time-input.cjs.entry.js +242 -0
  24. package/dist/cjs/ez-dialog.cjs.entry.js +180 -0
  25. package/dist/cjs/ez-dropdown.cjs.entry.js +515 -0
  26. package/dist/cjs/ez-file-item.cjs.entry.js +74 -0
  27. package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
  28. package/dist/cjs/ez-form-view.cjs.entry.js +191 -0
  29. package/dist/cjs/ez-form.cjs.entry.js +933 -0
  30. package/dist/cjs/ez-grid.cjs.entry.js +120838 -0
  31. package/dist/cjs/ez-guide-navigator.cjs.entry.js +96 -0
  32. package/dist/cjs/ez-icon.cjs.entry.js +44 -0
  33. package/dist/cjs/ez-list.cjs.entry.js +558 -0
  34. package/dist/cjs/ez-loading-bar.cjs.entry.js +32 -0
  35. package/dist/cjs/ez-modal-container.cjs.entry.js +64 -0
  36. package/dist/cjs/ez-modal.cjs.entry.js +72 -0
  37. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +183 -0
  38. package/dist/cjs/ez-number-input.cjs.entry.js +181 -0
  39. package/dist/cjs/ez-popover.cjs.entry.js +156 -0
  40. package/dist/cjs/ez-popup.cjs.entry.js +66 -0
  41. package/dist/cjs/ez-radio-button.cjs.entry.js +48 -0
  42. package/dist/cjs/ez-scroller_3.cjs.entry.js +792 -0
  43. package/dist/cjs/ez-search.cjs.entry.js +96 -0
  44. package/dist/cjs/ez-skeleton.cjs.entry.js +67 -0
  45. package/dist/cjs/ez-tabselector.cjs.entry.js +228 -0
  46. package/dist/cjs/ez-text-area.cjs.entry.js +179 -0
  47. package/dist/cjs/ez-text-edit.cjs.entry.js +107 -0
  48. package/dist/cjs/ez-text-input.cjs.entry.js +247 -0
  49. package/dist/cjs/ez-time-input.cjs.entry.js +168 -0
  50. package/dist/cjs/ez-toast.cjs.entry.js +101 -0
  51. package/dist/cjs/ez-upload.cjs.entry.js +395 -0
  52. package/dist/cjs/ez-view-stack.cjs.entry.js +86 -0
  53. package/dist/cjs/ezui.cjs.js +23 -0
  54. package/dist/cjs/filter-column.cjs.entry.js +151 -0
  55. package/dist/cjs/index-1064511f.js +2340 -0
  56. package/dist/cjs/index.cjs.js +2 -0
  57. package/dist/cjs/loader.cjs.js +22 -0
  58. package/dist/collection/collection-manifest.json +184 -0
  59. package/dist/collection/components/assets/actions-sprite.svg +257 -0
  60. package/dist/collection/components/ez-actions-button/ez-actions-button.css +139 -0
  61. package/dist/collection/components/ez-actions-button/ez-actions-button.js +440 -0
  62. package/dist/collection/components/ez-alert/ez-alert.css +76 -0
  63. package/dist/collection/components/ez-alert/ez-alert.js +53 -0
  64. package/dist/collection/components/ez-application/ez-application.css +3 -0
  65. package/dist/collection/components/ez-application/ez-application.js +41 -0
  66. package/dist/collection/components/ez-badge/enum/sizes.js +9 -0
  67. package/dist/collection/components/ez-badge/ez-badge.css +165 -0
  68. package/dist/collection/components/ez-badge/ez-badge.js +211 -0
  69. package/dist/collection/components/ez-badge/interfaces/IPosition.js +1 -0
  70. package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.css +66 -0
  71. package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.js +373 -0
  72. package/dist/collection/components/ez-breadcrumb/subcomponents/breadcrumb-item.js +20 -0
  73. package/dist/collection/components/ez-button/ez-button.css +255 -0
  74. package/dist/collection/components/ez-button/ez-button.js +241 -0
  75. package/dist/collection/components/ez-calendar/ez-calendar.css +318 -0
  76. package/dist/collection/components/ez-calendar/ez-calendar.js +439 -0
  77. package/dist/collection/components/ez-card-item/ez-card-item.css +126 -0
  78. package/dist/collection/components/ez-card-item/ez-card-item.js +97 -0
  79. package/dist/collection/components/ez-check/CheckMode.js +5 -0
  80. package/dist/collection/components/ez-check/ez-check.css +366 -0
  81. package/dist/collection/components/ez-check/ez-check.js +272 -0
  82. package/dist/collection/components/ez-chip/ez-chip.css +163 -0
  83. package/dist/collection/components/ez-chip/ez-chip.js +312 -0
  84. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +254 -0
  85. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +442 -0
  86. package/dist/collection/components/ez-combo-box/ez-combo-box.css +334 -0
  87. package/dist/collection/components/ez-combo-box/ez-combo-box.js +1125 -0
  88. package/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
  89. package/dist/collection/components/ez-date-input/ez-date-input.js +432 -0
  90. package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  91. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +504 -0
  92. package/dist/collection/components/ez-dialog/DialogType.js +7 -0
  93. package/dist/collection/components/ez-dialog/ez-dialog.css +544 -0
  94. package/dist/collection/components/ez-dialog/ez-dialog.js +401 -0
  95. package/dist/collection/components/ez-dropdown/ez-dropdown.css +349 -0
  96. package/dist/collection/components/ez-dropdown/ez-dropdown.js +356 -0
  97. package/dist/collection/components/ez-dropdown/structure/DropdownItem.js +30 -0
  98. package/dist/collection/components/ez-dropdown/structure/SubmenuControl.js +241 -0
  99. package/dist/collection/components/ez-file-item/ez-file-item.css +125 -0
  100. package/dist/collection/components/ez-file-item/ez-file-item.js +200 -0
  101. package/dist/collection/components/ez-filter-input/ez-filter-input.css +4 -0
  102. package/dist/collection/components/ez-filter-input/ez-filter-input.js +407 -0
  103. package/dist/collection/components/ez-form/ez-form.css +10 -0
  104. package/dist/collection/components/ez-form/ez-form.js +237 -0
  105. package/dist/collection/components/ez-form/store/form.slice.js +42 -0
  106. package/dist/collection/components/ez-form-view/ez-form-view.css +6 -0
  107. package/dist/collection/components/ez-form-view/ez-form-view.js +154 -0
  108. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +30 -0
  109. package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +11 -0
  110. package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +13 -0
  111. package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +10 -0
  112. package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +11 -0
  113. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +12 -0
  114. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +4 -0
  115. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.js +4 -0
  116. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +4 -0
  117. package/dist/collection/components/ez-form-view/interfaces/IFormViewField.js +1 -0
  118. package/dist/collection/components/ez-form-view/interfaces/index.js +1 -0
  119. package/dist/collection/components/ez-form-view/structure/index.js +29 -0
  120. package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
  121. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +791 -0
  122. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
  123. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +101 -0
  124. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +230 -0
  125. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +88 -0
  126. package/dist/collection/components/ez-grid/controller/ag-grid/components/cellRendererStatus.js +43 -0
  127. package/dist/collection/components/ez-grid/controller/ag-grid/components/selectionHeader.js +40 -0
  128. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +49 -0
  129. package/dist/collection/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.js +10 -0
  130. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.js +4 -0
  131. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellEditor.js +1 -0
  132. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +38 -0
  133. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +40 -0
  134. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +20 -0
  135. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +15 -0
  136. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +41 -0
  137. package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
  138. package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
  139. package/dist/collection/components/ez-grid/ez-grid.css +97 -0
  140. package/dist/collection/components/ez-grid/ez-grid.js +833 -0
  141. package/dist/collection/components/ez-grid/interfaces/ISelection.js +1 -0
  142. package/dist/collection/components/ez-grid/interfaces/ISelectionToastConfig.js +1 -0
  143. package/dist/collection/components/ez-grid/interfaces/index.js +2 -0
  144. package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
  145. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +377 -0
  146. package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +29 -0
  147. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
  148. package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.css +66 -0
  149. package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +385 -0
  150. package/dist/collection/components/ez-guide-navigator/interfaces/IGuideItem.js +1 -0
  151. package/dist/collection/components/ez-guide-navigator/interfaces/index.js +1 -0
  152. package/dist/collection/components/ez-icon/ez-icon.css +223 -0
  153. package/dist/collection/components/ez-icon/ez-icon.js +101 -0
  154. package/dist/collection/components/ez-list/ez-list.css +434 -0
  155. package/dist/collection/components/ez-list/ez-list.js +911 -0
  156. package/dist/collection/components/ez-loading-bar/ez-loading-bar.css +85 -0
  157. package/dist/collection/components/ez-loading-bar/ez-loading-bar.js +74 -0
  158. package/dist/collection/components/ez-modal/ez-modal.css +369 -0
  159. package/dist/collection/components/ez-modal/ez-modal.js +239 -0
  160. package/dist/collection/components/ez-modal-container/ez-modal-container.css +55 -0
  161. package/dist/collection/components/ez-modal-container/ez-modal-container.js +191 -0
  162. package/dist/collection/components/ez-modal-container/index.js +2 -0
  163. package/dist/collection/components/ez-modal-container/modal-action.js +8 -0
  164. package/dist/collection/components/ez-modal-container/modal-button-status.js +7 -0
  165. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
  166. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +338 -0
  167. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
  168. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
  169. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
  170. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
  171. package/dist/collection/components/ez-number-input/ez-number-input.css +8 -0
  172. package/dist/collection/components/ez-number-input/ez-number-input.js +457 -0
  173. package/dist/collection/components/ez-popover/ez-popover.css +42 -0
  174. package/dist/collection/components/ez-popover/ez-popover.js +365 -0
  175. package/dist/collection/components/ez-popup/ez-popup.css +418 -0
  176. package/dist/collection/components/ez-popup/ez-popup.js +180 -0
  177. package/dist/collection/components/ez-radio-button/ez-radio-button.css +217 -0
  178. package/dist/collection/components/ez-radio-button/ez-radio-button.js +163 -0
  179. package/dist/collection/components/ez-scroller/EzScrollDirection.js +6 -0
  180. package/dist/collection/components/ez-scroller/ez-scroller.css +192 -0
  181. package/dist/collection/components/ez-scroller/ez-scroller.js +293 -0
  182. package/dist/collection/components/ez-search/ez-search.css +3 -0
  183. package/dist/collection/components/ez-search/ez-search.js +462 -0
  184. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +63 -0
  185. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +47 -0
  186. package/dist/collection/components/ez-skeleton/ez-skeleton.constants.js +1 -0
  187. package/dist/collection/components/ez-skeleton/ez-skeleton.css +94 -0
  188. package/dist/collection/components/ez-skeleton/ez-skeleton.js +211 -0
  189. package/dist/collection/components/ez-tabselector/ez-tabselector.css +149 -0
  190. package/dist/collection/components/ez-tabselector/ez-tabselector.js +321 -0
  191. package/dist/collection/components/ez-text-area/ez-text-area.css +242 -0
  192. package/dist/collection/components/ez-text-area/ez-text-area.js +428 -0
  193. package/dist/collection/components/ez-text-edit/ez-text-edit.css +19 -0
  194. package/dist/collection/components/ez-text-edit/ez-text-edit.js +202 -0
  195. package/dist/collection/components/ez-text-input/ez-text-input.css +301 -0
  196. package/dist/collection/components/ez-text-input/ez-text-input.js +491 -0
  197. package/dist/collection/components/ez-time-input/ez-time-input.css +14 -0
  198. package/dist/collection/components/ez-time-input/ez-time-input.js +412 -0
  199. package/dist/collection/components/ez-toast/ez-toast.css +167 -0
  200. package/dist/collection/components/ez-toast/ez-toast.js +209 -0
  201. package/dist/collection/components/ez-tree/ez-tree.css +159 -0
  202. package/dist/collection/components/ez-tree/ez-tree.js +696 -0
  203. package/dist/collection/components/ez-tree/interfaces/ITree.js +1 -0
  204. package/dist/collection/components/ez-tree/interfaces/ITreeItem.js +1 -0
  205. package/dist/collection/components/ez-tree/subcomponents/DefaultIconResolver.js +8 -0
  206. package/dist/collection/components/ez-tree/subcomponents/DefaultTooltipResolver.js +3 -0
  207. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +24 -0
  208. package/dist/collection/components/ez-tree/subcomponents/index.js +2 -0
  209. package/dist/collection/components/ez-tree/types/Node.js +110 -0
  210. package/dist/collection/components/ez-tree/types/Tree.js +132 -0
  211. package/dist/collection/components/ez-upload/RemoteFile.js +94 -0
  212. package/dist/collection/components/ez-upload/ez-upload.css +582 -0
  213. package/dist/collection/components/ez-upload/ez-upload.js +587 -0
  214. package/dist/collection/components/ez-view-stack/ez-view-stack.css +9 -0
  215. package/dist/collection/components/ez-view-stack/ez-view-stack.js +126 -0
  216. package/dist/collection/index.js +1 -0
  217. package/dist/collection/servidor.js +101 -0
  218. package/dist/collection/setupTests.js +1 -0
  219. package/dist/collection/utils/ApplicationUtils.js +94 -0
  220. package/dist/collection/utils/AssetsUtils.js +19 -0
  221. package/dist/collection/utils/CSSVarsUtils.js +73 -0
  222. package/dist/collection/utils/constants.js +3 -0
  223. package/dist/collection/utils/form/DataBinder.js +287 -0
  224. package/dist/collection/utils/form/FormMetadata.js +176 -0
  225. package/dist/collection/utils/form/index.js +2 -0
  226. package/dist/collection/utils/form/interfaces/IDefaultConfig.js +1 -0
  227. package/dist/collection/utils/form/interfaces/IFormCardConfig.js +1 -0
  228. package/dist/collection/utils/form/interfaces/IFormConfig.js +1 -0
  229. package/dist/collection/utils/form/interfaces/IFormSheetMetadata.js +1 -0
  230. package/dist/collection/utils/form/interfaces/ISummaryField.js +1 -0
  231. package/dist/collection/utils/form/interfaces/ITabConfig.js +1 -0
  232. package/dist/collection/utils/form/interfaces/index.js +1 -0
  233. package/dist/collection/utils/index.js +6 -0
  234. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +21 -0
  235. package/dist/collection/utils/interfaces/IFieldConfig.js +1 -0
  236. package/dist/collection/utils/mock/ez-upload-mock.js +30 -0
  237. package/dist/collection/utils/utils.js +6 -0
  238. package/dist/collection/utils/validators/recordvalidator/IInvalidField.js +1 -0
  239. package/dist/collection/utils/validators/recordvalidator/IRecordValidator.js +1 -0
  240. package/dist/collection/utils/validators/recordvalidator/IValidationResult.js +1 -0
  241. package/dist/collection/utils/validators/recordvalidator/IValidationSource.js +1 -0
  242. package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +74 -0
  243. package/dist/custom-elements/index.d.ts +321 -0
  244. package/dist/custom-elements/index.js +129655 -0
  245. package/dist/esm/ApplicationUtils-d9a34a16.js +160 -0
  246. package/dist/esm/CSSVarsUtils-a97cfa29.js +75 -0
  247. package/dist/esm/CheckMode-bdb2ec19.js +7 -0
  248. package/dist/esm/DialogType-54a62731.js +9 -0
  249. package/dist/esm/EzScrollDirection-2df26c93.js +8 -0
  250. package/dist/esm/RecordValidationProcessor-abc814af.js +99 -0
  251. package/dist/esm/constants-6dab64f7.js +4 -0
  252. package/dist/esm/ez-actions-button.entry.js +208 -0
  253. package/dist/esm/ez-alert.entry.js +26 -0
  254. package/dist/esm/ez-application.entry.js +22 -0
  255. package/dist/esm/ez-badge.entry.js +116 -0
  256. package/dist/esm/ez-breadcrumb.entry.js +281 -0
  257. package/dist/esm/ez-button.entry.js +83 -0
  258. package/dist/esm/ez-calendar.entry.js +234 -0
  259. package/dist/esm/ez-card-item.entry.js +48 -0
  260. package/dist/esm/ez-check.entry.js +91 -0
  261. package/dist/esm/ez-chip.entry.js +112 -0
  262. package/dist/esm/ez-collapsible-box.entry.js +129 -0
  263. package/dist/esm/ez-combo-box.entry.js +686 -0
  264. package/dist/esm/ez-date-input.entry.js +184 -0
  265. package/dist/esm/ez-date-time-input.entry.js +238 -0
  266. package/dist/esm/ez-dialog.entry.js +176 -0
  267. package/dist/esm/ez-dropdown.entry.js +511 -0
  268. package/dist/esm/ez-file-item.entry.js +70 -0
  269. package/dist/esm/ez-filter-input_2.entry.js +132 -0
  270. package/dist/esm/ez-form-view.entry.js +187 -0
  271. package/dist/esm/ez-form.entry.js +929 -0
  272. package/dist/esm/ez-grid.entry.js +120834 -0
  273. package/dist/esm/ez-guide-navigator.entry.js +92 -0
  274. package/dist/esm/ez-icon.entry.js +40 -0
  275. package/dist/esm/ez-list.entry.js +554 -0
  276. package/dist/esm/ez-loading-bar.entry.js +28 -0
  277. package/dist/esm/ez-modal-container.entry.js +60 -0
  278. package/dist/esm/ez-modal.entry.js +68 -0
  279. package/dist/esm/ez-multi-selection-list.entry.js +179 -0
  280. package/dist/esm/ez-number-input.entry.js +177 -0
  281. package/dist/esm/ez-popover.entry.js +152 -0
  282. package/dist/esm/ez-popup.entry.js +62 -0
  283. package/dist/esm/ez-radio-button.entry.js +44 -0
  284. package/dist/esm/ez-scroller_3.entry.js +786 -0
  285. package/dist/esm/ez-search.entry.js +92 -0
  286. package/dist/esm/ez-skeleton.entry.js +63 -0
  287. package/dist/esm/ez-tabselector.entry.js +224 -0
  288. package/dist/esm/ez-text-area.entry.js +175 -0
  289. package/dist/esm/ez-text-edit.entry.js +103 -0
  290. package/dist/esm/ez-text-input.entry.js +243 -0
  291. package/dist/esm/ez-time-input.entry.js +164 -0
  292. package/dist/esm/ez-toast.entry.js +97 -0
  293. package/dist/esm/ez-upload.entry.js +391 -0
  294. package/dist/esm/ez-view-stack.entry.js +82 -0
  295. package/dist/esm/ezui.js +18 -0
  296. package/dist/esm/filter-column.entry.js +147 -0
  297. package/dist/esm/index-296b8458.js +2309 -0
  298. package/dist/esm/index.js +1 -0
  299. package/dist/esm/loader.js +18 -0
  300. package/dist/esm/polyfills/core-js.js +11 -0
  301. package/dist/esm/polyfills/css-shim.js +1 -0
  302. package/dist/esm/polyfills/dom.js +79 -0
  303. package/dist/esm/polyfills/es5-html-element.js +1 -0
  304. package/dist/esm/polyfills/index.js +34 -0
  305. package/dist/esm/polyfills/system.js +6 -0
  306. package/dist/ezui/ezui.esm.js +1 -0
  307. package/dist/ezui/index.esm.js +0 -0
  308. package/dist/ezui/p-028f264f.entry.js +1 -0
  309. package/dist/ezui/p-050247dc.entry.js +1 -0
  310. package/dist/ezui/p-061f4d73.entry.js +1 -0
  311. package/dist/ezui/p-1e7c4986.entry.js +1 -0
  312. package/dist/ezui/p-244dfe8a.entry.js +1 -0
  313. package/dist/ezui/p-25562cf8.entry.js +1 -0
  314. package/dist/ezui/p-27a01a26.js +1 -0
  315. package/dist/ezui/p-2da09f70.entry.js +1 -0
  316. package/dist/ezui/p-32b4163f.entry.js +1 -0
  317. package/dist/ezui/p-37673563.entry.js +1 -0
  318. package/dist/ezui/p-391de0e4.entry.js +1 -0
  319. package/dist/ezui/p-5ce6548c.entry.js +1 -0
  320. package/dist/ezui/p-5cef0264.entry.js +1 -0
  321. package/dist/ezui/p-5d6f2550.entry.js +1 -0
  322. package/dist/ezui/p-5e55a42b.entry.js +1 -0
  323. package/dist/ezui/p-60ba28ea.entry.js +1 -0
  324. package/dist/ezui/p-68352e41.entry.js +1 -0
  325. package/dist/ezui/p-6ab2f7c2.entry.js +1 -0
  326. package/dist/ezui/p-7525e604.entry.js +1 -0
  327. package/dist/ezui/p-7526f2b6.entry.js +1 -0
  328. package/dist/ezui/p-7eb3e1a5.js +1 -0
  329. package/dist/ezui/p-83885b21.entry.js +1 -0
  330. package/dist/ezui/p-86a2036d.js +1 -0
  331. package/dist/ezui/p-87e85160.entry.js +1 -0
  332. package/dist/ezui/p-8bd3903b.entry.js +1 -0
  333. package/dist/ezui/p-8fdff9cd.entry.js +1 -0
  334. package/dist/ezui/p-9285b53e.entry.js +1 -0
  335. package/dist/ezui/p-95426f93.entry.js +1 -0
  336. package/dist/ezui/p-964e5571.entry.js +304 -0
  337. package/dist/ezui/p-98bb8b16.js +1 -0
  338. package/dist/ezui/p-9b347f04.entry.js +1 -0
  339. package/dist/ezui/p-a01068e1.entry.js +1 -0
  340. package/dist/ezui/p-a510a4c5.entry.js +1 -0
  341. package/dist/ezui/p-a5e09759.entry.js +1 -0
  342. package/dist/ezui/p-ab574d59.js +1 -0
  343. package/dist/ezui/p-b11f035c.entry.js +1 -0
  344. package/dist/ezui/p-b853763b.js +1 -0
  345. package/dist/ezui/p-c49dbf23.entry.js +1 -0
  346. package/dist/ezui/p-ccb4ccd9.entry.js +1 -0
  347. package/dist/ezui/p-cd19a6f8.entry.js +1 -0
  348. package/dist/ezui/p-ce035beb.entry.js +1 -0
  349. package/dist/ezui/p-d43b22f3.entry.js +1 -0
  350. package/dist/ezui/p-d51aa09b.entry.js +1 -0
  351. package/dist/ezui/p-db528b31.entry.js +1 -0
  352. package/dist/ezui/p-e2dfd935.entry.js +1 -0
  353. package/dist/ezui/p-e318d280.js +2 -0
  354. package/dist/ezui/p-e67d0bd5.entry.js +1 -0
  355. package/dist/ezui/p-e7fa0ad6.entry.js +1 -0
  356. package/dist/ezui/p-f15ec3bb.js +1 -0
  357. package/dist/ezui/p-f4208819.entry.js +1 -0
  358. package/dist/ezui/p-fa571a4e.entry.js +1 -0
  359. package/dist/ezui/p-ff82b176.entry.js +1 -0
  360. package/dist/index.cjs.js +1 -0
  361. package/dist/index.js +1 -0
  362. package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +82 -0
  363. package/dist/types/components/ez-alert/ez-alert.d.ts +10 -0
  364. package/dist/types/components/ez-application/ez-application.d.ts +10 -0
  365. package/dist/types/components/ez-badge/enum/sizes.d.ts +8 -0
  366. package/dist/types/components/ez-badge/ez-badge.d.ts +35 -0
  367. package/dist/types/components/ez-badge/interfaces/IPosition.d.ts +4 -0
  368. package/dist/types/components/ez-breadcrumb/ez-breadcrumb.d.ts +71 -0
  369. package/dist/types/components/ez-breadcrumb/subcomponents/breadcrumb-item.d.ts +13 -0
  370. package/dist/types/components/ez-button/ez-button.d.ts +41 -0
  371. package/dist/types/components/ez-calendar/ez-calendar.d.ts +74 -0
  372. package/dist/types/components/ez-card-item/ez-card-item.d.ts +32 -0
  373. package/dist/types/components/ez-check/CheckMode.d.ts +4 -0
  374. package/dist/types/components/ez-check/ez-check.d.ts +49 -0
  375. package/dist/types/components/ez-chip/ez-chip.d.ts +60 -0
  376. package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +91 -0
  377. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +182 -0
  378. package/dist/types/components/ez-date-input/ez-date-input.d.ts +72 -0
  379. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +80 -0
  380. package/dist/types/components/ez-dialog/DialogType.d.ts +6 -0
  381. package/dist/types/components/ez-dialog/ez-dialog.d.ts +82 -0
  382. package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +60 -0
  383. package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +28 -0
  384. package/dist/types/components/ez-dropdown/structure/SubmenuControl.d.ts +78 -0
  385. package/dist/types/components/ez-file-item/ez-file-item.d.ts +36 -0
  386. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +77 -0
  387. package/dist/types/components/ez-form/ez-form.d.ts +47 -0
  388. package/dist/types/components/ez-form/store/form.slice.d.ts +27 -0
  389. package/dist/types/components/ez-form-view/ez-form-view.d.ts +22 -0
  390. package/dist/types/components/ez-form-view/fieldbuilder/FieldBuilder.d.ts +2 -0
  391. package/dist/types/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.d.ts +3 -0
  392. package/dist/types/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.d.ts +2 -0
  393. package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +4 -0
  394. package/dist/types/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.d.ts +2 -0
  395. package/dist/types/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.d.ts +3 -0
  396. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +2 -0
  397. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.d.ts +2 -0
  398. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +2 -0
  399. package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +3 -0
  400. package/dist/types/components/ez-form-view/interfaces/index.d.ts +1 -0
  401. package/dist/types/components/ez-form-view/structure/index.d.ts +14 -0
  402. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +287 -0
  403. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +89 -0
  404. package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
  405. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +20 -0
  406. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +38 -0
  407. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +32 -0
  408. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +11 -0
  409. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +12 -0
  410. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +10 -0
  411. package/dist/types/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.d.ts +1 -0
  412. package/dist/types/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.d.ts +9 -0
  413. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +10 -0
  414. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.d.ts +4 -0
  415. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.d.ts +5 -0
  416. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.d.ts +4 -0
  417. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.d.ts +3 -0
  418. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.d.ts +4 -0
  419. package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
  420. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
  421. package/dist/types/components/ez-grid/ez-grid.d.ts +139 -0
  422. package/dist/types/components/ez-grid/interfaces/ISelection.d.ts +3 -0
  423. package/dist/types/components/ez-grid/interfaces/ISelectionToastConfig.d.ts +3 -0
  424. package/dist/types/components/ez-grid/interfaces/index.d.ts +2 -0
  425. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +57 -0
  426. package/dist/types/components/ez-grid/subcomponents/selection-counter.d.ts +15 -0
  427. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
  428. package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +64 -0
  429. package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +4 -0
  430. package/dist/types/components/ez-guide-navigator/interfaces/index.d.ts +1 -0
  431. package/dist/types/components/ez-icon/ez-icon.d.ts +20 -0
  432. package/dist/types/components/ez-list/ez-list.d.ts +133 -0
  433. package/dist/types/components/ez-loading-bar/ez-loading-bar.d.ts +12 -0
  434. package/dist/types/components/ez-modal/ez-modal.d.ts +53 -0
  435. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +47 -0
  436. package/dist/types/components/ez-modal-container/index.d.ts +2 -0
  437. package/dist/types/components/ez-modal-container/modal-action.d.ts +7 -0
  438. package/dist/types/components/ez-modal-container/modal-button-status.d.ts +6 -0
  439. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +68 -0
  440. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
  441. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
  442. package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
  443. package/dist/types/components/ez-number-input/ez-number-input.d.ts +81 -0
  444. package/dist/types/components/ez-popover/ez-popover.d.ts +60 -0
  445. package/dist/types/components/ez-popup/ez-popup.d.ts +37 -0
  446. package/dist/types/components/ez-radio-button/ez-radio-button.d.ts +37 -0
  447. package/dist/types/components/ez-scroller/EzScrollDirection.d.ts +5 -0
  448. package/dist/types/components/ez-scroller/ez-scroller.d.ts +38 -0
  449. package/dist/types/components/ez-search/ez-search.d.ts +84 -0
  450. package/dist/types/components/ez-sidebar-button/ez-sidebar-button.d.ts +11 -0
  451. package/dist/types/components/ez-skeleton/ez-skeleton.constants.d.ts +1 -0
  452. package/dist/types/components/ez-skeleton/ez-skeleton.d.ts +54 -0
  453. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +52 -0
  454. package/dist/types/components/ez-text-area/ez-text-area.d.ts +78 -0
  455. package/dist/types/components/ez-text-edit/ez-text-edit.d.ts +41 -0
  456. package/dist/types/components/ez-text-input/ez-text-input.d.ts +82 -0
  457. package/dist/types/components/ez-time-input/ez-time-input.d.ts +74 -0
  458. package/dist/types/components/ez-toast/ez-toast.d.ts +45 -0
  459. package/dist/types/components/ez-tree/ez-tree.d.ts +101 -0
  460. package/dist/types/components/ez-tree/interfaces/ITree.d.ts +5 -0
  461. package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +11 -0
  462. package/dist/types/components/ez-tree/subcomponents/DefaultIconResolver.d.ts +2 -0
  463. package/dist/types/components/ez-tree/subcomponents/DefaultTooltipResolver.d.ts +2 -0
  464. package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +15 -0
  465. package/dist/types/components/ez-tree/subcomponents/index.d.ts +2 -0
  466. package/dist/types/components/ez-tree/types/Node.d.ts +22 -0
  467. package/dist/types/components/ez-tree/types/Tree.d.ts +21 -0
  468. package/dist/types/components/ez-upload/RemoteFile.d.ts +14 -0
  469. package/dist/types/components/ez-upload/ez-upload.d.ts +101 -0
  470. package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +25 -0
  471. package/dist/types/components.d.ts +3464 -0
  472. package/dist/types/index.d.ts +1 -0
  473. package/dist/types/stencil-public-runtime.d.ts +1637 -0
  474. package/dist/types/utils/ApplicationUtils.d.ts +31 -0
  475. package/dist/types/utils/AssetsUtils.d.ts +1 -0
  476. package/dist/types/utils/CSSVarsUtils.d.ts +6 -0
  477. package/dist/types/utils/constants.d.ts +3 -0
  478. package/dist/types/utils/form/DataBinder.d.ts +30 -0
  479. package/dist/types/utils/form/FormMetadata.d.ts +23 -0
  480. package/dist/types/utils/form/index.d.ts +2 -0
  481. package/dist/types/utils/form/interfaces/IDefaultConfig.d.ts +5 -0
  482. package/dist/types/utils/form/interfaces/IFormCardConfig.d.ts +5 -0
  483. package/dist/types/utils/form/interfaces/IFormConfig.d.ts +13 -0
  484. package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +6 -0
  485. package/dist/types/utils/form/interfaces/ISummaryField.d.ts +4 -0
  486. package/dist/types/utils/form/interfaces/ITabConfig.d.ts +6 -0
  487. package/dist/types/utils/form/interfaces/index.d.ts +10 -0
  488. package/dist/types/utils/index.d.ts +6 -0
  489. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +17 -0
  490. package/dist/types/utils/interfaces/IFieldConfig.d.ts +13 -0
  491. package/dist/types/utils/utils.d.ts +2 -0
  492. package/dist/types/utils/validators/recordvalidator/IInvalidField.d.ts +4 -0
  493. package/dist/types/utils/validators/recordvalidator/IRecordValidator.d.ts +5 -0
  494. package/dist/types/utils/validators/recordvalidator/IValidationResult.d.ts +8 -0
  495. package/dist/types/utils/validators/recordvalidator/IValidationSource.d.ts +6 -0
  496. package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +13 -0
  497. package/loader/cdn.js +3 -0
  498. package/loader/index.cjs.js +3 -0
  499. package/loader/index.d.ts +21 -0
  500. package/loader/index.es2017.js +3 -0
  501. package/loader/index.js +4 -0
  502. package/loader/package.json +11 -0
  503. package/package.json +93 -0
  504. package/react/.keepfolder +0 -0
  505. package/react/components.d.ts +48 -0
  506. package/react/components.js +52 -0
  507. package/react/components.js.map +1 -0
  508. package/react/react-component-lib/createComponent.d.ts +10 -0
  509. package/react/react-component-lib/createComponent.js +59 -0
  510. package/react/react-component-lib/createComponent.js.map +1 -0
  511. package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
  512. package/react/react-component-lib/createOverlayComponent.js +89 -0
  513. package/react/react-component-lib/createOverlayComponent.js.map +1 -0
  514. package/react/react-component-lib/index.d.ts +2 -0
  515. package/react/react-component-lib/index.js +3 -0
  516. package/react/react-component-lib/index.js.map +1 -0
  517. package/react/react-component-lib/interfaces.d.ts +29 -0
  518. package/react/react-component-lib/interfaces.js +1 -0
  519. package/react/react-component-lib/interfaces.js.map +1 -0
  520. package/react/react-component-lib/utils/attachProps.d.ts +12 -0
  521. package/react/react-component-lib/utils/attachProps.js +96 -0
  522. package/react/react-component-lib/utils/attachProps.js.map +1 -0
  523. package/react/react-component-lib/utils/case.d.ts +2 -0
  524. package/react/react-component-lib/utils/case.js +7 -0
  525. package/react/react-component-lib/utils/case.js.map +1 -0
  526. package/react/react-component-lib/utils/dev.d.ts +2 -0
  527. package/react/react-component-lib/utils/dev.js +13 -0
  528. package/react/react-component-lib/utils/dev.js.map +1 -0
  529. package/react/react-component-lib/utils/index.d.ts +7 -0
  530. package/react/react-component-lib/utils/index.js +21 -0
  531. package/react/react-component-lib/utils/index.js.map +1 -0
@@ -0,0 +1,929 @@
1
+ import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-296b8458.js';
2
+ import { DateUtils, Action, WaitingChangeException, ApplicationContext, DataUnitAction, StringUtils, DataUnit, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { b as buildFieldMetadata, R as RecordValidationProcessor } from './RecordValidationProcessor-abc814af.js';
4
+ import './ApplicationUtils-d9a34a16.js';
5
+ import './DialogType-54a62731.js';
6
+
7
+ const DETAIL_PATTERN = /child\[([^\]]+)\]/;
8
+ const REGEX_DEFAULT_VAR_KEY = /\$\{.+\}/;
9
+ class FormMetadata {
10
+ constructor() {
11
+ this._sheets = new Map();
12
+ this._requiredFields = [];
13
+ this._cleanOnCopyFields = [];
14
+ this._defaultValues = {};
15
+ }
16
+ static getDetailName(name) {
17
+ const result = DETAIL_PATTERN.exec(name);
18
+ return result ? result[1] : undefined;
19
+ }
20
+ getSheet(name) {
21
+ return this._sheets.get(name);
22
+ }
23
+ getAllSheets() {
24
+ return this._sheets;
25
+ }
26
+ addSheet(sheet) {
27
+ this._sheets.set(sheet.name, sheet);
28
+ }
29
+ addRequiredFields(fields) {
30
+ this._requiredFields = this._requiredFields.concat(fields);
31
+ }
32
+ getRequiredFields() {
33
+ return this._requiredFields;
34
+ }
35
+ addCleanOnCopyFields(fields) {
36
+ this._cleanOnCopyFields = this._cleanOnCopyFields.concat(fields);
37
+ }
38
+ getCleanOnCopyFields() {
39
+ return this._cleanOnCopyFields;
40
+ }
41
+ addDefaultValues(defaultValues) {
42
+ return this._defaultValues = Object.assign(Object.assign({}, this._defaultValues), defaultValues);
43
+ }
44
+ getDefaultValues() {
45
+ const result = {};
46
+ Object.entries(this._defaultValues).forEach(([key, value]) => {
47
+ if (typeof value === "string") {
48
+ const result = REGEX_DEFAULT_VAR_KEY.exec(value);
49
+ if (result) {
50
+ value = this.getDefaultVar(result[0]);
51
+ }
52
+ }
53
+ result[key] = value;
54
+ });
55
+ return result;
56
+ }
57
+ getDefaultVar(name) {
58
+ if (name === "${data}") {
59
+ return DateUtils.getToday();
60
+ }
61
+ if (name === "${datahora}") {
62
+ return DateUtils.getToday(true);
63
+ }
64
+ return this._defaultVars ? this._defaultVars.get(name) : undefined;
65
+ }
66
+ setDefaultVars(vars) {
67
+ this._defaultVars = vars;
68
+ }
69
+ }
70
+ const buildFormConfigFromDataUnit = (dataUnit) => {
71
+ const unitMD = dataUnit.metadata;
72
+ let fields;
73
+ if (unitMD) {
74
+ fields = unitMD.fields
75
+ .filter(descriptor => descriptor.visible !== false)
76
+ .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
77
+ }
78
+ const config = { emptyConfig: false, fields };
79
+ return config;
80
+ };
81
+ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
82
+ var _a, _b;
83
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
84
+ config = buildFormConfigFromDataUnit(dataUnit);
85
+ }
86
+ const sheets = new Map();
87
+ const hiddenTabs = new Map();
88
+ const requiredFields = [];
89
+ const cleanOnCopyFields = [];
90
+ const defaultValues = {};
91
+ (_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
92
+ if (!hiddenTabs.has(tab.label) && tab.visible === false) {
93
+ hiddenTabs.set(tab.label, tab);
94
+ }
95
+ });
96
+ (_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
97
+ var _a, _b, _c;
98
+ if (field.visible !== false) {
99
+ const tabConfig = getTabConfig(field.tab || "__main", sheets);
100
+ if (hiddenTabs.has(tabConfig.label)) {
101
+ return;
102
+ }
103
+ const descriptor = dataUnit.getField(field.name);
104
+ if (descriptor && tabConfig.visible) {
105
+ if (!sheets.has(tabConfig)) {
106
+ sheets.set(tabConfig, []);
107
+ }
108
+ const formField = buildFieldMetadata(descriptor, field);
109
+ sheets.get(tabConfig).push(formField);
110
+ if (formField.required) {
111
+ requiredFields.push(field.name);
112
+ }
113
+ const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
114
+ if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.cleanOnCopy)) {
115
+ cleanOnCopyFields.push(field.name);
116
+ }
117
+ let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
118
+ if (defaultValue && defaultValue.value != undefined) {
119
+ const { type, value } = defaultValue;
120
+ if (type) {
121
+ if (type === "V") {
122
+ defaultValue = value;
123
+ }
124
+ else {
125
+ try {
126
+ const parsed = JSON.parse(value);
127
+ if (parsed && "value" in parsed) {
128
+ defaultValue = parsed;
129
+ }
130
+ else {
131
+ defaultValue = value;
132
+ }
133
+ }
134
+ catch (_d) { }
135
+ }
136
+ }
137
+ defaultValues[field.name] = defaultValue;
138
+ }
139
+ }
140
+ }
141
+ });
142
+ const metadata = new FormMetadata();
143
+ metadata.setDefaultVars(config.defaultVars);
144
+ if (includeDetails) {
145
+ const unitMD = dataUnit.metadata;
146
+ if (unitMD != undefined && unitMD.children != undefined) {
147
+ unitMD.children.forEach(child => {
148
+ const { label, name, fields } = buildDetailSheet(child);
149
+ sheets.set({ name, label }, fields);
150
+ });
151
+ }
152
+ }
153
+ Array.from(sheets.entries())
154
+ .sort(sortTabs)
155
+ .forEach(([key, fields]) => {
156
+ metadata.addSheet({
157
+ label: (key.label === "__main") ? "Principal" : key.label,
158
+ name: key.name || key.label,
159
+ fields
160
+ });
161
+ });
162
+ metadata.addRequiredFields(requiredFields);
163
+ metadata.addCleanOnCopyFields(cleanOnCopyFields);
164
+ metadata.addDefaultValues(defaultValues);
165
+ return metadata;
166
+ };
167
+ const getTabConfig = (tab, sheets) => {
168
+ const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
169
+ return tabConfig || { label: tab, visible: true };
170
+ };
171
+ const sortTabs = (a, b) => {
172
+ return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
173
+ };
174
+ const buildDetailSheet = (child) => {
175
+ return {
176
+ name: `child[${child.name}]`,
177
+ label: child.label,
178
+ fields: []
179
+ };
180
+ };
181
+
182
+ class DataBinder {
183
+ constructor(dataUnit) {
184
+ this.onDataUnitEvent = (action) => {
185
+ var _a, _b;
186
+ switch (action.type) {
187
+ case Action.DATA_LOADED:
188
+ case Action.DATA_SAVED:
189
+ case Action.RECORDS_REMOVED:
190
+ case Action.RECORDS_ADDED:
191
+ case Action.RECORDS_COPIED:
192
+ case Action.EDITION_CANCELED:
193
+ case Action.SELECTION_CHANGED:
194
+ case Action.NEXT_SELECTED:
195
+ case Action.PREVIOUS_SELECTED:
196
+ this.clearInvalid();
197
+ case Action.DATA_CHANGED:
198
+ case Action.CHANGE_UNDONE:
199
+ case Action.CHANGE_REDONE:
200
+ case Action.RECORD_LOADED:
201
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
202
+ this.updateValue(field.fieldName, field.field);
203
+ });
204
+ break;
205
+ case Action.FIELD_INVALIDATED:
206
+ (_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
207
+ this.updateErrorMessage(field.fieldName, field.field);
208
+ });
209
+ break;
210
+ }
211
+ };
212
+ this._fields = new Map();
213
+ this._dataUnit = dataUnit;
214
+ this.applyDefaultValues();
215
+ this._dataUnit.subscribe(this.onDataUnitEvent);
216
+ this._dataUnit.addInterceptor(this);
217
+ }
218
+ applyDefaultValues() {
219
+ const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
220
+ if (recordIds.length > 0) {
221
+ const defaultValues = this.getDefaultValues();
222
+ if (defaultValues) {
223
+ Object.keys(defaultValues).forEach(field => {
224
+ this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
225
+ });
226
+ }
227
+ }
228
+ }
229
+ bind(fields, currentContextName, formMetadata, recordsValidator) {
230
+ fields.forEach(fieldElement => {
231
+ const { fieldName, contextName } = fieldElement.dataset;
232
+ if (contextName == undefined || contextName === currentContextName) {
233
+ this.updateBind(fieldName, fieldElement);
234
+ }
235
+ });
236
+ this._formMetadata = formMetadata;
237
+ this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
238
+ getRequiredFields: () => this._formMetadata.getRequiredFields(),
239
+ markAsInvalid: field => this.markInvalid(field),
240
+ getMessageForField: field => this.getErrorMessage(field)
241
+ }, recordsValidator);
242
+ }
243
+ onDisconnectedCallback() {
244
+ this._dataUnit.unsubscribe(this.onDataUnitEvent);
245
+ this._dataUnit.removeInterceptor(this);
246
+ }
247
+ getCurrentRecordId() {
248
+ const record = this._dataUnit.getSelectedRecord();
249
+ return record === null || record === void 0 ? void 0 : record.__record__id__;
250
+ }
251
+ markInvalid(field) {
252
+ if (this._fields.has(field.name)) {
253
+ const fieldElement = this._fields.get(field.name).field;
254
+ this.updateErrorMessage(field.name, fieldElement, field.message);
255
+ }
256
+ }
257
+ clearInvalid(recordId) {
258
+ this._dataUnit.clearInvalid(recordId);
259
+ this._fields.forEach(fieldBinder => {
260
+ const fieldElement = fieldBinder.field;
261
+ fieldElement["errorMessage"] = "";
262
+ });
263
+ }
264
+ updateValue(fieldName, field) {
265
+ const bind = this._fields.get(fieldName);
266
+ try {
267
+ if (bind) {
268
+ bind.listen = false;
269
+ }
270
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
271
+ this.updateErrorMessage(fieldName, field);
272
+ }
273
+ finally {
274
+ if (bind) {
275
+ bind.listen = true;
276
+ }
277
+ }
278
+ }
279
+ validate() {
280
+ return this._recordValidatorProcessor.validate();
281
+ }
282
+ updateErrorMessage(fieldName, field, message) {
283
+ if (message == undefined) {
284
+ message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
285
+ }
286
+ if (!field["errorMessage"]) {
287
+ field["errorMessage"] = message;
288
+ }
289
+ }
290
+ getErrorMessage(fieldName) {
291
+ if (this._fields.has(fieldName)) {
292
+ const fieldElement = this._fields.get(fieldName).field;
293
+ return fieldElement["errorMessage"];
294
+ }
295
+ return undefined;
296
+ }
297
+ updateBind(fieldName, field) {
298
+ const oldBind = this._fields.get(fieldName);
299
+ if (oldBind) {
300
+ oldBind.destroy();
301
+ }
302
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
303
+ this.updateErrorMessage(fieldName, field);
304
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
305
+ this.bindSearchOptionsLoader(fieldName, field);
306
+ this.applyEzUploadContext(fieldName, field);
307
+ }
308
+ changeStarted(fieldName, waitingChange) {
309
+ /**
310
+ * se o waitingChange não é blocante, add um event listener pra
311
+ * fazer o accept da promise
312
+ *
313
+ * se não tiver promise no waitingChange, eu crio uma e resolvo no bind
314
+ *
315
+ *
316
+ */
317
+ if (this._dataUnit.records.length === 0) {
318
+ this._dataUnit.addRecord();
319
+ }
320
+ if (!waitingChange.blocking && waitingChange.promise == undefined) {
321
+ const bind = this._fields.get(fieldName);
322
+ if (bind) {
323
+ waitingChange.promise = new Promise((resolve, reject) => {
324
+ bind.waitingChangePromiseResolve = resolve;
325
+ bind.waitingChangePromiseReject = reject;
326
+ });
327
+ }
328
+ }
329
+ this._dataUnit.startChange(fieldName, waitingChange);
330
+ }
331
+ cancelWaitingChange(fieldName) {
332
+ if (this._dataUnit.waitingForChange(fieldName)) {
333
+ this._dataUnit.cancelWaitingChange(fieldName);
334
+ const bind = this._fields.get(fieldName);
335
+ if (bind) {
336
+ bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
337
+ }
338
+ }
339
+ }
340
+ setFieldValue(fieldName, newValue) {
341
+ if (this._dataUnit.records.length === 0) {
342
+ this._dataUnit.addRecord();
343
+ }
344
+ this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
345
+ this._dataUnit.setFieldValue(fieldName, newValue);
346
+ if (this._dataUnit.waitingForChange(fieldName)) {
347
+ const bind = this._fields.get(fieldName);
348
+ if (bind) {
349
+ bind.acceptWaitingChange();
350
+ }
351
+ }
352
+ }
353
+ bindSearchOptionsLoader(fieldName, field) {
354
+ if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
355
+ const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
356
+ if (loader) {
357
+ field["optionLoader"] = (arg) => {
358
+ return loader(arg, fieldName, this._dataUnit);
359
+ };
360
+ }
361
+ }
362
+ }
363
+ applyEzUploadContext(fieldName, field) {
364
+ var _a, _b;
365
+ if (field.nodeName === "EZ-UPLOAD") {
366
+ field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
367
+ field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
368
+ const descriptor = this._dataUnit.getField(fieldName);
369
+ const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
370
+ if (destination) {
371
+ field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
372
+ }
373
+ field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
374
+ }
375
+ }
376
+ interceptAction(action) {
377
+ if (action.type === Action.RECORDS_COPIED) {
378
+ const cleanFields = this._formMetadata.getCleanOnCopyFields();
379
+ if (cleanFields) {
380
+ const records = action.payload;
381
+ return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
382
+ const newRecord = Object.assign({}, record);
383
+ cleanFields.forEach(fieldName => delete newRecord[fieldName]);
384
+ return newRecord;
385
+ }));
386
+ }
387
+ }
388
+ if (action.type === Action.SAVING_DATA) {
389
+ return new Promise((resolve) => {
390
+ this.validate()
391
+ .then(() => resolve(action))
392
+ .catch(() => { });
393
+ });
394
+ }
395
+ if (action.type === Action.RECORDS_ADDED) {
396
+ const defaultValues = this.getDefaultValues();
397
+ if (defaultValues) {
398
+ const records = action.payload;
399
+ return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
400
+ return Object.assign(Object.assign({}, record), defaultValues);
401
+ }));
402
+ }
403
+ }
404
+ return action;
405
+ }
406
+ getDefaultValues() {
407
+ var _a;
408
+ const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
409
+ if (rawDefaultValues) {
410
+ const defaultValues = {};
411
+ for (const field in rawDefaultValues) {
412
+ defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
413
+ }
414
+ return defaultValues;
415
+ }
416
+ return undefined;
417
+ }
418
+ }
419
+ class Bind {
420
+ constructor() {
421
+ this.listen = true;
422
+ this.startChangeEventName = "ezStartChange";
423
+ this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
424
+ this.changeEventName = "ezChange";
425
+ }
426
+ destroy() {
427
+ this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
428
+ this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
429
+ this.field.removeEventListener(this.changeEventName, this.changeListener);
430
+ }
431
+ acceptWaitingChange() {
432
+ if (this.waitingChangePromiseResolve) {
433
+ this.waitingChangePromiseResolve();
434
+ this.waitingChangePromiseReject = undefined;
435
+ this.waitingChangePromiseResolve = undefined;
436
+ }
437
+ }
438
+ rejectWaitingChange(reason) {
439
+ if (this.waitingChangePromiseReject) {
440
+ this.waitingChangePromiseReject(reason);
441
+ this.waitingChangePromiseReject = undefined;
442
+ this.waitingChangePromiseResolve = undefined;
443
+ }
444
+ }
445
+ static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
446
+ const b = new Bind();
447
+ b.field = field;
448
+ b.fieldName = fieldName;
449
+ b.startChangeListener = (evt) => { if (b.listen)
450
+ startChangeCallback(fieldName, evt.detail); };
451
+ b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
452
+ b.cancelWaitingChangeListener = () => { if (b.listen)
453
+ cancelWaitingChangeCallback(fieldName); };
454
+ b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
455
+ b.changeListener = (evt) => { if (b.listen)
456
+ changeCallback(fieldName, evt.detail); };
457
+ b.field.addEventListener(b.changeEventName, b.changeListener);
458
+ return b;
459
+ }
460
+ }
461
+
462
+ /**
463
+ * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
464
+ *
465
+ * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
466
+ * during build.
467
+ * @param {number} code
468
+ */
469
+ function formatProdErrorMessage(code) {
470
+ return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
471
+ }
472
+
473
+ // Inlined version of the `symbol-observable` polyfill
474
+ var $$observable = (function () {
475
+ return typeof Symbol === 'function' && Symbol.observable || '@@observable';
476
+ })();
477
+
478
+ /**
479
+ * These are private action types reserved by Redux.
480
+ * For any unknown actions, you must return the current state.
481
+ * If the current state is undefined, you must return the initial state.
482
+ * Do not reference these action types directly in your code.
483
+ */
484
+ var randomString = function randomString() {
485
+ return Math.random().toString(36).substring(7).split('').join('.');
486
+ };
487
+
488
+ var ActionTypes = {
489
+ INIT: "@@redux/INIT" + randomString(),
490
+ REPLACE: "@@redux/REPLACE" + randomString(),
491
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
492
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
493
+ }
494
+ };
495
+
496
+ /**
497
+ * @param {any} obj The object to inspect.
498
+ * @returns {boolean} True if the argument appears to be a plain object.
499
+ */
500
+ function isPlainObject(obj) {
501
+ if (typeof obj !== 'object' || obj === null) return false;
502
+ var proto = obj;
503
+
504
+ while (Object.getPrototypeOf(proto) !== null) {
505
+ proto = Object.getPrototypeOf(proto);
506
+ }
507
+
508
+ return Object.getPrototypeOf(obj) === proto;
509
+ }
510
+
511
+ /**
512
+ * @deprecated
513
+ *
514
+ * **We recommend using the `configureStore` method
515
+ * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
516
+ *
517
+ * Redux Toolkit is our recommended approach for writing Redux logic today,
518
+ * including store setup, reducers, data fetching, and more.
519
+ *
520
+ * **For more details, please read this Redux docs page:**
521
+ * **https://redux.js.org/introduction/why-rtk-is-redux-today**
522
+ *
523
+ * `configureStore` from Redux Toolkit is an improved version of `createStore` that
524
+ * simplifies setup and helps avoid common bugs.
525
+ *
526
+ * You should not be using the `redux` core package by itself today, except for learning purposes.
527
+ * The `createStore` method from the core `redux` package will not be removed, but we encourage
528
+ * all users to migrate to using Redux Toolkit for all Redux code.
529
+ *
530
+ * If you want to use `createStore` without this visual deprecation warning, use
531
+ * the `legacy_createStore` import instead:
532
+ *
533
+ * `import { legacy_createStore as createStore} from 'redux'`
534
+ *
535
+ */
536
+
537
+ function createStore(reducer, preloadedState, enhancer) {
538
+ var _ref2;
539
+
540
+ if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
541
+ throw new Error(formatProdErrorMessage(0) );
542
+ }
543
+
544
+ if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
545
+ enhancer = preloadedState;
546
+ preloadedState = undefined;
547
+ }
548
+
549
+ if (typeof enhancer !== 'undefined') {
550
+ if (typeof enhancer !== 'function') {
551
+ throw new Error(formatProdErrorMessage(1) );
552
+ }
553
+
554
+ return enhancer(createStore)(reducer, preloadedState);
555
+ }
556
+
557
+ if (typeof reducer !== 'function') {
558
+ throw new Error(formatProdErrorMessage(2) );
559
+ }
560
+
561
+ var currentReducer = reducer;
562
+ var currentState = preloadedState;
563
+ var currentListeners = [];
564
+ var nextListeners = currentListeners;
565
+ var isDispatching = false;
566
+ /**
567
+ * This makes a shallow copy of currentListeners so we can use
568
+ * nextListeners as a temporary list while dispatching.
569
+ *
570
+ * This prevents any bugs around consumers calling
571
+ * subscribe/unsubscribe in the middle of a dispatch.
572
+ */
573
+
574
+ function ensureCanMutateNextListeners() {
575
+ if (nextListeners === currentListeners) {
576
+ nextListeners = currentListeners.slice();
577
+ }
578
+ }
579
+ /**
580
+ * Reads the state tree managed by the store.
581
+ *
582
+ * @returns {any} The current state tree of your application.
583
+ */
584
+
585
+
586
+ function getState() {
587
+ if (isDispatching) {
588
+ throw new Error(formatProdErrorMessage(3) );
589
+ }
590
+
591
+ return currentState;
592
+ }
593
+ /**
594
+ * Adds a change listener. It will be called any time an action is dispatched,
595
+ * and some part of the state tree may potentially have changed. You may then
596
+ * call `getState()` to read the current state tree inside the callback.
597
+ *
598
+ * You may call `dispatch()` from a change listener, with the following
599
+ * caveats:
600
+ *
601
+ * 1. The subscriptions are snapshotted just before every `dispatch()` call.
602
+ * If you subscribe or unsubscribe while the listeners are being invoked, this
603
+ * will not have any effect on the `dispatch()` that is currently in progress.
604
+ * However, the next `dispatch()` call, whether nested or not, will use a more
605
+ * recent snapshot of the subscription list.
606
+ *
607
+ * 2. The listener should not expect to see all state changes, as the state
608
+ * might have been updated multiple times during a nested `dispatch()` before
609
+ * the listener is called. It is, however, guaranteed that all subscribers
610
+ * registered before the `dispatch()` started will be called with the latest
611
+ * state by the time it exits.
612
+ *
613
+ * @param {Function} listener A callback to be invoked on every dispatch.
614
+ * @returns {Function} A function to remove this change listener.
615
+ */
616
+
617
+
618
+ function subscribe(listener) {
619
+ if (typeof listener !== 'function') {
620
+ throw new Error(formatProdErrorMessage(4) );
621
+ }
622
+
623
+ if (isDispatching) {
624
+ throw new Error(formatProdErrorMessage(5) );
625
+ }
626
+
627
+ var isSubscribed = true;
628
+ ensureCanMutateNextListeners();
629
+ nextListeners.push(listener);
630
+ return function unsubscribe() {
631
+ if (!isSubscribed) {
632
+ return;
633
+ }
634
+
635
+ if (isDispatching) {
636
+ throw new Error(formatProdErrorMessage(6) );
637
+ }
638
+
639
+ isSubscribed = false;
640
+ ensureCanMutateNextListeners();
641
+ var index = nextListeners.indexOf(listener);
642
+ nextListeners.splice(index, 1);
643
+ currentListeners = null;
644
+ };
645
+ }
646
+ /**
647
+ * Dispatches an action. It is the only way to trigger a state change.
648
+ *
649
+ * The `reducer` function, used to create the store, will be called with the
650
+ * current state tree and the given `action`. Its return value will
651
+ * be considered the **next** state of the tree, and the change listeners
652
+ * will be notified.
653
+ *
654
+ * The base implementation only supports plain object actions. If you want to
655
+ * dispatch a Promise, an Observable, a thunk, or something else, you need to
656
+ * wrap your store creating function into the corresponding middleware. For
657
+ * example, see the documentation for the `redux-thunk` package. Even the
658
+ * middleware will eventually dispatch plain object actions using this method.
659
+ *
660
+ * @param {Object} action A plain object representing “what changed”. It is
661
+ * a good idea to keep actions serializable so you can record and replay user
662
+ * sessions, or use the time travelling `redux-devtools`. An action must have
663
+ * a `type` property which may not be `undefined`. It is a good idea to use
664
+ * string constants for action types.
665
+ *
666
+ * @returns {Object} For convenience, the same action object you dispatched.
667
+ *
668
+ * Note that, if you use a custom middleware, it may wrap `dispatch()` to
669
+ * return something else (for example, a Promise you can await).
670
+ */
671
+
672
+
673
+ function dispatch(action) {
674
+ if (!isPlainObject(action)) {
675
+ throw new Error(formatProdErrorMessage(7) );
676
+ }
677
+
678
+ if (typeof action.type === 'undefined') {
679
+ throw new Error(formatProdErrorMessage(8) );
680
+ }
681
+
682
+ if (isDispatching) {
683
+ throw new Error(formatProdErrorMessage(9) );
684
+ }
685
+
686
+ try {
687
+ isDispatching = true;
688
+ currentState = currentReducer(currentState, action);
689
+ } finally {
690
+ isDispatching = false;
691
+ }
692
+
693
+ var listeners = currentListeners = nextListeners;
694
+
695
+ for (var i = 0; i < listeners.length; i++) {
696
+ var listener = listeners[i];
697
+ listener();
698
+ }
699
+
700
+ return action;
701
+ }
702
+ /**
703
+ * Replaces the reducer currently used by the store to calculate the state.
704
+ *
705
+ * You might need this if your app implements code splitting and you want to
706
+ * load some of the reducers dynamically. You might also need this if you
707
+ * implement a hot reloading mechanism for Redux.
708
+ *
709
+ * @param {Function} nextReducer The reducer for the store to use instead.
710
+ * @returns {void}
711
+ */
712
+
713
+
714
+ function replaceReducer(nextReducer) {
715
+ if (typeof nextReducer !== 'function') {
716
+ throw new Error(formatProdErrorMessage(10) );
717
+ }
718
+
719
+ currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
720
+ // Any reducers that existed in both the new and old rootReducer
721
+ // will receive the previous state. This effectively populates
722
+ // the new state tree with any relevant data from the old one.
723
+
724
+ dispatch({
725
+ type: ActionTypes.REPLACE
726
+ });
727
+ }
728
+ /**
729
+ * Interoperability point for observable/reactive libraries.
730
+ * @returns {observable} A minimal observable of state changes.
731
+ * For more information, see the observable proposal:
732
+ * https://github.com/tc39/proposal-observable
733
+ */
734
+
735
+
736
+ function observable() {
737
+ var _ref;
738
+
739
+ var outerSubscribe = subscribe;
740
+ return _ref = {
741
+ /**
742
+ * The minimal observable subscription method.
743
+ * @param {Object} observer Any object that can be used as an observer.
744
+ * The observer object should have a `next` method.
745
+ * @returns {subscription} An object with an `unsubscribe` method that can
746
+ * be used to unsubscribe the observable from the store, and prevent further
747
+ * emission of values from the observable.
748
+ */
749
+ subscribe: function subscribe(observer) {
750
+ if (typeof observer !== 'object' || observer === null) {
751
+ throw new Error(formatProdErrorMessage(11) );
752
+ }
753
+
754
+ function observeState() {
755
+ if (observer.next) {
756
+ observer.next(getState());
757
+ }
758
+ }
759
+
760
+ observeState();
761
+ var unsubscribe = outerSubscribe(observeState);
762
+ return {
763
+ unsubscribe: unsubscribe
764
+ };
765
+ }
766
+ }, _ref[$$observable] = function () {
767
+ return this;
768
+ }, _ref;
769
+ } // When a store is created, an "INIT" action is dispatched so that every
770
+ // reducer returns their initial state. This effectively populates
771
+ // the initial state tree.
772
+
773
+
774
+ dispatch({
775
+ type: ActionTypes.INIT
776
+ });
777
+ return _ref2 = {
778
+ dispatch: dispatch,
779
+ subscribe: subscribe,
780
+ getState: getState,
781
+ replaceReducer: replaceReducer
782
+ }, _ref2[$$observable] = observable, _ref2;
783
+ }
784
+
785
+ const inicialState = {};
786
+ /////////////////////////////// REDUCERS ///////////////////////////////
787
+ function formReducer(state = inicialState, action) {
788
+ switch (action.type) {
789
+ case FormActions.METADATA_LOADED:
790
+ return Object.assign(Object.assign({}, state), { formMetadata: action.payload, currentSheet: undefined });
791
+ case FormActions.CHANGE_TAB:
792
+ return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
793
+ default:
794
+ return state;
795
+ }
796
+ }
797
+ /////////////////////////////// ACTION CREATORS ///////////////////////////////
798
+ function loadMetadata(formMetadata) {
799
+ return {
800
+ type: FormActions.METADATA_LOADED,
801
+ payload: formMetadata
802
+ };
803
+ }
804
+ function changeTab(currentSheet) {
805
+ return {
806
+ type: FormActions.CHANGE_TAB,
807
+ payload: typeof currentSheet === "string" ? currentSheet : currentSheet.tabKey
808
+ };
809
+ }
810
+ /////////////////////////////// SELECTORS ///////////////////////////////
811
+ function selectFormMetadata(state) {
812
+ return state.formMetadata;
813
+ }
814
+ function selectCurrentSheetId(state) {
815
+ return state.currentSheet;
816
+ }
817
+ function selectCurrentSheet(state) {
818
+ const currentSheetId = selectCurrentSheetId(state);
819
+ return currentSheetId ? state.formMetadata.getSheet(currentSheetId) : Array.from(state.formMetadata.getAllSheets().values())[0];
820
+ }
821
+ /////////////////////////////// TYPES ///////////////////////////////
822
+ var FormActions;
823
+ (function (FormActions) {
824
+ FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
825
+ FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
826
+ })(FormActions || (FormActions = {}));
827
+
828
+ const ezFormCss = ".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";
829
+
830
+ const EzForm = class {
831
+ constructor(hostRef) {
832
+ registerInstance(this, hostRef);
833
+ this.ezReady = createEvent(this, "ezReady", 7);
834
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
835
+ this.onDataUnitAction = (action) => {
836
+ if (action.type === Action.METADATA_LOADED) {
837
+ this.processMetadata();
838
+ }
839
+ };
840
+ this.dataUnit = undefined;
841
+ this.config = undefined;
842
+ this.recordsValidator = undefined;
843
+ }
844
+ /**
845
+ * Realiza validação no conteúdo de todos os campos.
846
+ */
847
+ validate() {
848
+ return this._dataBinder.validate();
849
+ }
850
+ observeConfig() {
851
+ this.processMetadata();
852
+ }
853
+ getDynamicContent() {
854
+ var _a;
855
+ const formMD = selectFormMetadata(this._store.getState());
856
+ if (!formMD) {
857
+ return null;
858
+ }
859
+ const allSheets = Array.from(formMD.getAllSheets().values());
860
+ const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
861
+ let result = [];
862
+ if (allSheets.length > 1) {
863
+ const tabs = allSheets.map((sheet, index) => {
864
+ return { tabKey: sheet.name, label: sheet.label, index };
865
+ });
866
+ const idTabSelector = `selector`;
867
+ result.push(h("ez-tabselector", { tabs: this.buildIdTabSelector(tabs), onEzChange: (evt) => this._store.dispatch(changeTab(evt.detail)), selectedTab: currentSheet.name, "data-element-id": idTabSelector }));
868
+ }
869
+ result = result.concat(this.buildFormContent(currentSheet));
870
+ return result;
871
+ }
872
+ buildFormContent(currentSheet) {
873
+ const fields = currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.fields;
874
+ if (currentSheet == undefined) {
875
+ return;
876
+ }
877
+ const idFormSheet = `${StringUtils.replaceAccentuatedChars(StringUtils.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
878
+ return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { class: "ez-row ez-padding-vertical--small", fields: fields })));
879
+ }
880
+ processMetadata() {
881
+ if (!this.isStatic() && this.dataUnit && this._store) {
882
+ const metadata = buildFormMetadata(this.config, this.dataUnit);
883
+ this._store.dispatch(loadMetadata(metadata));
884
+ }
885
+ }
886
+ isStatic() {
887
+ var _a;
888
+ return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
889
+ }
890
+ componentWillLoad() {
891
+ if (this.dataUnit === undefined) {
892
+ this.dataUnit = new DataUnit("ez-form");
893
+ }
894
+ this.dataUnit.subscribe(this.onDataUnitAction);
895
+ this._dataBinder = new DataBinder(this.dataUnit);
896
+ this._store = createStore(formReducer);
897
+ this._store.subscribe(() => forceUpdate(this));
898
+ this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));
899
+ this.processMetadata();
900
+ const dataInfo = { dataUnit: this.dataUnit };
901
+ ElementIDUtils.addIDInfo(this._element, null, dataInfo);
902
+ }
903
+ componentDidRender() {
904
+ const metadata = selectFormMetadata(this._store.getState());
905
+ metadata.addRequiredFields(this._staticFields.filter(f => f.dataset.required).map(f => f.dataset.fieldName));
906
+ this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")), this.dataUnit.dataUnitId, metadata, this.recordsValidator);
907
+ this.ezReady.emit();
908
+ }
909
+ disconnectedCallback() {
910
+ this.dataUnit.unsubscribe(this.onDataUnitAction);
911
+ this._dataBinder.onDisconnectedCallback();
912
+ }
913
+ buildIdTabSelector(tabs) {
914
+ if (tabs) {
915
+ tabs.forEach(tab => tab[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = StringUtils.toCamelCase(tab.label));
916
+ }
917
+ return tabs;
918
+ }
919
+ render() {
920
+ return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
921
+ }
922
+ get _element() { return getElement(this); }
923
+ static get watchers() { return {
924
+ "config": ["observeConfig"]
925
+ }; }
926
+ };
927
+ EzForm.style = ezFormCss;
928
+
929
+ export { EzForm as ez_form };