@sankhyalabs/sankhyablocks 5.4.3 → 5.6.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 (223) hide show
  1. package/dist/cjs/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-e64dce7f.js} +49 -1
  2. package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
  3. package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
  4. package/dist/cjs/index-8d94b7e0.js +7 -0
  5. package/dist/cjs/{index-fc7ca86c.js → index-de79181a.js} +2 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +3 -315
  9. package/dist/cjs/snk-attach.cjs.entry.js +450 -0
  10. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-crud.cjs.entry.js +23 -13
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  14. package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-85d6565e.js} +4 -1
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
  18. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
  20. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-grid.cjs.entry.js +11 -3
  23. package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-9784c527.js} +2 -2
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  25. package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
  26. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  27. package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +48 -5
  28. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +6 -4
  30. package/dist/cjs/{taskbar-elements-5e87cf44.js → taskbar-elements-bc2598f9.js} +4 -1
  31. package/dist/collection/collection-manifest.json +4 -1
  32. package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
  33. package/dist/collection/components/snk-attach/snk-attach.css +8 -0
  34. package/dist/collection/components/snk-attach/snk-attach.js +202 -0
  35. package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
  36. package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
  37. package/dist/collection/components/snk-attach/structure/index.js +3 -0
  38. package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
  40. package/dist/collection/components/snk-crud/snk-crud.js +22 -11
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
  42. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
  43. package/dist/collection/components/snk-grid/snk-grid.js +11 -3
  44. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
  45. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
  46. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
  47. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
  48. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
  49. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
  50. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
  51. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
  52. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  53. package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
  54. package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
  55. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
  56. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
  57. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
  58. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
  59. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
  60. package/dist/collection/lib/message/SnkMessageBuilder.js +7 -1
  61. package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
  62. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
  63. package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
  64. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  65. package/dist/collection/lib/store/index.js +2 -1
  66. package/dist/collection/lib/utils/constants.js +1 -0
  67. package/dist/components/SnkMessageBuilder.js +49 -1
  68. package/dist/components/constants.js +1 -0
  69. package/dist/components/dataunit-fetcher.js +317 -0
  70. package/dist/components/index.d.ts +3 -0
  71. package/dist/components/index.js +3 -0
  72. package/dist/components/index2.js +1 -1
  73. package/dist/components/index3.js +199 -0
  74. package/dist/components/snk-application2.js +2 -314
  75. package/dist/components/snk-attach.d.ts +11 -0
  76. package/dist/components/snk-attach.js +6 -0
  77. package/dist/components/snk-attach2.js +498 -0
  78. package/dist/components/snk-crud.js +77 -48
  79. package/dist/components/snk-data-exporter2.js +1 -1
  80. package/dist/components/snk-data-unit2.js +4 -0
  81. package/dist/components/snk-expression-item.d.ts +11 -0
  82. package/dist/components/snk-expression-item.js +6 -0
  83. package/dist/components/snk-expression-item2.js +241 -0
  84. package/dist/components/snk-filter-field-search.js +1 -200
  85. package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
  86. package/dist/components/snk-filter-param-config.js +1 -273
  87. package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
  88. package/dist/components/snk-grid2.js +12 -4
  89. package/dist/components/snk-personalized-filter.d.ts +11 -0
  90. package/dist/components/snk-personalized-filter.js +158 -0
  91. package/dist/components/snk-simple-bar.js +1 -41
  92. package/dist/components/snk-simple-bar2.js +59 -0
  93. package/dist/components/snk-simple-crud.js +1 -328
  94. package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
  95. package/dist/components/snk-taskbar2.js +10 -199
  96. package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-f3590f65.js} +49 -1
  97. package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
  98. package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
  99. package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
  100. package/dist/esm/index-620ac460.js +7 -0
  101. package/dist/esm/{index-e467ade5.js → index-8efbf198.js} +2 -1
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/sankhyablocks.js +1 -1
  104. package/dist/esm/snk-application.entry.js +3 -315
  105. package/dist/esm/snk-attach.entry.js +446 -0
  106. package/dist/esm/snk-config-options.entry.js +1 -1
  107. package/dist/esm/snk-configurator.entry.js +1 -1
  108. package/dist/esm/snk-crud.entry.js +25 -15
  109. package/dist/esm/snk-data-exporter.entry.js +4 -4
  110. package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-50b1660c.js} +4 -1
  111. package/dist/esm/snk-data-unit.entry.js +2 -2
  112. package/dist/esm/snk-detail-view.entry.js +6 -6
  113. package/dist/esm/snk-expression-item.entry.js +209 -0
  114. package/dist/esm/snk-field-config.entry.js +1 -1
  115. package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
  116. package/dist/esm/snk-form-config.entry.js +1 -1
  117. package/dist/esm/snk-grid-config.entry.js +1 -1
  118. package/dist/esm/snk-grid.entry.js +13 -5
  119. package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-4d12f268.js} +3 -3
  120. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  121. package/dist/esm/snk-personalized-filter.entry.js +122 -0
  122. package/dist/esm/snk-select-box.entry.js +1 -1
  123. package/dist/esm/snk-simple-bar_2.entry.js +325 -0
  124. package/dist/esm/snk-tab-config.entry.js +1 -1
  125. package/dist/esm/snk-taskbar.entry.js +7 -5
  126. package/dist/esm/{taskbar-elements-10d80c79.js → taskbar-elements-e6af3e93.js} +5 -2
  127. package/dist/sankhyablocks/p-17375123.js +1 -0
  128. package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-1dcfd32a.entry.js +1 -0
  130. package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
  131. package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
  132. package/dist/sankhyablocks/p-3d3263b4.js +1 -0
  133. package/dist/sankhyablocks/p-3fbe2d69.entry.js +11 -0
  134. package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
  135. package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
  136. package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6a02e236.js +1 -0
  138. package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
  141. package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
  142. package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
  143. package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-c4417efb.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-c9477950.js +1 -0
  145. package/dist/sankhyablocks/{p-703dddb9.js → p-ccd26e3a.js} +1 -1
  146. package/dist/sankhyablocks/p-d410f45a.js +1 -0
  147. package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-1393dc00.entry.js → p-f344b811.entry.js} +1 -1
  151. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  152. package/dist/sankhyablocks/p-f821768b.js +74 -0
  153. package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
  155. package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
  156. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  157. package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
  158. package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
  159. package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
  160. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
  161. package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
  162. package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
  163. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
  164. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
  165. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
  166. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
  167. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
  168. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
  169. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
  170. package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
  171. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  172. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
  173. package/dist/types/components.d.ts +150 -9
  174. package/dist/types/global.d.ts +9 -0
  175. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
  176. package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
  177. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
  178. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
  179. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
  181. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
  182. package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
  183. package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
  184. package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
  185. package/dist/types/lib/store/index.d.ts +1 -0
  186. package/dist/types/lib/utils/constants.d.ts +2 -1
  187. package/package.json +1 -1
  188. package/react/components.d.ts +3 -0
  189. package/react/components.js +3 -0
  190. package/react/components.js.map +1 -1
  191. package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
  192. package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
  193. package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
  194. package/dist/esm/snk-simple-bar.entry.js +0 -26
  195. package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
  196. package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
  197. package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
  198. package/dist/sankhyablocks/p-74724fa7.js +0 -1
  199. package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
  200. package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
  201. package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
  202. package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
  203. package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
  204. package/dist/sankhyablocks/p-98f7f796.js +0 -1
  205. package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
  206. package/dist/sankhyablocks/p-bc281de0.js +0 -1
  207. package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
  208. package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
  209. package/dist/sankhyablocks/p-f587a454.js +0 -1
  210. package/dist/types/components/snk-application/snk-application.d.ts +0 -259
  211. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
  212. package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
  213. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
  214. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
  215. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
  216. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
  217. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
  218. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
  219. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
  220. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
  221. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
  222. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
  223. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -0,0 +1,199 @@
