@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
@@ -1,205 +1,11 @@
1
- import { getRenderingRef, forceUpdate, h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
1
+ import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
2
2
  import { StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig.js';
4
4
  import { P as PresentationMode } from './index2.js';
5
+ import { s as store } from './index3.js';
5
6
  import { d as defineCustomElement$2 } from './snk-data-exporter2.js';
6
7
  import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
7
8
 
8
- const appendToMap = (map, propName, value) => {
9
- const items = map.get(propName);
10
- if (!items) {
11
- map.set(propName, [value]);
12
- }
13
- else if (!items.includes(value)) {
14
- items.push(value);
15
- }
16
- };
17
- const debounce = (fn, ms) => {
18
- let timeoutId;
19
- return (...args) => {
20
- if (timeoutId) {
21
- clearTimeout(timeoutId);
22
- }
23
- timeoutId = setTimeout(() => {
24
- timeoutId = 0;
25
- fn(...args);
26
- }, ms);
27
- };
28
- };
29
-
30
- /**
31
- * Check if a possible element isConnected.
32
- * The property might not be there, so we check for it.
33
- *
34
- * We want it to return true if isConnected is not a property,
35
- * otherwise we would remove these elements and would not update.
36
- *
37
- * Better leak in Edge than to be useless.
38
- */
39
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
40
- const cleanupElements = debounce((map) => {
41
- for (let key of map.keys()) {
42
- map.set(key, map.get(key).filter(isConnected));
43
- }
44
- }, 2000);
45
- const stencilSubscription = () => {
46
- if (typeof getRenderingRef !== 'function') {
47
- // If we are not in a stencil project, we do nothing.
48
- // This function is not really exported by @stencil/core.
49
- return {};
50
- }
51
- const elmsToUpdate = new Map();
52
- return {
53
- dispose: () => elmsToUpdate.clear(),
54
- get: (propName) => {
55
- const elm = getRenderingRef();
56
- if (elm) {
57
- appendToMap(elmsToUpdate, propName, elm);
58
- }
59
- },
60
- set: (propName) => {
61
- const elements = elmsToUpdate.get(propName);
62
- if (elements) {
63
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
64
- }
65
- cleanupElements(elmsToUpdate);
66
- },
67
- reset: () => {
68
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
69
- cleanupElements(elmsToUpdate);
70
- },
71
- };
72
- };
73
-
74
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
75
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
76
- const unwrappedState = unwrap(defaultState);
77
- let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
78
- const handlers = {
79
- dispose: [],
80
- get: [],
81
- set: [],
82
- reset: [],
83
- };
84
- const reset = () => {
85
- var _a;
86
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
87
- // otherwise, the state won't be properly reset
88
- states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
89
- handlers.reset.forEach((cb) => cb());
90
- };
91
- const dispose = () => {
92
- // Call first dispose as resetting the state would
93
- // cause less updates ;)
94
- handlers.dispose.forEach((cb) => cb());
95
- reset();
96
- };
97
- const get = (propName) => {
98
- handlers.get.forEach((cb) => cb(propName));
99
- return states.get(propName);
100
- };
101
- const set = (propName, value) => {
102
- const oldValue = states.get(propName);
103
- if (shouldUpdate(value, oldValue, propName)) {
104
- states.set(propName, value);
105
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
106
- }
107
- };
108
- const state = (typeof Proxy === 'undefined'
109
- ? {}
110
- : new Proxy(unwrappedState, {
111
- get(_, propName) {
112
- return get(propName);
113
- },
114
- ownKeys(_) {
115
- return Array.from(states.keys());
116
- },
117
- getOwnPropertyDescriptor() {
118
- return {
119
- enumerable: true,
120
- configurable: true,
121
- };
122
- },
123
- has(_, propName) {
124
- return states.has(propName);
125
- },
126
- set(_, propName, value) {
127
- set(propName, value);
128
- return true;
129
- },
130
- }));
131
- const on = (eventName, callback) => {
132
- handlers[eventName].push(callback);
133
- return () => {
134
- removeFromArray(handlers[eventName], callback);
135
- };
136
- };
137
- const onChange = (propName, cb) => {
138
- const unSet = on('set', (key, newValue) => {
139
- if (key === propName) {
140
- cb(newValue);
141
- }
142
- });
143
- // We need to unwrap the defaultState because it might be a function.
144
- // Otherwise we might not be sending the right reset value.
145
- const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
146
- return () => {
147
- unSet();
148
- unReset();
149
- };
150
- };
151
- const use = (...subscriptions) => {
152
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
153
- if (subscription.set) {
154
- unsubs.push(on('set', subscription.set));
155
- }
156
- if (subscription.get) {
157
- unsubs.push(on('get', subscription.get));
158
- }
159
- if (subscription.reset) {
160
- unsubs.push(on('reset', subscription.reset));
161
- }
162
- if (subscription.dispose) {
163
- unsubs.push(on('dispose', subscription.dispose));
164
- }
165
- return unsubs;
166
- }, []);
167
- return () => unsubs.forEach((unsub) => unsub());
168
- };
169
- const forceUpdate = (key) => {
170
- const oldValue = states.get(key);
171
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
172
- };
173
- return {
174
- state,
175
- get,
176
- set,
177
- on,
178
- onChange,
179
- use,
180
- dispose,
181
- reset,
182
- forceUpdate,
183
- };
184
- };
185
- const removeFromArray = (array, item) => {
186
- const index = array.indexOf(item);
187
- if (index >= 0) {
188
- array[index] = array[array.length - 1];
189
- array.length--;
190
- }
191
- };
192
-
193
- const createStore = (defaultState, shouldUpdate) => {
194
- const map = createObservableMap(defaultState, shouldUpdate);
195
- map.use(stencilSubscription());
196
- return map;
197
- };
198
-
199
- const store = createStore({
200
- exporterProviders: {}
201
- });
202
-
203
9
  var TaskbarElement;
