@sankhyalabs/sankhyablocks 1.1.28 → 1.3.1

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 (236) 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 +2 -2
  5. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  6. package/dist/cjs/snk-application.cjs.entry.js +668 -653
  7. package/dist/collection/collection-manifest.json +5 -34
  8. package/dist/collection/components/snk-application/snk-application.css +5 -5
  9. package/dist/collection/components/snk-application/snk-application.js +492 -492
  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 +655 -640
  23. package/dist/esm/index-72d4e2e0.js +709 -0
  24. package/dist/esm/loader.js +2 -2
  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 +2 -2
  31. package/dist/esm/snk-application.entry.js +626 -611
  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/index.d.ts +1 -1
  37. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +15 -15
  38. package/dist/types/lib/http/data-fetcher/fetchers/application-config-fetcher.d.ts +6 -6
  39. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +12 -12
  40. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +5 -5
  41. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +2 -2
  42. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +13 -13
  43. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +6 -6
  44. package/dist/types/lib/http/data-fetcher/state/LoadStateManager.d.ts +23 -23
  45. package/dist/types/lib/utils/pesquisa.d.ts +2 -2
  46. package/dist/types/lib/utils/urlutils.d.ts +4 -4
  47. package/dist/types/lib/workspace/workspace.d.ts +4 -4
  48. package/package.json +63 -52
  49. package/react/.keepfolder +1 -0
  50. package/react/components.d.ts +3 -32
  51. package/react/components.js +5 -34
  52. package/react/components.js.map +1 -1
  53. package/react/react-component-lib/createComponent.d.ts +10 -10
  54. package/react/react-component-lib/createComponent.js +58 -74
  55. package/react/react-component-lib/createComponent.js.map +1 -1
  56. package/react/react-component-lib/createOverlayComponent.d.ts +20 -21
  57. package/react/react-component-lib/createOverlayComponent.js +88 -108
  58. package/react/react-component-lib/createOverlayComponent.js.map +1 -1
  59. package/react/react-component-lib/index.d.ts +2 -2
  60. package/react/react-component-lib/index.js +2 -2
  61. package/react/react-component-lib/interfaces.d.ts +29 -29
  62. package/react/react-component-lib/utils/attachProps.d.ts +12 -12
  63. package/react/react-component-lib/utils/attachProps.js +95 -97
  64. package/react/react-component-lib/utils/attachProps.js.map +1 -1
  65. package/react/react-component-lib/utils/case.d.ts +2 -2
  66. package/react/react-component-lib/utils/case.js +6 -6
  67. package/react/react-component-lib/utils/dev.d.ts +2 -2
  68. package/react/react-component-lib/utils/dev.js +12 -12
  69. package/react/react-component-lib/utils/index.d.ts +7 -10
  70. package/react/react-component-lib/utils/index.js +20 -33
  71. package/react/react-component-lib/utils/index.js.map +1 -1
  72. package/dist/cjs/ApplicationUtils-05b74ee9.js +0 -39
  73. package/dist/cjs/AssetsUtils-7e3c38f9.js +0 -24
  74. package/dist/cjs/CSSVarsUtils-75ca9c64.js +0 -19
  75. package/dist/cjs/_commonjsHelpers-537d719a.js +0 -20
  76. package/dist/cjs/ez-action-chip.cjs.entry.js +0 -27
  77. package/dist/cjs/ez-application.cjs.entry.js +0 -26
  78. package/dist/cjs/ez-button_4.cjs.entry.js +0 -660
  79. package/dist/cjs/ez-calendar.cjs.entry.js +0 -223
  80. package/dist/cjs/ez-collapsible-box.cjs.entry.js +0 -47
  81. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -278
  82. package/dist/cjs/ez-date-input.cjs.entry.js +0 -102
  83. package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -145
  84. package/dist/cjs/ez-dialog.cjs.entry.js +0 -89
  85. package/dist/cjs/ez-form.cjs.entry.js +0 -785
  86. package/dist/cjs/ez-grid.cjs.entry.js +0 -110485
  87. package/dist/cjs/ez-icon.cjs.entry.js +0 -41
  88. package/dist/cjs/ez-label-chip.cjs.entry.js +0 -104
  89. package/dist/cjs/ez-modal_2.cjs.entry.js +0 -316
  90. package/dist/cjs/ez-number-input.cjs.entry.js +0 -86
  91. package/dist/cjs/ez-popover.cjs.entry.js +0 -120
  92. package/dist/cjs/ez-popup.cjs.entry.js +0 -48
  93. package/dist/cjs/ez-search.cjs.entry.js +0 -64
  94. package/dist/cjs/ez-tabselector.cjs.entry.js +0 -198
  95. package/dist/cjs/ez-text-area.cjs.entry.js +0 -114
  96. package/dist/cjs/ez-text-input.cjs.entry.js +0 -201
  97. package/dist/cjs/ez-time-input.cjs.entry.js +0 -118
  98. package/dist/cjs/ez-toast.cjs.entry.js +0 -44
  99. package/dist/cjs/ez-upload.cjs.entry.js +0 -356
  100. package/dist/cjs/index-682c98b2.js +0 -1771
  101. package/dist/cjs/test-du.cjs.entry.js +0 -76
  102. package/dist/components/ApplicationUtils.js +0 -37
  103. package/dist/components/AssetsUtils.js +0 -22
  104. package/dist/components/CSSVarsUtils.js +0 -17
  105. package/dist/components/_commonjsHelpers.js +0 -17
  106. package/dist/components/ez-action-chip.js +0 -44
  107. package/dist/components/ez-application.js +0 -39
  108. package/dist/components/ez-button.js +0 -6
  109. package/dist/components/ez-button2.js +0 -105
  110. package/dist/components/ez-calendar.js +0 -6
  111. package/dist/components/ez-calendar2.js +0 -242
  112. package/dist/components/ez-check.js +0 -6
  113. package/dist/components/ez-check2.js +0 -94
  114. package/dist/components/ez-collapsible-box.js +0 -67
  115. package/dist/components/ez-combo-box.js +0 -6
  116. package/dist/components/ez-combo-box2.js +0 -311
  117. package/dist/components/ez-date-input.js +0 -135
  118. package/dist/components/ez-date-time-input.js +0 -179
  119. package/dist/components/ez-dialog.js +0 -124
  120. package/dist/components/ez-form.js +0 -6
  121. package/dist/components/ez-form2.js +0 -807
  122. package/dist/components/ez-grid.js +0 -110576
  123. package/dist/components/ez-icon.js +0 -6
  124. package/dist/components/ez-icon2.js +0 -56
  125. package/dist/components/ez-label-chip.js +0 -125
  126. package/dist/components/ez-list.js +0 -6
  127. package/dist/components/ez-list2.js +0 -523
  128. package/dist/components/ez-modal.js +0 -6
  129. package/dist/components/ez-modal2.js +0 -82
  130. package/dist/components/ez-number-input.js +0 -115
  131. package/dist/components/ez-popover.js +0 -145
  132. package/dist/components/ez-popup.js +0 -67
  133. package/dist/components/ez-search.js +0 -100
  134. package/dist/components/ez-tabselector.js +0 -6
  135. package/dist/components/ez-tabselector2.js +0 -213
  136. package/dist/components/ez-text-area.js +0 -137
  137. package/dist/components/ez-text-input.js +0 -6
  138. package/dist/components/ez-text-input2.js +0 -223
  139. package/dist/components/ez-time-input.js +0 -153
  140. package/dist/components/ez-toast.js +0 -64
  141. package/dist/components/ez-upload.js +0 -382
  142. package/dist/components/grid-config.js +0 -6
  143. package/dist/components/grid-config2.js +0 -318
  144. package/dist/components/select-box.js +0 -6
  145. package/dist/components/select-box2.js +0 -47
  146. package/dist/components/test-du.js +0 -101
  147. package/dist/esm/ApplicationUtils-e0b6d857.js +0 -37
  148. package/dist/esm/AssetsUtils-6e6624dc.js +0 -22
  149. package/dist/esm/CSSVarsUtils-0787c3f3.js +0 -17
  150. package/dist/esm/_commonjsHelpers-9943807e.js +0 -17
  151. package/dist/esm/ez-action-chip.entry.js +0 -23
  152. package/dist/esm/ez-application.entry.js +0 -22
  153. package/dist/esm/ez-button_4.entry.js +0 -653
  154. package/dist/esm/ez-calendar.entry.js +0 -219
  155. package/dist/esm/ez-collapsible-box.entry.js +0 -43
  156. package/dist/esm/ez-combo-box.entry.js +0 -274
  157. package/dist/esm/ez-date-input.entry.js +0 -98
  158. package/dist/esm/ez-date-time-input.entry.js +0 -141
  159. package/dist/esm/ez-dialog.entry.js +0 -85
  160. package/dist/esm/ez-form.entry.js +0 -781
  161. package/dist/esm/ez-grid.entry.js +0 -110481
  162. package/dist/esm/ez-icon.entry.js +0 -37
  163. package/dist/esm/ez-label-chip.entry.js +0 -100
  164. package/dist/esm/ez-modal_2.entry.js +0 -311
  165. package/dist/esm/ez-number-input.entry.js +0 -82
  166. package/dist/esm/ez-popover.entry.js +0 -116
  167. package/dist/esm/ez-popup.entry.js +0 -44
  168. package/dist/esm/ez-search.entry.js +0 -60
  169. package/dist/esm/ez-tabselector.entry.js +0 -194
  170. package/dist/esm/ez-text-area.entry.js +0 -110
  171. package/dist/esm/ez-text-input.entry.js +0 -197
  172. package/dist/esm/ez-time-input.entry.js +0 -114
  173. package/dist/esm/ez-toast.entry.js +0 -40
  174. package/dist/esm/ez-upload.entry.js +0 -352
  175. package/dist/esm/index-35088a3f.js +0 -1740
  176. package/dist/esm/test-du.entry.js +0 -72
  177. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +0 -67
  178. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +0 -3
  179. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +0 -180
  180. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +0 -319
  181. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +0 -327
  182. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +0 -162
  183. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -217
  184. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +0 -49
  185. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -44
  186. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +0 -527
  187. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +0 -5
  188. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +0 -31
  189. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +0 -129
  190. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +0 -10
  191. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +0 -176
  192. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +0 -139
  193. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +0 -335
  194. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +0 -358
  195. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +0 -4
  196. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +0 -44
  197. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +0 -405
  198. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +0 -3
  199. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -138
  200. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +0 -165
  201. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +0 -196
  202. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +0 -10
  203. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +0 -127
  204. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +0 -568
  205. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +0 -3
  206. package/dist/sankhyablocks/p-0183d259.entry.js +0 -1
  207. package/dist/sankhyablocks/p-01f23a70.entry.js +0 -1
  208. package/dist/sankhyablocks/p-07c32f68.entry.js +0 -1
  209. package/dist/sankhyablocks/p-0f90499d.entry.js +0 -1
  210. package/dist/sankhyablocks/p-105724a3.entry.js +0 -1
  211. package/dist/sankhyablocks/p-112455b1.js +0 -1
  212. package/dist/sankhyablocks/p-2ac02d48.entry.js +0 -1
  213. package/dist/sankhyablocks/p-35364a97.entry.js +0 -1
  214. package/dist/sankhyablocks/p-3f6aa9a7.entry.js +0 -1
  215. package/dist/sankhyablocks/p-4811bc0a.entry.js +0 -369
  216. package/dist/sankhyablocks/p-5f9af495.entry.js +0 -1
  217. package/dist/sankhyablocks/p-60967cf0.js +0 -1
  218. package/dist/sankhyablocks/p-70ad6c16.entry.js +0 -1
  219. package/dist/sankhyablocks/p-710bfffe.entry.js +0 -1
  220. package/dist/sankhyablocks/p-73397a0f.entry.js +0 -57
  221. package/dist/sankhyablocks/p-811b4b9d.js +0 -1
  222. package/dist/sankhyablocks/p-813fe4f7.js +0 -1
  223. package/dist/sankhyablocks/p-85a9446b.js +0 -2
  224. package/dist/sankhyablocks/p-89a1100f.entry.js +0 -1
  225. package/dist/sankhyablocks/p-8b543003.entry.js +0 -1
  226. package/dist/sankhyablocks/p-9750632b.entry.js +0 -1
  227. package/dist/sankhyablocks/p-a96272f7.entry.js +0 -1
  228. package/dist/sankhyablocks/p-ac8842e5.entry.js +0 -1
  229. package/dist/sankhyablocks/p-ba64cc41.entry.js +0 -1
  230. package/dist/sankhyablocks/p-c1ede043.entry.js +0 -1
  231. package/dist/sankhyablocks/p-d90ebb85.entry.js +0 -1
  232. package/dist/sankhyablocks/p-e5355a29.entry.js +0 -1
  233. package/dist/sankhyablocks/p-ef04b633.entry.js +0 -1
  234. package/dist/sankhyablocks/p-f6db07fb.entry.js +0 -1
  235. package/dist/sankhyablocks/p-f80cabc7.entry.js +0 -1
  236. package/dist/sankhyablocks/p-fcd9bd92.entry.js +0 -1
@@ -1,492 +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
- 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
- }
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
+ }