1
+ import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
2
+
3
+ const appendToMap = (map, propName, value) => {
4
+ const items = map.get(propName);
5
+ if (!items) {
6
+ map.set(propName, [value]);
7
+ }
8
+ else if (!items.includes(value)) {
9
+ items.push(value);
10
+ }
11
+ };
12
+ const debounce = (fn, ms) => {
13
+ let timeoutId;
14
+ return (...args) => {
15
+ if (timeoutId) {
16
+ clearTimeout(timeoutId);
17
+ }
18
+ timeoutId = setTimeout(() => {
19
+ timeoutId = 0;
20
+ fn(...args);
21
+ }, ms);
22
+ };
23
+ };
24
+
25
+ /**
26
+ * Check if a possible element isConnected.
27
+ * The property might not be there, so we check for it.
28
+ *
29
+ * We want it to return true if isConnected is not a property,
30
+ * otherwise we would remove these elements and would not update.
31
+ *
32
+ * Better leak in Edge than to be useless.
33
+ */
34
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
35
+ const cleanupElements = debounce((map) => {
36
+ for (let key of map.keys()) {
37
+ map.set(key, map.get(key).filter(isConnected));
38
+ }
39
+ }, 2000);
40
+ const stencilSubscription = () => {
41
+ if (typeof getRenderingRef !== 'function') {
42
+ // If we are not in a stencil project, we do nothing.
43
+ // This function is not really exported by @stencil/core.
44
+ return {};
45
+ }
46
+ const elmsToUpdate = new Map();
47
+ return {
48
+ dispose: () => elmsToUpdate.clear(),
49
+ get: (propName) => {
50
+ const elm = getRenderingRef();
51
+ if (elm) {
52
+ appendToMap(elmsToUpdate, propName, elm);
53
+ }
54
+ },
55
+ set: (propName) => {
56
+ const elements = elmsToUpdate.get(propName);
57
+ if (elements) {
58
+ elmsToUpdate.set(propName, elements.filter(forceUpdate));
59
+ }
60
+ cleanupElements(elmsToUpdate);
61
+ },
62
+ reset: () => {
63
+ elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
64
+ cleanupElements(elmsToUpdate);
65
+ },
66
+ };
67
+ };
68
+
69
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
70
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
71
+ const unwrappedState = unwrap(defaultState);
72
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
73
+ const handlers = {
74
+ dispose: [],
75
+ get: [],
76
+ set: [],
77
+ reset: [],
78
+ };
79
+ const reset = () => {
80
+ var _a;
81
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
82
+ // otherwise, the state won't be properly reset
83
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
84
+ handlers.reset.forEach((cb) => cb());
85
+ };
86
+ const dispose = () => {
87
+ // Call first dispose as resetting the state would
88
+ // cause less updates ;)
89
+ handlers.dispose.forEach((cb) => cb());
90
+ reset();
91
+ };
92
+ const get = (propName) => {
93
+ handlers.get.forEach((cb) => cb(propName));
94
+ return states.get(propName);
95
+ };
96
+ const set = (propName, value) => {
97
+ const oldValue = states.get(propName);
98
+ if (shouldUpdate(value, oldValue, propName)) {
99
+ states.set(propName, value);
100
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
101
+ }
102
+ };
103
+ const state = (typeof Proxy === 'undefined'
104
+ ? {}
105
+ : new Proxy(unwrappedState, {
106
+ get(_, propName) {
107
+ return get(propName);
108
+ },
109
+ ownKeys(_) {
110
+ return Array.from(states.keys());
111
+ },
112
+ getOwnPropertyDescriptor() {
113
+ return {
114
+ enumerable: true,
115
+ configurable: true,
116
+ };
117
+ },
118
+ has(_, propName) {
119
+ return states.has(propName);
120
+ },
121
+ set(_, propName, value) {
122
+ set(propName, value);
123
+ return true;
124
+ },
125
+ }));
126
+ const on = (eventName, callback) => {
127
+ handlers[eventName].push(callback);
128
+ return () => {
129
+ removeFromArray(handlers[eventName], callback);
130
+ };
131
+ };
132
+ const onChange = (propName, cb) => {
133
+ const unSet = on('set', (key, newValue) => {
134
+ if (key === propName) {
135
+ cb(newValue);
136
+ }
137
+ });
138
+ // We need to unwrap the defaultState because it might be a function.
139
+ // Otherwise we might not be sending the right reset value.
140
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
141
+ return () => {
142
+ unSet();
143
+ unReset();
144
+ };
145
+ };
146
+ const use = (...subscriptions) => {
147
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
148
+ if (subscription.set) {
149
+ unsubs.push(on('set', subscription.set));
150
+ }
151
+ if (subscription.get) {
152
+ unsubs.push(on('get', subscription.get));
153
+ }
154
+ if (subscription.reset) {
155
+ unsubs.push(on('reset', subscription.reset));
156
+ }
157
+ if (subscription.dispose) {
158
+ unsubs.push(on('dispose', subscription.dispose));
159
+ }
160
+ return unsubs;
161
+ }, []);
162
+ return () => unsubs.forEach((unsub) => unsub());
163
+ };
164
+ const forceUpdate = (key) => {
165
+ const oldValue = states.get(key);
166
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
167
+ };
168
+ return {
169
+ state,
170
+ get,
171
+ set,
172
+ on,
173
+ onChange,
174
+ use,
175
+ dispose,
176
+ reset,
177
+ forceUpdate,
178
+ };
179
+ };
180
+ const removeFromArray = (array, item) => {
181
+ const index = array.indexOf(item);
182
+ if (index >= 0) {
183
+ array[index] = array[array.length - 1];
184
+ array.length--;
185
+ }
186
+ };
187
+
188
+ const createStore = (defaultState, shouldUpdate) => {
189
+ const map = createObservableMap(defaultState, shouldUpdate);
190
+ map.use(stencilSubscription());
191
+ return map;
192
+ };
193
+
194
+ const store = createStore({
195
+ exporterProviders: {},
196
+ filterFieldsDataSource: undefined
197
+ });
198
+
199
+ export { store as s };
@@ -1,9 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataUnit, StringUtils, DataType, DataUnitStorage, ChangeOperation, DateUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
2
+ import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DateUtils, StringUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking, DataType } from '@sankhyalabs/core';
3
3
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
4
4
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
6
6
  import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
