@sankhyalabs/sankhyablocks 8.1.0 → 8.2.0-dev.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 (221) hide show
  1. package/dist/cjs/{ConfigStorage-73e7afff.js → ConfigStorage-12397f18.js} +163 -51
  2. package/dist/cjs/{DataFetcher-004811c6.js → DataFetcher-f2da1f79.js} +68 -30
  3. package/dist/cjs/ISave-d68ce3cd.js +8 -0
  4. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  5. package/dist/cjs/{SnkFormConfigManager-d1f1a222.js → SnkFormConfigManager-13f79e37.js} +19 -21
  6. package/dist/cjs/auth-fetcher-319a4cb2.js +34 -0
  7. package/dist/cjs/{dataunit-fetcher-029eafbd.js → dataunit-fetcher-e72068c1.js} +1 -1
  8. package/dist/cjs/{form-config-fetcher-181767c9.js → form-config-fetcher-5d62ab62.js} +66 -3
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-9a97994a.js → pesquisa-fetcher-8c363096.js} +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button.cjs.entry.js +18 -11
  13. package/dist/cjs/snk-application.cjs.entry.js +51 -73
  14. package/dist/cjs/snk-attach.cjs.entry.js +7 -13
  15. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  16. package/dist/cjs/snk-crud.cjs.entry.js +28 -9
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  18. package/dist/cjs/{snk-data-unit-d5109a08.js → snk-data-unit-80a00ae4.js} +8 -6
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +18 -25
  21. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +14 -17
  23. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
  24. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -19
  25. package/dist/cjs/snk-form-config.cjs.entry.js +6 -17
  26. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  27. package/dist/cjs/snk-form.cjs.entry.js +12 -8
  28. package/dist/cjs/snk-grid-config.cjs.entry.js +5 -6
  29. package/dist/cjs/snk-grid.cjs.entry.js +20 -20
  30. package/dist/cjs/{snk-guides-viewer-aa3e3bfa.js → snk-guides-viewer-a7cd6fda.js} +18 -9
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  32. package/dist/cjs/snk-personalized-filter.cjs.entry.js +13 -16
  33. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-simple-crud.cjs.entry.js +22 -80
  35. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  36. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  37. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  38. package/dist/collection/components/snk-application/snk-application.js +60 -65
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  40. package/dist/collection/components/snk-crud/snk-crud.js +63 -8
  41. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +65 -15
  42. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  43. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +66 -30
  44. package/dist/collection/components/snk-data-unit/snk-data-unit.js +42 -7
  45. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  46. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
  47. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  48. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  50. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  51. package/dist/collection/components/snk-form/snk-form.js +46 -2
  52. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  53. package/dist/collection/components/snk-grid/snk-grid.js +110 -16
  54. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  55. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  56. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +43 -9
  57. package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
  58. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  59. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -59
  60. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +39 -30
  61. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  62. package/dist/collection/lib/index.js +10 -0
  63. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  64. package/dist/collection/lib/utils/urlutils.js +29 -0
  65. package/dist/components/ConfigStorage.js +161 -48
  66. package/dist/components/DataFetcher.js +68 -30
  67. package/dist/components/ResourceIDUtils.js +10 -0
  68. package/dist/components/SnkFormConfigManager.js +17 -19
  69. package/dist/components/auth-fetcher.js +32 -0
  70. package/dist/components/form-config-fetcher.js +64 -2
  71. package/dist/components/snk-actions-button2.js +23 -9
  72. package/dist/components/snk-application2.js +132 -154
  73. package/dist/components/snk-attach2.js +1 -8
  74. package/dist/components/snk-configurator2.js +3 -1
  75. package/dist/components/snk-crud.js +29 -7
  76. package/dist/components/snk-data-unit2.js +10 -6
  77. package/dist/components/snk-detail-view2.js +28 -23
  78. package/dist/components/snk-entity-list.js +0 -4
  79. package/dist/components/snk-filter-bar2.js +12 -12
  80. package/dist/components/snk-filter-detail2.js +2 -12
  81. package/dist/components/snk-filter-modal-item2.js +5 -16
  82. package/dist/components/snk-form-config2.js +5 -15
  83. package/dist/components/snk-form-view2.js +6 -1
  84. package/dist/components/snk-form.js +9 -2
  85. package/dist/components/snk-grid-config2.js +4 -2
  86. package/dist/components/snk-grid2.js +23 -16
  87. package/dist/components/snk-personalized-filter2.js +11 -11
  88. package/dist/components/snk-simple-crud2.js +12 -69
  89. package/dist/components/snk-taskbar2.js +3 -1
  90. package/dist/esm/{ConfigStorage-19a7260b.js → ConfigStorage-932ab366.js} +162 -49
  91. package/dist/esm/{DataFetcher-e0fc5549.js → DataFetcher-7e18aa30.js} +68 -30
  92. package/dist/esm/ISave-4412b20c.js +8 -0
  93. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  94. package/dist/esm/{SnkFormConfigManager-1a42eb02.js → SnkFormConfigManager-bb9afc3f.js} +19 -21
  95. package/dist/esm/auth-fetcher-6d9664b7.js +32 -0
  96. package/dist/esm/{dataunit-fetcher-6a695723.js → dataunit-fetcher-91a4eb82.js} +1 -1
  97. package/dist/esm/{form-config-fetcher-9e167008.js → form-config-fetcher-aaaa79a6.js} +65 -3
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/esm/{pesquisa-fetcher-9118eb7a.js → pesquisa-fetcher-56b30fb4.js} +1 -1
  100. package/dist/esm/sankhyablocks.js +1 -1
  101. package/dist/esm/snk-actions-button.entry.js +18 -11
  102. package/dist/esm/snk-application.entry.js +49 -71
  103. package/dist/esm/snk-attach.entry.js +3 -9
  104. package/dist/esm/snk-configurator.entry.js +2 -1
  105. package/dist/esm/snk-crud.entry.js +28 -9
  106. package/dist/esm/snk-data-exporter.entry.js +2 -2
  107. package/dist/esm/{snk-data-unit-3a0bbfcb.js → snk-data-unit-3ab57d1a.js} +8 -6
  108. package/dist/esm/snk-data-unit.entry.js +1 -1
  109. package/dist/esm/snk-detail-view.entry.js +18 -25
  110. package/dist/esm/snk-entity-list.entry.js +0 -4
  111. package/dist/esm/snk-filter-bar.entry.js +14 -17
  112. package/dist/esm/snk-filter-detail.entry.js +2 -16
  113. package/dist/esm/snk-filter-modal-item.entry.js +6 -20
  114. package/dist/esm/snk-form-config.entry.js +7 -18
  115. package/dist/esm/snk-form-view.entry.js +6 -1
  116. package/dist/esm/snk-form.entry.js +12 -8
  117. package/dist/esm/snk-grid-config.entry.js +5 -6
  118. package/dist/esm/snk-grid.entry.js +20 -20
  119. package/dist/esm/{snk-guides-viewer-aa386f6e.js → snk-guides-viewer-cc709b5f.js} +18 -9
  120. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  121. package/dist/esm/snk-personalized-filter.entry.js +13 -16
  122. package/dist/esm/snk-print-selector.entry.js +1 -1
  123. package/dist/esm/snk-simple-crud.entry.js +13 -71
  124. package/dist/esm/snk-taskbar.entry.js +2 -1
  125. package/dist/sankhyablocks/p-01739b21.entry.js +1 -0
  126. package/dist/sankhyablocks/{p-e7e54737.entry.js → p-03bb1aea.entry.js} +1 -1
  127. package/dist/sankhyablocks/p-05dbc70e.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-0a4c753d.js → p-14eac6fe.js} +1 -1
  129. package/dist/sankhyablocks/{p-2ac9c585.js → p-2d333d22.js} +1 -1
  130. package/dist/sankhyablocks/p-41e897f1.js +56 -0
  131. package/dist/sankhyablocks/p-48a40939.js +1 -0
  132. package/dist/sankhyablocks/p-611aa624.entry.js +1 -0
  133. package/dist/sankhyablocks/p-66bb8c20.entry.js +1 -0
  134. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  135. package/dist/sankhyablocks/p-6f154396.entry.js +1 -0
  136. package/dist/sankhyablocks/p-787071a8.js +1 -0
  137. package/dist/sankhyablocks/p-8481bb59.entry.js +1 -0
  138. package/dist/sankhyablocks/p-8818d8f6.entry.js +1 -0
  139. package/dist/sankhyablocks/p-93f6ca04.entry.js +1 -0
  140. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  141. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  142. package/dist/sankhyablocks/p-a52a6c9d.js +26 -0
  143. package/dist/sankhyablocks/p-b6003974.entry.js +1 -0
  144. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  145. package/dist/sankhyablocks/{p-7c7764bf.entry.js → p-d13c00b6.entry.js} +1 -1
  146. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  147. package/dist/sankhyablocks/p-d53a9169.entry.js +1 -0
  148. package/dist/sankhyablocks/p-d7638f45.entry.js +11 -0
  149. package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
  150. package/dist/sankhyablocks/p-e64f3e17.entry.js +1 -0
  151. package/dist/sankhyablocks/p-ed41b38c.js +1 -0
  152. package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
  153. package/dist/sankhyablocks/p-efc10705.entry.js +1 -0
  154. package/dist/sankhyablocks/p-f74fe358.js +1 -0
  155. package/dist/sankhyablocks/{p-df8621b4.js → p-f8e6b97e.js} +1 -1
  156. package/dist/sankhyablocks/p-f91e0c5d.entry.js +1 -0
  157. package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
  158. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  159. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  160. package/dist/types/components/snk-application/snk-application.d.ts +8 -13
  161. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  162. package/dist/types/components/snk-crud/snk-crud.d.ts +10 -0
  163. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +13 -0
  164. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  165. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
  166. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +8 -0
  167. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  168. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  169. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  170. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  171. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  172. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  173. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  174. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  175. package/dist/types/components/snk-grid/snk-grid.d.ts +18 -1
  176. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  177. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  178. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +8 -0
  179. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
  180. package/dist/types/components.d.ts +189 -21
  181. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  182. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -7
  183. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  184. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  185. package/dist/types/lib/index.d.ts +11 -0
  186. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  187. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  188. package/package.json +2 -2
  189. package/dist/cjs/filter-bar-config-fetcher-2b8ed9d0.js +0 -155
  190. package/dist/cjs/resource-fetcher-c0332609.js +0 -68
  191. package/dist/components/filter-bar-config-fetcher.js +0 -153
  192. package/dist/components/resource-fetcher.js +0 -66
  193. package/dist/esm/filter-bar-config-fetcher-06e02851.js +0 -153
  194. package/dist/esm/resource-fetcher-768d5556.js +0 -66
  195. package/dist/sankhyablocks/p-0a94fdbd.entry.js +0 -1
  196. package/dist/sankhyablocks/p-0ed0fc02.entry.js +0 -1
  197. package/dist/sankhyablocks/p-1e0189ff.entry.js +0 -1
  198. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  199. package/dist/sankhyablocks/p-50d72261.entry.js +0 -1
  200. package/dist/sankhyablocks/p-6759adae.entry.js +0 -1
  201. package/dist/sankhyablocks/p-7b8b8ae9.js +0 -10
  202. package/dist/sankhyablocks/p-815a42c0.entry.js +0 -1
  203. package/dist/sankhyablocks/p-8a41172a.entry.js +0 -1
  204. package/dist/sankhyablocks/p-8f8184ff.js +0 -56
  205. package/dist/sankhyablocks/p-8fdc3108.js +0 -1
  206. package/dist/sankhyablocks/p-976e56e9.js +0 -1
  207. package/dist/sankhyablocks/p-98f9d076.js +0 -17
  208. package/dist/sankhyablocks/p-9edad923.js +0 -1
  209. package/dist/sankhyablocks/p-abdcac04.entry.js +0 -1
  210. package/dist/sankhyablocks/p-b0847056.entry.js +0 -1
  211. package/dist/sankhyablocks/p-bc735728.entry.js +0 -1
  212. package/dist/sankhyablocks/p-be684b38.entry.js +0 -1
  213. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  214. package/dist/sankhyablocks/p-c0f656af.entry.js +0 -1
  215. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  216. package/dist/sankhyablocks/p-ccbfb1cf.entry.js +0 -1
  217. package/dist/sankhyablocks/p-d1b89765.js +0 -1
  218. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  219. package/dist/sankhyablocks/p-e28129aa.entry.js +0 -1
  220. package/dist/sankhyablocks/p-f31bfdee.entry.js +0 -1
  221. package/dist/sankhyablocks/p-f92fda53.entry.js +0 -11
