@sankhyalabs/sankhyablocks 8.2.0-dev.1 → 8.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 (221) hide show
  1. package/dist/cjs/{ConfigStorage-12397f18.js → ConfigStorage-e9d7fa82.js} +51 -163
  2. package/dist/cjs/{DataFetcher-f2da1f79.js → DataFetcher-39b63a1e.js} +29 -67
  3. package/dist/cjs/{SnkFormConfigManager-13f79e37.js → SnkFormConfigManager-2f8eccd9.js} +21 -19
  4. package/dist/cjs/{dataunit-fetcher-e72068c1.js → dataunit-fetcher-15a7cc88.js} +1 -1
  5. package/dist/cjs/filter-bar-config-fetcher-24548cec.js +155 -0
  6. package/dist/cjs/{form-config-fetcher-5d62ab62.js → form-config-fetcher-ab3ce222.js} +3 -66
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-8c363096.js → pesquisa-fetcher-96c042aa.js} +1 -1
  9. package/dist/cjs/resource-fetcher-64102551.js +68 -0
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button.cjs.entry.js +11 -18
  12. package/dist/cjs/snk-application.cjs.entry.js +73 -51
  13. package/dist/cjs/snk-attach.cjs.entry.js +13 -7
  14. package/dist/cjs/snk-configurator.cjs.entry.js +1 -2
  15. package/dist/cjs/snk-crud.cjs.entry.js +9 -28
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  17. package/dist/cjs/{snk-data-unit-80a00ae4.js → snk-data-unit-d5109a08.js} +6 -8
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +25 -18
  20. package/dist/cjs/snk-entity-list.cjs.entry.js +4 -0
  21. package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -14
  22. package/dist/cjs/snk-filter-detail.cjs.entry.js +15 -1
  23. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +19 -5
  24. package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
  25. package/dist/cjs/snk-form-view.cjs.entry.js +1 -6
  26. package/dist/cjs/snk-form.cjs.entry.js +8 -12
  27. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
  28. package/dist/cjs/snk-grid.cjs.entry.js +20 -20
  29. package/dist/cjs/{snk-guides-viewer-a7cd6fda.js → snk-guides-viewer-8c9693aa.js} +9 -18
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +16 -13
  32. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +80 -22
  34. package/dist/cjs/snk-taskbar.cjs.entry.js +1 -2
  35. package/dist/collection/components/snk-actions-button/actions/index.js +4 -3
  36. package/dist/collection/components/snk-actions-button/snk-actions-button.js +4 -8
  37. package/dist/collection/components/snk-application/snk-application.js +65 -60
  38. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -19
  39. package/dist/collection/components/snk-crud/snk-crud.js +8 -63
  40. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +15 -65
  41. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +1 -27
  42. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +30 -66
  43. package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -42
  44. package/dist/collection/components/snk-entity-list/snk-entity-list.js +23 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
  46. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  47. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +16 -21
  48. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -28
  49. package/dist/collection/components/snk-form/SnkFormConfigManager.js +19 -17
  50. package/dist/collection/components/snk-form/snk-form.js +2 -46
  51. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +15 -5
  52. package/dist/collection/components/snk-grid/snk-grid.js +16 -110
  53. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +1 -19
  54. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +12 -28
  55. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -43
  56. package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -19
  57. package/dist/collection/lib/configs/ConfigStorage.js +44 -33
  58. package/dist/collection/lib/dataUnit/InMemoryLoader.js +59 -2
  59. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -38
  60. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +24 -0
  61. package/dist/collection/lib/index.js +0 -10
  62. package/dist/collection/lib/utils/urlutils.js +0 -29
  63. package/dist/components/ConfigStorage.js +48 -161
  64. package/dist/components/DataFetcher.js +29 -67
  65. package/dist/components/SnkFormConfigManager.js +19 -17
  66. package/dist/components/filter-bar-config-fetcher.js +153 -0
  67. package/dist/components/form-config-fetcher.js +2 -64
  68. package/dist/components/resource-fetcher.js +66 -0
  69. package/dist/components/snk-actions-button2.js +9 -23
  70. package/dist/components/snk-application2.js +154 -132
  71. package/dist/components/snk-attach2.js +8 -1
  72. package/dist/components/snk-configurator2.js +1 -3
  73. package/dist/components/snk-crud.js +7 -29
  74. package/dist/components/snk-data-unit2.js +6 -10
  75. package/dist/components/snk-detail-view2.js +23 -28
  76. package/dist/components/snk-entity-list.js +4 -0
  77. package/dist/components/snk-filter-bar2.js +12 -12
  78. package/dist/components/snk-filter-detail2.js +12 -2
  79. package/dist/components/snk-filter-modal-item2.js +16 -5
  80. package/dist/components/snk-form-config2.js +15 -5
  81. package/dist/components/snk-form-view2.js +1 -6
  82. package/dist/components/snk-form.js +2 -9
  83. package/dist/components/snk-grid-config2.js +2 -4
  84. package/dist/components/snk-grid2.js +16 -23
  85. package/dist/components/snk-personalized-filter2.js +11 -11
  86. package/dist/components/snk-simple-crud2.js +69 -12
  87. package/dist/components/snk-taskbar2.js +1 -3
  88. package/dist/esm/{ConfigStorage-932ab366.js → ConfigStorage-1090289a.js} +49 -162
  89. package/dist/esm/{DataFetcher-7e18aa30.js → DataFetcher-a4ed43e7.js} +29 -67
  90. package/dist/esm/{SnkFormConfigManager-bb9afc3f.js → SnkFormConfigManager-de537eca.js} +21 -19
  91. package/dist/esm/{dataunit-fetcher-91a4eb82.js → dataunit-fetcher-8d0bfa4a.js} +1 -1
  92. package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +153 -0
  93. package/dist/esm/{form-config-fetcher-aaaa79a6.js → form-config-fetcher-4065db9a.js} +3 -65
  94. package/dist/esm/loader.js +1 -1
  95. package/dist/esm/{pesquisa-fetcher-56b30fb4.js → pesquisa-fetcher-7460b876.js} +1 -1
  96. package/dist/esm/resource-fetcher-45a70066.js +66 -0
  97. package/dist/esm/sankhyablocks.js +1 -1
  98. package/dist/esm/snk-actions-button.entry.js +11 -18
  99. package/dist/esm/snk-application.entry.js +71 -49
  100. package/dist/esm/snk-attach.entry.js +9 -3
  101. package/dist/esm/snk-configurator.entry.js +1 -2
  102. package/dist/esm/snk-crud.entry.js +9 -28
  103. package/dist/esm/snk-data-exporter.entry.js +2 -2
  104. package/dist/esm/{snk-data-unit-3ab57d1a.js → snk-data-unit-3a0bbfcb.js} +6 -8
  105. package/dist/esm/snk-data-unit.entry.js +1 -1
  106. package/dist/esm/snk-detail-view.entry.js +25 -18
  107. package/dist/esm/snk-entity-list.entry.js +4 -0
  108. package/dist/esm/snk-filter-bar.entry.js +17 -14
  109. package/dist/esm/snk-filter-detail.entry.js +16 -2
  110. package/dist/esm/snk-filter-modal-item.entry.js +20 -6
  111. package/dist/esm/snk-form-config.entry.js +18 -7
  112. package/dist/esm/snk-form-view.entry.js +1 -6
  113. package/dist/esm/snk-form.entry.js +8 -12
  114. package/dist/esm/snk-grid-config.entry.js +6 -5
  115. package/dist/esm/snk-grid.entry.js +20 -20
  116. package/dist/esm/{snk-guides-viewer-cc709b5f.js → snk-guides-viewer-a6d39c18.js} +9 -18
  117. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  118. package/dist/esm/snk-personalized-filter.entry.js +16 -13
  119. package/dist/esm/snk-print-selector.entry.js +1 -1
  120. package/dist/esm/snk-simple-crud.entry.js +71 -13
  121. package/dist/esm/snk-taskbar.entry.js +1 -2
  122. package/dist/sankhyablocks/p-0fb83448.js +1 -0
  123. package/dist/sankhyablocks/p-15aba6fb.entry.js +11 -0
  124. package/dist/sankhyablocks/p-216f081a.entry.js +1 -0
  125. package/dist/sankhyablocks/p-21e7c08e.entry.js +1 -0
  126. package/dist/sankhyablocks/p-2861d44f.entry.js +1 -0
  127. package/dist/sankhyablocks/p-2d883fe9.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-d13c00b6.entry.js → p-3d6f91c2.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-f8e6b97e.js → p-44e66c8d.js} +1 -1
  130. package/dist/sankhyablocks/p-4514fc6a.entry.js +1 -0
  131. package/dist/sankhyablocks/p-4f4cd005.entry.js +1 -0
  132. package/dist/sankhyablocks/p-50c13cc8.entry.js +1 -0
  133. package/dist/sankhyablocks/p-52c6b2e7.js +1 -0
  134. package/dist/sankhyablocks/p-5994af77.js +56 -0
  135. package/dist/sankhyablocks/p-5df17074.js +1 -0
  136. package/dist/sankhyablocks/p-6bb904bb.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6f0795c8.entry.js +1 -0
  138. package/dist/sankhyablocks/p-7588f006.entry.js +1 -0
  139. package/dist/sankhyablocks/p-847e6c20.js +17 -0
  140. package/dist/sankhyablocks/p-9471cbc9.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-14eac6fe.js → p-9d18017a.js} +1 -1
  142. package/dist/sankhyablocks/p-9edad923.js +1 -0
  143. package/dist/sankhyablocks/p-a42dd503.entry.js +1 -0
  144. package/dist/sankhyablocks/{p-2d333d22.js → p-b978da60.js} +1 -1
  145. package/dist/sankhyablocks/p-befbc9ee.entry.js +1 -0
  146. package/dist/sankhyablocks/p-c6380ea2.entry.js +1 -0
  147. package/dist/sankhyablocks/{p-03bb1aea.entry.js → p-c6feb995.entry.js} +1 -1
  148. package/dist/sankhyablocks/p-c945318c.entry.js +1 -0
  149. package/dist/sankhyablocks/p-ccbfb1cf.entry.js +1 -0
  150. package/dist/sankhyablocks/p-d7c7a289.entry.js +1 -0
  151. package/dist/sankhyablocks/p-de69b4b0.entry.js +1 -0
  152. package/dist/sankhyablocks/p-f3b7b69e.js +10 -0
  153. package/dist/sankhyablocks/p-f7eded3a.entry.js +1 -0
  154. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  155. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -2
  156. package/dist/types/components/snk-application/snk-application.d.ts +13 -8
  157. package/dist/types/components/snk-configurator/snk-configurator.d.ts +0 -4
  158. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -10
  159. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -13
  160. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +0 -5
  161. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +2 -13
  162. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +0 -8
  163. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +4 -0
  164. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
  165. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  166. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +4 -5
  167. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  168. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +4 -5
  169. package/dist/types/components/snk-form/snk-form.d.ts +1 -9
  170. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
  171. package/dist/types/components/snk-grid/snk-grid.d.ts +1 -18
  172. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +0 -4
  173. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -5
  174. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -8
  175. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -4
  176. package/dist/types/components.d.ts +21 -189
  177. package/dist/types/lib/configs/ConfigStorage.d.ts +13 -11
  178. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +7 -0
  179. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  180. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +1 -0
  181. package/dist/types/lib/index.d.ts +0 -11
  182. package/dist/types/lib/utils/urlutils.d.ts +0 -14
  183. package/package.json +2 -2
  184. package/dist/cjs/ISave-d68ce3cd.js +0 -8
  185. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +0 -12
  186. package/dist/cjs/auth-fetcher-319a4cb2.js +0 -34
  187. package/dist/collection/lib/resourceid/ResourceIDUtils.js +0 -7
  188. package/dist/components/ResourceIDUtils.js +0 -10
  189. package/dist/components/auth-fetcher.js +0 -32
  190. package/dist/esm/ISave-4412b20c.js +0 -8
  191. package/dist/esm/ResourceIDUtils-a114189a.js +0 -10
  192. package/dist/esm/auth-fetcher-6d9664b7.js +0 -32
  193. package/dist/sankhyablocks/p-01739b21.entry.js +0 -1
  194. package/dist/sankhyablocks/p-05dbc70e.entry.js +0 -1
  195. package/dist/sankhyablocks/p-41e897f1.js +0 -56
  196. package/dist/sankhyablocks/p-48a40939.js +0 -1
  197. package/dist/sankhyablocks/p-611aa624.entry.js +0 -1
  198. package/dist/sankhyablocks/p-66bb8c20.entry.js +0 -1
  199. package/dist/sankhyablocks/p-688dcb4c.js +0 -1
  200. package/dist/sankhyablocks/p-6f154396.entry.js +0 -1
  201. package/dist/sankhyablocks/p-787071a8.js +0 -1
  202. package/dist/sankhyablocks/p-8481bb59.entry.js +0 -1
  203. package/dist/sankhyablocks/p-8818d8f6.entry.js +0 -1
  204. package/dist/sankhyablocks/p-93f6ca04.entry.js +0 -1
  205. package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
  206. package/dist/sankhyablocks/p-9e7d65a4.js +0 -1
  207. package/dist/sankhyablocks/p-a52a6c9d.js +0 -26
  208. package/dist/sankhyablocks/p-b6003974.entry.js +0 -1
  209. package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
  210. package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
  211. package/dist/sankhyablocks/p-d53a9169.entry.js +0 -1
  212. package/dist/sankhyablocks/p-d7638f45.entry.js +0 -11
  213. package/dist/sankhyablocks/p-e086cc2a.entry.js +0 -1
  214. package/dist/sankhyablocks/p-e64f3e17.entry.js +0 -1
  215. package/dist/sankhyablocks/p-ed41b38c.js +0 -1
  216. package/dist/sankhyablocks/p-ed705cbb.entry.js +0 -1
  217. package/dist/sankhyablocks/p-efc10705.entry.js +0 -1
  218. package/dist/sankhyablocks/p-f74fe358.js +0 -1
  219. package/dist/sankhyablocks/p-f91e0c5d.entry.js +0 -1
  220. package/dist/sankhyablocks/p-fa523d6b.entry.js +0 -1
  221. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +0 -3
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const formConfigFetcher = require('./form-config-fetcher-5d62ab62.js');
4
- const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
5
- const DataFetcher = require('./DataFetcher-f2da1f79.js');
3
+ const core = require('@sankhyalabs/core');
4
+ const formConfigFetcher = require('./form-config-fetcher-ab3ce222.js');
5
+ const resourceFetcher = require('./resource-fetcher-64102551.js');
6
+ const filterBarConfigFetcher = require('./filter-bar-config-fetcher-24548cec.js');
7
+ const DataFetcher = require('./DataFetcher-39b63a1e.js');
6
8
 