204
10
  (function (TaskbarElement) {
205
11
  TaskbarElement["PREVIOUS"] = "PREVIOUS";
@@ -217,6 +23,7 @@ var TaskbarElement;
217
23
  TaskbarElement["DIVIDER"] = "DIVIDER";
218
24
  TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
219
25
  TaskbarElement["DATA_EXPORTER"] = "DATA_EXPORTER";
26
+ TaskbarElement["ATTACH"] = "ATTACH";
220
27
  })(TaskbarElement || (TaskbarElement = {}));
221
28
  var AuthorizationElements;
222
29
  (function (AuthorizationElements) {
@@ -289,6 +96,8 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
289
96
  case TaskbarElement.DATA_EXPORTER:
290
97
  const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
291
98
  return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId });
99
+ case TaskbarElement.ATTACH:
100
+ return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
292
101
  }
293
102
  };
294
103
  function textButton(name, className, dataElementId, text, title, action, isEnabled) {
@@ -327,7 +136,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
327
136
  [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
328
137
  [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
329
138
  [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
330
- [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator"
139
+ [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
140
+ [TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
331
141
  };
332
142
  this._permissions = undefined;
333
143
  this.configName = undefined;
@@ -434,7 +244,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
434
244
  if (index > 1) {
435
245
  className += "ez-padding-left--medium";
436
246
  }
437
- if (TaskbarElement[def.toString()]) {
247
+ const taskbarElement = TaskbarElement[def.toString()];
248
+ if (taskbarElement) {
438
249
  return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName, this.presentationMode);
439
250
  }
440
251
  else {
@@ -548,4 +359,4 @@ function defineCustomElement() {
548
359
  } });
549
360
  }
550
361
 
551
- export { SnkTaskbar as S, TaskbarElement as T, defineCustomElement as d, store as s };
362
+ export { SnkTaskbar as S, TaskbarElement as T, defineCustomElement as d };
@@ -73,6 +73,7 @@ const snkTaskbarMessages = {
73
73
  titleGridMode: "Modo Grade",
74
74
  titleFormMode: "Modo Formulário",
75
75
  titleConfigurator: "Configurações",
76
+ titleAttach: "Anexar",
76
77
  forbidden: "Permissão não liberada"
77
78
  };
78
79
 
@@ -278,6 +279,50 @@ const snkFilterFieldSearchMessages = {
278
279
  linkLabel: "Categorias de {{link}}",
279
280
  };
280
281
 
282
+ const snkSimpleBarMessages = {
283
+ backTitle: "Voltar"
284
+ };
285
+
286
+ const snkAttachMessages = {
287
+ title: "Anexar arquivos",
288
+ description: "Faça o upload dos arquivos ou informe links que deseja anexar ao título",
289
+ attachHint: "Fazer download do arquivo",
290
+ breadcrumbTitle: "Anexar",
291
+ finishedMessage: "O anexo foi finalizado com sucesso",
292
+ finish: "Finalizar",
293
+ cancelConfirmation: {
294
+ title: "Atenção",
295
+ message: "As alterações realizadas não serão aplicadas.<br/><br/><b>Deseja mesmo continuar?</b>",
296
+ },
297
+ alertValidation: {
298
+ fileAndLinkAtTheSameTime: {
299
+ title: "Atenção",
300
+ message: "Não é permitido inserir o arquivo e o link ao mesmo tempo."
301
+ },
302
+ anyLinkOrFileFilled: {
303
+ title: "Atenção",
304
+ message: `É necessário preencher o campo "Link" ou anexar um arquivo.`
305
+ }
306
+ },
307
+ taskbar: {
308
+ titleDownload: "Fazer download",
309
+ titleLink: "Abrir link",
310
+ }
311
+ };
312
+
313
+ const snkPersonalizedFilterMessages = {
314
+ info: {
315
+ labelSearchField: "Buscar campo",
316
+ labelOperator: "Operador",
317
+ labelValueVarible: "Valor variável",
318
+ titleTooltip: "Ao ativar um valor variável, é possível inserir um valor diferente sempre que o filtro for aplicado"
319
+ },
320
+ confirm: {
321
+ title: "Aviso",
322
+ description: `As informações da condição serão descartadas.</br></br><b>Gostaria de continuar?</b>`
323
+ }
324
+ };
325
+
281
326
  class SnkMessageBuilder {
282
327
  constructor(domainName) {
283
328
  this._defaults = {
@@ -297,7 +342,10 @@ class SnkMessageBuilder {
297
342
  snkCrud: snkCrudMessages,
298
343
  fileViewer: fileViewerMessages,
299
344
  snkFilterParamConfig: snkFilterParamConfigMessages,
300
- snkFilterFieldSearch: snkFilterFieldSearchMessages
345
+ snkFilterFieldSearch: snkFilterFieldSearchMessages,
346
+ snkSimpleBar: snkSimpleBarMessages,
347
+ snkAttach: snkAttachMessages,
348
+ snkPersonalizedFilter: snkPersonalizedFilterMessages
301
349
  };
302
350
  this._currentOperation = OperationMap.CLEAN;
303
351
  this._domainName = domainName;
@@ -4,6 +4,7 @@ var VIEW_MODE;
4
4
  (function (VIEW_MODE) {
5
5
  VIEW_MODE[VIEW_MODE["GRID"] = 0] = "GRID";
6
6
  VIEW_MODE[VIEW_MODE["FORM"] = 1] = "FORM";
7
+ VIEW_MODE[VIEW_MODE["ATTACHMENT"] = 2] = "ATTACHMENT";
7
8
  })(VIEW_MODE || (VIEW_MODE = {}));
8
9
  const ACTION_CONFIG = {
9
10
  add: 'ADD',
@@ -0,0 +1,317 @@
1
+ import { DataUnit, StringUtils, DataType, DataUnitStorage, ChangeOperation } from '@sankhyalabs/core';
2
+ import { d as dist, D as DataFetcher } from './DataFetcher-b3d8b2d5.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
+ class DataUnitFetcher {
16
+ constructor() {
17
+ this.templateByQuery = new Map();
18
+ this._loadDataTimeout = {};
19
+ this.buldTemplates();
20
+ }
21
+ buldTemplates() {
22
+ this.templateByQuery.set("fetchDataUnit", dist.gql `query($name: String!) {
23
+ $queryAlias$: fetchDataUnit(name: $name){
24
+ name
25
+ fields{
26
+ name
27
+ defaultValue
28
+ label
29
+ visible
30
+ readOnly
31
+ required
32
+ dataType
33
+ userInterface
34
+ calculated
35
+ group
36
+ order
37
+ properties{
38
+ name
39
+ value
40
+ }
41
+ dependencies{
42
+ masterFields
43
+ type
44
+ expression
45
+ }
46
+ }
47
+ children{
48
+ name
49
+ label
50
+ links{
51
+ source
52
+ target
53
+ }
54
+ }
55
+ }
56
+ }`);
57
+ this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!] $parentRecordId: String) {
58
+ $queryAlias$: fetchDataUnit(name: $dataunit){
59
+ data(limit: $limit offset: $offset filters: $filters sort: $sort parentRecordId: $parentRecordId){
60
+ limit
61
+ offset
62
+ total
63
+ hasMore
64
+ records{
65
+ id
66
+ label
67
+ fields {
68
+ name
69
+ value
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }`);
75
+ this.templateByQuery.set("saveData", dist.gql `mutation($changes: [InputBatchChange!]!) {
76
+ $queryAlias$: batchOperationDataUnit(changes: $changes){
77
+ oldId
78
+ id
79
+ label
80
+ ownerDataUnitName
81
+ fields {
82
+ name
83
+ value
84
+ }
85
+ }
86
+ }`);
87
+ this.templateByQuery.set("fetchDataRecord", dist.gql `query($dataunit: String! $recordID: [String!]) {
88
+ $queryAlias$: fetchDataUnit(name: $dataunit){
89
+ record(id: $recordID){
90
+ id
91
+ label
92
+ fields {
93
+ name
94
+ value
95
+ }
96
+ }
97
+ }
98
+ }`);
99
+ }
100
+ getDataUnit(entityName, resourceID, parentDataUnit) {
101
+ const dataUnit = parentDataUnit != undefined ? parentDataUnit.getChildDataunit(`dd://${entityName}/${resourceID}`) : new DataUnit(`dd://${entityName}/${resourceID}`);
102
+ dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
103
+ dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
104
+ dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
105
+ dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
106
+ dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
107
+ return dataUnit;
108
+ }
109
+ loadMetadata(dataUnit) {
110
+ return new Promise((resolve, reject) => {
111
+ DataFetcher.get()
112
+ .callGraphQL({
113
+ values: { name: dataUnit.name },
114
+ query: this.templateByQuery.get("fetchDataUnit"),
115
+ })
116
+ .then((resp) => {
117
+ var _a;
118
+ const metadata = {
119
+ name: resp.name,
120
+ label: resp.name,
121
+ children: [...resp.children],
122
+ fields: []
123
+ };
124
+ (_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
125
+ let properties = undefined;
126
+ if (Array.isArray(source.properties)) {
127
+ properties = {};
128
+ if (source.calculated) {
129
+ properties.gridHeaderTooltip = "Campos calculados não podem ser ordenados";
130
+ }
131
+ source.properties.forEach((prop) => (properties[prop.name] = prop.value));
132
+ }
133
+ metadata.fields.push(Object.assign(Object.assign({}, source), { properties }));
134
+ });
135
+ metadata.fields.sort((a, b) => a.order - b.order);
136
+ resolve(metadata);
137
+ })
138
+ .catch((error) => {
139
+ reject(error);
140
+ });
141
+ });
142
+ }
143
+ loadData(dataUnit, request) {
144
+ const duName = dataUnit.name;
145
+ if (this._loadDataTimeout[duName]) {
146
+ clearTimeout(this._loadDataTimeout[duName]);
147
+ delete this._loadDataTimeout[duName];
148
+ }
149
+ return new Promise((resolve, reject) => {
150
+ this._loadDataTimeout[duName] = setTimeout(() => {
151
+ delete this._loadDataTimeout[duName];
152
+ this.doLoadData(dataUnit, request)
153
+ .then(result => resolve(result))
154
+ .catch(reason => reject(reason));
155
+ }, 200);
156
+ });
157
+ }
158
+ doLoadData(dataUnit, request) {
159
+ return new Promise((resolve, reject) => {
160
+ var _a;
161
+ const { sort, filters, limit, offset, quickFilter } = request;
162
+ const variables = { dataunit: dataUnit.name, sort, filters };
163
+ variables.limit = limit;
164
+ variables.offset = offset;
165
+ variables.parentRecordId = request.parentRecordId;
166
+ if (!StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
167
+ if (variables.filter === undefined) {
168
+ variables.filter = [];
169
+ }
170
+ const quickFilterCriteria = {
171
+ name: "__QUICK_FILTER__",
172
+ expression: "__QUICK_FILTER__",
173
+ params: [{ name: "term", dataType: DataType.TEXT, value: quickFilter.term }]
174
+ };
175
+ if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
176
+ quickFilterCriteria.params.push({ name: "fields", dataType: DataType.OBJECT, value: quickFilter.fields });
177
+ }
178
+ variables.filter.push(quickFilterCriteria);
179
+ }
180
+ DataFetcher.get()
181
+ .callGraphQL({
182
+ values: variables,
183
+ query: this.templateByQuery.get("fetchData"),
184
+ })
185
+ .then((resp) => {
186
+ const { limit, offset, total, hasMore, records } = resp.data;
187
+ let paginationInfo;
188
+ if (limit) {
189
+ const firstRecord = total == 0 ? 0 : offset + 1;
190
+ const lastRecord = offset + Math.min(records.length, limit);
191
+ const currentPage = offset / limit;
192
+ paginationInfo = {
193
+ firstRecord,
194
+ lastRecord,
195
+ total,
196
+ currentPage,
197
+ hasMore
198
+ };
199
+ }
200
+ const processedRecords = [];
201
+ records.forEach((responseRecord) => {
202
+ const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
203
+ responseRecord.fields.forEach(({ name, value }) => {
204
+ duRecord[name] = dataUnit.valueFromString(name, value);
205
+ });
206
+ processedRecords.push(duRecord);
207
+ });
208
+ resolve({
209
+ paginationInfo,
210
+ records: processedRecords
211
+ });
212
+ })
213
+ .catch((error) => {
214
+ reject(error);
215
+ });
216
+ });
217
+ }
218
+ saveData(dataUnit, duChanges) {
219
+ const changes = duChanges.map((change) => {
220
+ const { dataUnit: changeDU, record, updatingFields, operation } = change;
221
+ const dataUnitInstance = DataUnitStorage.get(changeDU);
222
+ let parsedUpdatingFields;
223
+ if (updatingFields) {
224
+ parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
225
+ const descriptor = dataUnitInstance.getField(fieldName);
226
+ const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
227
+ return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
228
+ });
229
+ }
230
+ const reqChange = { dataUnit: changeDU, fields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
231
+ if (change.sourceId) {
232
+ reqChange.sourceId = change.sourceId;
233
+ }
234
+ if (record.__parent__record__id__) {
235
+ reqChange.parentRecordId = record.__parent__record__id__;
236
+ }
237
+ return reqChange;
238
+ });
239
+ return new Promise((resolve, reject) => {
240
+ const changesFormatted = changes.map((_a) => {
241
+ var rest = __rest(_a, []);
242
+ return rest;
243
+ });
244
+ DataFetcher.get()
245
+ .callGraphQL({
246
+ values: { changes: changesFormatted },
247
+ query: this.templateByQuery.get("saveData"),
248
+ })
249
+ .then((resp) => {
250
+ const dataUnitRecords = [];
251
+ resp === null || resp === void 0 ? void 0 : resp.forEach((responseRecord) => {
252
+ const duRecord = {
253
+ __record__id__: responseRecord.id,
254
+ __record__label__: responseRecord.label,
255
+ __owner__dataunit__name__: responseRecord.ownerDataUnitName,
256
+ };
257
+ const dataUnitInstance = DataUnitStorage.get(duRecord.__owner__dataunit__name__) || dataUnit;
258
+ if (responseRecord.oldId) {
259
+ duRecord.__old__id__ = responseRecord.oldId;
260
+ }
261
+ responseRecord.fields.forEach(({ name, value }) => {
262
+ var _a;
263
+ duRecord[name] = ((_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value)) || value;
264
+ });
265
+ dataUnitRecords.push(duRecord);
266
+ });
267
+ resolve(dataUnitRecords);
268
+ })
269
+ .catch((error) => {
270
+ reject(error);
271
+ });
272
+ });
273
+ }
274
+ removeRecords(dataUnit, recordIds) {
275
+ const changes = recordIds.map((recordId) => {
276
+ return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
277
+ });
278
+ return new Promise((resolve, reject) => {
279
+ DataFetcher.get()
280
+ .callGraphQL({
281
+ values: { changes: changes },
282
+ query: this.templateByQuery.get("saveData"),
283
+ })
284
+ .then((_resp) => {
285
+ resolve(recordIds);
286
+ })
287
+ .catch((error) => {
288
+ reject(error);
289
+ });
290
+ });
291
+ }
292
+ loadRecord(dataUnit, recordIds) {
293
+ return new Promise((resolve, reject) => {
294
+ DataFetcher.get()
295
+ .callGraphQL({
296
+ values: { recordID: recordIds, dataunit: dataUnit.name },
297
+ query: this.templateByQuery.get("fetchDataRecord"),
298
+ })
299
+ .then((response) => {
300
+ const dataUnitRecords = [];
301
+ response.record.forEach(responseRecord => {
302
+ const duRecord = { __record__id__: responseRecord.id, __record__label__: responseRecord.label };
303
+ responseRecord.fields.forEach(({ name, value }) => {
304
+ duRecord[name] = dataUnit.valueFromString(name, value);
305
+ });
306
+ dataUnitRecords.push(duRecord);
307
+ });
308
+ resolve(dataUnitRecords);
309
+ })
310
+ .catch((error) => {
311
+ reject(error);
312
+ });
313
+ });
314
+ }
315
+ }
316
+
317
+ export { DataUnitFetcher as D };
@@ -64,4 +64,4 @@ var FilterEntities;
64
64
  FilterEntities["INSTANCE"] = "Instancia";
65
65
  })(FilterEntities || (FilterEntities = {}));
66
66
 
67
- export { DataExporterOption as D, FilterOperand as F, PresentationMode as P, DataExporterFormat as a, DataExporterType as b, FilterConfigType as c, FilterEntities as d, FilterUserConfigTypes as e };
67
+ export { DataExporterOption as D, FilterUserConfigTypes as F, PresentationMode as P, DataExporterFormat as a, DataExporterType as b, FilterOperand as c, FilterConfigType as d, FilterEntities as e };
@@ -0,0 +1,7 @@
1
+ var SelectedItemType;
2
+ (function (SelectedItemType) {
3
+ SelectedItemType["LINK"] = "LINK";
4
+ SelectedItemType["FIELD"] = "FIELD";
5
+ })(SelectedItemType || (SelectedItemType = {}));
6
+
7
+ export { SelectedItemType as S };
@@ -192,7 +192,8 @@ const createStore = (defaultState, shouldUpdate) => {
192
192
  };
193
193
 
194
194
  const store = createStore({
195
- exporterProviders: {}
195
+ exporterProviders: {},
196
+ filterFieldsDataSource: undefined
196
197
  });
197
198
 
198
199
  export { store as s };