@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,158 +0,0 @@
1
- import { batchRequests } from 'graphql-request';
2
- export class HttpFetcher {
3
- constructor() {
4
- this.watingRequestsById = new Map();
5
- }
6
- static get() {
7
- if (!HttpFetcher.instance) {
8
- HttpFetcher.instance = new HttpFetcher();
9
- const application = document.querySelector(this.appTagName);
10
- if (application === null) {
11
- HttpFetcher.instance.resume();
12
- }
13
- else {
14
- application.addEventListener('applicationLoading', () => HttpFetcher.instance.pause());
15
- application.addEventListener('applicationLoaded', () => HttpFetcher.instance.resume());
16
- }
17
- }
18
- return this.instance;
19
- }
20
- async callGraphQL(req) {
21
- var _a;
22
- const reqKey = this.getReqKey(req);
23
- req.queryID = reqKey;
24
- req.values.queryID = reqKey;
25
- if (this.ready) {
26
- return new Promise(async (resolve, reject) => {
27
- let query = this.getQueryTemplate(req);
28
- const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
29
- if (res.errors.length > 0) {
30
- reject(res);
31
- }
32
- else {
33
- //resolve(res);
34
- //FIXME: Precisamos trabalhar melhor a resposta, quem chamou
35
- //a API não pode ficar responsavel por desempacotar... fiz uma
36
- //gambiarra aqui...
37
- resolve(res.data[0][reqKey]);
38
- }
39
- });
40
- }
41
- else {
42
- if (!this.watingRequestsById.has(reqKey)) {
43
- this.watingRequestsById.set(reqKey, new WaitingRequest(req));
44
- }
45
- return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
46
- }
47
- }
48
- getReqKey(req) {
49
- return window.btoa(this.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
50
- }
51
- getQueryTemplate(re) {
52
- return (re.query || "").replaceAll("$queryAlias$", re.queryID);
53
- }
54
- getWatingRequest(reqID) {
55
- return this.watingRequestsById.get(reqID);
56
- }
57
- pause() {
58
- this.ready = false;
59
- }
60
- async resume() {
61
- this.ready = true;
62
- if (this.watingRequestsById.size > 0) {
63
- const requestsBatch = [];
64
- this.watingRequestsById.forEach(async (waitingReq) => {
65
- let query = this.getQueryTemplate(waitingReq.request);
66
- requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
67
- });
68
- let res = undefined;
69
- let dataResponse = [];
70
- let errorsResponse = [];
71
- res = await this.fecthGrapql(requestsBatch);
72
- dataResponse = res.data;
73
- errorsResponse = res.errors;
74
- //Reject promises with errors from query
75
- errorsResponse.forEach((errorResponse) => {
76
- Object.entries(errorResponse).forEach(([_key, val]) => {
77
- var _a;
78
- (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(val);
79
- });
80
- });
81
- //Resolve promises with data from query
82
- dataResponse.forEach((data) => {
83
- Object.entries(data).forEach(([key, val]) => {
84
- var _a;
85
- (((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
86
- });
87
- });
88
- this.watingRequestsById.clear();
89
- }
90
- }
91
- async fecthGrapql(request) {
92
- let res = undefined;
93
- let dataResponse = [];
94
- let errorsResponse = [];
95
- try {
96
- res = await batchRequests('http://localhost:8082/', request);
97
- res.forEach((resItem) => {
98
- dataResponse.push(resItem.data);
99
- });
100
- }
101
- catch (err) {
102
- //TODO: Tratar erro quando não existir err.response
103
- res = err.response;
104
- const req = err.request;
105
- Object.entries(res).forEach(([key, val]) => {
106
- if (val.errors) {
107
- errorsResponse.push(val.errors.map((item) => {
108
- item.request = req;
109
- item.index = Number(key);
110
- return item;
111
- }));
112
- }
113
- else if (val.data) {
114
- dataResponse.push(val.data);
115
- }
116
- });
117
- }
118
- return { data: dataResponse, errors: errorsResponse };
119
- }
120
- //TODO: Mover este metodo para o @sankhyalabs/core classe string utils.
121
- hashCode(txt) {
122
- var hash = 0, i, chr;
123
- if (txt.length === 0)
124
- return hash.toString();
125
- for (i = 0; i < txt.length; i++) {
126
- chr = txt.charCodeAt(i);
127
- hash = ((hash << 5) - hash) + chr;
128
- hash |= 0; // Convert to 32bit integer
129
- }
130
- return hash.toString();
131
- }
132
- ;
133
- }
134
- HttpFetcher.appTagName = "snk-application";
135
- class WaitingRequest {
136
- constructor(req) {
137
- this._resolve = () => { };
138
- this._reject = () => { };
139
- this._request = undefined;
140
- this._request = req;
141
- this._promisse = new Promise((resolve, reject) => {
142
- this._resolve = resolve;
143
- this._reject = reject;
144
- });
145
- }
146
- get resolve() {
147
- return this._resolve;
148
- }
149
- get reject() {
150
- return this._reject;
151
- }
152
- get promise() {
153
- return this._promisse;
154
- }
155
- get request() {
156
- return this._request;
157
- }
158
- }
@@ -1,23 +0,0 @@
1
- import { gql } from "graphql-request";
2
- import { HttpFetcher } from "../DataFetcher";
3
- export default class ApplicationConfigFetcher {
4
- constructor() {
5
- this.templateByQuery = new Map();
6
- this.buldTemplates();
7
- }
8
- buldTemplates() {
9
- this.templateByQuery.set("getResource", gql `query($name: String!) {
10
- $queryAlias$: getResource(name: $name){
11
- name
12
- resource
13
- }
14
- }`);
15
- }
16
- getResource(name, resourceID) {
17
- const completPath = `cfg://app/${resourceID}/${name}`;
18
- return HttpFetcher.get().callGraphQL({
19
- values: { name: completPath },
20
- query: this.templateByQuery.get("getResource"),
21
- });
22
- }
23
- }
@@ -1,188 +0,0 @@
1
- import { DataUnit, ChangeOperation, } from "@sankhyalabs/core";
2
- import { HttpFetcher } from "../DataFetcher";
3
- import { gql } from "graphql-request";
4
- export default class DataUnitFetcher {
5
- constructor() {
6
- this.templateByQuery = new Map();
7
- this.buldTemplates();
8
- }
9
- buldTemplates() {
10
- this.templateByQuery.set("fetchDataUnit", gql `query($name: String!) {
11
- $queryAlias$: fetchDataUnit(name: $name){
12
- name
13
- fields{
14
- name
15
- defaultValue
16
- label
17
- readOnly
18
- required
19
- dataType
20
- userInterface
21
- properties{
22
- name
23
- value
24
- }
25
- dependencies{
26
- masterFields
27
- type
28
- expression
29
- }
30
- }
31
- }
32
- }`);
33
- this.templateByQuery.set("fetchData", gql `query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
34
- $queryAlias$: fetchDataUnit(name: $dataunit){
35
- data(first: $first offset: $offset filters: $filter sort: $sort){
36
- first
37
- offset
38
- total
39
- hasMore
40
- records{
41
- id
42
- fields {
43
- name
44
- value
45
- }
46
- }
47
- }
48
- }
49
- }`);
50
- this.templateByQuery.set("saveData", gql `mutation($changes: [Change!]!) {
51
- $queryAlias$: saveDataUnitChanges(changes: $changes){
52
- oldId
53
- id
54
- fields {
55
- name
56
- value
57
- }
58
- }
59
- }`);
60
- }
61
- getDataUnit(entityName, resourceID) {
62
- const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
63
- dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
64
- dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
65
- dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
66
- dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
67
- return dataUnit;
68
- }
69
- loadMetadata(dataUnit) {
70
- return new Promise((resolve, reject) => {
71
- HttpFetcher.get()
72
- .callGraphQL({
73
- values: { name: dataUnit.name },
74
- query: this.templateByQuery.get("fetchDataUnit"),
75
- })
76
- .then((resp) => {
77
- var _a;
78
- const metadata = {
79
- name: resp.name,
80
- label: resp.name,
81
- fields: [],
82
- };
83
- (_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
84
- let properties = undefined;
85
- if (Array.isArray(source.properties)) {
86
- properties = {};
87
- source.properties.forEach((prop) => (properties[prop.name] = prop.value));
88
- }
89
- metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
90
- });
91
- resolve(metadata);
92
- })
93
- .catch((error) => {
94
- reject(error);
95
- });
96
- });
97
- }
98
- loadData(dataUnit, sort, filters) {
99
- return new Promise((resolve, reject) => {
100
- HttpFetcher.get()
101
- .callGraphQL({
102
- values: { dataunit: dataUnit.name, sort, filters },
103
- query: this.templateByQuery.get("fetchData"),
104
- })
105
- .then((resp) => {
106
- const result = resp.data;
107
- const dataUnitRecords = [];
108
- result.records.forEach((responseRecord) => {
109
- const duRecord = { __record__id__: responseRecord.id };
110
- responseRecord.fields.forEach(({ name, value }) => {
111
- duRecord[name] = dataUnit.valueFromString(name, value);
112
- });
113
- dataUnitRecords.push(duRecord);
114
- });
115
- resolve(dataUnitRecords);
116
- })
117
- .catch((error) => {
118
- reject(error);
119
- });
120
- });
121
- }
122
- saveData(dataUnit, duChanges) {
123
- const changes = duChanges.map((change) => {
124
- const { dataUnit: changeDU, record, updatingFields, operation } = change;
125
- const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
126
- return { fieldName, value: this.formatValueToServer(value) };
127
- });
128
- return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
129
- });
130
- return new Promise((resolve, reject) => {
131
- HttpFetcher.get()
132
- .callGraphQL({
133
- values: { changes: changes },
134
- query: this.templateByQuery.get("saveData"),
135
- })
136
- .then((resp) => {
137
- const dataUnitRecords = [];
138
- resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
139
- const duRecord = { __record__id__: responseRecord.id };
140
- if (responseRecord.oldId) {
141
- duRecord.__old__id__ = responseRecord.oldId;
142
- }
143
- responseRecord.fields.forEach(({ name, value }) => {
144
- duRecord[name] = dataUnit.valueFromString(name, value);
145
- });
146
- dataUnitRecords.push(duRecord);
147
- });
148
- resolve(dataUnitRecords);
149
- })
150
- .catch((error) => {
151
- reject(error);
152
- });
153
- });
154
- }
155
- formatValueToServer(value) {
156
- if (value === undefined)
157
- return value;
158
- try {
159
- if (value instanceof Date) {
160
- return value.toString();
161
- }
162
- //Any others objects
163
- value = JSON.stringify(value);
164
- }
165
- catch (_a) {
166
- value = value.toString();
167
- }
168
- return value;
169
- }
170
- removeRecords(dataUnit, recordIds) {
171
- const changes = recordIds.map((recordId) => {
172
- return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
173
- });
174
- return new Promise((resolve, reject) => {
175
- HttpFetcher.get()
176
- .callGraphQL({
177
- values: { changes: changes },
178
- query: this.templateByQuery.get("saveData"),
179
- })
180
- .then((_resp) => {
181
- resolve(recordIds);
182
- })
183
- .catch((error) => {
184
- reject(error);
185
- });
186
- });
187
- }
188
- }
@@ -1,25 +0,0 @@
1
- import { ResourceFetcher } from "./resource-fetcher";
2
- export class FormConfigFetcher extends ResourceFetcher {
3
- loadFormConfig(formName, resourceID) {
4
- return new Promise((accept, reject) => {
5
- this.loadResource(`cfg://form/${resourceID}/${formName}`)
6
- .then((configAsString) => {
7
- if (configAsString) {
8
- const config = JSON.parse(configAsString);
9
- const { tabs, fields } = config;
10
- if (tabs) {
11
- const allTabs = new Map(tabs.map(t => [t.label, t]));
12
- fields.forEach(f => f.tab = allTabs.get(f.tab));
13
- }
14
- accept(fields);
15
- }
16
- else {
17
- reject(`Sem configuração pro formulário "${formName}".`);
18
- }
19
- })
20
- .catch((error) => {
21
- reject(error);
22
- });
23
- });
24
- }
25
- }
@@ -1,2 +0,0 @@
1
- export class GridConfigFetcher {
2
- }
@@ -1,59 +0,0 @@
1
- import { gql } from "graphql-request";
2
- import { DateUtils, StringUtils } from "@sankhyalabs/core";
3
- import { HttpFetcher } from "../DataFetcher";
4
- export default class ParametersFetcher {
5
- constructor() {
6
- this.templateByQuery = new Map();
7
- this.buldTemplates();
8
- }
9
- buldTemplates() {
10
- this.templateByQuery.set("fetchParam", gql `query($name: String!) {
11
- $queryAlias$: fetchResource(name: $name){
12
- name
13
- resource
14
- }
15
- }`);
16
- }
17
- async getParam(name, resourceID) {
18
- const completPath = `param://${resourceID}?params=${window.btoa(name)}`;
19
- return HttpFetcher.get().callGraphQL({
20
- values: { name: completPath },
21
- query: this.templateByQuery.get("fetchParam"),
22
- });
23
- }
24
- async asString(name, resourceID) {
25
- const paramArr = await this.getParam(name, resourceID);
26
- return this.getValue(paramArr);
27
- }
28
- async asInteger(name, resourceID) {
29
- const paramArr = await this.getParam(name, resourceID);
30
- return parseInt(this.getValue(paramArr));
31
- }
32
- async asFloat(name, resourceID) {
33
- const paramArr = await this.getParam(name, resourceID);
34
- return parseFloat(this.getValue(paramArr));
35
- }
36
- async asBoolean(name, resourceID) {
37
- const paramArr = await this.getParam(name, resourceID);
38
- return this.getValue(paramArr) == "S";
39
- }
40
- async asDate(name, resourceID) {
41
- const paramArr = await this.getParam(name, resourceID);
42
- return DateUtils.strToDate(this.getValue(paramArr));
43
- }
44
- async getBatchParams(names, resourceID) {
45
- const paramArr = await this.getParam(names.join(","), resourceID);
46
- //TODO: try to typed params val?
47
- const response = {};
48
- paramArr.forEach((param) => (response[param.name] = param.resource));
49
- return response;
50
- }
51
- getValue(obj = {}) {
52
- if (Array.isArray(obj) && obj.length > 0) {
53
- obj = obj[0];
54
- }
55
- if (StringUtils.isEmpty(obj.resource))
56
- return "";
57
- return obj.resource;
58
- }
59
- }
@@ -1,30 +0,0 @@
1
- import { gql } from "graphql-request";
2
- import { HttpFetcher } from "../DataFetcher";
3
- export class ResourceFetcher {
4
- constructor() {
5
- this.templateByQuery = new Map();
6
- this.buldTemplates();
7
- }
8
- buldTemplates() {
9
- this.templateByQuery.set("fetchResource", gql `query($name: String!) {
10
- $queryAlias$: fetchResource(name: $name){
11
- resource
12
- }
13
- }`);
14
- }
15
- loadResource(name) {
16
- return new Promise((resolve, reject) => {
17
- HttpFetcher.get()
18
- .callGraphQL({
19
- values: { name },
20
- query: this.templateByQuery.get("fetchResource"),
21
- })
22
- .then((result) => {
23
- resolve(result === null || result === void 0 ? void 0 : result.resource);
24
- })
25
- .catch((error) => {
26
- reject(error);
27
- });
28
- });
29
- }
30
- }
@@ -1,66 +0,0 @@
1
- export class LoadStateManager {
2
- constructor(appName = 'snk-application') {
3
- this._state = LoadStatus.DOM_LOADED;
4
- this._application = document.querySelector(appName);
5
- if (this._application === null) {
6
- console.warn(`application ${appName} not found, then state is loadded`);
7
- this.onStatusChange(LoadStatus.LOADED);
8
- }
9
- else {
10
- this._application.addEventListener('applicationLoaded', () => this.onStatusChange(LoadStatus.LOADED));
11
- this._application.addEventListener('applicationLoading', () => this.onStatusChange(LoadStatus.PRE_INITIALIZE));
12
- this.onStatusChange(LoadStatus.PRE_INITIALIZE);
13
- }
14
- }
15
- async onStatusChange(newStatus) {
16
- this._state = newStatus;
17
- (LoadStateManager.listenersByType.get(newStatus) || []).forEach((listener) => {
18
- listener();
19
- });
20
- }
21
- addListener(status, listener) {
22
- var _a;
23
- if (!LoadStateManager.listenersByType.has(status)) {
24
- LoadStateManager.listenersByType.set(status, []);
25
- }
26
- (_a = LoadStateManager.listenersByType.get(status)) === null || _a === void 0 ? void 0 : _a.push(listener);
27
- if (status === this._state) {
28
- listener();
29
- }
30
- }
31
- onPreInitialize(listener) {
32
- this.addListener(LoadStatus.PRE_INITIALIZE, listener);
33
- return this;
34
- }
35
- onLoaded(listener) {
36
- this.addListener(LoadStatus.LOADED, listener);
37
- return this;
38
- }
39
- getStatus() {
40
- return this._state;
41
- }
42
- isPreInitialize() {
43
- return this._state === LoadStatus.PRE_INITIALIZE;
44
- }
45
- isLoaded() {
46
- return this._state === LoadStatus.LOADED;
47
- }
48
- static get(type = LoadType.APP_LOAD) {
49
- if (!LoadStateManager.instanceByStatus.has(type)) {
50
- LoadStateManager.instanceByStatus.set(type, new LoadStateManager());
51
- }
52
- return LoadStateManager.instanceByStatus.get(type) || new LoadStateManager();
53
- }
54
- }
55
- LoadStateManager.instanceByStatus = new Map();
56
- LoadStateManager.listenersByType = new Map();
57
- export var LoadStatus;
58
- (function (LoadStatus) {
59
- LoadStatus["DOM_LOADED"] = "DOM_LOADED";
60
- LoadStatus["PRE_INITIALIZE"] = "PRE_INITIALIZE";
61
- LoadStatus["LOADED"] = "LOADED";
62
- })(LoadStatus || (LoadStatus = {}));
63
- export var LoadType;
64
- (function (LoadType) {
65
- LoadType["APP_LOAD"] = "APP_LOAD";
66
- })(LoadType || (LoadType = {}));
@@ -1,16 +0,0 @@
1
- const mockByEntity = {
2
- "ImplantacaoSaldoConta": [{ "value": 6, "label": "Conta Financeiro" }, { "value": 7, "label": "Conta Banco do Brasil" }],
3
- "HistoricoBancario": [{ "value": 9, "label": "Lanç. Origem" }, { "value": 8, "label": "Lanç. Origem 2" }],
4
- "ContaDestino": [{ "value": 10, "label": "Conta BB" }, { "value": 7, "label": "Conta Santander" }],
5
- "HistoricoBancarioDestino": [{ "value": 11, "label": "Contra Bradesco" }, { "value": 13, "label": "Contra Destino" }],
6
- "Usuario": [{ "value": 0, "label": "SUP" }],
7
- "ContaBancaria": [{ "value": 10, "label": "Conta 10" }, { "value": 17, "label": "Conta 17" }],
8
- "TipoOperacao": [{ "value": 4, "label": "Entrada NFse" }, { "value": 5, "label": "Outra top" }, { "value": 6, "label": "Top 6" }]
9
- };
10
- export const pesquisaLoadOptions = (searchArgument, fieldName, dataUnit) => {
11
- var _a;
12
- console.log(searchArgument);
13
- const field = dataUnit.getField(fieldName);
14
- const entityName = (_a = field.properties) === null || _a === void 0 ? void 0 : _a.ENTITYNAME;
15
- return (mockByEntity[entityName] || []);
16
- };
@@ -1,23 +0,0 @@
1
- export default class UrlUtils {
2
- static getQueryParams(queryString) {
3
- const params = new Map();
4
- const re = /[?&]?([^=]+)=([^&]*)/g;
5
- let tokens;
6
- //Necessário por causa da tela Histórico Padrão que possui resourceID com acento
7
- queryString = window.unescape(queryString);
8
- queryString = queryString.split("+").join(" ");
9
- while ((tokens = re.exec(queryString))) {
10
- params.set(window.decodeURIComponent(tokens[1]), tokens[2]);
11
- }
12
- //Inserimos a urlBase no params.
13
- params.set("urlBase", this.getUrlBase());
14
- if (window["moduleID"] && window["URIServiceBroker"]) {
15
- params.set("moduleID", window["moduleID"]);
16
- params.set("URIServiceBroker", window["URIServiceBroker"]);
17
- }
18
- return params;
19
- }
20
- static getUrlBase() {
21
- return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
22
- }
23
- }
@@ -1,7 +0,0 @@
1
- export default class Workspace {
2
- static openAppActivity(resourceId, pkObject) {
3
- var _a;
4
- (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
5
- }
6
- }
7
- Workspace.resourceID = window["workspace"].resourceID;
@@ -1,37 +0,0 @@
1
- class ApplicationUtils {
2
- static async showDialog(title, message, icon = null, confirm, critical = false) {
3
- return new Promise(resolve => {
4
- let dialog = document.querySelector("ez-dialog");
5
- if (!dialog) {
6
- dialog = document.createElement("ez-dialog");
7
- window.document.body.appendChild(dialog);
8
- }
9
- dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
10
- });
11
- }
12
- static async alert(title, message, icon = null) {
13
- return ApplicationUtils.showDialog(title, message, icon, false, false);
14
- }
15
- static async error(title, message, icon = null) {
16
- return ApplicationUtils.showDialog(title, message, icon, false, true);
17
- }
18
- static async confirm(title, message, icon = null, critical = false) {
19
- return ApplicationUtils.showDialog(title, message, icon, true, critical);
20
- }
21
- static async info(message, options = ApplicationUtils.defaultMessageOptions) {
22
- let toast = document.querySelector("ez-toast");
23
- if (!toast) {
24
- toast = document.createElement("ez-toast");
25
- window.document.body.appendChild(toast);
26
- }
27
- toast.canClose = options.canClose;
28
- toast.message = message;
29
- toast.fadeTime = 4000;
30
- toast.show();
31
- }
32
- }
33
- ApplicationUtils.defaultMessageOptions = {
34
- canClose: true
35
- };
36
-
37
- export { ApplicationUtils as A };
@@ -1,22 +0,0 @@
1
- import { getAssetPath, setAssetPath } from '@stencil/core/internal/client';
2
-
3
- const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
4
- let ctxLoaded = false;
5
- function getContextAssetsPath(resource) {
6
- if (!ctxLoaded) {
7
- const scriptElem = document.querySelector("script[data-ezui-assets-url]");
8
- if (scriptElem) {
9
- let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
10
- if (assetsPath) {
11
- if (assetsPath.startsWith('/')) {
12
- assetsPath = window.location.origin + assetsPath;
13
- }
14
- setAssetPath(assetsPath);
15
- }
16
- }
17
- ctxLoaded = true;
18
- }
19
- return getAssetPath(resource);
20
- }
21
-
22
- export { getSpritePath as g };
@@ -1,17 +0,0 @@
1
- class CSSVarsUtils {
2
- static applyVarsTextInput(host, child) {
3
- if (child) {
4
- CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
5
- CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
6
- CSSVarsUtils.applyIfExists(host, child, '--ez-text-input--height');
7
- }
8
- }
9
- static applyIfExists(host, element, varName) {
10
- const prop = getComputedStyle(host).getPropertyValue(varName);
11
- if (prop) {
12
- element.style.setProperty(varName, prop);
13
- }
14
- }
15
- }
16
-
17
- export { CSSVarsUtils as C };