@sankhyalabs/sankhyablocks 1.1.27 → 1.3.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 (237) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +75 -75
  3. package/dist/cjs/index-4720dab8.js +735 -0
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/sankhyablocks.cjs.js +3 -3
  6. package/dist/cjs/snk-application.cjs.entry.js +954 -656
  7. package/dist/collection/collection-manifest.json +6 -35
  8. package/dist/collection/components/snk-application/snk-application.css +5 -5
  9. package/dist/collection/components/snk-application/snk-application.js +492 -495
  10. package/dist/collection/index.js +1 -1
  11. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +158 -158
  12. package/dist/collection/lib/http/data-fetcher/fetchers/application-config-fetcher.js +23 -23
  13. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +188 -188
  14. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +25 -25
  15. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +2 -2
  16. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +59 -59
  17. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +30 -30
  18. package/dist/collection/lib/http/data-fetcher/state/LoadStateManager.js +66 -66
  19. package/dist/collection/lib/utils/pesquisa.js +16 -16
  20. package/dist/collection/lib/utils/urlutils.js +23 -23
  21. package/dist/collection/lib/workspace/workspace.js +7 -7
  22. package/dist/components/snk-application.js +945 -647
  23. package/dist/esm/index-72d4e2e0.js +709 -0
  24. package/dist/esm/loader.js +3 -3
  25. package/dist/esm/polyfills/core-js.js +0 -0
  26. package/dist/esm/polyfills/dom.js +0 -0
  27. package/dist/esm/polyfills/es5-html-element.js +0 -0
  28. package/dist/esm/polyfills/index.js +0 -0
  29. package/dist/esm/polyfills/system.js +0 -0
  30. package/dist/esm/sankhyablocks.js +3 -3
  31. package/dist/esm/snk-application.entry.js +916 -618
  32. package/dist/sankhyablocks/p-5d8ddbda.entry.js +57 -0
  33. package/dist/sankhyablocks/p-a33afc3b.js +2 -0
  34. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  35. package/dist/types/components/snk-application/snk-application.d.ts +44 -44
  36. package/dist/types/components.d.ts +6 -2
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +15 -15
  39. package/dist/types/lib/http/data-fetcher/fetchers/application-config-fetcher.d.ts +6 -6
  40. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +12 -12
  41. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +5 -5
  42. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +2 -2
  43. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +13 -13
  44. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +6 -6
  45. package/dist/types/lib/http/data-fetcher/state/LoadStateManager.d.ts +23 -23
  46. package/dist/types/lib/utils/pesquisa.d.ts +2 -2
  47. package/dist/types/lib/utils/urlutils.d.ts +4 -4
  48. package/dist/types/lib/workspace/workspace.d.ts +4 -4
  49. package/package.json +63 -52
  50. package/react/.keepfolder +1 -0
  51. package/react/components.d.ts +3 -32
  52. package/react/components.js +5 -34
  53. package/react/components.js.map +1 -1
  54. package/react/react-component-lib/createComponent.d.ts +10 -10
  55. package/react/react-component-lib/createComponent.js +58 -74
  56. package/react/react-component-lib/createComponent.js.map +1 -1
  57. package/react/react-component-lib/createOverlayComponent.d.ts +20 -21
  58. package/react/react-component-lib/createOverlayComponent.js +88 -108
  59. package/react/react-component-lib/createOverlayComponent.js.map +1 -1
  60. package/react/react-component-lib/index.d.ts +2 -2
  61. package/react/react-component-lib/index.js +2 -2
  62. package/react/react-component-lib/interfaces.d.ts +29 -29
  63. package/react/react-component-lib/utils/attachProps.d.ts +12 -12
  64. package/react/react-component-lib/utils/attachProps.js +95 -97
  65. package/react/react-component-lib/utils/attachProps.js.map +1 -1
  66. package/react/react-component-lib/utils/case.d.ts +2 -2
  67. package/react/react-component-lib/utils/case.js +6 -6
  68. package/react/react-component-lib/utils/dev.d.ts +2 -2
  69. package/react/react-component-lib/utils/dev.js +12 -12
  70. package/react/react-component-lib/utils/index.d.ts +7 -10
  71. package/react/react-component-lib/utils/index.js +20 -33
  72. package/react/react-component-lib/utils/index.js.map +1 -1
  73. package/dist/cjs/ApplicationUtils-05b74ee9.js +0 -39
  74. package/dist/cjs/AssetsUtils-bd004f63.js +0 -24
  75. package/dist/cjs/CSSVarsUtils-75ca9c64.js +0 -19
  76. package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
  77. package/dist/cjs/ez-action-chip.cjs.entry.js +0 -27
  78. package/dist/cjs/ez-application.cjs.entry.js +0 -26
  79. package/dist/cjs/ez-button_4.cjs.entry.js +0 -660
  80. package/dist/cjs/ez-calendar.cjs.entry.js +0 -223
  81. package/dist/cjs/ez-collapsible-box.cjs.entry.js +0 -47
  82. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -278
  83. package/dist/cjs/ez-date-input.cjs.entry.js +0 -102
  84. package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -145
  85. package/dist/cjs/ez-dialog.cjs.entry.js +0 -89
  86. package/dist/cjs/ez-form.cjs.entry.js +0 -785
  87. package/dist/cjs/ez-grid.cjs.entry.js +0 -110485
  88. package/dist/cjs/ez-icon.cjs.entry.js +0 -41
  89. package/dist/cjs/ez-label-chip.cjs.entry.js +0 -104
  90. package/dist/cjs/ez-modal_2.cjs.entry.js +0 -316
  91. package/dist/cjs/ez-number-input.cjs.entry.js +0 -86
  92. package/dist/cjs/ez-popover.cjs.entry.js +0 -120
  93. package/dist/cjs/ez-popup.cjs.entry.js +0 -48
  94. package/dist/cjs/ez-search.cjs.entry.js +0 -64
  95. package/dist/cjs/ez-tabselector.cjs.entry.js +0 -198
  96. package/dist/cjs/ez-text-area.cjs.entry.js +0 -114
  97. package/dist/cjs/ez-text-input.cjs.entry.js +0 -201
  98. package/dist/cjs/ez-time-input.cjs.entry.js +0 -118
  99. package/dist/cjs/ez-toast.cjs.entry.js +0 -44
  100. package/dist/cjs/ez-upload.cjs.entry.js +0 -356
  101. package/dist/cjs/index-6ac5268e.js +0 -1769
  102. package/dist/cjs/test-du.cjs.entry.js +0 -76
  103. package/dist/components/ApplicationUtils.js +0 -37
  104. package/dist/components/AssetsUtils.js +0 -22
  105. package/dist/components/CSSVarsUtils.js +0 -17
  106. package/dist/components/_commonjsHelpers.js +0 -17
  107. package/dist/components/ez-action-chip.js +0 -44
  108. package/dist/components/ez-application.js +0 -39
  109. package/dist/components/ez-button.js +0 -6
  110. package/dist/components/ez-button2.js +0 -105
  111. package/dist/components/ez-calendar.js +0 -6
  112. package/dist/components/ez-calendar2.js +0 -242
  113. package/dist/components/ez-check.js +0 -6
  114. package/dist/components/ez-check2.js +0 -94
  115. package/dist/components/ez-collapsible-box.js +0 -67
  116. package/dist/components/ez-combo-box.js +0 -6
  117. package/dist/components/ez-combo-box2.js +0 -311
  118. package/dist/components/ez-date-input.js +0 -135
  119. package/dist/components/ez-date-time-input.js +0 -179
  120. package/dist/components/ez-dialog.js +0 -124
  121. package/dist/components/ez-form.js +0 -6
  122. package/dist/components/ez-form2.js +0 -807
  123. package/dist/components/ez-grid.js +0 -110576
  124. package/dist/components/ez-icon.js +0 -6
  125. package/dist/components/ez-icon2.js +0 -56
  126. package/dist/components/ez-label-chip.js +0 -125
  127. package/dist/components/ez-list.js +0 -6
  128. package/dist/components/ez-list2.js +0 -523
  129. package/dist/components/ez-modal.js +0 -6
  130. package/dist/components/ez-modal2.js +0 -82
  131. package/dist/components/ez-number-input.js +0 -115
  132. package/dist/components/ez-popover.js +0 -145
  133. package/dist/components/ez-popup.js +0 -67
  134. package/dist/components/ez-search.js +0 -100
  135. package/dist/components/ez-tabselector.js +0 -6
  136. package/dist/components/ez-tabselector2.js +0 -213
  137. package/dist/components/ez-text-area.js +0 -137
  138. package/dist/components/ez-text-input.js +0 -6
  139. package/dist/components/ez-text-input2.js +0 -223
  140. package/dist/components/ez-time-input.js +0 -153
  141. package/dist/components/ez-toast.js +0 -64
  142. package/dist/components/ez-upload.js +0 -382
  143. package/dist/components/grid-config.js +0 -6
  144. package/dist/components/grid-config2.js +0 -318
  145. package/dist/components/select-box.js +0 -6
  146. package/dist/components/select-box2.js +0 -47
  147. package/dist/components/test-du.js +0 -101
  148. package/dist/esm/ApplicationUtils-e0b6d857.js +0 -37
  149. package/dist/esm/AssetsUtils-98074c9c.js +0 -22
  150. package/dist/esm/CSSVarsUtils-0787c3f3.js +0 -17
  151. package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
  152. package/dist/esm/ez-action-chip.entry.js +0 -23
  153. package/dist/esm/ez-application.entry.js +0 -22
  154. package/dist/esm/ez-button_4.entry.js +0 -653
  155. package/dist/esm/ez-calendar.entry.js +0 -219
  156. package/dist/esm/ez-collapsible-box.entry.js +0 -43
  157. package/dist/esm/ez-combo-box.entry.js +0 -274
  158. package/dist/esm/ez-date-input.entry.js +0 -98
  159. package/dist/esm/ez-date-time-input.entry.js +0 -141
  160. package/dist/esm/ez-dialog.entry.js +0 -85
  161. package/dist/esm/ez-form.entry.js +0 -781
  162. package/dist/esm/ez-grid.entry.js +0 -110481
  163. package/dist/esm/ez-icon.entry.js +0 -37
  164. package/dist/esm/ez-label-chip.entry.js +0 -100
  165. package/dist/esm/ez-modal_2.entry.js +0 -311
  166. package/dist/esm/ez-number-input.entry.js +0 -82
  167. package/dist/esm/ez-popover.entry.js +0 -116
  168. package/dist/esm/ez-popup.entry.js +0 -44
  169. package/dist/esm/ez-search.entry.js +0 -60
  170. package/dist/esm/ez-tabselector.entry.js +0 -194
  171. package/dist/esm/ez-text-area.entry.js +0 -110
  172. package/dist/esm/ez-text-input.entry.js +0 -197
  173. package/dist/esm/ez-time-input.entry.js +0 -114
  174. package/dist/esm/ez-toast.entry.js +0 -40
  175. package/dist/esm/ez-upload.entry.js +0 -352
  176. package/dist/esm/index-df166135.js +0 -1738
  177. package/dist/esm/test-du.entry.js +0 -72
  178. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +0 -67
  179. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +0 -3
  180. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +0 -180
  181. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +0 -319
  182. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +0 -327
  183. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +0 -162
  184. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -217
  185. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +0 -49
  186. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -44
  187. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +0 -527
  188. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +0 -5
  189. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +0 -31
  190. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +0 -129
  191. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +0 -10
  192. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +0 -176
  193. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +0 -139
  194. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +0 -335
  195. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +0 -358
  196. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +0 -4
  197. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +0 -44
  198. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +0 -405
  199. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +0 -3
  200. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -138
  201. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +0 -165
  202. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +0 -196
  203. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +0 -10
  204. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +0 -127
  205. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +0 -568
  206. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +0 -3
  207. package/dist/sankhyablocks/p-08e1cded.entry.js +0 -1
  208. package/dist/sankhyablocks/p-0a77ac95.entry.js +0 -57
  209. package/dist/sankhyablocks/p-112455b1.js +0 -1
  210. package/dist/sankhyablocks/p-126c4aaa.entry.js +0 -1
  211. package/dist/sankhyablocks/p-1421b89a.entry.js +0 -1
  212. package/dist/sankhyablocks/p-1beadcaf.entry.js +0 -1
  213. package/dist/sankhyablocks/p-1c423f5d.entry.js +0 -1
  214. package/dist/sankhyablocks/p-28a0dbf0.entry.js +0 -1
  215. package/dist/sankhyablocks/p-4763d5c2.js +0 -1
  216. package/dist/sankhyablocks/p-4c66200a.entry.js +0 -1
  217. package/dist/sankhyablocks/p-5dc772be.entry.js +0 -1
  218. package/dist/sankhyablocks/p-5ff3e300.entry.js +0 -1
  219. package/dist/sankhyablocks/p-7122cec4.entry.js +0 -1
  220. package/dist/sankhyablocks/p-811b4b9d.js +0 -1
  221. package/dist/sankhyablocks/p-813fe4f7.js +0 -1
  222. package/dist/sankhyablocks/p-9b33a005.entry.js +0 -1
  223. package/dist/sankhyablocks/p-9e22ec87.entry.js +0 -1
  224. package/dist/sankhyablocks/p-9f7239df.entry.js +0 -1
  225. package/dist/sankhyablocks/p-9f7e6e48.js +0 -1
  226. package/dist/sankhyablocks/p-a47e0537.entry.js +0 -1
  227. package/dist/sankhyablocks/p-a9aba60a.entry.js +0 -1
  228. package/dist/sankhyablocks/p-afda7940.entry.js +0 -1
  229. package/dist/sankhyablocks/p-b3a83eaf.entry.js +0 -1
  230. package/dist/sankhyablocks/p-b96a8d40.entry.js +0 -1
  231. package/dist/sankhyablocks/p-c61c0e40.entry.js +0 -1
  232. package/dist/sankhyablocks/p-ca29d028.entry.js +0 -1
  233. package/dist/sankhyablocks/p-cd17abb1.entry.js +0 -1
  234. package/dist/sankhyablocks/p-d3a5366d.entry.js +0 -369
  235. package/dist/sankhyablocks/p-d5703a41.entry.js +0 -1
  236. package/dist/sankhyablocks/p-e5f77a59.entry.js +0 -1
  237. package/dist/sankhyablocks/p-e9e94d51.entry.js +0 -1