7
- class GridConfigFetcher extends formConfigFetcher.ResourceFetcher {
9
+ class GridConfigFetcher extends resourceFetcher.ResourceFetcher {
8
10
  constructor() {
9
11
  super(...arguments);
10
12
  this.GRID_CONFIG_VERSION = "V3:";
@@ -44,131 +46,6 @@ class GridConfigFetcher extends formConfigFetcher.ResourceFetcher {
44
46
  }
45
47
  }
46
48
 
47
- var __rest = (undefined && undefined.__rest) || function (s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- };
58
- function normalizeValue(value, type) {
59
- if (value == undefined) {
60
- return value;
61
- }
62
- if (value instanceof Date) {
63
- return value.toISOString();
64
- }
65
- if (typeof value === "object") {
66
- if (value instanceof Array) {
67
- return value.map(item => {
68
- if (filterItemType_enum.FilterItemType.MULTI_LIST === type) {
69
- const values = __rest(item, ["label"]);
70
- return normalizeValue(values);
71
- }
72
- return normalizeValue(item);
73
- });
74
- }
75
- else {
76
- const normalized = Object.assign({}, value);
77
- Object.keys(value).forEach(prop => {
78
- if (value[prop] !== undefined) {
79
- normalized[prop] = normalizeValue(value[prop], type);
80
- }
81
- else {
82
- delete normalized[prop];
83
- }
84
- });
85
- return normalized;
86
- }
87
- }
88
- return value;
89
- }
90
- class FilterBarConfigFetcher extends formConfigFetcher.ResourceFetcher {
91
- normalize(items) {
92
- return items.map(item => {
93
- const { id, value, fixed, visible, type, groupedItems } = item;
94
- const stateItem = { id };
95
- if (value) {
96
- stateItem["value"] = normalizeValue(value, type);
97
- }
98
- if (fixed) {
99
- stateItem["fixed"] = fixed;
100
- }
101
- if (groupedItems) {
102
- if (groupedItems.length === 0) {
103
- return;
104
- }
105
- if (groupedItems.filter(item => item.visible).length > 0) {
106
- stateItem["visible"] = true;
107
- }
108
- stateItem["groupedItems"] = this.normalize(groupedItems);
109
- }
110
- else {
111
- if (visible) {
112
- stateItem["visible"] = true;
113
- }
114
- }
115
- return stateItem;
116
- }).filter(item => item != undefined);
117
- }
118
- saveConfig(items, resourceID, configName) {
119
- return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
120
- }
121
- getConfig(resourceID, configName, urlParams) {
122
- return new Promise((accept, reject) => {
123
- this.loadResource(this.getPath(resourceID, configName, urlParams))
124
- .then((configAsString) => {
125
- let fieldsList;
126
- if (configAsString) {
127
- const filterBarConfig = JSON.parse(configAsString);
128
- fieldsList = this.buildFieldList(filterBarConfig.items);
129
- }
130
- accept(fieldsList || []);
131
- })
132
- .catch((error) => {
133
- reject(error);
134
- });
135
- });
136
- }
137
- buildFieldList(items) {
138
- return items.map(item => {
139
- var _a, _b;
140
- if (item.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
141
- const multiListValue = item.value;
142
- 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;
143
- }
144
- return item;
145
- });
146
- }
147
- getPath(resourceID, name, urlParams) {
148
- let path = `cfg://filter/FilterBarState:${resourceID}`;
149
- if (name) {
150
- path += `.${name}`;
151
- }
152
- if (urlParams) {
153
- path += this.buildQueryString(urlParams);
154
- }
155
- return path;
156
- }
157
- buildQueryString(urlParams) {
158
- let queryString = '?';
159
- for (let key in urlParams) {
160
- if (!urlParams.hasOwnProperty(key)) {
161
- continue;
162
- }
163
- if (queryString.length > 1) {
164
- queryString += '&';
165
- }
166
- queryString += key + '=' + urlParams[key];
167
- }
168
- return queryString;
169
- }
170
- }
171
-
172
49
  class PersonalizedFilterFetcher {
173
50
  constructor() {
174
51
  this.templateByQuery = new Map();
@@ -343,80 +220,91 @@ const CONFIG_SOURCE = {
343
220
  filterBar: "filterBar"
344
221
  };
345
222
  class ConfigStorage {
346
- static preload(resourceID, configName) {
347
- ConfigStorage.loadFormConfig(configName, resourceID);
348
- ConfigStorage.loadGridConfig(configName, resourceID);
223
+ static async get() {
224
+ if (!ConfigStorage.instance) {
225
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
226
+ if (application != undefined) {
227
+ const configName = application.configName;
228
+ const resourceID = await application.getResourceID();
229
+ ConfigStorage.instance = new ConfigStorage();
230
+ ConfigStorage.resourceID = resourceID;
231
+ ConfigStorage.instance.loadFormConfig(configName);
232
+ ConfigStorage.instance.loadGridConfig(configName);
233
+ }
234
+ }
235
+ return this.instance;
349
236
  }
350
- static async loadFilterBarConfig(name, resourceID, urlParams) {
351
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
237
+ async loadFilterBarConfig(name, urlParams) {
238
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
352
239
  if (!ConfigStorage.configById.has(cacheID)) {
353
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
240
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
354
241
  }
355
242
  return ConfigStorage.configById.get(cacheID);
356
243
  }
357
- static async loadFormConfig(name, resourceID) {
358
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
244
+ async loadFormConfig(name) {
245
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
359
246
  if (!ConfigStorage.configById.has(cacheID)) {
360
- ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
247
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
361
248
  }
362
249
  return ConfigStorage.configById.get(cacheID);
363
250
  }
364
- static async loadGridConfig(name, resourceID) {
365
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
251
+ async loadGridConfig(name) {
252
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
366
253
  if (!ConfigStorage.configById.has(cacheID)) {
367
- ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
254
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
368
255
  }
369
256
  return ConfigStorage.configById.get(cacheID);
370
257
  }
371
- static async saveFilterBarConfig(config, name, resourceID) {
372
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
258
+ static async saveFilterBarConfig(config, name) {
259
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
373
260
  this.configById.delete(cacheID);
374
- return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
261
+ return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
375
262
  }
376
- static async saveFormConfig(config, name, resourceID) {
377
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
263
+ static async saveFormConfig(config, name) {
264
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
378
265
  this.configById.delete(cacheID);
379
- return this.formConfigFetcher.saveConfig(config, name, resourceID);
266
+ return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
380
267
  }
381
- static async saveCardState(config, name, resourceID) {
382
- return this.formConfigFetcher.saveCardState(config, name, resourceID);
268
+ static async saveCardState(config, name) {
269
+ return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
383
270
  }
384
- static async saveGridConfig(config, name, resourceID) {
271
+ static async saveGridConfig(config, name) {
385
272
  if (config == undefined) {
386
273
  return;
387
274
  }
388
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
275
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
389
276
  this.configById.delete(cacheID);
390
- return this.gridConfigFetcher.saveConfig(config, name, resourceID);
277
+ return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
391
278
  }
392
- static async loadPersonalizedFilter(filterId, resourceID, configName) {
393
- return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
279
+ static async loadPersonalizedFilter(filterId, configName) {
280
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
394
281
  }
395
- static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
282
+ static async savePersonalizedFilter(personalizedFilter, configName) {
396
283
  //Ao criar ou alterar um filtro personalizado,
397
284
  //precisamos remover o cache do status da filterbar.
398
- const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
285
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
399
286
  this.configById.delete(cacheID);
400
- return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
287
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
401
288
  }
402
- static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
403
- return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
289
+ static async removePersonalizedFilter(personalizedFilter, configName) {
290
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
404
291
  }
405
292
  static async validatePersonalizedFilter(dataUnitName, expression) {
406
293
  return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
407
294
  }
408
- static buildCacheID(name, source, resourceID) {
295
+ static buildCacheID(name, source) {
409
296
  if (name == undefined) {
410
- return `req_${source}_${resourceID}`;
297
+ return `req_${source}_${this.resourceID}`;
411
298
  }
412
- return `req_${source}_${name}_${resourceID}`;
299
+ return `req_${source}_${name}_${this.resourceID}`;
413
300
  }
414
301
  }
415
302
  ConfigStorage.configById = new Map();
416
- ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
303
+ ConfigStorage.filterBarConfigFetcher = new filterBarConfigFetcher.FilterBarConfigFetcher();
417
304
  ConfigStorage.formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
418
305
  ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
419
306
  ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
420
307
 
421
308
  exports.ConfigStorage = ConfigStorage;
309
+ exports.GridConfigFetcher = GridConfigFetcher;
422
310
  exports.PersonalizedFilterFetcher = PersonalizedFilterFetcher;
@@ -6436,35 +6436,6 @@ class UrlUtils {
6436
6436
  return window['mock_url'];
6437
6437
  return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
6438
6438
  }
6439
- /**
6440
- * Extrai da URL o parâmetro que contém o resourceId da tela desejada.
6441
- *
6442
- */
6443
- static getResourceIdFromUrlToken(url) {
6444
- try {
6445
- const parts = url.split('/');
6446
- const encodedValue = parts[1];
6447
- return atob(encodedValue);
6448
- }
6449
- catch (error) {
6450
- throw new Error('Erro ao obter resourceId:' + error);
6451
- }
6452
- }
6453
- /**
6454
- * Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
6455
- *
6456
- */
6457
- static getPkObjectFromUrlToken(url) {
6458
- try {
6459
- const parts = url.split('/');
6460
- const encodedObjectPart = parts[parts.length - 2];
6461
- const decodedObjectPart = atob(encodedObjectPart);
6462
- return JSON.parse(decodedObjectPart);
6463
- }
6464
- catch (error) {
6465
- throw new Error('Erro ao obter a PK do objeto:' + error);
6466
- }
6467
- }
6468
6439
  }
6469
6440
 
6470
6441
  class ServiceBrokerRecaller {
@@ -6711,7 +6682,6 @@ class AppletImpressao {
6711
6682
  class DataFetcher {
6712
6683
  constructor() {
6713
6684
  this.GRAPHQL_PATH = `/${window.MGE_MODULE_NAME || 'mgefin-bff'}/graphql`;
6714
- this.ready = true;
6715
6685
  this.watingRequestsById = new Map();
6716
6686
  }
6717
6687
  static get() {
@@ -6722,9 +6692,6 @@ class DataFetcher {
6722
6692
  DataFetcher.instance.resume();
6723
6693
  }
6724
6694
  else {
6725
- if (core.ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
6726
- DataFetcher.instance.pause();
6727
- }
6728
6695
  application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
6729
6696
  application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
6730
6697
  }
@@ -6783,10 +6750,6 @@ class DataFetcher {
6783
6750
  }
6784
6751
  async callGraphQL(req) {
6785
6752
  var _a;
6786
- if (this.ready) {
6787
- this.pause();
6788
- window.requestAnimationFrame(() => this.resume());
6789
- }
6790
6753
  const reqKey = this.getReqKey(req);
6791
6754
  req.queryID = reqKey;
6792
6755
  req.values.queryID = reqKey;
@@ -6816,7 +6779,7 @@ class DataFetcher {
6816
6779
  if (!this.watingRequestsById.has(reqKey)) {
6817
6780
  this.watingRequestsById.set(reqKey, new WaitingRequest(req));
6818
6781
  }
6819
- return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6782
+ return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6820
6783
  }
6821
6784
  }
6822
6785
  resolveURL() {
@@ -6964,43 +6927,42 @@ class DataFetcher {
6964
6927
  getQueryTemplate(re) {
6965
6928
  return (re.query || "").replaceAll("$queryAlias$", re.queryID);
6966
6929
  }
6930
+ getWatingRequest(reqID) {
6931
+ return this.watingRequestsById.get(reqID);
6932
+ }
6967
6933
  pause() {
6968
6934
  this.ready = false;
6969
6935
  }
6970
6936
  async resume() {
6971
6937
  this.ready = true;
6972
6938
  if (this.watingRequestsById.size > 0) {
6973
- const waitinRequests = this.watingRequestsById;
6974
- this.watingRequestsById = new Map();
6975
- this.executePendingRequest(waitinRequests);
6976
- }
6977
- }
6978
- async executePendingRequest(watingRequestsById) {
6979
- const requestsBatch = [];
6980
- watingRequestsById.forEach(async (waitingReq) => {
6981
- let query = this.getQueryTemplate(waitingReq.request);
6982
- requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6983
- });
6984
- let res = undefined;
6985
- let dataResponse = [];
6986
- let errorsResponse = [];
6987
- res = await this.fecthGrapql(requestsBatch);
6988
- dataResponse = res.data;
6989
- errorsResponse = res.errors;
6990
- //Reject promises with errors from query
6991
- errorsResponse.forEach((errorResponse) => {
6992
- Object.entries(errorResponse).forEach(([_key, val]) => {
6993
- var _a;
6994
- (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
6939
+ const requestsBatch = [];
6940
+ this.watingRequestsById.forEach(async (waitingReq) => {
6941
+ let query = this.getQueryTemplate(waitingReq.request);
6942
+ requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6995
6943
  });
6996
- });
6997
- //Resolve promises with data from query
6998
- dataResponse.forEach((data) => {
6999
- Object.entries(data).forEach(([key, val]) => {
7000
- var _a;
7001
- (((_a = watingRequestsById.get(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
6944
+ let res = undefined;
6945
+ let dataResponse = [];
6946
+ let errorsResponse = [];
6947
+ res = await this.fecthGrapql(requestsBatch);
6948
+ dataResponse = res.data;
6949
+ errorsResponse = res.errors;
6950
+ //Reject promises with errors from query
6951
+ errorsResponse.forEach((errorResponse) => {
6952
+ Object.entries(errorResponse).forEach(([_key, val]) => {
6953
+ var _a;
6954
+ (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
6955
+ });
7002
6956
  });
7003
- });
6957
+ //Resolve promises with data from query
6958
+ dataResponse.forEach((data) => {
6959
+ Object.entries(data).forEach(([key, val]) => {
6960
+ var _a;
6961
+ (((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
6962
+ });
6963
+ });
6964
+ this.watingRequestsById.clear();
6965
+ }
7004
6966
  }
7005
6967
  async fecthGrapql(request) {
7006
6968
  let res = undefined;
@@ -1,31 +1,33 @@
1
1
  'use strict';
2
2
 
3
- const ConfigStorage = require('./ConfigStorage-12397f18.js');
3
+ const ConfigStorage = require('./ConfigStorage-e9d7fa82.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const formConfigFetcher = require('./form-config-fetcher-5d62ab62.js');
5
+ const formConfigFetcher = require('./form-config-fetcher-ab3ce222.js');
6
6
 
7
7
  class SnkFormConfigManager {
8
- constructor(configName, resourceID, onConfigChange) {
9
- this._resourceID = resourceID;
8
+ constructor(configName, onConfigChange) {
10
9
  this._configName = configName;
11
10
  this._onConfigChange = onConfigChange;
12
11
  }
13
12
  async loadConfig() {
14
13
  return new Promise(resolve => {
15
- ConfigStorage.ConfigStorage.loadFormConfig(this._configName, this._resourceID)
16
- .then((config) => {
17
- this.setConfig(config);
18
- resolve(config);
19
- })
20
- .catch((error) => {
21
- console.warn(error);
14
+ ConfigStorage.ConfigStorage.get()
15
+ .then((configStorage) => {
16
+ configStorage.loadFormConfig(this._configName)
17
+ .then((config) => {
18
+ this.setConfig(config);
19
+ resolve(config);
20
+ })
21
+ .catch((error) => {
22
+ console.warn(error);
23
+ });
22
24
  });
23
25
  });
24
26
  }
25
27
  saveConfig(config) {
26
28
  const configToSave = core.ObjectUtils.copy(config);
27
29
  return new Promise(accept => {
28
- ConfigStorage.ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
30
+ ConfigStorage.ConfigStorage.saveFormConfig(config, this._configName)
29
31
  .then((response) => {
30
32
  this.setConfig(Object.assign(Object.assign({}, configToSave), response));
31
33
  accept(Object.assign(Object.assign({}, configToSave), response));
@@ -40,7 +42,7 @@ class SnkFormConfigManager {
40
42
  cardsState.set(cardId, propertyChanged === "fixed" ?
41
43
  this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
42
44
  : Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
43
- ConfigStorage.ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
45
+ ConfigStorage.ConfigStorage.saveCardState(cardsState, this._configName)
44
46
  .then(savedCardConfig => {
45
47
  this._config = Object.assign(Object.assign({}, this._config), { cardsState });
46
48
  resolve(savedCardConfig);
@@ -116,18 +118,18 @@ class SnkFormConfigManager {
116
118
  }
117
119
  return this._formConfigFetcher;
118
120
  }
119
- async fetchUserAvailableConfigs() {
121
+ async fetchUserAvailableConfigs(resourceID) {
120
122
  if (this._configName != undefined) {
121
123
  //FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
122
124
  return Promise.resolve(undefined);
123
125
  }
124
- return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
126
+ return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, resourceID);
125
127
  }
126
- async fetchLegacyConfig() {
127
- return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
128
+ async fetchLegacyConfig(resourceID) {
129
+ return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, resourceID);
128
130
  }
129
- async fetchDefaultConfig() {
130
- return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
131
+ async fetchDefaultConfig(resourceID) {
132
+ return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, resourceID);
131
133
  }
132
134
  }
133
135
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@sankhyalabs/core');
4
- const DataFetcher = require('./DataFetcher-f2da1f79.js');
4
+ const DataFetcher = require('./DataFetcher-39b63a1e.js');
5
5
  const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
6
6
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
7
7
 
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
4
+ const resourceFetcher = require('./resource-fetcher-64102551.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;