@sankhyalabs/sankhyablocks 1.1.22 → 1.1.25

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 (184) hide show
  1. package/dist/cjs/ApplicationUtils-05b74ee9.js +39 -0
  2. package/dist/cjs/AssetsUtils-7e3c38f9.js +24 -0
  3. package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
  5. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  6. package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
  7. package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
  8. package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
  9. package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
  10. package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
  11. package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
  12. package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
  13. package/dist/cjs/ez-form.cjs.entry.js +463 -0
  14. package/dist/cjs/ez-grid.cjs.entry.js +647 -0
  15. package/dist/cjs/ez-icon.cjs.entry.js +41 -0
  16. package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
  17. package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
  18. package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
  19. package/dist/cjs/ez-popover.cjs.entry.js +120 -0
  20. package/dist/cjs/ez-popup.cjs.entry.js +48 -0
  21. package/dist/cjs/ez-search.cjs.entry.js +64 -0
  22. package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
  23. package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
  24. package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
  25. package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
  26. package/dist/cjs/ez-toast.cjs.entry.js +44 -0
  27. package/dist/cjs/ez-upload.cjs.entry.js +356 -0
  28. package/dist/cjs/index-682c98b2.js +1771 -0
  29. package/dist/cjs/loader.cjs.js +3 -3
  30. package/dist/cjs/sankhyablocks.cjs.js +3 -3
  31. package/dist/cjs/snk-application.cjs.entry.js +319 -1275
  32. package/dist/cjs/test-du.cjs.entry.js +76 -0
  33. package/dist/collection/collection-manifest.json +37 -2
  34. package/dist/collection/components/snk-application/snk-application.js +8 -4
  35. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +16 -9
  36. package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
  37. package/dist/components/AssetsUtils.js +22 -0
  38. package/dist/components/CSSVarsUtils.js +17 -0
  39. package/dist/components/ez-action-chip.js +44 -0
  40. package/dist/components/ez-application.js +39 -0
  41. package/dist/components/ez-button.js +6 -0
  42. package/dist/components/ez-button2.js +105 -0
  43. package/dist/components/ez-calendar.js +6 -0
  44. package/dist/components/ez-calendar2.js +242 -0
  45. package/dist/components/ez-check.js +6 -0
  46. package/dist/components/ez-check2.js +94 -0
  47. package/dist/components/ez-collapsible-box.js +67 -0
  48. package/dist/components/ez-combo-box.js +6 -0
  49. package/dist/components/ez-combo-box2.js +311 -0
  50. package/dist/components/ez-date-input.js +135 -0
  51. package/dist/components/ez-date-time-input.js +179 -0
  52. package/dist/components/ez-dialog.js +124 -0
  53. package/dist/components/ez-form.js +6 -0
  54. package/dist/components/ez-form2.js +485 -0
  55. package/dist/components/ez-grid.js +738 -0
  56. package/dist/components/ez-icon.js +6 -0
  57. package/dist/components/ez-icon2.js +56 -0
  58. package/dist/components/ez-label-chip.js +125 -0
  59. package/dist/components/ez-list.js +6 -0
  60. package/dist/components/ez-list2.js +523 -0
  61. package/dist/components/ez-modal.js +6 -0
  62. package/dist/components/ez-modal2.js +82 -0
  63. package/dist/components/ez-number-input.js +115 -0
  64. package/dist/components/ez-popover.js +145 -0
  65. package/dist/components/ez-popup.js +67 -0
  66. package/dist/components/ez-search.js +100 -0
  67. package/dist/components/ez-tabselector.js +6 -0
  68. package/dist/components/ez-tabselector2.js +213 -0
  69. package/dist/components/ez-text-area.js +137 -0
  70. package/dist/components/ez-text-input.js +6 -0
  71. package/dist/components/ez-text-input2.js +223 -0
  72. package/dist/components/ez-time-input.js +153 -0
  73. package/dist/components/ez-toast.js +64 -0
  74. package/dist/components/ez-upload.js +382 -0
  75. package/dist/components/grid-config.js +6 -0
  76. package/dist/components/grid-config2.js +318 -0
  77. package/dist/components/select-box.js +6 -0
  78. package/dist/components/select-box2.js +47 -0
  79. package/dist/components/snk-application.js +310 -1266
  80. package/dist/components/test-du.js +101 -0
  81. package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
  82. package/dist/esm/AssetsUtils-6e6624dc.js +22 -0
  83. package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
  84. package/dist/esm/ez-action-chip.entry.js +23 -0
  85. package/dist/esm/ez-application.entry.js +22 -0
  86. package/dist/esm/ez-button_4.entry.js +653 -0
  87. package/dist/esm/ez-calendar.entry.js +219 -0
  88. package/dist/esm/ez-collapsible-box.entry.js +43 -0
  89. package/dist/esm/ez-combo-box.entry.js +274 -0
  90. package/dist/esm/ez-date-input.entry.js +98 -0
  91. package/dist/esm/ez-date-time-input.entry.js +141 -0
  92. package/dist/esm/ez-dialog.entry.js +85 -0
  93. package/dist/esm/ez-form.entry.js +459 -0
  94. package/dist/esm/ez-grid.entry.js +643 -0
  95. package/dist/esm/ez-icon.entry.js +37 -0
  96. package/dist/esm/ez-label-chip.entry.js +100 -0
  97. package/dist/esm/ez-modal_2.entry.js +311 -0
  98. package/dist/esm/ez-number-input.entry.js +82 -0
  99. package/dist/esm/ez-popover.entry.js +116 -0
  100. package/dist/esm/ez-popup.entry.js +44 -0
  101. package/dist/esm/ez-search.entry.js +60 -0
  102. package/dist/esm/ez-tabselector.entry.js +194 -0
  103. package/dist/esm/ez-text-area.entry.js +110 -0
  104. package/dist/esm/ez-text-input.entry.js +197 -0
  105. package/dist/esm/ez-time-input.entry.js +114 -0
  106. package/dist/esm/ez-toast.entry.js +40 -0
  107. package/dist/esm/ez-upload.entry.js +352 -0
  108. package/dist/esm/index-35088a3f.js +1740 -0
  109. package/dist/esm/loader.js +3 -3
  110. package/dist/esm/sankhyablocks.js +3 -3
  111. package/dist/esm/snk-application.entry.js +311 -1267
  112. package/dist/esm/test-du.entry.js +72 -0
  113. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
  114. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
  115. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
  116. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
  117. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
  118. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
  119. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
  120. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
  121. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  122. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
  123. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
  124. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
  125. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
  126. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
  127. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
  128. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
  129. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
  130. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
  131. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
  132. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
  133. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
  134. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
  135. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
  136. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
  137. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
  138. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
  139. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
  140. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
  141. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
  142. package/dist/sankhyablocks/p-0183d259.entry.js +1 -0
  143. package/dist/sankhyablocks/p-01f23a70.entry.js +1 -0
  144. package/dist/sankhyablocks/p-07c32f68.entry.js +1 -0
  145. package/dist/sankhyablocks/p-0f90499d.entry.js +1 -0
  146. package/dist/sankhyablocks/p-105724a3.entry.js +1 -0
  147. package/dist/sankhyablocks/p-2ac02d48.entry.js +1 -0
  148. package/dist/sankhyablocks/p-35364a97.entry.js +1 -0
  149. package/dist/sankhyablocks/p-3f6aa9a7.entry.js +1 -0
  150. package/dist/sankhyablocks/p-5f9af495.entry.js +1 -0
  151. package/dist/sankhyablocks/p-60967cf0.js +1 -0
  152. package/dist/sankhyablocks/p-6ce33b60.entry.js +57 -0
  153. package/dist/sankhyablocks/p-70ad6c16.entry.js +1 -0
  154. package/dist/sankhyablocks/p-710bfffe.entry.js +1 -0
  155. package/dist/sankhyablocks/p-735440c1.entry.js +1 -0
  156. package/dist/sankhyablocks/p-811b4b9d.js +1 -0
  157. package/dist/sankhyablocks/p-813fe4f7.js +1 -0
  158. package/dist/sankhyablocks/p-85a9446b.js +2 -0
  159. package/dist/sankhyablocks/p-89a1100f.entry.js +1 -0
  160. package/dist/sankhyablocks/p-8b543003.entry.js +1 -0
  161. package/dist/sankhyablocks/p-9750632b.entry.js +1 -0
  162. package/dist/sankhyablocks/p-a96272f7.entry.js +1 -0
  163. package/dist/sankhyablocks/p-ac8842e5.entry.js +1 -0
  164. package/dist/sankhyablocks/p-ba64cc41.entry.js +1 -0
  165. package/dist/sankhyablocks/p-c1ede043.entry.js +1 -0
  166. package/dist/sankhyablocks/p-d90ebb85.entry.js +1 -0
  167. package/dist/sankhyablocks/p-e17dfaae.entry.js +1 -0
  168. package/dist/sankhyablocks/p-e5355a29.entry.js +1 -0
  169. package/dist/sankhyablocks/p-ef04b633.entry.js +1 -0
  170. package/dist/sankhyablocks/p-f6db07fb.entry.js +1 -0
  171. package/dist/sankhyablocks/p-fcd9bd92.entry.js +1 -0
  172. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  173. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  174. package/dist/types/components.d.ts +7 -3
  175. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
  176. package/package.json +12 -7
  177. package/react/components.d.ts +29 -0
  178. package/react/components.js +29 -0
  179. package/react/components.js.map +1 -1
  180. package/dist/cjs/index-20a7d705.js +0 -733
  181. package/dist/esm/index-8d3572c4.js +0 -707
  182. package/dist/sankhyablocks/p-5fa264b9.js +0 -1
  183. package/dist/sankhyablocks/p-fe95f2c4.entry.js +0 -57
  184. package/dist/types/temp/ApplicationUtils.d.ts +0 -7
