@sankhyalabs/sankhyablocks 1.1.28 → 1.2.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 (254) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +75 -75
  3. package/package.json +94 -52
  4. package/react/.keepfolder +1 -0
  5. package/dist/cjs/ApplicationUtils-05b74ee9.js +0 -39
  6. package/dist/cjs/AssetsUtils-7e3c38f9.js +0 -24
  7. package/dist/cjs/CSSVarsUtils-75ca9c64.js +0 -19
  8. package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
  9. package/dist/cjs/ez-action-chip.cjs.entry.js +0 -27
  10. package/dist/cjs/ez-application.cjs.entry.js +0 -26
  11. package/dist/cjs/ez-button_4.cjs.entry.js +0 -660
  12. package/dist/cjs/ez-calendar.cjs.entry.js +0 -223
  13. package/dist/cjs/ez-collapsible-box.cjs.entry.js +0 -47
  14. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -278
  15. package/dist/cjs/ez-date-input.cjs.entry.js +0 -102
  16. package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -145
  17. package/dist/cjs/ez-dialog.cjs.entry.js +0 -89
  18. package/dist/cjs/ez-form.cjs.entry.js +0 -785
  19. package/dist/cjs/ez-grid.cjs.entry.js +0 -110485
  20. package/dist/cjs/ez-icon.cjs.entry.js +0 -41
  21. package/dist/cjs/ez-label-chip.cjs.entry.js +0 -104
  22. package/dist/cjs/ez-modal_2.cjs.entry.js +0 -316
  23. package/dist/cjs/ez-number-input.cjs.entry.js +0 -86
  24. package/dist/cjs/ez-popover.cjs.entry.js +0 -120
  25. package/dist/cjs/ez-popup.cjs.entry.js +0 -48
  26. package/dist/cjs/ez-search.cjs.entry.js +0 -64
  27. package/dist/cjs/ez-tabselector.cjs.entry.js +0 -198
  28. package/dist/cjs/ez-text-area.cjs.entry.js +0 -114
  29. package/dist/cjs/ez-text-input.cjs.entry.js +0 -201
  30. package/dist/cjs/ez-time-input.cjs.entry.js +0 -118
  31. package/dist/cjs/ez-toast.cjs.entry.js +0 -44
  32. package/dist/cjs/ez-upload.cjs.entry.js +0 -356
  33. package/dist/cjs/index-682c98b2.js +0 -1771
  34. package/dist/cjs/index.cjs.js +0 -2
  35. package/dist/cjs/loader.cjs.js +0 -21
  36. package/dist/cjs/sankhyablocks.cjs.js +0 -19
  37. package/dist/cjs/snk-application.cjs.entry.js +0 -7050
  38. package/dist/cjs/test-du.cjs.entry.js +0 -76
  39. package/dist/collection/collection-manifest.json +0 -47
  40. package/dist/collection/components/snk-application/snk-application.css +0 -5
  41. package/dist/collection/components/snk-application/snk-application.js +0 -492
  42. package/dist/collection/index.js +0 -1
  43. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +0 -158
  44. package/dist/collection/lib/http/data-fetcher/fetchers/application-config-fetcher.js +0 -23
  45. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +0 -188
  46. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +0 -25
  47. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +0 -2
  48. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +0 -59
  49. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +0 -30
  50. package/dist/collection/lib/http/data-fetcher/state/LoadStateManager.js +0 -66
  51. package/dist/collection/lib/utils/pesquisa.js +0 -16
  52. package/dist/collection/lib/utils/urlutils.js +0 -23
  53. package/dist/collection/lib/workspace/workspace.js +0 -7
  54. package/dist/components/ApplicationUtils.js +0 -37
  55. package/dist/components/AssetsUtils.js +0 -22
  56. package/dist/components/CSSVarsUtils.js +0 -17
  57. package/dist/components/_commonjsHelpers.js +0 -17
  58. package/dist/components/ez-action-chip.js +0 -44
  59. package/dist/components/ez-application.js +0 -39
  60. package/dist/components/ez-button.js +0 -6
  61. package/dist/components/ez-button2.js +0 -105
  62. package/dist/components/ez-calendar.js +0 -6
  63. package/dist/components/ez-calendar2.js +0 -242
  64. package/dist/components/ez-check.js +0 -6
  65. package/dist/components/ez-check2.js +0 -94
  66. package/dist/components/ez-collapsible-box.js +0 -67
  67. package/dist/components/ez-combo-box.js +0 -6
  68. package/dist/components/ez-combo-box2.js +0 -311
  69. package/dist/components/ez-date-input.js +0 -135
  70. package/dist/components/ez-date-time-input.js +0 -179
  71. package/dist/components/ez-dialog.js +0 -124
  72. package/dist/components/ez-form.js +0 -6
  73. package/dist/components/ez-form2.js +0 -807
  74. package/dist/components/ez-grid.js +0 -110576
  75. package/dist/components/ez-icon.js +0 -6
  76. package/dist/components/ez-icon2.js +0 -56
  77. package/dist/components/ez-label-chip.js +0 -125
  78. package/dist/components/ez-list.js +0 -6
  79. package/dist/components/ez-list2.js +0 -523
  80. package/dist/components/ez-modal.js +0 -6
  81. package/dist/components/ez-modal2.js +0 -82
  82. package/dist/components/ez-number-input.js +0 -115
  83. package/dist/components/ez-popover.js +0 -145
  84. package/dist/components/ez-popup.js +0 -67
  85. package/dist/components/ez-search.js +0 -100
  86. package/dist/components/ez-tabselector.js +0 -6
  87. package/dist/components/ez-tabselector2.js +0 -213
  88. package/dist/components/ez-text-area.js +0 -137
  89. package/dist/components/ez-text-input.js +0 -6
  90. package/dist/components/ez-text-input2.js +0 -223
  91. package/dist/components/ez-time-input.js +0 -153
  92. package/dist/components/ez-toast.js +0 -64
  93. package/dist/components/ez-upload.js +0 -382
  94. package/dist/components/grid-config.js +0 -6
  95. package/dist/components/grid-config2.js +0 -318
  96. package/dist/components/index.d.ts +0 -26
  97. package/dist/components/index.js +0 -1
  98. package/dist/components/select-box.js +0 -6
  99. package/dist/components/select-box2.js +0 -47
  100. package/dist/components/snk-application.d.ts +0 -11
  101. package/dist/components/snk-application.js +0 -7079
  102. package/dist/components/test-du.js +0 -101
  103. package/dist/esm/ApplicationUtils-e0b6d857.js +0 -37
  104. package/dist/esm/AssetsUtils-6e6624dc.js +0 -22
  105. package/dist/esm/CSSVarsUtils-0787c3f3.js +0 -17
  106. package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
  107. package/dist/esm/ez-action-chip.entry.js +0 -23
  108. package/dist/esm/ez-application.entry.js +0 -22
  109. package/dist/esm/ez-button_4.entry.js +0 -653
  110. package/dist/esm/ez-calendar.entry.js +0 -219
  111. package/dist/esm/ez-collapsible-box.entry.js +0 -43
  112. package/dist/esm/ez-combo-box.entry.js +0 -274
  113. package/dist/esm/ez-date-input.entry.js +0 -98
  114. package/dist/esm/ez-date-time-input.entry.js +0 -141
  115. package/dist/esm/ez-dialog.entry.js +0 -85
  116. package/dist/esm/ez-form.entry.js +0 -781
  117. package/dist/esm/ez-grid.entry.js +0 -110481
  118. package/dist/esm/ez-icon.entry.js +0 -37
  119. package/dist/esm/ez-label-chip.entry.js +0 -100
  120. package/dist/esm/ez-modal_2.entry.js +0 -311
  121. package/dist/esm/ez-number-input.entry.js +0 -82
  122. package/dist/esm/ez-popover.entry.js +0 -116
  123. package/dist/esm/ez-popup.entry.js +0 -44
  124. package/dist/esm/ez-search.entry.js +0 -60
  125. package/dist/esm/ez-tabselector.entry.js +0 -194
  126. package/dist/esm/ez-text-area.entry.js +0 -110
  127. package/dist/esm/ez-text-input.entry.js +0 -197
  128. package/dist/esm/ez-time-input.entry.js +0 -114
  129. package/dist/esm/ez-toast.entry.js +0 -40
  130. package/dist/esm/ez-upload.entry.js +0 -352
  131. package/dist/esm/index-35088a3f.js +0 -1740
  132. package/dist/esm/index.js +0 -1
  133. package/dist/esm/loader.js +0 -17
  134. package/dist/esm/polyfills/core-js.js +0 -11
  135. package/dist/esm/polyfills/css-shim.js +0 -1
  136. package/dist/esm/polyfills/dom.js +0 -79
  137. package/dist/esm/polyfills/es5-html-element.js +0 -1
  138. package/dist/esm/polyfills/index.js +0 -34
  139. package/dist/esm/polyfills/system.js +0 -6
  140. package/dist/esm/sankhyablocks.js +0 -17
  141. package/dist/esm/snk-application.entry.js +0 -7046
  142. package/dist/esm/test-du.entry.js +0 -72
  143. package/dist/index.cjs.js +0 -1
  144. package/dist/index.js +0 -1
  145. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +0 -67
  146. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +0 -3
  147. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +0 -180
  148. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +0 -319
  149. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +0 -327
  150. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +0 -162
  151. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -217
  152. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +0 -49
  153. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -44
  154. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +0 -527
  155. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +0 -5
  156. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +0 -31
  157. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +0 -129
  158. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +0 -10
  159. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +0 -176
  160. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +0 -139
  161. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +0 -335
  162. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +0 -358
  163. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +0 -4
  164. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +0 -44
  165. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +0 -405
  166. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +0 -3
  167. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -138
  168. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +0 -165
  169. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +0 -196
  170. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +0 -10
  171. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +0 -127
  172. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +0 -568
  173. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +0 -3
  174. package/dist/sankhyablocks/index.esm.js +0 -0
  175. package/dist/sankhyablocks/p-0183d259.entry.js +0 -1
  176. package/dist/sankhyablocks/p-01f23a70.entry.js +0 -1
  177. package/dist/sankhyablocks/p-07c32f68.entry.js +0 -1
  178. package/dist/sankhyablocks/p-0f90499d.entry.js +0 -1
  179. package/dist/sankhyablocks/p-105724a3.entry.js +0 -1
  180. package/dist/sankhyablocks/p-112455b1.js +0 -1
  181. package/dist/sankhyablocks/p-2ac02d48.entry.js +0 -1
  182. package/dist/sankhyablocks/p-35364a97.entry.js +0 -1
  183. package/dist/sankhyablocks/p-3f6aa9a7.entry.js +0 -1
  184. package/dist/sankhyablocks/p-4811bc0a.entry.js +0 -369
  185. package/dist/sankhyablocks/p-5f9af495.entry.js +0 -1
  186. package/dist/sankhyablocks/p-60967cf0.js +0 -1
  187. package/dist/sankhyablocks/p-70ad6c16.entry.js +0 -1
  188. package/dist/sankhyablocks/p-710bfffe.entry.js +0 -1
  189. package/dist/sankhyablocks/p-73397a0f.entry.js +0 -57
  190. package/dist/sankhyablocks/p-811b4b9d.js +0 -1
  191. package/dist/sankhyablocks/p-813fe4f7.js +0 -1
  192. package/dist/sankhyablocks/p-85a9446b.js +0 -2
  193. package/dist/sankhyablocks/p-89a1100f.entry.js +0 -1
  194. package/dist/sankhyablocks/p-8b543003.entry.js +0 -1
  195. package/dist/sankhyablocks/p-9750632b.entry.js +0 -1
  196. package/dist/sankhyablocks/p-a96272f7.entry.js +0 -1
  197. package/dist/sankhyablocks/p-ac8842e5.entry.js +0 -1
  198. package/dist/sankhyablocks/p-ba64cc41.entry.js +0 -1
  199. package/dist/sankhyablocks/p-c1ede043.entry.js +0 -1
  200. package/dist/sankhyablocks/p-d90ebb85.entry.js +0 -1
  201. package/dist/sankhyablocks/p-e5355a29.entry.js +0 -1
  202. package/dist/sankhyablocks/p-ef04b633.entry.js +0 -1
  203. package/dist/sankhyablocks/p-f6db07fb.entry.js +0 -1
  204. package/dist/sankhyablocks/p-f80cabc7.entry.js +0 -1
  205. package/dist/sankhyablocks/p-fcd9bd92.entry.js +0 -1
  206. package/dist/sankhyablocks/sankhyablocks.esm.js +0 -1
  207. package/dist/types/components/snk-application/snk-application.d.ts +0 -44
  208. package/dist/types/components.d.ts +0 -66
  209. package/dist/types/index.d.ts +0 -1
  210. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -15
  211. package/dist/types/lib/http/data-fetcher/fetchers/application-config-fetcher.d.ts +0 -6
  212. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +0 -12
  213. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +0 -5
  214. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +0 -2
  215. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +0 -13
  216. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +0 -6
  217. package/dist/types/lib/http/data-fetcher/state/LoadStateManager.d.ts +0 -23
  218. package/dist/types/lib/utils/pesquisa.d.ts +0 -2
  219. package/dist/types/lib/utils/urlutils.d.ts +0 -4
  220. package/dist/types/lib/workspace/workspace.d.ts +0 -4
  221. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  222. package/loader/cdn.js +0 -3
  223. package/loader/index.cjs.js +0 -3
  224. package/loader/index.d.ts +0 -12
  225. package/loader/index.es2017.js +0 -3
  226. package/loader/index.js +0 -4
  227. package/loader/package.json +0 -10
  228. package/react/components.d.ts +0 -32
  229. package/react/components.js +0 -35
  230. package/react/components.js.map +0 -1
  231. package/react/react-component-lib/createComponent.d.ts +0 -10
  232. package/react/react-component-lib/createComponent.js +0 -75
  233. package/react/react-component-lib/createComponent.js.map +0 -1
  234. package/react/react-component-lib/createOverlayComponent.d.ts +0 -21
  235. package/react/react-component-lib/createOverlayComponent.js +0 -109
  236. package/react/react-component-lib/createOverlayComponent.js.map +0 -1
  237. package/react/react-component-lib/index.d.ts +0 -2
  238. package/react/react-component-lib/index.js +0 -3
  239. package/react/react-component-lib/index.js.map +0 -1
  240. package/react/react-component-lib/interfaces.d.ts +0 -29
  241. package/react/react-component-lib/interfaces.js +0 -1
  242. package/react/react-component-lib/interfaces.js.map +0 -1
  243. package/react/react-component-lib/utils/attachProps.d.ts +0 -12
  244. package/react/react-component-lib/utils/attachProps.js +0 -98
  245. package/react/react-component-lib/utils/attachProps.js.map +0 -1
  246. package/react/react-component-lib/utils/case.d.ts +0 -2
  247. package/react/react-component-lib/utils/case.js +0 -7
  248. package/react/react-component-lib/utils/case.js.map +0 -1
  249. package/react/react-component-lib/utils/dev.d.ts +0 -2
  250. package/react/react-component-lib/utils/dev.js +0 -13
  251. package/react/react-component-lib/utils/dev.js.map +0 -1
  252. package/react/react-component-lib/utils/index.d.ts +0 -10
  253. package/react/react-component-lib/utils/index.js +0 -34
  254. package/react/react-component-lib/utils/index.js.map +0 -1