@@ -0,0 +1,3 @@
1
+ export default class ResourceIDUtils {
2
+ static getResourceID(): Promise<string>;
3
+ }
@@ -1,4 +1,18 @@
1
1
  export default class UrlUtils {
2
2
  static getQueryParams(queryString: string): Map<string, any>;
3
3
  static getUrlBase(): string;
4
+ /**
5
+ * Extrai da URL o parâmetro que contém o resourceId da tela desejada.
6
+ *
7
+ */
8
+ static getResourceIdFromUrlToken(url: string): string | null;
9
+ /**
10
+ * Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
11
+ *
12
+ */
13
+ static getPkObjectFromUrlToken(url: string): ObjectFromToken | null;
4
14
  }
15
+ interface ObjectFromToken {
16
+ [key: string]: any;
17
+ }
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "8.1.0",
3
+ "version": "8.2.0-dev.1",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@shopify/draggable": "1.0.0-beta.8",
37
37
  "@stencil/store": "^2.0.4",
38
- "graphql": "^16.6.0",
38
+ "graphql": "16.6.0",
39
39
  "graphql-request": "^4.2.0"
40
40
  },
41
41
  "devDependencies": {
@@ -1,155 +0,0 @@
1
- 'use strict';
2
-
3
- const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
4
- const resourceFetcher = require('./resource-fetcher-c0332609.js');
5
-
6
- var __rest = (undefined && undefined.__rest) || function (s, e) {
7
- var t = {};
8
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9
- t[p] = s[p];
10
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
11
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
13
- t[p[i]] = s[p[i]];
14
- }
15
- return t;
16
- };
17
- function normalizeValue(value, type) {
18
- if (value == undefined) {
19
- return value;
20
- }
21
- if (value instanceof Date) {
22
- return value.toISOString();
23
- }
24
- if (typeof value === "object") {
25
- if (value instanceof Array) {
26
- return value.map(item => {
27
- if (filterItemType_enum.FilterItemType.MULTI_LIST === type) {
28
- const values = __rest(item, ["label"]);
29
- return normalizeValue(values);
30
- }
31
- return normalizeValue(item);
32
- });
33
- }
34
- else {
35
- const normalized = Object.assign({}, value);
36
- Object.keys(value).forEach(prop => {
37
- if (value[prop] !== undefined) {
38
- normalized[prop] = normalizeValue(value[prop], type);
39
- }
40
- else {
41
- delete normalized[prop];
42
- }
43
- });
44
- return normalized;
45
- }
46
- }
47
- return value;
48
- }
49
- class FilterBarConfigFetcher extends resourceFetcher.ResourceFetcher {
50
- normalize(items) {
51
- return items.map(item => {
52
- const { id, value, fixed, visible, type, groupedItems } = item;
53
- const stateItem = { id };
54
- if (value) {
55
- stateItem["value"] = normalizeValue(value, type);
56
- }
57
- if (fixed) {
58
- stateItem["fixed"] = fixed;
59
- }
60
- if (groupedItems) {
61
- if (groupedItems.length === 0) {
62
- return;
63
- }
64
- if (groupedItems.filter(item => item.visible).length > 0) {
65
- stateItem["visible"] = true;
66
- }
67
- stateItem["groupedItems"] = this.normalize(groupedItems);
68
- }
69
- else {
70
- if (visible) {
71
- stateItem["visible"] = true;
72
- }
73
- }
74
- return stateItem;
75
- }).filter(item => item != undefined);
76
- }
77
- saveConfig(items, resourceID, configName) {
78
- return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
79
- }
80
- getConfig(resourceID, configName, urlParams) {
81
- return new Promise((accept, reject) => {
82
- this.loadResource(this.getPath(resourceID, configName, urlParams))
83
- .then((configAsString) => {
84
- let fieldsList;
85
- if (configAsString) {
86
- const filterBarConfig = JSON.parse(configAsString);
87
- fieldsList = this.buildFieldList(filterBarConfig.items);
88
- }
89
- accept(fieldsList || []);
90
- })
91
- .catch((error) => {
92
- reject(error);
93
- });
94
- });
95
- }
96
- saveEntityListConfig(item, resourceID, configName) {
97
- return new Promise((accept, reject) => {
98
- this.getConfig(resourceID, configName).then(config => {
99
- const state = config.map(({ id, value, fixed, visible, type, groupedItems }) => {
100
- return Object.assign(Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true })), { groupedItems });
101
- });
102
- const index = state.findIndex(({ id }) => id === item.id);
103
- const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
104
- if (index > -1) {
105
- state[index] = newItem;
106
- }
107
- else {
108
- state.push(newItem);
109
- }
110
- this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
111
- accept(resp);
112
- }).catch(exception => {
113
- reject(exception);
114
- });
115
- }).catch(exception => {
116
- reject(exception);
117
- });
118
- });
119
- }
120
- buildFieldList(items) {
121
- return items.map(item => {
122
- var _a, _b;
123
- if (item.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
124
- const multiListValue = item.value;
125
- item.value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
126
- }
127
- return item;
128
- });
129
- }
130
- getPath(resourceID, name, urlParams) {
131
- let path = `cfg://filter/FilterBarState:${resourceID}`;
132
- if (name) {
133
- path += `.${name}`;
134
- }
135
- if (urlParams) {
136
- path += this.buildQueryString(urlParams);
137
- }
138
- return path;
139
- }
140
- buildQueryString(urlParams) {
141
- let queryString = '?';
142
- for (let key in urlParams) {
143
- if (!urlParams.hasOwnProperty(key)) {
144
- continue;
145
- }
146
- if (queryString.length > 1) {
147
- queryString += '&';
148
- }
149
- queryString += key + '=' + urlParams[key];
150
- }
151
- return queryString;
152
- }
153
- }
154
-
155
- exports.FilterBarConfigFetcher = FilterBarConfigFetcher;
@@ -1,68 +0,0 @@
1
- 'use strict';
2
-
3
- const DataFetcher = require('./DataFetcher-004811c6.js');
4
-
5
- class ResourceFetcher {
6
- constructor() {
7
- this.templateByQuery = new Map();
8
- this.buldTemplates();
9
- }
10
- buldTemplates() {
11
- this.templateByQuery.set("fetchResource", DataFetcher.dist.gql `query($name: String!) {
12
- $queryAlias$: fetchResource(name: $name){
13
- resource
14
- }
15
- }`);
16
- this.templateByQuery.set("saveResource", DataFetcher.dist.gql `mutation($resource: InputResource!) {
17
- $queryAlias$: saveResource(resource: $resource){
18
- name
19
- resource
20
- }
21
- }`);
22
- }
23
- loadResource(name) {
24
- if (ResourceFetcher._loadingResource.has(name)) {
25
- return ResourceFetcher._loadingResource.get(name);
26
- }
27
- const promiseLoadResource = new Promise((resolve, reject) => {
28
- DataFetcher.DataFetcher.get()
29
- .callGraphQL({
30
- values: { name },
31
- query: this.templateByQuery.get("fetchResource"),
32
- })
33
- .then((result) => {
34
- resolve(result === null || result === void 0 ? void 0 : result.resource);
35
- ResourceFetcher._loadingResource.delete(name);
36
- })
37
- .catch((error) => {
38
- reject(error);
39
- ResourceFetcher._loadingResource.delete(name);
40
- });
41
- });
42
- ResourceFetcher._loadingResource.set(name, promiseLoadResource);
43
- return promiseLoadResource;
44
- }
45
- saveResource(resource, name) {
46
- return new Promise((resolve, reject) => {
47
- DataFetcher.DataFetcher.get()
48
- .callGraphQL({
49
- values: {
50
- resource: {
51
- name: name,
52
- resource: JSON.stringify(resource)
53
- }
54
- },
55
- query: this.templateByQuery.get("saveResource")
56
- })
57
- .then((resp) => {
58
- resolve(resp);
59
- })
60
- .catch((error) => {
61
- reject(error);
62
- });
63
- });
64
- }
65
- }
66
- ResourceFetcher._loadingResource = new Map();
67
-
68
- exports.ResourceFetcher = ResourceFetcher;
@@ -1,153 +0,0 @@
1
- import { F as FilterItemType } from './filter-item-type.enum.js';
2
- import { R as ResourceFetcher } from './resource-fetcher.js';
3
-
4
- var __rest = (undefined && undefined.__rest) || function (s, e) {
5
- var t = {};
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7
- t[p] = s[p];
8
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
9
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
11
- t[p[i]] = s[p[i]];
12
- }
13
- return t;
14
- };
15
- function normalizeValue(value, type) {
16
- if (value == undefined) {
17
- return value;
18
- }
19
- if (value instanceof Date) {
20
- return value.toISOString();
21
- }
22
- if (typeof value === "object") {
23
- if (value instanceof Array) {
24
- return value.map(item => {
25
- if (FilterItemType.MULTI_LIST === type) {
26
- const values = __rest(item, ["label"]);
27
- return normalizeValue(values);
28
- }
29
- return normalizeValue(item);
30
- });
31
- }
32
- else {
33
- const normalized = Object.assign({}, value);
34
- Object.keys(value).forEach(prop => {
35
- if (value[prop] !== undefined) {
36
- normalized[prop] = normalizeValue(value[prop], type);
37
- }
38
- else {
39
- delete normalized[prop];
40
- }
41
- });
42
- return normalized;
43
- }
44
- }
45
- return value;
46
- }
47
- class FilterBarConfigFetcher extends ResourceFetcher {
48
- normalize(items) {
49
- return items.map(item => {
50
- const { id, value, fixed, visible, type, groupedItems } = item;
51
- const stateItem = { id };
52
- if (value) {
53
- stateItem["value"] = normalizeValue(value, type);
54
- }
55
- if (fixed) {
56
- stateItem["fixed"] = fixed;
57
- }
58
- if (groupedItems) {
59
- if (groupedItems.length === 0) {
60
- return;
61
- }
62
- if (groupedItems.filter(item => item.visible).length > 0) {
63
- stateItem["visible"] = true;
64
- }
65
- stateItem["groupedItems"] = this.normalize(groupedItems);
66
- }
67
- else {
68
- if (visible) {
69
- stateItem["visible"] = true;
70
- }
71
- }
72
- return stateItem;
73
- }).filter(item => item != undefined);
74
- }
75
- saveConfig(items, resourceID, configName) {
76
- return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
77
- }
78
- getConfig(resourceID, configName, urlParams) {
79
- return new Promise((accept, reject) => {
80
- this.loadResource(this.getPath(resourceID, configName, urlParams))
81
- .then((configAsString) => {
82
- let fieldsList;
83
- if (configAsString) {
84
- const filterBarConfig = JSON.parse(configAsString);
85
- fieldsList = this.buildFieldList(filterBarConfig.items);
86
- }
87
- accept(fieldsList || []);
88
- })
89
- .catch((error) => {
90
- reject(error);
91
- });
92
- });
93
- }
94
- saveEntityListConfig(item, resourceID, configName) {
95
- return new Promise((accept, reject) => {
96
- this.getConfig(resourceID, configName).then(config => {
97
- const state = config.map(({ id, value, fixed, visible, type, groupedItems }) => {
98
- return Object.assign(Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true })), { groupedItems });
99
- });
100
- const index = state.findIndex(({ id }) => id === item.id);
101
- const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
102
- if (index > -1) {
103
- state[index] = newItem;
104
- }
105
- else {
106
- state.push(newItem);
107
- }
108
- this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
109
- accept(resp);
110
- }).catch(exception => {
111
- reject(exception);
112
- });
113
- }).catch(exception => {
114
- reject(exception);
115
- });
116
- });
117
- }
118
- buildFieldList(items) {
119
- return items.map(item => {
120
- var _a, _b;
121
- if (item.type === FilterItemType.MULTI_LIST) {
122
- const multiListValue = item.value;
123
- item.value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
124
- }
125
- return item;
126
- });
127
- }
128
- getPath(resourceID, name, urlParams) {
129
- let path = `cfg://filter/FilterBarState:${resourceID}`;
130
- if (name) {
131
- path += `.${name}`;
132
- }
133
- if (urlParams) {
134
- path += this.buildQueryString(urlParams);
135
- }
136
- return path;
137
- }
138
- buildQueryString(urlParams) {
139
- let queryString = '?';
140
- for (let key in urlParams) {
141
- if (!urlParams.hasOwnProperty(key)) {
142
- continue;
143
- }
144
- if (queryString.length > 1) {
145
- queryString += '&';
146
- }
147
- queryString += key + '=' + urlParams[key];
148
- }
149
- return queryString;
150
- }
151
- }
152
-
153
- export { FilterBarConfigFetcher as F };
@@ -1,66 +0,0 @@
1
- import { d as dist, D as DataFetcher } from './DataFetcher.js';
2
-
3
- class ResourceFetcher {
4
- constructor() {
5
- this.templateByQuery = new Map();
6
- this.buldTemplates();
7
- }
8
- buldTemplates() {
9
- this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
10
- $queryAlias$: fetchResource(name: $name){
11
- resource
12
- }
13
- }`);
14
- this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
15
- $queryAlias$: saveResource(resource: $resource){
16
- name
17
- resource
18
- }
19
- }`);
20
- }
21
- loadResource(name) {
22
- if (ResourceFetcher._loadingResource.has(name)) {
23
- return ResourceFetcher._loadingResource.get(name);
24
- }
25
- const promiseLoadResource = new Promise((resolve, reject) => {
26
- DataFetcher.get()
27
- .callGraphQL({
28
- values: { name },
29
- query: this.templateByQuery.get("fetchResource"),
30
- })
31
- .then((result) => {
32
- resolve(result === null || result === void 0 ? void 0 : result.resource);
33
- ResourceFetcher._loadingResource.delete(name);
34
- })
35
- .catch((error) => {
36
- reject(error);
37
- ResourceFetcher._loadingResource.delete(name);
38
- });
39
- });
40
- ResourceFetcher._loadingResource.set(name, promiseLoadResource);
41
- return promiseLoadResource;
42
- }
43
- saveResource(resource, name) {
44
- return new Promise((resolve, reject) => {
45
- DataFetcher.get()
46
- .callGraphQL({
47
- values: {
48
- resource: {
49
- name: name,
50
- resource: JSON.stringify(resource)
51
- }
52
- },
53
- query: this.templateByQuery.get("saveResource")
54
- })
55
- .then((resp) => {
56
- resolve(resp);
57
- })
58
- .catch((error) => {
59
- reject(error);
60
- });
61
- });
62
- }
63
- }
64
- ResourceFetcher._loadingResource = new Map();
65
-
66
- export { ResourceFetcher as R };
@@ -1,153 +0,0 @@
1
- import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
2
- import { R as ResourceFetcher } from './resource-fetcher-768d5556.js';
3
-
4
- var __rest = (undefined && undefined.__rest) || function (s, e) {
5
- var t = {};
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7
- t[p] = s[p];
8
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
9
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
11
- t[p[i]] = s[p[i]];
12
- }
13
- return t;
14
- };
15
- function normalizeValue(value, type) {
16
- if (value == undefined) {
17
- return value;
18
- }
19
- if (value instanceof Date) {
20
- return value.toISOString();
21
- }
22
- if (typeof value === "object") {
23
- if (value instanceof Array) {
24
- return value.map(item => {
25
- if (FilterItemType.MULTI_LIST === type) {
26
- const values = __rest(item, ["label"]);
27
- return normalizeValue(values);
28
- }
29
- return normalizeValue(item);
30
- });
31
- }
32
- else {
33
- const normalized = Object.assign({}, value);
34
- Object.keys(value).forEach(prop => {
35
- if (value[prop] !== undefined) {
36
- normalized[prop] = normalizeValue(value[prop], type);
37
- }
38
- else {
39
- delete normalized[prop];
40
- }
41
- });
42
- return normalized;
43
- }
44
- }
45
- return value;
46
- }
47
- class FilterBarConfigFetcher extends ResourceFetcher {
48
- normalize(items) {
49
- return items.map(item => {
50
- const { id, value, fixed, visible, type, groupedItems } = item;
51
- const stateItem = { id };
52
- if (value) {
53
- stateItem["value"] = normalizeValue(value, type);
54
- }
55
- if (fixed) {
56
- stateItem["fixed"] = fixed;
57
- }
58
- if (groupedItems) {
59
- if (groupedItems.length === 0) {
60
- return;
61
- }
62
- if (groupedItems.filter(item => item.visible).length > 0) {
63
- stateItem["visible"] = true;
64
- }
65
- stateItem["groupedItems"] = this.normalize(groupedItems);
66
- }
67
- else {
68
- if (visible) {
69
- stateItem["visible"] = true;
70
- }
71
- }
72
- return stateItem;
73
- }).filter(item => item != undefined);
74
- }
75
- saveConfig(items, resourceID, configName) {
76
- return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
77
- }
78
- getConfig(resourceID, configName, urlParams) {
79
- return new Promise((accept, reject) => {
80
- this.loadResource(this.getPath(resourceID, configName, urlParams))
81
- .then((configAsString) => {
82
- let fieldsList;
83
- if (configAsString) {
84
- const filterBarConfig = JSON.parse(configAsString);
85
- fieldsList = this.buildFieldList(filterBarConfig.items);
86
- }
87
- accept(fieldsList || []);
88
- })
89
- .catch((error) => {
90
- reject(error);
91
- });
92
- });
93
- }
94
- saveEntityListConfig(item, resourceID, configName) {
95
- return new Promise((accept, reject) => {
96
- this.getConfig(resourceID, configName).then(config => {
97
- const state = config.map(({ id, value, fixed, visible, type, groupedItems }) => {
98
- return Object.assign(Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true })), { groupedItems });
99
- });
100
- const index = state.findIndex(({ id }) => id === item.id);
101
- const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
102
- if (index > -1) {
103
- state[index] = newItem;
104
- }
105
- else {
106
- state.push(newItem);
107
- }
108
- this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
109
- accept(resp);
110
- }).catch(exception => {
111
- reject(exception);
112
- });
113
- }).catch(exception => {
114
- reject(exception);
115
- });
116
- });
117
- }
118
- buildFieldList(items) {
119
- return items.map(item => {
120
- var _a, _b;
121
- if (item.type === FilterItemType.MULTI_LIST) {
122
- const multiListValue = item.value;
123
- item.value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
124
- }
125
- return item;
126
- });
127
- }
128
- getPath(resourceID, name, urlParams) {
129
- let path = `cfg://filter/FilterBarState:${resourceID}`;
130
- if (name) {
131
- path += `.${name}`;
132
- }
133
- if (urlParams) {
134
- path += this.buildQueryString(urlParams);
135
- }
136
- return path;
137
- }
138
- buildQueryString(urlParams) {
139
- let queryString = '?';
140
- for (let key in urlParams) {
141
- if (!urlParams.hasOwnProperty(key)) {
142
- continue;
143
- }
144
- if (queryString.length > 1) {
145
- queryString += '&';
146
- }
147
- queryString += key + '=' + urlParams[key];
148
- }
149
- return queryString;
150
- }
151
- }
152
-
153
- export { FilterBarConfigFetcher as F };
@@ -1,66 +0,0 @@
1
- import { d as dist, D as DataFetcher } from './DataFetcher-e0fc5549.js';
2
-
3
- class ResourceFetcher {
4
- constructor() {
5
- this.templateByQuery = new Map();
6
- this.buldTemplates();
7
- }
8
- buldTemplates() {
9
- this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
10
- $queryAlias$: fetchResource(name: $name){
11
- resource
12
- }
13
- }`);
14
- this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
15
- $queryAlias$: saveResource(resource: $resource){
16
- name
17
- resource
18
- }
19
- }`);
20
- }
21
- loadResource(name) {
22
- if (ResourceFetcher._loadingResource.has(name)) {
23
- return ResourceFetcher._loadingResource.get(name);
24
- }
25
- const promiseLoadResource = new Promise((resolve, reject) => {
26
- DataFetcher.get()
27
- .callGraphQL({
28
- values: { name },
29
- query: this.templateByQuery.get("fetchResource"),
30
- })
31
- .then((result) => {
32
- resolve(result === null || result === void 0 ? void 0 : result.resource);
33
- ResourceFetcher._loadingResource.delete(name);
34
- })
35
- .catch((error) => {
36
- reject(error);
37
- ResourceFetcher._loadingResource.delete(name);
38
- });
39
- });
40
- ResourceFetcher._loadingResource.set(name, promiseLoadResource);
41
- return promiseLoadResource;
42
- }
43
- saveResource(resource, name) {
44
- return new Promise((resolve, reject) => {
45
- DataFetcher.get()
46
- .callGraphQL({
47
- values: {
48
- resource: {
49
- name: name,
50
- resource: JSON.stringify(resource)
51
- }
52
- },
53
- query: this.templateByQuery.get("saveResource")
54
- })
55
- .then((resp) => {
56
- resolve(resp);
57
- })
58
- .catch((error) => {
59
- reject(error);
60
- });
61
- });
62
- }
63
- }
64
- ResourceFetcher._loadingResource = new Map();
65
-
66
- export { ResourceFetcher as R };