@@ -0,0 +1,124 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$3 } from './ez-button2.js';
3
+ import { d as defineCustomElement$2 } from './ez-icon2.js';
4
+
5
+ const ezDialogCss = ":host{--dialog__container-padding:var(--space--large, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"'Sora', 'Algerian'\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--large, 24px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog-z-index:var(--most-visible, 3);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:24px;overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);--ez-icon--color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:1.3}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title--label{padding-left:var(--dialog__title--padding-left)}.title-icon{outline:none;border:none;background-color:var(--dialog__warning--background-color);width:26px;height:26px;border-radius:100%;padding:0;display:flex;justify-content:center;align-items:center}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.title-icon--critical::after{content:'';display:flex;background-color:#FFFF;width:13px;height:13px;-webkit-mask-image:var(--dialog--critical__image);mask-image:var(--dialog--critical__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__no{padding-right:var(--dialog__btn__no--padding-right)}.button__ok--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
6
+
7
+ class Message {
8
+ constructor(title, message, critical, confirm, icon, callBack) {
9
+ this.title = title;
10
+ this.message = message;
11
+ this.critical = critical;
12
+ this.confirm = confirm;
13
+ this.icon = icon;
14
+ this.callBack = callBack;
15
+ }
16
+ }
17
+ const EzDialog$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
18
+ constructor() {
19
+ super();
20
+ this.__registerHost();
21
+ this.__attachShadow();
22
+ this.ezCancel = createEvent(this, "ezCancel", 7);
23
+ this.ezAccept = createEvent(this, "ezAccept", 7);
24
+ /**
25
+ * Define se o componente será utilizado no modo de confirmação.
26
+ */
27
+ this.confirm = false;
28
+ /**
29
+ * Define se o componente terá o visual de erro ou de aviso
30
+ */
31
+ this.critical = false;
32
+ /**
33
+ * Controla a exibição do componente
34
+ */
35
+ this.opened = false;
36
+ this._messageQueue = [];
37
+ }
38
+ /**
39
+ * Lida com o clique nos botões de dentro do componente.
40
+ */
41
+ async handleButtonClick(selectedOption) {
42
+ this.opened = this._messageQueue.length > 0;
43
+ if (this._currentMessage.callBack) {
44
+ this._currentMessage.callBack(selectedOption);
45
+ }
46
+ else {
47
+ selectedOption ? this.ezAccept.emit(selectedOption) : this.ezCancel.emit(selectedOption);
48
+ }
49
+ this._currentMessage = this._messageQueue.shift();
50
+ forceUpdate(this);
51
+ }
52
+ /**
53
+ * Faz com que o componente seja exibido.
54
+ */
55
+ async show(title, message, critical, confirm, icon) {
56
+ this.opened = true;
57
+ return new Promise(resolve => {
58
+ this._messageQueue.push(new Message(title, message, critical, confirm, icon, resolve));
59
+ });
60
+ }
61
+ componentWillRender() {
62
+ if (!this._currentMessage) {
63
+ if (this._messageQueue.length > 0) {
64
+ this._currentMessage = this._messageQueue.pop();
65
+ }
66
+ else {
67
+ if (this.opened) {
68
+ this._currentMessage = new Message(this.ezTitle, this.message, this.critical, this.confirm, this.personalizedIconPath, null);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ render() {
74
+ if (this.opened && this._currentMessage) {
75
+ return (h("div", { class: "overlay" }, h("div", { class: "dialog" }, h("div", { class: this._currentMessage.critical === true ? "dialog__critical--indicator" : "dialog__warning--indicator" }), h("div", { class: "dialog__container" }, h("div", { class: "title__container" }, h("div", { class: "title__box" }, this._currentMessage.icon ?
76
+ h("ez-icon", { class: this._currentMessage.critical ? "changeable__icon critical" : "changeable__icon", size: "small", iconName: this._currentMessage.icon })
77
+ :
78
+ h("div", { class: this._currentMessage.critical ? "title-icon title-icon--critical" : "title-icon" }), h("div", { class: "title title--label", innerHTML: this._currentMessage.title })), h("button", { class: "btn-close", onClick: () => this.handleButtonClick(false) })), h("div", { class: "message", innerHTML: this._currentMessage.message }), this._currentMessage.confirm ?
79
+ h("div", { class: "button-yes-no__container" }, h("ez-button", { class: "button__no", mode: "link", label: "N\u00E3o", onClick: () => this.handleButtonClick(false) }), h("ez-button", { label: "Ok", onClick: () => this.handleButtonClick(true) }))
80
+ : undefined, !this._currentMessage.confirm ?
81
+ h("div", { class: "button__ok--container" }, h("ez-button", { label: "Ok", onClick: () => this.handleButtonClick(true) }))
82
+ : undefined))));
83
+ }
84
+ return null;
85
+ }
86
+ static get style() { return ezDialogCss; }
87
+ }, [1, "ez-dialog", {
88
+ "confirm": [1028],
89
+ "critical": [1028],
90
+ "message": [1025],
91
+ "opened": [1540],
92
+ "personalizedIconPath": [1025, "personalized-icon-path"],
93
+ "ezTitle": [1025, "ez-title"],
94
+ "handleButtonClick": [64],
95
+ "show": [64]
96
+ }]);
97
+ function defineCustomElement$1() {
98
+ if (typeof customElements === "undefined") {
99
+ return;
100
+ }
101
+ const components = ["ez-dialog", "ez-button", "ez-icon"];
102
+ components.forEach(tagName => { switch (tagName) {
103
+ case "ez-dialog":
104
+ if (!customElements.get(tagName)) {
105
+ customElements.define(tagName, EzDialog$1);
106
+ }
107
+ break;
108
+ case "ez-button":
109
+ if (!customElements.get(tagName)) {
110
+ defineCustomElement$3();
111
+ }
112
+ break;
113
+ case "ez-icon":
114
+ if (!customElements.get(tagName)) {
115
+ defineCustomElement$2();
116
+ }
117
+ break;
118
+ } });
119
+ }
120
+
121
+ const EzDialog = EzDialog$1;
122
+ const defineCustomElement = defineCustomElement$1;
123
+
124
+ export { EzDialog, defineCustomElement };
@@ -0,0 +1,6 @@
1
+ import { E as EzForm$1, d as defineCustomElement$1 } from './ez-form2.js';
2
+
3
+ const EzForm = EzForm$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { EzForm, defineCustomElement };
@@ -0,0 +1,485 @@
1
+ import { h, proxyCustomElement, HTMLElement, forceUpdate, Host } from '@stencil/core/internal/client';
2
+ import { UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit } from '@sankhyalabs/core';
3
+ import { createStore } from 'redux';
4
+ import { A as ApplicationUtils } from './ApplicationUtils.js';
5
+ import { d as defineCustomElement$1 } from './ez-tabselector2.js';
6
+
7
+ const buildTextArea = ({ name, label, readOnly }) => {
8
+ return (h("div", { class: "col col--sd-12 padding-horizontal--small", key: name },
9
+ h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
10
+ };
11
+
12
+ const buildTextInput = ({ name, label }) => {
13
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
14
+ h("ez-text-input", { label: label, "data-field-name": name, key: name })));
15
+ };
16
+
17
+ const buildSwitch = (fieldConfig) => {
18
+ return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, true);
19
+ };
20
+ const buildCheckBox = (fieldConfig) => {
21
+ return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, false);
22
+ };
23
+ function buildField$1(fieldName, fieldLabel, readOnly, switchMode = false) {
24
+ return (h("div", { class: "col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large" },
25
+ h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? "switch" : "regular", "data-field-name": fieldName, key: fieldName })));
26
+ }
27
+
28
+ const buildComboBox = ({ name, label, readOnly }, properties) => {
29
+ const prop = properties === null || properties === void 0 ? void 0 : properties.options;
30
+ let options;
31
+ if (typeof prop === "string") {
32
+ const parsed = JSON.parse(prop);
33
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
34
+ }
35
+ else {
36
+ options = prop;
37
+ }
38
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
39
+ h("ez-combo-box", { enabled: !readOnly, label: label, "data-field-name": name, key: name, options: options })));
40
+ };
41
+
42
+ const buildSearch = ({ name, label, readOnly }) => {
43
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
44
+ h("ez-search", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
45
+ };
46
+
47
+ const buildFile = ({ name, label, readOnly }) => {
48
+ return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
49
+ h("ez-upload", { enabled: !readOnly, label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
50
+ };
51
+
52
+ const buildDate = ({ name, label, readOnly }) => {
53
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
54
+ h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
55
+ };
56
+ const buildTime = ({ name, label }) => {
57
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
58
+ h("ez-time-input", { label: label, "data-field-name": name, key: name })));
59
+ };
60
+ const buildTimeDate = ({ name, label }) => {
61
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
62
+ h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
63
+ };
64
+
65
+ const buildDecimal = ({ name, label, readOnly }, properties) => {
66
+ const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
67
+ const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
68
+ return buildNumeric(name, label, readOnly, precision, prettyPrecision);
69
+ };
70
+ const buildInteger = ({ name, label, readOnly }) => {
71
+ return buildNumeric(name, label, readOnly, 0, 0);
72
+ };
73
+ function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
74
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
75
+ h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
76
+ }
77
+
78
+ const uiBuilders = new Map();
79
+ uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
80
+ uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
81
+ uiBuilders.set(UserInterface.SWITCH, buildSwitch);
82
+ uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
83
+ uiBuilders.set(UserInterface.SEARCH, buildSearch);
84
+ uiBuilders.set(UserInterface.FILE, buildFile);
85
+ uiBuilders.set(UserInterface.DATE, buildDate);
86
+ uiBuilders.set(UserInterface.TIME, buildTime);
87
+ uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
88
+ uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
89
+ uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
90
+ const buildField = (field) => {
91
+ const descriptor = field.descriptor;
92
+ const config = Object.assign({}, field.config);
93
+ let builder;
94
+ let props;
95
+ if (descriptor) {
96
+ if (!config.label) {
97
+ config.label = descriptor.label;
98
+ }
99
+ if (!config.name) {
100
+ config.name = descriptor.name;
101
+ }
102
+ if (config.required === undefined) {
103
+ config.required = descriptor.required;
104
+ }
105
+ if (config.readOnly === undefined) {
106
+ config.readOnly = descriptor.readOnly;
107
+ }
108
+ props = descriptor.properties;
109
+ builder = uiBuilders.get(descriptor.userInterface);
110
+ }
111
+ if (config.required) {
112
+ config.label = `* ${config.label} (obrigatório)`;
113
+ }
114
+ if (!builder) {
115
+ builder = buildTextInput;
116
+ }
117
+ return builder(config, props);
118
+ };
119
+
120
+ const FormItem = ({ source }) => {
121
+ if ("items" in source) {
122
+ const fieldSet = source;
123
+ return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
124
+ }
125
+ else {
126
+ return buildField(source);
127
+ }
128
+ };
129
+
130
+ const FormSheet = ({ store, source }) => {
131
+ return (h("div", { class: "box__container" },
132
+ h("div", { class: "row padding-vertical--small" }, source.items.map(item => h(FormItem, { store: store, source: item })))));
133
+ };
134
+
135
+ class FormMetadata {
136
+ constructor() {
137
+ this._sheets = new Map();
138
+ this._requiredFields = [];
139
+ this._cleanOnCopyFields = [];
140
+ }
141
+ getSheet(name) {
142
+ return this._sheets.get(name);
143
+ }
144
+ getAllSheets() {
145
+ return this._sheets;
146
+ }
147
+ addSheet(sheet) {
148
+ this._sheets.set(sheet.name, sheet);
149
+ this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
150
+ this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
151
+ }
152
+ getRequiredFields() {
153
+ return this._requiredFields;
154
+ }
155
+ getCleanOnCopyFields() {
156
+ return this._cleanOnCopyFields;
157
+ }
158
+ }
159
+ const buildFromDataUnit = (dataUnit) => {
160
+ var _a;
161
+ const unitMD = dataUnit.metadata;
162
+ const metadata = new FormMetadata();
163
+ if (unitMD) {
164
+ const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
165
+ metadata.addSheet({
166
+ label: unitMD.label,
167
+ name: unitMD.name,
168
+ items: visibleFields.map(descriptor => { return { descriptor }; }),
169
+ requiredFields: visibleFields
170
+ .filter(descriptor => descriptor.required)
171
+ .map(descriptor => descriptor.name),
172
+ cleanOnCopyFields: visibleFields
173
+ .filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
174
+ .map(descriptor => descriptor.name)
175
+ });
176
+ }
177
+ return metadata;
178
+ };
179
+ function getTabConfig(tab, sheets) {
180
+ const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
181
+ return tabConfig || { label: tab, visible: true };
182
+ }
183
+ const buildFromConfig = (fields, dataUnit) => {
184
+ const sheets = new Map();
185
+ const requiredFields = [];
186
+ const cleanOnCopyFields = [];
187
+ fields.forEach(config => {
188
+ var _a;
189
+ if (config.visible !== false) {
190
+ const tabConfig = getTabConfig(config.tab || "Geral", sheets);
191
+ const descriptor = dataUnit.getField(config.name);
192
+ if (descriptor && tabConfig.visible) {
193
+ if (!sheets.has(tabConfig)) {
194
+ sheets.set(tabConfig, new Map());
195
+ }
196
+ const tabItens = sheets.get(tabConfig);
197
+ const isRequired = config.required === undefined ? descriptor.required : config.required;
198
+ if (isRequired) {
199
+ requiredFields.push(config.name);
200
+ }
201
+ const clearOnCopy = config.cleanOnCopy === undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : config.cleanOnCopy;
202
+ if (clearOnCopy) {
203
+ cleanOnCopyFields.push(config.name);
204
+ }
205
+ const fieldMD = { config, descriptor };
206
+ const group = config.group;
207
+ if (group) {
208
+ const key = `group::${group}`;
209
+ if (!tabItens.has(key)) {
210
+ tabItens.set(key, { label: group, items: [fieldMD] });
211
+ }
212
+ else {
213
+ tabItens.get(key).items.push(fieldMD);
214
+ }
215
+ }
216
+ else {
217
+ tabItens.set(config.name, fieldMD);
218
+ }
219
+ }
220
+ }
221
+ });
222
+ const metadata = new FormMetadata();
223
+ Array.from(sheets.entries())
224
+ .sort((a, b) => (a[0].order || 10000) - (b[0].order || 10000))
225
+ .forEach(([key, value]) => {
226
+ metadata.addSheet({
227
+ label: key.label,
228
+ name: key.label,
229
+ items: Array.from(value.values()),
230
+ requiredFields,
231
+ cleanOnCopyFields
232
+ });
233
+ });
234
+ return metadata;
235
+ };
236
+
237
+ const inicialState = {};
238
+ /////////////////////////////// REDUCERS ///////////////////////////////
239
+ function formReducer(state = inicialState, action) {
240
+ switch (action.type) {
241
+ case FormActions.METADATA_LOADED:
242
+ return Object.assign(Object.assign({}, state), { formMetadata: action.payload });
243
+ case FormActions.CHANGE_TAB:
244
+ return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
245
+ default:
246
+ return state;
247
+ }
248
+ }
249
+ /////////////////////////////// ACTION CREATORS ///////////////////////////////
250
+ function loadMetadata(formMetadata) {
251
+ return {
252
+ type: FormActions.METADATA_LOADED,
253
+ payload: formMetadata
254
+ };
255
+ }
256
+ function changeTab(currentSheet) {
257
+ return {
258
+ type: FormActions.CHANGE_TAB,
259
+ payload: currentSheet.tabKey
260
+ };
261
+ }
262
+ /////////////////////////////// SELECTORS ///////////////////////////////
263
+ function selectFormMetadata(state) {
264
+ return state.formMetadata;
265
+ }
266
+ function selectCurrentSheet(state) {
267
+ return state.currentSheet ? state.formMetadata.getSheet(state.currentSheet) : Array.from(state.formMetadata.getAllSheets().values())[0];
268
+ }
269
+ /////////////////////////////// TYPES ///////////////////////////////
270
+ var FormActions;
271
+ (function (FormActions) {
272
+ FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
273
+ FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
274
+ })(FormActions || (FormActions = {}));
275
+
276
+ class DataBinder {
277
+ constructor(dataUnit) {
278
+ this._fields = new Map();
279
+ this._dataUnit = dataUnit;
280
+ this._dataUnit.subscribe(_action => {
281
+ var _a;
282
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
283
+ this.updateValue(field.fieldName, field.field);
284
+ });
285
+ });
286
+ }
287
+ bind(fields) {
288
+ fields.forEach(fieldElement => {
289
+ const fieldName = fieldElement.dataset.fieldName;
290
+ this.updateBind(fieldName, fieldElement);
291
+ this.updateValue(fieldName, fieldElement);
292
+ });
293
+ }
294
+ updateValue(fieldName, field) {
295
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
296
+ }
297
+ updateBind(fieldName, field) {
298
+ const oldBind = this._fields.get(fieldName);
299
+ if (oldBind) {
300
+ oldBind.destroy();
301
+ }
302
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
303
+ this.bindSearchOptionsLoader(fieldName, field);
304
+ }
305
+ setFieldValue(fieldName, newValue) {
306
+ if (this._dataUnit.records.length === 0) {
307
+ this._dataUnit.addRecord();
308
+ }
309
+ this._dataUnit.setFieldValue(fieldName, newValue);
310
+ }
311
+ bindSearchOptionsLoader(fieldName, field) {
312
+ if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] === undefined) {
313
+ const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
314
+ if (loader) {
315
+ field["optionLoader"] = (arg) => {
316
+ return loader(arg, fieldName, this._dataUnit);
317
+ };
318
+ }
319
+ }
320
+ }
321
+ }
322
+ class Bind {
323
+ destroy() {
324
+ this.field.removeEventListener(this.eventName, this.eventListener);
325
+ }
326
+ static create(fieldName, field, callback) {
327
+ const b = new Bind();
328
+ b.fieldName = fieldName;
329
+ b.field = field;
330
+ //FIXME: Verificar se o field é um EzField
331
+ b.eventListener = (evt) => { callback(fieldName, evt.detail); };
332
+ b.eventName = "ezChange";
333
+ b.field.addEventListener(b.eventName, b.eventListener);
334
+ return b;
335
+ }
336
+ }
337
+
338
+ const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}";
339
+
340
+ const EzForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
341
+ constructor() {
342
+ super();
343
+ this.__registerHost();
344
+ }
345
+ submit() {
346
+ return Promise.resolve();
347
+ }
348
+ cancel() {
349
+ return Promise.resolve();
350
+ }
351
+ validate() {
352
+ return new Promise((accept, reject) => {
353
+ const metadata = selectFormMetadata(this._store.getState());
354
+ const requiredFields = this._staticFields
355
+ .filter(f => f.dataset.required)
356
+ .map(f => f.dataset.fieldName)
357
+ .concat(metadata.getRequiredFields());
358
+ const records = this.dataUnit.records;
359
+ for (let i = 0; i < records.length; i++) {
360
+ if (!this.validateRequired(requiredFields, records[i])) {
361
+ reject();
362
+ break;
363
+ }
364
+ }
365
+ accept();
366
+ });
367
+ }
368
+ configChanged() {
369
+ this.processMetadata();
370
+ }
371
+ validateRequired(requiredFields, record) {
372
+ const invalidFields = [];
373
+ requiredFields.forEach(field => {
374
+ const value = record[field];
375
+ const fieldElem = this._element.querySelector(`[data-field-name=${field}]`);
376
+ if (value === null || value === undefined || value === "") {
377
+ invalidFields.push(field);
378
+ fieldElem["errorMessage"] = "Essa informação é obrigatória";
379
+ }
380
+ else {
381
+ fieldElem["errorMessage"] = "";
382
+ }
383
+ });
384
+ const isValid = invalidFields.length === 0;
385
+ if (!isValid) {
386
+ ApplicationUtils.info("Há pelo menos um campo obrigatório não preenchido.");
387
+ }
388
+ return isValid;
389
+ }
390
+ getDynamicContent() {
391
+ var _a;
392
+ const formMD = selectFormMetadata(this._store.getState());
393
+ if (!formMD)
394
+ return null;
395
+ const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
396
+ if (!currentSheet) {
397
+ return null;
398
+ }
399
+ const allSheets = Array.from(formMD.getAllSheets().values());
400
+ const result = [];
401
+ if (allSheets.length > 1) {
402
+ result.push(h("ez-tabselector", { onEzChange: (evt) => this._store.dispatch(changeTab(evt.detail)), selectedTab: currentSheet.name }, allSheets.map(s => h("ez-tab", { tabKey: s.name, label: s.label }))));
403
+ }
404
+ result.push(h(FormSheet, { store: this._store, source: currentSheet }));
405
+ return result;
406
+ }
407
+ processMetadata() {
408
+ if (!this.isStatic()) {
409
+ const metadata = this.config && this.config.length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
410
+ this._store.dispatch(loadMetadata(metadata));
411
+ }
412
+ }
413
+ isStatic() {
414
+ var _a;
415
+ return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
416
+ }
417
+ interceptAction(action) {
418
+ if (action.type === Action.RECORDS_COPIED) {
419
+ const metadata = selectFormMetadata(this._store.getState());
420
+ const cleanFields = metadata.getCleanOnCopyFields();
421
+ if (cleanFields) {
422
+ const records = action.payload;
423
+ return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
424
+ const newRecord = Object.assign({}, record);
425
+ cleanFields.forEach(fieldName => delete newRecord[fieldName]);
426
+ return newRecord;
427
+ }));
428
+ }
429
+ }
430
+ return action;
431
+ }
432
+ componentWillLoad() {
433
+ if (this.dataUnit === undefined) {
434
+ this.dataUnit = new DataUnit("ez-form");
435
+ }
436
+ this.dataUnit.addInterceptor(this);
437
+ this.dataUnit.subscribe(action => {
438
+ if (action.type === Action.METADATA_LOADED) {
439
+ this.processMetadata();
440
+ }
441
+ });
442
+ this._dataBinder = new DataBinder(this.dataUnit);
443
+ this._store = createStore(formReducer);
444
+ this._store.subscribe(() => forceUpdate(this));
445
+ this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));
446
+ this.processMetadata();
447
+ }
448
+ componentDidRender() {
449
+ this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")));
450
+ }
451
+ render() {
452
+ return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
453
+ }
454
+ get _element() { return this; }
455
+ static get watchers() { return {
456
+ "config": ["configChanged"]
457
+ }; }
458
+ static get style() { return ezFormCss; }
459
+ }, [0, "ez-form", {
460
+ "dataUnit": [1040],
461
+ "config": [16],
462
+ "submit": [64],
463
+ "cancel": [64],
464
+ "validate": [64]
465
+ }]);
466
+ function defineCustomElement() {
467
+ if (typeof customElements === "undefined") {
468
+ return;
469
+ }
470
+ const components = ["ez-form", "ez-tabselector"];
471
+ components.forEach(tagName => { switch (tagName) {
472
+ case "ez-form":
473
+ if (!customElements.get(tagName)) {
474
+ customElements.define(tagName, EzForm);
475
+ }
476
+ break;
477
+ case "ez-tabselector":
478
+ if (!customElements.get(tagName)) {
479
+ defineCustomElement$1();
480
+ }
481
+ break;
482
+ } });
483
+ }
484
+
485
+ export { EzForm as E, defineCustomElement as d };