@@ -1,807 +0,0 @@
1
- import { h, proxyCustomElement, HTMLElement, forceUpdate, Host } from '@stencil/core/internal/client';
2
- import { UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit } from '@sankhyalabs/core';
3
- import { A as ApplicationUtils } from './ApplicationUtils.js';
4
- import { d as defineCustomElement$1 } from './ez-tabselector2.js';
5
-
6
- const buildTextArea = ({ name, label, readOnly }) => {
7
- return (h("div", { class: "col col--sd-12 padding-horizontal--small", key: name },
8
- h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
9
- };
10
-
11
- const buildTextInput = ({ name, label }) => {
12
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
13
- h("ez-text-input", { label: label, "data-field-name": name, key: name })));
14
- };
15
-
16
- const buildSwitch = (fieldConfig) => {
17
- return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, true);
18
- };
19
- const buildCheckBox = (fieldConfig) => {
20
- return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, false);
21
- };
22
- function buildField$1(fieldName, fieldLabel, readOnly, switchMode = false) {
23
- return (h("div", { class: "col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large" },
24
- h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? "switch" : "regular", "data-field-name": fieldName, key: fieldName })));
25
- }
26
-
27
- const buildComboBox = ({ name, label, readOnly }, properties) => {
28
- const prop = properties === null || properties === void 0 ? void 0 : properties.options;
29
- let options;
30
- if (typeof prop === "string") {
31
- const parsed = JSON.parse(prop);
32
- options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
33
- }
34
- else {
35
- options = prop;
36
- }
37
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
38
- h("ez-combo-box", { enabled: !readOnly, label: label, "data-field-name": name, key: name, options: options })));
39
- };
40
-
41
- const buildSearch = ({ name, label, readOnly }) => {
42
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
43
- h("ez-search", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
44
- };
45
-
46
- const buildFile = ({ name, label, readOnly }) => {
47
- return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
48
- h("ez-upload", { enabled: !readOnly, label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
49
- };
50
-
51
- const buildDate = ({ name, label, readOnly }) => {
52
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
53
- h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
54
- };
55
- const buildTime = ({ name, label }) => {
56
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
57
- h("ez-time-input", { label: label, "data-field-name": name, key: name })));
58
- };
59
- const buildTimeDate = ({ name, label }) => {
60
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
61
- h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
62
- };
63
-
64
- const buildDecimal = ({ name, label, readOnly }, properties) => {
65
- const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
66
- const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
67
- return buildNumeric(name, label, readOnly, precision, prettyPrecision);
68
- };
69
- const buildInteger = ({ name, label, readOnly }) => {
70
- return buildNumeric(name, label, readOnly, 0, 0);
71
- };
72
- function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
73
- return (h("div", { class: "col col--sd-12 col--tb-3 padding-horizontal--small" },
74
- h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
75
- }
76
-
77
- const uiBuilders = new Map();
78
- uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
79
- uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
80
- uiBuilders.set(UserInterface.SWITCH, buildSwitch);
81
- uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
82
- uiBuilders.set(UserInterface.SEARCH, buildSearch);
83
- uiBuilders.set(UserInterface.FILE, buildFile);
84
- uiBuilders.set(UserInterface.DATE, buildDate);
85
- uiBuilders.set(UserInterface.TIME, buildTime);
86
- uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
87
- uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
88
- uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
89
- const buildField = (field) => {
90
- const descriptor = field.descriptor;
91
- const config = Object.assign({}, field.config);
92
- let builder;
93
- let props;
94
- if (descriptor) {
95
- if (!config.label) {
96
- config.label = descriptor.label;
97
- }
98
- if (!config.name) {
99
- config.name = descriptor.name;
100
- }
101
- if (config.required === undefined) {
102
- config.required = descriptor.required;
103
- }
104
- if (config.readOnly === undefined) {
105
- config.readOnly = descriptor.readOnly;
106
- }
107
- props = descriptor.properties;
108
- builder = uiBuilders.get(descriptor.userInterface);
109
- }
110
- if (config.required) {
111
- config.label = `* ${config.label} (obrigatório)`;
112
- }
113
- if (!builder) {
114
- builder = buildTextInput;
115
- }
116
- return builder(config, props);
117
- };
118
-
119
- const FormItem = ({ source }) => {
120
- if ("items" in source) {
121
- const fieldSet = source;
122
- return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
123
- }
124
- else {
125
- return buildField(source);
126
- }
127
- };
128
-
129
- const FormSheet = ({ store, source }) => {
130
- return (h("div", { class: "box__container" },
131
- h("div", { class: "row padding-vertical--small" }, source.items.map(item => h(FormItem, { store: store, source: item })))));
132
- };
133
-
134
- class FormMetadata {
135
- constructor() {
136
- this._sheets = new Map();
137
- this._requiredFields = [];
138
- this._cleanOnCopyFields = [];
139
- }
140
- getSheet(name) {
141
- return this._sheets.get(name);
142
- }
143
- getAllSheets() {
144
- return this._sheets;
145
- }
146
- addSheet(sheet) {
147
- this._sheets.set(sheet.name, sheet);
148
- this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
149
- this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
150
- }
151
- getRequiredFields() {
152
- return this._requiredFields;
153
- }
154
- getCleanOnCopyFields() {
155
- return this._cleanOnCopyFields;
156
- }
157
- }
158
- const buildFromDataUnit = (dataUnit) => {
159
- var _a;
160
- const unitMD = dataUnit.metadata;
161
- const metadata = new FormMetadata();
162
- if (unitMD) {
163
- const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
164
- metadata.addSheet({
165
- label: unitMD.label,
166
- name: unitMD.name,
167
- items: visibleFields.map(descriptor => { return { descriptor }; }),
168
- requiredFields: visibleFields
169
- .filter(descriptor => descriptor.required)
170
- .map(descriptor => descriptor.name),
171
- cleanOnCopyFields: visibleFields
172
- .filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
173
- .map(descriptor => descriptor.name)
174
- });
175
- }
176
- return metadata;
177
- };
178
- function getTabConfig(tab, sheets) {
179
- const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
180
- return tabConfig || { label: tab, visible: true };
181
- }
182
- const buildFromConfig = (fields, dataUnit) => {
183
- const sheets = new Map();
184
- const requiredFields = [];
185
- const cleanOnCopyFields = [];
186
- fields.forEach(config => {
187
- var _a;
188
- if (config.visible !== false) {
189
- const tabConfig = getTabConfig(config.tab || "Geral", sheets);
190
- const descriptor = dataUnit.getField(config.name);
191
- if (descriptor && tabConfig.visible) {
192
- if (!sheets.has(tabConfig)) {
193
- sheets.set(tabConfig, new Map());
194
- }
195
- const tabItens = sheets.get(tabConfig);
196
- const isRequired = config.required === undefined ? descriptor.required : config.required;
197
- if (isRequired) {
198
- requiredFields.push(config.name);
199
- }
200
- const clearOnCopy = config.cleanOnCopy === undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : config.cleanOnCopy;
201
- if (clearOnCopy) {
202
- cleanOnCopyFields.push(config.name);
203
- }
204
- const fieldMD = { config, descriptor };
205
- const group = config.group;
206
- if (group) {
207
- const key = `group::${group}`;
208
- if (!tabItens.has(key)) {
209
- tabItens.set(key, { label: group, items: [fieldMD] });
210
- }
211
- else {
212
- tabItens.get(key).items.push(fieldMD);
213
- }
214
- }
215
- else {
216
- tabItens.set(config.name, fieldMD);
217
- }
218
- }
219
- }
220
- });
221
- const metadata = new FormMetadata();
222
- Array.from(sheets.entries())
223
- .sort((a, b) => (a[0].order || 10000) - (b[0].order || 10000))
224
- .forEach(([key, value]) => {
225
- metadata.addSheet({
226
- label: key.label,
227
- name: key.label,
228
- items: Array.from(value.values()),
229
- requiredFields,
230
- cleanOnCopyFields
231
- });
232
- });
233
- return metadata;
234
- };
235
-
236
- /**
237
- * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
238
- *
239
- * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
240
- * during build.
241
- * @param {number} code
242
- */
243
- function formatProdErrorMessage(code) {
244
- 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. ';
245
- }
246
-
247
- // Inlined version of the `symbol-observable` polyfill
248
- var $$observable = (function () {
249
- return typeof Symbol === 'function' && Symbol.observable || '@@observable';
250
- })();
251
-
252
- /**
253
- * These are private action types reserved by Redux.
254
- * For any unknown actions, you must return the current state.
255
- * If the current state is undefined, you must return the initial state.
256
- * Do not reference these action types directly in your code.
257
- */
258
- var randomString = function randomString() {
259
- return Math.random().toString(36).substring(7).split('').join('.');
260
- };
261
-
262
- var ActionTypes = {
263
- INIT: "@@redux/INIT" + randomString(),
264
- REPLACE: "@@redux/REPLACE" + randomString(),
265
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
266
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
267
- }
268
- };
269
-
270
- /**
271
- * @param {any} obj The object to inspect.
272
- * @returns {boolean} True if the argument appears to be a plain object.
273
- */
274
- function isPlainObject(obj) {
275
- if (typeof obj !== 'object' || obj === null) return false;
276
- var proto = obj;
277
-
278
- while (Object.getPrototypeOf(proto) !== null) {
279
- proto = Object.getPrototypeOf(proto);
280
- }
281
-
282
- return Object.getPrototypeOf(obj) === proto;
283
- }
284
-
285
- /**
286
- * @deprecated
287
- *
288
- * **We recommend using the `configureStore` method
289
- * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
290
- *
291
- * Redux Toolkit is our recommended approach for writing Redux logic today,
292
- * including store setup, reducers, data fetching, and more.
293
- *
294
- * **For more details, please read this Redux docs page:**
295
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
296
- *
297
- * `configureStore` from Redux Toolkit is an improved version of `createStore` that
298
- * simplifies setup and helps avoid common bugs.
299
- *
300
- * You should not be using the `redux` core package by itself today, except for learning purposes.
301
- * The `createStore` method from the core `redux` package will not be removed, but we encourage
302
- * all users to migrate to using Redux Toolkit for all Redux code.
303
- *
304
- * If you want to use `createStore` without this visual deprecation warning, use
305
- * the `legacy_createStore` import instead:
306
- *
307
- * `import { legacy_createStore as createStore} from 'redux'`
308
- *
309
- */
310
-
311
- function createStore(reducer, preloadedState, enhancer) {
312
- var _ref2;
313
-
314
- if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
315
- throw new Error(formatProdErrorMessage(0) );
316
- }
317
-
318
- if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
319
- enhancer = preloadedState;
320
- preloadedState = undefined;
321
- }
322
-
323
- if (typeof enhancer !== 'undefined') {
324
- if (typeof enhancer !== 'function') {
325
- throw new Error(formatProdErrorMessage(1) );
326
- }
327
-
328
- return enhancer(createStore)(reducer, preloadedState);
329
- }
330
-
331
- if (typeof reducer !== 'function') {
332
- throw new Error(formatProdErrorMessage(2) );
333
- }
334
-
335
- var currentReducer = reducer;
336
- var currentState = preloadedState;
337
- var currentListeners = [];
338
- var nextListeners = currentListeners;
339
- var isDispatching = false;
340
- /**
341
- * This makes a shallow copy of currentListeners so we can use
342
- * nextListeners as a temporary list while dispatching.
343
- *
344
- * This prevents any bugs around consumers calling
345
- * subscribe/unsubscribe in the middle of a dispatch.
346
- */
347
-
348
- function ensureCanMutateNextListeners() {
349
- if (nextListeners === currentListeners) {
350
- nextListeners = currentListeners.slice();
351
- }
352
- }
353
- /**
354
- * Reads the state tree managed by the store.
355
- *
356
- * @returns {any} The current state tree of your application.
357
- */
358
-
359
-
360
- function getState() {
361
- if (isDispatching) {
362
- throw new Error(formatProdErrorMessage(3) );
363
- }
364
-
365
- return currentState;
366
- }
367
- /**
368
- * Adds a change listener. It will be called any time an action is dispatched,
369
- * and some part of the state tree may potentially have changed. You may then
370
- * call `getState()` to read the current state tree inside the callback.
371
- *
372
- * You may call `dispatch()` from a change listener, with the following
373
- * caveats:
374
- *
375
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
376
- * If you subscribe or unsubscribe while the listeners are being invoked, this
377
- * will not have any effect on the `dispatch()` that is currently in progress.
378
- * However, the next `dispatch()` call, whether nested or not, will use a more
379
- * recent snapshot of the subscription list.
380
- *
381
- * 2. The listener should not expect to see all state changes, as the state
382
- * might have been updated multiple times during a nested `dispatch()` before
383
- * the listener is called. It is, however, guaranteed that all subscribers
384
- * registered before the `dispatch()` started will be called with the latest
385
- * state by the time it exits.
386
- *
387
- * @param {Function} listener A callback to be invoked on every dispatch.
388
- * @returns {Function} A function to remove this change listener.
389
- */
390
-
391
-
392
- function subscribe(listener) {
393
- if (typeof listener !== 'function') {
394
- throw new Error(formatProdErrorMessage(4) );
395
- }
396
-
397
- if (isDispatching) {
398
- throw new Error(formatProdErrorMessage(5) );
399
- }
400
-
401
- var isSubscribed = true;
402
- ensureCanMutateNextListeners();
403
- nextListeners.push(listener);
404
- return function unsubscribe() {
405
- if (!isSubscribed) {
406
- return;
407
- }
408
-
409
- if (isDispatching) {
410
- throw new Error(formatProdErrorMessage(6) );
411
- }
412
-
413
- isSubscribed = false;
414
- ensureCanMutateNextListeners();
415
- var index = nextListeners.indexOf(listener);
416
- nextListeners.splice(index, 1);
417
- currentListeners = null;
418
- };
419
- }
420
- /**
421
- * Dispatches an action. It is the only way to trigger a state change.
422
- *
423
- * The `reducer` function, used to create the store, will be called with the
424
- * current state tree and the given `action`. Its return value will
425
- * be considered the **next** state of the tree, and the change listeners
426
- * will be notified.
427
- *
428
- * The base implementation only supports plain object actions. If you want to
429
- * dispatch a Promise, an Observable, a thunk, or something else, you need to
430
- * wrap your store creating function into the corresponding middleware. For
431
- * example, see the documentation for the `redux-thunk` package. Even the
432
- * middleware will eventually dispatch plain object actions using this method.
433
- *
434
- * @param {Object} action A plain object representing “what changed”. It is
435
- * a good idea to keep actions serializable so you can record and replay user
436
- * sessions, or use the time travelling `redux-devtools`. An action must have
437
- * a `type` property which may not be `undefined`. It is a good idea to use
438
- * string constants for action types.
439
- *
440
- * @returns {Object} For convenience, the same action object you dispatched.
441
- *
442
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
443
- * return something else (for example, a Promise you can await).
444
- */
445
-
446
-
447
- function dispatch(action) {
448
- if (!isPlainObject(action)) {
449
- throw new Error(formatProdErrorMessage(7) );
450
- }
451
-
452
- if (typeof action.type === 'undefined') {
453
- throw new Error(formatProdErrorMessage(8) );
454
- }
455
-
456
- if (isDispatching) {
457
- throw new Error(formatProdErrorMessage(9) );
458
- }
459
-
460
- try {
461
- isDispatching = true;
462
- currentState = currentReducer(currentState, action);
463
- } finally {
464
- isDispatching = false;
465
- }
466
-
467
- var listeners = currentListeners = nextListeners;
468
-
469
- for (var i = 0; i < listeners.length; i++) {
470
- var listener = listeners[i];
471
- listener();
472
- }
473
-
474
- return action;
475
- }
476
- /**
477
- * Replaces the reducer currently used by the store to calculate the state.
478
- *
479
- * You might need this if your app implements code splitting and you want to
480
- * load some of the reducers dynamically. You might also need this if you
481
- * implement a hot reloading mechanism for Redux.
482
- *
483
- * @param {Function} nextReducer The reducer for the store to use instead.
484
- * @returns {void}
485
- */
486
-
487
-
488
- function replaceReducer(nextReducer) {
489
- if (typeof nextReducer !== 'function') {
490
- throw new Error(formatProdErrorMessage(10) );
491
- }
492
-
493
- currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
494
- // Any reducers that existed in both the new and old rootReducer
495
- // will receive the previous state. This effectively populates
496
- // the new state tree with any relevant data from the old one.
497
-
498
- dispatch({
499
- type: ActionTypes.REPLACE
500
- });
501
- }
502
- /**
503
- * Interoperability point for observable/reactive libraries.
504
- * @returns {observable} A minimal observable of state changes.
505
- * For more information, see the observable proposal:
506
- * https://github.com/tc39/proposal-observable
507
- */
508
-
509
-
510
- function observable() {
511
- var _ref;
512
-
513
- var outerSubscribe = subscribe;
514
- return _ref = {
515
- /**
516
- * The minimal observable subscription method.
517
- * @param {Object} observer Any object that can be used as an observer.
518
- * The observer object should have a `next` method.
519
- * @returns {subscription} An object with an `unsubscribe` method that can
520
- * be used to unsubscribe the observable from the store, and prevent further
521
- * emission of values from the observable.
522
- */
523
- subscribe: function subscribe(observer) {
524
- if (typeof observer !== 'object' || observer === null) {
525
- throw new Error(formatProdErrorMessage(11) );
526
- }
527
-
528
- function observeState() {
529
- if (observer.next) {
530
- observer.next(getState());
531
- }
532
- }
533
-
534
- observeState();
535
- var unsubscribe = outerSubscribe(observeState);
536
- return {
537
- unsubscribe: unsubscribe
538
- };
539
- }
540
- }, _ref[$$observable] = function () {
541
- return this;
542
- }, _ref;
543
- } // When a store is created, an "INIT" action is dispatched so that every
544
- // reducer returns their initial state. This effectively populates
545
- // the initial state tree.
546
-
547
-
548
- dispatch({
549
- type: ActionTypes.INIT
550
- });
551
- return _ref2 = {
552
- dispatch: dispatch,
553
- subscribe: subscribe,
554
- getState: getState,
555
- replaceReducer: replaceReducer
556
- }, _ref2[$$observable] = observable, _ref2;
557
- }
558
-
559
- const inicialState = {};
560
- /////////////////////////////// REDUCERS ///////////////////////////////
561
- function formReducer(state = inicialState, action) {
562
- switch (action.type) {
563
- case FormActions.METADATA_LOADED:
564
- return Object.assign(Object.assign({}, state), { formMetadata: action.payload });
565
- case FormActions.CHANGE_TAB:
566
- return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
567
- default:
568
- return state;
569
- }
570
- }
571
- /////////////////////////////// ACTION CREATORS ///////////////////////////////
572
- function loadMetadata(formMetadata) {
573
- return {
574
- type: FormActions.METADATA_LOADED,
575
- payload: formMetadata
576
- };
577
- }
578
- function changeTab(currentSheet) {
579
- return {
580
- type: FormActions.CHANGE_TAB,
581
- payload: currentSheet.tabKey
582
- };
583
- }
584
- /////////////////////////////// SELECTORS ///////////////////////////////
585
- function selectFormMetadata(state) {
586
- return state.formMetadata;
587
- }
588
- function selectCurrentSheet(state) {
589
- return state.currentSheet ? state.formMetadata.getSheet(state.currentSheet) : Array.from(state.formMetadata.getAllSheets().values())[0];
590
- }
591
- /////////////////////////////// TYPES ///////////////////////////////
592
- var FormActions;
593
- (function (FormActions) {
594
- FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
595
- FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
596
- })(FormActions || (FormActions = {}));
597
-
598
- class DataBinder {
599
- constructor(dataUnit) {
600
- this._fields = new Map();
601
- this._dataUnit = dataUnit;
602
- this._dataUnit.subscribe(_action => {
603
- var _a;
604
- (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
605
- this.updateValue(field.fieldName, field.field);
606
- });
607
- });
608
- }
609
- bind(fields) {
610
- fields.forEach(fieldElement => {
611
- const fieldName = fieldElement.dataset.fieldName;
612
- this.updateBind(fieldName, fieldElement);
613
- this.updateValue(fieldName, fieldElement);
614
- });
615
- }
616
- updateValue(fieldName, field) {
617
- field["value"] = this._dataUnit.getFieldValue(fieldName);
618
- }
619
- updateBind(fieldName, field) {
620
- const oldBind = this._fields.get(fieldName);
621
- if (oldBind) {
622
- oldBind.destroy();
623
- }
624
- this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
625
- this.bindSearchOptionsLoader(fieldName, field);
626
- }
627
- setFieldValue(fieldName, newValue) {
628
- if (this._dataUnit.records.length === 0) {
629
- this._dataUnit.addRecord();
630
- }
631
- this._dataUnit.setFieldValue(fieldName, newValue);
632
- }
633
- bindSearchOptionsLoader(fieldName, field) {
634
- if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] === undefined) {
635
- const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
636
- if (loader) {
637
- field["optionLoader"] = (arg) => {
638
- return loader(arg, fieldName, this._dataUnit);
639
- };
640
- }
641
- }
642
- }
643
- }
644
- class Bind {
645
- destroy() {
646
- this.field.removeEventListener(this.eventName, this.eventListener);
647
- }
648
- static create(fieldName, field, callback) {
649
- const b = new Bind();
650
- b.fieldName = fieldName;
651
- b.field = field;
652
- //FIXME: Verificar se o field é um EzField
653
- b.eventListener = (evt) => { callback(fieldName, evt.detail); };
654
- b.eventName = "ezChange";
655
- b.field.addEventListener(b.eventName, b.eventListener);
656
- return b;
657
- }
658
- }
659
-
660
- const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}";
661
-
662
- const EzForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
663
- constructor() {
664
- super();
665
- this.__registerHost();
666
- }
667
- submit() {
668
- return Promise.resolve();
669
- }
670
- cancel() {
671
- return Promise.resolve();
672
- }
673
- validate() {
674
- return new Promise((accept, reject) => {
675
- const metadata = selectFormMetadata(this._store.getState());
676
- const requiredFields = this._staticFields
677
- .filter(f => f.dataset.required)
678
- .map(f => f.dataset.fieldName)
679
- .concat(metadata.getRequiredFields());
680
- const records = this.dataUnit.records;
681
- for (let i = 0; i < records.length; i++) {
682
- if (!this.validateRequired(requiredFields, records[i])) {
683
- reject();
684
- break;
685
- }
686
- }
687
- accept();
688
- });
689
- }
690
- configChanged() {
691
- this.processMetadata();
692
- }
693
- validateRequired(requiredFields, record) {
694
- const invalidFields = [];
695
- requiredFields.forEach(field => {
696
- const value = record[field];
697
- const fieldElem = this._element.querySelector(`[data-field-name=${field}]`);
698
- if (value === null || value === undefined || value === "") {
699
- invalidFields.push(field);
700
- fieldElem["errorMessage"] = "Essa informação é obrigatória";
701
- }
702
- else {
703
- fieldElem["errorMessage"] = "";
704
- }
705
- });
706
- const isValid = invalidFields.length === 0;
707
- if (!isValid) {
708
- ApplicationUtils.info("Há pelo menos um campo obrigatório não preenchido.");
709
- }
710
- return isValid;
711
- }
712
- getDynamicContent() {
713
- var _a;
714
- const formMD = selectFormMetadata(this._store.getState());
715
- if (!formMD)
716
- return null;
717
- const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
718
- if (!currentSheet) {
719
- return null;
720
- }
721
- const allSheets = Array.from(formMD.getAllSheets().values());
722
- const result = [];
723
- if (allSheets.length > 1) {
724
- 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 }))));
725
- }
726
- result.push(h(FormSheet, { store: this._store, source: currentSheet }));
727
- return result;
728
- }
729
- processMetadata() {
730
- if (!this.isStatic()) {
731
- const metadata = this.config && this.config.length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
732
- this._store.dispatch(loadMetadata(metadata));
733
- }
734
- }
735
- isStatic() {
736
- var _a;
737
- return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
738
- }
739
- interceptAction(action) {
740
- if (action.type === Action.RECORDS_COPIED) {
741
- const metadata = selectFormMetadata(this._store.getState());
742
- const cleanFields = metadata.getCleanOnCopyFields();
743
- if (cleanFields) {
744
- const records = action.payload;
745
- return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
746
- const newRecord = Object.assign({}, record);
747
- cleanFields.forEach(fieldName => delete newRecord[fieldName]);
748
- return newRecord;
749
- }));
750
- }
751
- }
752
- return action;
753
- }
754
- componentWillLoad() {
755
- if (this.dataUnit === undefined) {
756
- this.dataUnit = new DataUnit("ez-form");
757
- }
758
- this.dataUnit.addInterceptor(this);
759
- this.dataUnit.subscribe(action => {
760
- if (action.type === Action.METADATA_LOADED) {
761
- this.processMetadata();
762
- }
763
- });
764
- this._dataBinder = new DataBinder(this.dataUnit);
765
- this._store = createStore(formReducer);
766
- this._store.subscribe(() => forceUpdate(this));
767
- this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));
768
- this.processMetadata();
769
- }
770
- componentDidRender() {
771
- this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")));
772
- }
773
- render() {
774
- return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
775
- }
776
- get _element() { return this; }
777
- static get watchers() { return {
778
- "config": ["configChanged"]
779
- }; }
780
- static get style() { return ezFormCss; }
781
- }, [0, "ez-form", {
782
- "dataUnit": [1040],
783
- "config": [16],
784
- "submit": [64],
785
- "cancel": [64],
786
- "validate": [64]
787
- }]);
788
- function defineCustomElement() {
789
- if (typeof customElements === "undefined") {
790
- return;
791
- }
792
- const components = ["ez-form", "ez-tabselector"];
793
- components.forEach(tagName => { switch (tagName) {
794
- case "ez-form":
795
- if (!customElements.get(tagName)) {
796
- customElements.define(tagName, EzForm);
797
- }
798
- break;
799
- case "ez-tabselector":
800
- if (!customElements.get(tagName)) {
801
- defineCustomElement$1();
802
- }
803
- break;
804
- } });
805
- }
806
-
807
- export { EzForm as E, defineCustomElement as d };