@@ -1,495 +1,492 @@
1
- import { Component, h, Method, Event } from "@stencil/core";
2
- import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
3
- import UrlUtils from "../../lib/utils/urlutils";
4
- import Workspace from "../../lib/workspace/workspace";
5
- import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
6
- //FIXME: temporariamente estamos compiando essa classe do ezui pois não conseguimos
7
- //incluída no pacote. Isso deve ser resolvido nas proximas entregas e então ajustado aqui
8
- //import ApplicationUtils from "../../temp/ApplicationUtils";
9
- import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
10
- import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
11
- import { ApplicationContext } from "@sankhyalabs/core";
12
- import { pesquisaLoadOptions } from "../../lib/utils/pesquisa";
13
- export class SnkApplication {
14
- get parameters() {
15
- if (!this._parameters) {
16
- this._parameters = new ParametersFetcher();
17
- }
18
- return this._parameters;
19
- }
20
- get resourceID() {
21
- if (!this._resourceID) {
22
- this._resourceID = this.urlParams.get("workspaceResourceID") ||
23
- this.urlParams.get("resourceID") ||
24
- Workspace.resourceID ||
25
- "unknown.resource.id";
26
- }
27
- return this._resourceID;
28
- }
29
- async getStringParam(name) {
30
- return this.parameters.asString(name, this.resourceID);
31
- }
32
- async getIntParam(name) {
33
- return this.parameters.asInteger(name, this.resourceID);
34
- }
35
- async getFloatParam(name) {
36
- return this.parameters.asFloat(name, this.resourceID);
37
- }
38
- async getBooleanParam(name) {
39
- return this.parameters.asBoolean(name, this.resourceID);
40
- }
41
- async getDateParam(name) {
42
- return this.parameters.asDate(name, this.resourceID);
43
- }
44
- async temOpcional(opcional) {
45
- const opts = opcional.split(",");
46
- return new Promise((resolve, reject) => {
47
- this.getAttributeFromHTMLWrapper("opc0009")
48
- .then(value => {
49
- if (value === "1") {
50
- resolve(true);
51
- }
52
- else {
53
- Promise.all(opts.map(opt => this.getAttributeFromHTMLWrapper("opc" + opt)))
54
- .then(result => {
55
- resolve(result.includes("1"));
56
- })
57
- .catch(error => {
58
- reject(error);
59
- });
60
- }
61
- })
62
- .catch(error => {
63
- reject(error);
64
- });
65
- });
66
- }
67
- async getAttributeFromHTMLWrapper(attribName) {
68
- return Promise.resolve(window[attribName]);
69
- }
70
- async openApp(resourceId, pkObject) {
71
- Workspace.openAppActivity(resourceId, pkObject);
72
- }
73
- async createDataunit(entityName) {
74
- return new Promise(resolve => {
75
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
76
- dataUnit.loadMetadata();
77
- resolve(dataUnit);
78
- });
79
- }
80
- async getResourceID() {
81
- return Promise.resolve(this.resourceID);
82
- }
83
- async alert(title, message, icon) {
84
- return ApplicationUtils.alert(title, message, icon);
85
- }
86
- async error(title, message, icon) {
87
- return ApplicationUtils.error(title, message, icon);
88
- }
89
- async confirm(title, message, icon, critical) {
90
- return ApplicationUtils.confirm(title, message, icon, critical);
91
- }
92
- async info(message, options = undefined) {
93
- return ApplicationUtils.info(message, options);
94
- }
95
- async loadFormConfig(name) {
96
- return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
97
- }
98
- get urlParams() {
99
- if (!this._urlParams) {
100
- this._urlParams = UrlUtils.getQueryParams(location.search);
101
- }
102
- return this._urlParams;
103
- }
104
- get dataUnitFetcher() {
105
- if (!this._dataUnitFetcher) {
106
- this._dataUnitFetcher = new DataUnitFetcher();
107
- }
108
- return this._dataUnitFetcher;
109
- }
110
- get formConfigFetcher() {
111
- if (!this._formConfigFetcher) {
112
- this._formConfigFetcher = new FormConfigFetcher();
113
- }
114
- return this._formConfigFetcher;
115
- }
116
- componentWillLoad() {
117
- ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
118
- }
119
- componentDidLoad() {
120
- this.applicationLoading.emit(true);
121
- window.requestAnimationFrame(() => {
122
- this.applicationLoaded.emit(true);
123
- });
124
- }
125
- render() {
126
- return (h("div", null));
127
- }
128
- static get is() { return "snk-application"; }
129
- static get encapsulation() { return "scoped"; }
130
- static get originalStyleUrls() { return {
131
- "$": ["snk-application.css"]
132
- }; }
133
- static get styleUrls() { return {
134
- "$": ["snk-application.css"]
135
- }; }
136
- static get events() { return [{
137
- "method": "applicationLoaded",
138
- "name": "applicationLoaded",
139
- "bubbles": true,
140
- "cancelable": true,
141
- "composed": true,
142
- "docs": {
143
- "tags": [],
144
- "text": "Evento disparado quando a aplica\u00E7\u00E3o for carregada."
145
- },
146
- "complexType": {
147
- "original": "boolean",
148
- "resolved": "boolean",
149
- "references": {}
150
- }
151
- }, {
152
- "method": "applicationLoading",
153
- "name": "applicationLoading",
154
- "bubbles": true,
155
- "cancelable": true,
156
- "composed": true,
157
- "docs": {
158
- "tags": [],
159
- "text": "Evento"
160
- },
161
- "complexType": {
162
- "original": "boolean",
163
- "resolved": "boolean",
164
- "references": {}
165
- }
166
- }]; }
167
- static get methods() { return {
168
- "getStringParam": {
169
- "complexType": {
170
- "signature": "(name: string) => Promise<string>",
171
- "parameters": [{
172
- "tags": [],
173
- "text": ""
174
- }],
175
- "references": {
176
- "Promise": {
177
- "location": "global"
178
- }
179
- },
180
- "return": "Promise<string>"
181
- },
182
- "docs": {
183
- "text": "",
184
- "tags": []
185
- }
186
- },
187
- "getIntParam": {
188
- "complexType": {
189
- "signature": "(name: string) => Promise<number>",
190
- "parameters": [{
191
- "tags": [],
192
- "text": ""
193
- }],
194
- "references": {
195
- "Promise": {
196
- "location": "global"
197
- }
198
- },
199
- "return": "Promise<number>"
200
- },
201
- "docs": {
202
- "text": "",
203
- "tags": []
204
- }
205
- },
206
- "getFloatParam": {
207
- "complexType": {
208
- "signature": "(name: string) => Promise<number>",
209
- "parameters": [{
210
- "tags": [],
211
- "text": ""
212
- }],
213
- "references": {
214
- "Promise": {
215
- "location": "global"
216
- }
217
- },
218
- "return": "Promise<number>"
219
- },
220
- "docs": {
221
- "text": "",
222
- "tags": []
223
- }
224
- },
225
- "getBooleanParam": {
226
- "complexType": {
227
- "signature": "(name: string) => Promise<boolean>",
228
- "parameters": [{
229
- "tags": [],
230
- "text": ""
231
- }],
232
- "references": {
233
- "Promise": {
234
- "location": "global"
235
- }
236
- },
237
- "return": "Promise<boolean>"
238
- },
239
- "docs": {
240
- "text": "",
241
- "tags": []
242
- }
243
- },
244
- "getDateParam": {
245
- "complexType": {
246
- "signature": "(name: string) => Promise<Date>",
247
- "parameters": [{
248
- "tags": [],
249
- "text": ""
250
- }],
251
- "references": {
252
- "Promise": {
253
- "location": "global"
254
- },
255
- "Date": {
256
- "location": "global"
257
- }
258
- },
259
- "return": "Promise<Date>"
260
- },
261
- "docs": {
262
- "text": "",
263
- "tags": []
264
- }
265
- },
266
- "temOpcional": {
267
- "complexType": {
268
- "signature": "(opcional: string) => Promise<boolean>",
269
- "parameters": [{
270
- "tags": [],
271
- "text": ""
272
- }],
273
- "references": {
274
- "Promise": {
275
- "location": "global"
276
- }
277
- },
278
- "return": "Promise<boolean>"
279
- },
280
- "docs": {
281
- "text": "",
282
- "tags": []
283
- }
284
- },
285
- "getAttributeFromHTMLWrapper": {
286
- "complexType": {
287
- "signature": "(attribName: string) => Promise<string>",
288
- "parameters": [{
289
- "tags": [],
290
- "text": ""
291
- }],
292
- "references": {
293
- "Promise": {
294
- "location": "global"
295
- }
296
- },
297
- "return": "Promise<string>"
298
- },
299
- "docs": {
300
- "text": "",
301
- "tags": []
302
- }
303
- },
304
- "openApp": {
305
- "complexType": {
306
- "signature": "(resourceId: string, pkObject: Object) => Promise<void>",
307
- "parameters": [{
308
- "tags": [],
309
- "text": ""
310
- }, {
311
- "tags": [],
312
- "text": ""
313
- }],
314
- "references": {
315
- "Promise": {
316
- "location": "global"
317
- },
318
- "Object": {
319
- "location": "global"
320
- }
321
- },
322
- "return": "Promise<void>"
323
- },
324
- "docs": {
325
- "text": "",
326
- "tags": []
327
- }
328
- },
329
- "createDataunit": {
330
- "complexType": {
331
- "signature": "(entityName: string) => Promise<DataUnit>",
332
- "parameters": [{
333
- "tags": [],
334
- "text": ""
335
- }],
336
- "references": {
337
- "Promise": {
338
- "location": "global"
339
- },
340
- "DataUnit": {
341
- "location": "import",
342
- "path": "@sankhyalabs/core"
343
- }
344
- },
345
- "return": "Promise<DataUnit>"
346
- },
347
- "docs": {
348
- "text": "",
349
- "tags": []
350
- }
351
- },
352
- "getResourceID": {
353
- "complexType": {
354
- "signature": "() => Promise<string>",
355
- "parameters": [],
356
- "references": {
357
- "Promise": {
358
- "location": "global"
359
- }
360
- },
361
- "return": "Promise<string>"
362
- },
363
- "docs": {
364
- "text": "",
365
- "tags": []
366
- }
367
- },
368
- "alert": {
369
- "complexType": {
370
- "signature": "(title: string, message: string, icon?: string) => Promise<boolean>",
371
- "parameters": [{
372
- "tags": [],
373
- "text": ""
374
- }, {
375
- "tags": [],
376
- "text": ""
377
- }, {
378
- "tags": [],
379
- "text": ""
380
- }],
381
- "references": {
382
- "Promise": {
383
- "location": "global"
384
- }
385
- },
386
- "return": "Promise<boolean>"
387
- },
388
- "docs": {
389
- "text": "",
390
- "tags": []
391
- }
392
- },
393
- "error": {
394
- "complexType": {
395
- "signature": "(title: string, message: string, icon?: string) => Promise<boolean>",
396
- "parameters": [{
397
- "tags": [],
398
- "text": ""
399
- }, {
400
- "tags": [],
401
- "text": ""
402
- }, {
403
- "tags": [],
404
- "text": ""
405
- }],
406
- "references": {
407
- "Promise": {
408
- "location": "global"
409
- }
410
- },
411
- "return": "Promise<boolean>"
412
- },
413
- "docs": {
414
- "text": "",
415
- "tags": []
416
- }
417
- },
418
- "confirm": {
419
- "complexType": {
420
- "signature": "(title: string, message: string, icon?: string, critical?: boolean) => Promise<boolean>",
421
- "parameters": [{
422
- "tags": [],
423
- "text": ""
424
- }, {
425
- "tags": [],
426
- "text": ""
427
- }, {
428
- "tags": [],
429
- "text": ""
430
- }, {
431
- "tags": [],
432
- "text": ""
433
- }],
434
- "references": {
435
- "Promise": {
436
- "location": "global"
437
- }
438
- },
439
- "return": "Promise<boolean>"
440
- },
441
- "docs": {
442
- "text": "",
443
- "tags": []
444
- }
445
- },
446
- "info": {
447
- "complexType": {
448
- "signature": "(message: string, options?: any) => Promise<void>",
449
- "parameters": [{
450
- "tags": [],
451
- "text": ""
452
- }, {
453
- "tags": [],
454
- "text": ""
455
- }],
456
- "references": {
457
- "Promise": {
458
- "location": "global"
459
- }
460
- },
461
- "return": "Promise<void>"
462
- },
463
- "docs": {
464
- "text": "",
465
- "tags": []
466
- }
467
- },
468
- "loadFormConfig": {
469
- "complexType": {
470
- "signature": "(name: string) => Promise<Array<FieldConfig>>",
471
- "parameters": [{
472
- "tags": [],
473
- "text": ""
474
- }],
475
- "references": {
476
- "Promise": {
477
- "location": "global"
478
- },
479
- "FieldConfig": {
480
- "location": "import",
481
- "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
482
- },
483
- "Array": {
484
- "location": "global"
485
- }
486
- },
487
- "return": "Promise<FieldConfig[]>"
488
- },
489
- "docs": {
490
- "text": "",
491
- "tags": []
492
- }
493
- }
494
- }; }
495
- }
1
+ import { Component, h, Method, Event } from "@stencil/core";
2
+ import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
3
+ import UrlUtils from "../../lib/utils/urlutils";
4
+ import Workspace from "../../lib/workspace/workspace";
5
+ import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
6
+ import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
7
+ import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
8
+ import { ApplicationContext } from "@sankhyalabs/core";
9
+ import { pesquisaLoadOptions } from "../../lib/utils/pesquisa";
10
+ export class SnkApplication {
11
+ get parameters() {
12
+ if (!this._parameters) {
13
+ this._parameters = new ParametersFetcher();
14
+ }
15
+ return this._parameters;
16
+ }
17
+ get resourceID() {
18
+ if (!this._resourceID) {
19
+ this._resourceID = this.urlParams.get("workspaceResourceID") ||
20
+ this.urlParams.get("resourceID") ||
21
+ Workspace.resourceID ||
22
+ "unknown.resource.id";
23
+ }
24
+ return this._resourceID;
25
+ }
26
+ async getStringParam(name) {
27
+ return this.parameters.asString(name, this.resourceID);
28
+ }
29
+ async getIntParam(name) {
30
+ return this.parameters.asInteger(name, this.resourceID);
31
+ }
32
+ async getFloatParam(name) {
33
+ return this.parameters.asFloat(name, this.resourceID);
34
+ }
35
+ async getBooleanParam(name) {
36
+ return this.parameters.asBoolean(name, this.resourceID);
37
+ }
38
+ async getDateParam(name) {
39
+ return this.parameters.asDate(name, this.resourceID);
40
+ }
41
+ async temOpcional(opcional) {
42
+ const opts = opcional.split(",");
43
+ return new Promise((resolve, reject) => {
44
+ this.getAttributeFromHTMLWrapper("opc0009")
45
+ .then(value => {
46
+ if (value === "1") {
47
+ resolve(true);
48
+ }
49
+ else {
50
+ Promise.all(opts.map(opt => this.getAttributeFromHTMLWrapper("opc" + opt)))
51
+ .then(result => {
52
+ resolve(result.includes("1"));
53
+ })
54
+ .catch(error => {
55
+ reject(error);
56
+ });
57
+ }
58
+ })
59
+ .catch(error => {
60
+ reject(error);
61
+ });
62
+ });
63
+ }
64
+ async getAttributeFromHTMLWrapper(attribName) {
65
+ return Promise.resolve(window[attribName]);
66
+ }
67
+ async openApp(resourceId, pkObject) {
68
+ Workspace.openAppActivity(resourceId, pkObject);
69
+ }
70
+ async createDataunit(entityName) {
71
+ return new Promise(resolve => {
72
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
73
+ dataUnit.loadMetadata();
74
+ resolve(dataUnit);
75
+ });
76
+ }
77
+ async getResourceID() {
78
+ return Promise.resolve(this.resourceID);
79
+ }
80
+ async alert(title, message, icon) {
81
+ return ApplicationUtils.alert(title, message, icon);
82
+ }
83
+ async error(title, message, icon) {
84
+ return ApplicationUtils.error(title, message, icon);
85
+ }
86
+ async confirm(title, message, icon, critical) {
87
+ return ApplicationUtils.confirm(title, message, icon, critical);
88
+ }
89
+ async info(message, options = undefined) {
90
+ return ApplicationUtils.info(message, options);
91
+ }
92
+ async loadFormConfig(name) {
93
+ return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
94
+ }
95
+ get urlParams() {
96
+ if (!this._urlParams) {
97
+ this._urlParams = UrlUtils.getQueryParams(location.search);
98
+ }
99
+ return this._urlParams;
100
+ }
101
+ get dataUnitFetcher() {
102
+ if (!this._dataUnitFetcher) {
103
+ this._dataUnitFetcher = new DataUnitFetcher();
104
+ }
105
+ return this._dataUnitFetcher;
106
+ }
107
+ get formConfigFetcher() {
108
+ if (!this._formConfigFetcher) {
109
+ this._formConfigFetcher = new FormConfigFetcher();
110
+ }
111
+ return this._formConfigFetcher;
112
+ }
113
+ componentWillLoad() {
114
+ ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
115
+ }
116
+ componentDidLoad() {
117
+ this.applicationLoading.emit(true);
118
+ window.requestAnimationFrame(() => {
119
+ this.applicationLoaded.emit(true);
120
+ });
121
+ }
122
+ render() {
123
+ return (h("div", null));
124
+ }
125
+ static get is() { return "snk-application"; }
126
+ static get encapsulation() { return "scoped"; }
127
+ static get originalStyleUrls() { return {
128
+ "$": ["snk-application.css"]
129
+ }; }
130
+ static get styleUrls() { return {
131
+ "$": ["snk-application.css"]
132
+ }; }
133
+ static get events() { return [{
134
+ "method": "applicationLoaded",
135
+ "name": "applicationLoaded",
136
+ "bubbles": true,
137
+ "cancelable": true,
138
+ "composed": true,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": "Evento disparado quando a aplica\u00E7\u00E3o for carregada."
142
+ },
143
+ "complexType": {
144
+ "original": "boolean",
145
+ "resolved": "boolean",
146
+ "references": {}
147
+ }
148
+ }, {
149
+ "method": "applicationLoading",
150
+ "name": "applicationLoading",
151
+ "bubbles": true,
152
+ "cancelable": true,
153
+ "composed": true,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": "Evento"
157
+ },
158
+ "complexType": {
159
+ "original": "boolean",
160
+ "resolved": "boolean",
161
+ "references": {}
162
+ }
163
+ }]; }
164
+ static get methods() { return {
165
+ "getStringParam": {
166
+ "complexType": {
167
+ "signature": "(name: string) => Promise<string>",
168
+ "parameters": [{
169
+ "tags": [],
170
+ "text": ""
171
+ }],
172
+ "references": {
173
+ "Promise": {
174
+ "location": "global"
175
+ }
176
+ },
177
+ "return": "Promise<string>"
178
+ },
179
+ "docs": {
180
+ "text": "",
181
+ "tags": []
182
+ }
183
+ },
184
+ "getIntParam": {
185
+ "complexType": {
186
+ "signature": "(name: string) => Promise<number>",
187
+ "parameters": [{
188
+ "tags": [],
189
+ "text": ""
190
+ }],
191
+ "references": {
192
+ "Promise": {
193
+ "location": "global"
194
+ }
195
+ },
196
+ "return": "Promise<number>"
197
+ },
198
+ "docs": {
199
+ "text": "",
200
+ "tags": []
201
+ }
202
+ },
203
+ "getFloatParam": {
204
+ "complexType": {
205
+ "signature": "(name: string) => Promise<number>",
206
+ "parameters": [{
207
+ "tags": [],
208
+ "text": ""
209
+ }],
210
+ "references": {
211
+ "Promise": {
212
+ "location": "global"
213
+ }
214
+ },
215
+ "return": "Promise<number>"
216
+ },
217
+ "docs": {
218
+ "text": "",
219
+ "tags": []
220
+ }
221
+ },
222
+ "getBooleanParam": {
223
+ "complexType": {
224
+ "signature": "(name: string) => Promise<boolean>",
225
+ "parameters": [{
226
+ "tags": [],
227
+ "text": ""
228
+ }],
229
+ "references": {
230
+ "Promise": {
231
+ "location": "global"
232
+ }
233
+ },
234
+ "return": "Promise<boolean>"
235
+ },
236
+ "docs": {
237
+ "text": "",
238
+ "tags": []
239
+ }
240
+ },
241
+ "getDateParam": {
242
+ "complexType": {
243
+ "signature": "(name: string) => Promise<Date>",
244
+ "parameters": [{
245
+ "tags": [],
246
+ "text": ""
247
+ }],
248
+ "references": {
249
+ "Promise": {
250
+ "location": "global"
251
+ },
252
+ "Date": {
253
+ "location": "global"
254
+ }
255
+ },
256
+ "return": "Promise<Date>"
257
+ },
258
+ "docs": {
259
+ "text": "",
260
+ "tags": []
261
+ }
262
+ },
263
+ "temOpcional": {
264
+ "complexType": {
265
+ "signature": "(opcional: string) => Promise<boolean>",
266
+ "parameters": [{
267
+ "tags": [],
268
+ "text": ""
269
+ }],
270
+ "references": {
271
+ "Promise": {
272
+ "location": "global"
273
+ }
274
+ },
275
+ "return": "Promise<boolean>"
276
+ },
277
+ "docs": {
278
+ "text": "",
279
+ "tags": []
280
+ }
281
+ },
282
+ "getAttributeFromHTMLWrapper": {
283
+ "complexType": {
284
+ "signature": "(attribName: string) => Promise<string>",
285
+ "parameters": [{
286
+ "tags": [],
287
+ "text": ""
288
+ }],
289
+ "references": {
290
+ "Promise": {
291
+ "location": "global"
292
+ }
293
+ },
294
+ "return": "Promise<string>"
295
+ },
296
+ "docs": {
297
+ "text": "",
298
+ "tags": []
299
+ }
300
+ },
301
+ "openApp": {
302
+ "complexType": {
303
+ "signature": "(resourceId: string, pkObject: Object) => Promise<void>",
304
+ "parameters": [{
305
+ "tags": [],
306
+ "text": ""
307
+ }, {
308
+ "tags": [],
309
+ "text": ""
310
+ }],
311
+ "references": {
312
+ "Promise": {
313
+ "location": "global"
314
+ },
315
+ "Object": {
316
+ "location": "global"
317
+ }
318
+ },
319
+ "return": "Promise<void>"
320
+ },
321
+ "docs": {
322
+ "text": "",
323
+ "tags": []
324
+ }
325
+ },
326
+ "createDataunit": {
327
+ "complexType": {
328
+ "signature": "(entityName: string) => Promise<DataUnit>",
329
+ "parameters": [{
330
+ "tags": [],
331
+ "text": ""
332
+ }],
333
+ "references": {
334
+ "Promise": {
335
+ "location": "global"
336
+ },
337
+ "DataUnit": {
338
+ "location": "import",
339
+ "path": "@sankhyalabs/core"
340
+ }
341
+ },
342
+ "return": "Promise<DataUnit>"
343
+ },
344
+ "docs": {
345
+ "text": "",
346
+ "tags": []
347
+ }
348
+ },
349
+ "getResourceID": {
350
+ "complexType": {
351
+ "signature": "() => Promise<string>",
352
+ "parameters": [],
353
+ "references": {
354
+ "Promise": {
355
+ "location": "global"
356
+ }
357
+ },
358
+ "return": "Promise<string>"
359
+ },
360
+ "docs": {
361
+ "text": "",
362
+ "tags": []
363
+ }
364
+ },
365
+ "alert": {
366
+ "complexType": {
367
+ "signature": "(title: string, message: string, icon?: string) => Promise<boolean>",
368
+ "parameters": [{
369
+ "tags": [],
370
+ "text": ""
371
+ }, {
372
+ "tags": [],
373
+ "text": ""
374
+ }, {
375
+ "tags": [],
376
+ "text": ""
377
+ }],
378
+ "references": {
379
+ "Promise": {
380
+ "location": "global"
381
+ }
382
+ },
383
+ "return": "Promise<boolean>"
384
+ },
385
+ "docs": {
386
+ "text": "",
387
+ "tags": []
388
+ }
389
+ },
390
+ "error": {
391
+ "complexType": {
392
+ "signature": "(title: string, message: string, icon?: string) => Promise<boolean>",
393
+ "parameters": [{
394
+ "tags": [],
395
+ "text": ""
396
+ }, {
397
+ "tags": [],
398
+ "text": ""
399
+ }, {
400
+ "tags": [],
401
+ "text": ""
402
+ }],
403
+ "references": {
404
+ "Promise": {
405
+ "location": "global"
406
+ }
407
+ },
408
+ "return": "Promise<boolean>"
409
+ },
410
+ "docs": {
411
+ "text": "",
412
+ "tags": []
413
+ }
414
+ },
415
+ "confirm": {
416
+ "complexType": {
417
+ "signature": "(title: string, message: string, icon?: string, critical?: boolean) => Promise<boolean>",
418
+ "parameters": [{
419
+ "tags": [],
420
+ "text": ""
421
+ }, {
422
+ "tags": [],
423
+ "text": ""
424
+ }, {
425
+ "tags": [],
426
+ "text": ""
427
+ }, {
428
+ "tags": [],
429
+ "text": ""
430
+ }],
431
+ "references": {
432
+ "Promise": {
433
+ "location": "global"
434
+ }
435
+ },
436
+ "return": "Promise<boolean>"
437
+ },
438
+ "docs": {
439
+ "text": "",
440
+ "tags": []
441
+ }
442
+ },
443
+ "info": {
444
+ "complexType": {
445
+ "signature": "(message: string, options?: any) => Promise<void>",
446
+ "parameters": [{
447
+ "tags": [],
448
+ "text": ""
449
+ }, {
450
+ "tags": [],
451
+ "text": ""
452
+ }],
453
+ "references": {
454
+ "Promise": {
455
+ "location": "global"
456
+ }
457
+ },
458
+ "return": "Promise<void>"
459
+ },
460
+ "docs": {
461
+ "text": "",
462
+ "tags": []
463
+ }
464
+ },
465
+ "loadFormConfig": {
466
+ "complexType": {
467
+ "signature": "(name: string) => Promise<Array<FieldConfig>>",
468
+ "parameters": [{
469
+ "tags": [],
470
+ "text": ""
471
+ }],
472
+ "references": {
473
+ "Promise": {
474
+ "location": "global"
475
+ },
476
+ "FieldConfig": {
477
+ "location": "import",
478
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
479
+ },
480
+ "Array": {
481
+ "location": "global"
482
+ }
483
+ },
484
+ "return": "Promise<FieldConfig[]>"
485
+ },
486
+ "docs": {
487
+ "text": "",
488
+ "tags": []
489
+ }
490
+ }
491
+ }; }
492
+ }