7
+ import { D as DataUnitFetcher } from './dataunit-fetcher.js';
7
8
  import { R as ResourceFetcher } from './form-config-fetcher.js';
8
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
9
10
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
@@ -116,319 +117,6 @@ class TotalsFetcher {
116
117
  }
117
118
  }
118
119
 
119
- var __rest = (undefined && undefined.__rest) || function (s, e) {
120
- var t = {};
121
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
122
- t[p] = s[p];
123
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
124
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
125
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
126
- t[p[i]] = s[p[i]];
127
- }
128
- return t;
129
- };
130
- class DataUnitFetcher {
131
- constructor() {
132
- this.templateByQuery = new Map();
133
- this._loadDataTimeout = {};
134
- this.buldTemplates();
135
- }
136
- buldTemplates() {
137
- this.templateByQuery.set("fetchDataUnit", dist.gql `query($name: String!) {
138
- $queryAlias$: fetchDataUnit(name: $name){
139
- name
140
- fields{
141
- name
142
- defaultValue
143
- label
144
- visible
145
- readOnly
146
- required
147
- dataType
148
- userInterface
149
- calculated
150
- group
151
- order
152
- properties{
153
- name
154
- value
155
- }
156
- dependencies{
157
- masterFields
158
- type
159
- expression
160
- }
161
- }
162
- children{
163
- name
164
- label
165
- links{
166
- source
167
- target
168
- }
169
- }
170
- }
171
- }`);
172
- this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!] $parentRecordId: String) {
173
- $queryAlias$: fetchDataUnit(name: $dataunit){
174
- data(limit: $limit offset: $offset filters: $filters sort: $sort parentRecordId: $parentRecordId){
175
- limit
176
- offset
177
- total
178
- hasMore
179
- records{
180
- id
181
- label
182
- fields {
183
- name
184
- value
185
- }
186
- }
187
- }
188
- }
189
- }`);
190
- this.templateByQuery.set("saveData", dist.gql `mutation($changes: [InputBatchChange!]!) {
191
- $queryAlias$: batchOperationDataUnit(changes: $changes){
192
- oldId
193
- id
194
- label
195
- ownerDataUnitName
196
- fields {
197
- name
198
- value
199
- }
200
- }
201
- }`);
202
- this.templateByQuery.set("fetchDataRecord", dist.gql `query($dataunit: String! $recordID: [String!]) {
203
- $queryAlias$: fetchDataUnit(name: $dataunit){
204
- record(id: $recordID){
205
- id
206
- label
207
- fields {
208
- name
209
- value
210
- }
211
- }
212
- }
213
- }`);
214
- }
215
- getDataUnit(entityName, resourceID, parentDataUnit) {
216
- const dataUnit = parentDataUnit != undefined ? parentDataUnit.getChildDataunit(`dd://${entityName}/${resourceID}`) : new DataUnit(`dd://${entityName}/${resourceID}`);
217
- dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
218
- dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
219
- dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
220
- dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
221
- dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
222
- return dataUnit;
223
- }
224
- loadMetadata(dataUnit) {
225
- return new Promise((resolve, reject) => {
226
- DataFetcher.get()
227
- .callGraphQL({
228
- values: { name: dataUnit.name },
229
- query: this.templateByQuery.get("fetchDataUnit"),
230
- })
231
- .then((resp) => {
232
- var _a;
233
- const metadata = {
234
- name: resp.name,
235
- label: resp.name,
236
- children: [...resp.children],
237
- fields: []
238
- };
239
- (_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
240
- let properties = undefined;
241
- if (Array.isArray(source.properties)) {
242
- properties = {};
243
- if (source.calculated) {
244
- properties.gridHeaderTooltip = "Campos calculados não podem ser ordenados";
245
- }
246
- source.properties.forEach((prop) => (properties[prop.name] = prop.value));
247
- }
248
- metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
249
- });
250
- metadata.fields.sort((a, b) => a.order - b.order);
251
- resolve(metadata);
252
- })
253
- .catch((error) => {
254
- reject(error);
255
- });
256
- });
257
- }
258
- loadData(dataUnit, request) {
259
- const duName = dataUnit.name;
260
- if (this._loadDataTimeout[duName]) {
261
- clearTimeout(this._loadDataTimeout[duName]);
262
- delete this._loadDataTimeout[duName];
263
- }
264
- return new Promise((resolve, reject) => {
265
- this._loadDataTimeout[duName] = setTimeout(() => {
266
- delete this._loadDataTimeout[duName];
267
- this.doLoadData(dataUnit, request)
268
- .then(result => resolve(result))
269
- .catch(reason => reject(reason));
270
- }, 200);
271
- });
272
- }
273
- doLoadData(dataUnit, request) {
274
- return new Promise((resolve, reject) => {
275
- var _a;
276
- const { sort, filters, limit, offset, quickFilter } = request;
277
- const variables = { dataunit: dataUnit.name, sort, filters };
278
- variables.limit = limit;
279
- variables.offset = offset;
280
- variables.parentRecordId = request.parentRecordId;
281
- if (!StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
282
- if (variables.filter === undefined) {
283
- variables.filter = [];
284
- }
285
- const quickFilterCriteria = {
286
- name: "__QUICK_FILTER__",
287
- expression: "__QUICK_FILTER__",
288
- params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
289
- };
290
- if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
291
- quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
292
- }
293
- variables.filter.push(quickFilterCriteria);
294
- }
295
- DataFetcher.get()
296
- .callGraphQL({
297
- values: variables,
298
- query: this.templateByQuery.get("fetchData"),
299
- })
300
- .then((resp) => {
301
- const { limit, offset, total, hasMore, records } = resp.data;
302
- let paginationInfo;
303
- if (limit) {
304
- const firstRecord = total == 0 ? 0 : offset + 1;
305
- const lastRecord = offset + Math.min(records.length, limit);
306
- const currentPage = offset / limit;
307
- paginationInfo = {
308
- firstRecord,
309
- lastRecord,
310
- total,
311
- currentPage,
312
- hasMore
313
- };
314
- }
315
- const processedRecords = [];
316
- records.forEach((responseRecord) => {
317
- const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
318
- responseRecord.fields.forEach(({ name, value }) => {
319
- duRecord[name] = dataUnit.valueFromString(name, value);
320
- });
321
- processedRecords.push(duRecord);
322
- });
323
- resolve({
324
- paginationInfo,
325
- records: processedRecords
326
- });
327
- })
328
- .catch((error) => {
329
- reject(error);
330
- });
331
- });
332
- }
333
- saveData(dataUnit, duChanges) {
334
- const changes = duChanges.map((change) => {
335
- const { dataUnit: changeDU, record, updatingFields, operation } = change;
336
- const dataUnitInstance = DataUnitStorage.get(changeDU);
337
- let parsedUpdatingFields;
338
- if (updatingFields) {
339
- parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
340
- const descriptor = dataUnitInstance.getField(fieldName);
341
- const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
342
- return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
343
- });
344
- }
345
- const reqChange = { dataUnit: changeDU, fields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
346
- if (change.sourceId) {
347
- reqChange.sourceId = change.sourceId;
348
- }
349
- if (record.__parent__record__id__) {
350
- reqChange.parentRecordId = record.__parent__record__id__;
351
- }
352
- return reqChange;
353
- });
354
- return new Promise((resolve, reject) => {
355
- const changesFormatted = changes.map((_a) => {
356
- var rest = __rest(_a, []);
357
- return rest;
358
- });
359
- DataFetcher.get()
360
- .callGraphQL({
361
- values: { changes: changesFormatted },
362
- query: this.templateByQuery.get("saveData"),
363
- })
364
- .then((resp) => {
365
- const dataUnitRecords = [];
366
- resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
367
- const duRecord = {
368
- __record__id__: responseRecord.id,
369
- __record__label__: responseRecord.label,
370
- __owner__dataunit__name__: responseRecord.ownerDataUnitName,
371
- };
372
- const dataUnitInstance = DataUnitStorage.get(duRecord.__owner__dataunit__name__) || dataUnit;
373
- if (responseRecord.oldId) {
374
- duRecord.__old__id__ = responseRecord.oldId;
375
- }
376
- responseRecord.fields.forEach(({ name, value }) => {
377
- var _a;
378
- duRecord[name] = ((_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value)) || value;
379
- });
380
- dataUnitRecords.push(duRecord);
381
- });
382
- resolve(dataUnitRecords);
383
- })
384
- .catch((error) => {
385
- reject(error);
386
- });
387
- });
388
- }
389
- removeRecords(dataUnit, recordIds) {
390
- const changes = recordIds.map((recordId) => {
391
- return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
392
- });
393
- return new Promise((resolve, reject) => {
394
- DataFetcher.get()
395
- .callGraphQL({
396
- values: { changes: changes },
397
- query: this.templateByQuery.get("saveData"),
398
- })
399
- .then((_resp) => {
400
- resolve(recordIds);
401
- })
402
- .catch((error) => {
403
- reject(error);
404
- });
405
- });
406
- }
407
- loadRecord(dataUnit, recordIds) {
408
- return new Promise((resolve, reject) => {
409
- DataFetcher.get()
410
- .callGraphQL({
411
- values: { recordID: recordIds, dataunit: dataUnit.name },
412
- query: this.templateByQuery.get("fetchDataRecord"),
413
- })
414
- .then((response) => {
415
- const dataUnitRecords = [];
416
- response.record.forEach(responseRecord => {
417
- const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
418
- responseRecord.fields.forEach(({ name, value }) => {
419
- duRecord[name] = dataUnit.valueFromString(name, value);
420
- });
421
- dataUnitRecords.push(duRecord);
422
- });
423
- resolve(dataUnitRecords);
424
- })
425
- .catch((error) => {
426
- reject(error);
427
- });
428
- });
429
- }
430
- }
431
-
432
120
  var _a;
433
121
  class Workspace {
434
122
  static openAppActivity(resourceId, pkObject) {
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkAttach extends Components.SnkAttach, HTMLElement {}
4
+ export const SnkAttach: {
5
+ prototype: SnkAttach;
6
+ new (): SnkAttach;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkAttach$1, d as defineCustomElement$1 } from './snk-attach2.js';
2
+
3
+ const SnkAttach = SnkAttach$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkAttach, defineCustomElement };