@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-50737.1 → 0.0.0-bugfix-dev-KB-53946.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/cjs/{ConfigStorage-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
  2. package/dist/cjs/{SnkMultiSelectionListDataSource-1438f8f2.js → IExporterProvider-f50b6846.js} +52 -5
  3. package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
  4. package/dist/cjs/{SnkFormConfigManager-33995e92.js → SnkFormConfigManager-8986431f.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-141aa18d.js → SnkMessageBuilder-66aa2557.js} +4 -0
  6. package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
  7. package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{pesquisa-fetcher-94f6b316.js → pesquisa-fetcher-90b801fb.js} +79 -55
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button_4.cjs.entry.js +9 -9
  12. package/dist/cjs/snk-application.cjs.entry.js +24 -24
  13. package/dist/cjs/snk-attach.cjs.entry.js +73 -52
  14. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  15. package/dist/cjs/snk-data-exporter.cjs.entry.js +199 -81
  16. package/dist/cjs/{snk-data-unit-6026a9f7.js → snk-data-unit-abd2113f.js} +3 -38
  17. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -2
  18. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
  19. package/dist/cjs/snk-filter-bar.cjs.entry.js +7 -3
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
  21. package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
  22. package/dist/cjs/snk-form.cjs.entry.js +3 -4
  23. package/dist/cjs/snk-grid.cjs.entry.js +66 -102
  24. package/dist/cjs/{snk-guides-viewer-25721856.js → snk-guides-viewer-e4c8ee66.js} +4 -5
  25. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +144 -36
  28. package/dist/cjs/snk-taskbar.cjs.entry.js +27 -4
  29. package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
  30. package/dist/collection/components/snk-attach/snk-attach.js +39 -24
  31. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
  32. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
  33. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
  34. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
  35. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
  36. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  37. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
  38. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  39. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +37 -47
  40. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  41. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  42. package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
  43. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +5 -0
  44. package/dist/collection/components/snk-grid/snk-grid.js +3 -94
  45. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +5 -2
  46. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +126 -14
  47. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
  48. package/dist/collection/components/snk-taskbar/snk-taskbar.js +30 -3
  49. package/dist/collection/lib/dataUnit/InMemoryLoader.js +10 -41
  50. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
  51. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  52. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  53. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +10 -2
  54. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
  55. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  56. package/dist/components/ConfigStorage.js +1 -2
  57. package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
  58. package/dist/components/ISave.js +42 -0
  59. package/dist/components/SnkMessageBuilder.js +4 -0
  60. package/dist/components/dataunit-fetcher.js +61 -44
  61. package/dist/components/form-config-fetcher.js +7022 -3
  62. package/dist/components/index2.js +198 -33
  63. package/dist/components/snk-actions-button2.js +3 -12
  64. package/dist/components/snk-application2.js +1 -1
  65. package/dist/components/snk-attach2.js +64 -44
  66. package/dist/components/snk-crud.js +3 -4
  67. package/dist/components/snk-data-exporter2.js +194 -81
  68. package/dist/components/snk-data-unit2.js +41 -39
  69. package/dist/components/snk-detail-view2.js +4 -5
  70. package/dist/components/snk-expression-item2.js +1 -1
  71. package/dist/components/snk-filter-bar2.js +5 -0
  72. package/dist/components/snk-form-config2.js +1 -1
  73. package/dist/components/snk-grid2.js +63 -100
  74. package/dist/components/snk-personalized-filter2.js +1 -1
  75. package/dist/components/snk-simple-crud2.js +133 -23
  76. package/dist/components/snk-taskbar2.js +33 -8
  77. package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
  78. package/dist/esm/{SnkMultiSelectionListDataSource-aad5d4ff.js → IExporterProvider-9e6e0071.js} +52 -6
  79. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  80. package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
  81. package/dist/esm/{SnkMessageBuilder-9747ddd2.js → SnkMessageBuilder-0a4becdd.js} +4 -0
  82. package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
  83. package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
  84. package/dist/esm/loader.js +1 -1
  85. package/dist/esm/{pesquisa-fetcher-f05a12ca.js → pesquisa-fetcher-d785663b.js} +61 -44
  86. package/dist/esm/sankhyablocks.js +1 -1
  87. package/dist/esm/snk-actions-button_4.entry.js +4 -4
  88. package/dist/esm/snk-application.entry.js +6 -6
  89. package/dist/esm/snk-attach.entry.js +65 -44
  90. package/dist/esm/snk-crud.entry.js +5 -5
  91. package/dist/esm/snk-data-exporter.entry.js +199 -81
  92. package/dist/esm/{snk-data-unit-4c343635.js → snk-data-unit-29eba11a.js} +4 -39
  93. package/dist/esm/snk-data-unit.entry.js +3 -2
  94. package/dist/esm/snk-detail-view.entry.js +8 -8
  95. package/dist/esm/snk-filter-bar.entry.js +7 -3
  96. package/dist/esm/snk-filter-modal-item.entry.js +2 -3
  97. package/dist/esm/snk-form-config.entry.js +1 -2
  98. package/dist/esm/snk-form.entry.js +3 -4
  99. package/dist/esm/snk-grid.entry.js +64 -100
  100. package/dist/esm/{snk-guides-viewer-b94752f2.js → snk-guides-viewer-8fc16590.js} +4 -5
  101. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  102. package/dist/esm/snk-personalized-filter.entry.js +2 -3
  103. package/dist/esm/snk-simple-crud.entry.js +132 -24
  104. package/dist/esm/snk-taskbar.entry.js +27 -4
  105. package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
  106. package/dist/sankhyablocks/p-07825198.js +1 -0
  107. package/dist/sankhyablocks/p-0ba97458.js +65 -0
  108. package/dist/sankhyablocks/p-1650f66b.entry.js +1 -0
  109. package/dist/sankhyablocks/p-1d1aa052.js +1 -0
  110. package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
  111. package/dist/sankhyablocks/p-250149af.entry.js +1 -0
  112. package/dist/sankhyablocks/p-2cfa05b0.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-400097f2.entry.js → p-2daa70f9.entry.js} +3 -3
  114. package/dist/sankhyablocks/p-32556aa6.js +1 -0
  115. package/dist/sankhyablocks/p-33a6728e.js +26 -0
  116. package/dist/sankhyablocks/p-5b6c4f46.entry.js +1 -0
  117. package/dist/sankhyablocks/p-5d9456dc.js +1 -0
  118. package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
  119. package/dist/sankhyablocks/p-9863d682.js +1 -0
  120. package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
  121. package/dist/sankhyablocks/p-9c283890.entry.js +1 -0
  122. package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
  123. package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
  124. package/dist/sankhyablocks/p-c2e3a71c.entry.js +1 -0
  125. package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
  126. package/dist/sankhyablocks/p-ce37e3d3.entry.js +1 -0
  127. package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
  129. package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
  130. package/dist/sankhyablocks/p-f51af6dd.entry.js +1 -0
  131. package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
  132. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  133. package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
  134. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
  135. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
  136. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
  137. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
  138. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
  139. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  140. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  141. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  142. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
  143. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  144. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  145. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
  146. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
  147. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +17 -2
  148. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  149. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
  150. package/dist/types/components.d.ts +17 -0
  151. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
  152. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
  153. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  154. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  155. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  156. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
  157. package/package.json +1 -1
  158. package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
  159. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  160. package/dist/components/DataFetcher.js +0 -7023
  161. package/dist/components/index3.js +0 -199
  162. package/dist/esm/form-config-fetcher-765b8498.js +0 -253
  163. package/dist/sankhyablocks/p-004c356e.js +0 -26
  164. package/dist/sankhyablocks/p-0bba5c9f.entry.js +0 -1
  165. package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
  166. package/dist/sankhyablocks/p-20b46647.entry.js +0 -1
  167. package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
  168. package/dist/sankhyablocks/p-2936303b.js +0 -1
  169. package/dist/sankhyablocks/p-6c9adfca.js +0 -1
  170. package/dist/sankhyablocks/p-85af23fe.entry.js +0 -1
  171. package/dist/sankhyablocks/p-85ba3d6b.entry.js +0 -1
  172. package/dist/sankhyablocks/p-88b29791.js +0 -1
  173. package/dist/sankhyablocks/p-9a5d1b39.js +0 -1
  174. package/dist/sankhyablocks/p-9e8618ec.entry.js +0 -1
  175. package/dist/sankhyablocks/p-a043314f.entry.js +0 -1
  176. package/dist/sankhyablocks/p-a1642e7c.entry.js +0 -1
  177. package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
  178. package/dist/sankhyablocks/p-b47c2963.entry.js +0 -1
  179. package/dist/sankhyablocks/p-be75153c.js +0 -1
  180. package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
  181. package/dist/sankhyablocks/p-d304659d.entry.js +0 -1
  182. package/dist/sankhyablocks/p-d5cb4b5a.entry.js +0 -1
  183. package/dist/sankhyablocks/p-d78d4062.js +0 -65
  184. package/dist/sankhyablocks/p-e7dbe53a.entry.js +0 -1
  185. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
  186. /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
@@ -1,34 +1,199 @@
1
- var PresentationMode;
2
- (function (PresentationMode) {
3
- PresentationMode["PRIMARY"] = "primary";
4
- PresentationMode["SECONDARY"] = "secondary";
5
- PresentationMode["SINGLE_TASKBAR"] = "singleTaskbar";
6
- })(PresentationMode || (PresentationMode = {}));
7
- var DataExporterOption;
8
- (function (DataExporterOption) {
9
- DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
10
- DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
11
- DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
12
- DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
13
- DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
14
- DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
15
- DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
16
- DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
17
- })(DataExporterOption || (DataExporterOption = {}));
18
- var DataExporterFormat;
19
- (function (DataExporterFormat) {
20
- DataExporterFormat["PDF"] = "exportPDFToEmail";
21
- DataExporterFormat["XLS"] = "exportXLSToEmail";
22
- DataExporterFormat["XLSX"] = "exportXLSToEmail";
23
- })(DataExporterFormat || (DataExporterFormat = {}));
24
- var DataExporterType;
25
- (function (DataExporterType) {
26
- DataExporterType["EXPORT_TO_PDF"] = "PDF";
27
- DataExporterType["EXPORT_TO_XLS"] = "XLS";
28
- DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
29
- DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
30
- DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
31
- DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
32
- })(DataExporterType || (DataExporterType = {}));
1
+ import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
33
2
 
34
- export { DataExporterOption as D, PresentationMode as P, DataExporterFormat as a, DataExporterType as b };
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,13 +1,12 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher.js';
3
+ import { D as DataFetcher } from './form-config-fetcher.js';
4
4
  import { P as ParamType } from './ParamType.js';
5
5
  import './dataunit-fetcher.js';
6
- import './index2.js';
6
+ import './ISave.js';
7
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
9
9
  import './filter-item-type.enum.js';
10
- import './form-config-fetcher.js';
11
10
  import { R as ResourceIDUtils } from './ResourceIDUtils.js';
12
11
 
13
12
  const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
@@ -158,14 +157,6 @@ var RefreshType;
158
157
  RefreshType["ALL"] = "ALL";
159
158
  })(RefreshType || (RefreshType = {}));
160
159
 
161
- var SaveErrorsEnum;
162
- (function (SaveErrorsEnum) {
163
- SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
164
- SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
165
- SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
166
- SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
167
- })(SaveErrorsEnum || (SaveErrorsEnum = {}));
168
-
169
160
  const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
170
161
  const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
171
162
  const NUFIN_COLUMN = 'NUFIN';
@@ -735,4 +726,4 @@ function defineCustomElement() {
735
726
  } });
736
727
  }
737
728
 
738
- export { SnkActionsButton as S, SaveErrorsEnum as a, defineCustomElement as d };
729
+ export { SnkActionsButton as S, defineCustomElement as d };
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, KeyboardManager, OnboardingUtils, DependencyType, ArrayUtils, SearchUtils, ElementIDUtils, ApplicationContext, DataType, ErrorTracking } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
- import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
5
+ import { d as dist, D as DataFetcher, U as UrlUtils } from './form-config-fetcher.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
7
7
  import { D as DataUnitFetcher, P as PesquisaFetcher } from './dataunit-fetcher.js';
8
8
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
@@ -1,14 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher.js';
4
- import { a as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher.js';
5
- import './index2.js';
6
- import { a as SaveErrorsEnum, d as defineCustomElement$f } from './snk-actions-button2.js';
3
+ import { D as DataFetcher } from './form-config-fetcher.js';
4
+ import { a as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher.js';
5
+ import { S as SaveErrorsEnum } from './ISave.js';
7
6
  import './filter-item-type.enum.js';
8
- import './form-config-fetcher.js';
9
7
  import { V as VIEW_MODE } from './constants.js';
10
8
  import { A as AutorizationType } from './auth-fetcher.js';
11
9
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
10
+ import { d as defineCustomElement$f } from './snk-actions-button2.js';
12
11
  import { d as defineCustomElement$e } from './snk-config-options2.js';
13
12
  import { d as defineCustomElement$d } from './snk-configurator2.js';
14
13
  import { d as defineCustomElement$c } from './snk-data-exporter2.js';
@@ -396,7 +395,7 @@ const attachFetcherMetadataBuilder = {
396
395
  label: "Attach List",
397
396
  fields: [
398
397
  { name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
399
- { name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT },
398
+ { name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT, readOnly: false },
400
399
  { name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
401
400
  { name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
402
401
  { name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
@@ -422,6 +421,7 @@ const SERVICE_LOAD = "Attach.load";
422
421
  class AttachFetcherDataUnitFactory {
423
422
  constructor(getMessage) {
424
423
  this.getMessage = getMessage;
424
+ this._records = [];
425
425
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
426
426
  }
427
427
  initLoaders(dataUnit, fetcher, onSuccess) {
@@ -441,25 +441,30 @@ class AttachFetcherDataUnitFactory {
441
441
  metadataLoader(_) {
442
442
  return Promise.resolve(attachFetcherMetadataBuilder);
443
443
  }
444
- async dataLoader(_, request) {
444
+ async dataLoader(dataUnit, request) {
445
445
  if (!request.source) {
446
- return Promise.resolve({ records: [] });
446
+ return Promise.resolve({ records: this._records });
447
447
  }
448
- const criteria = {
449
- criteria: {
450
- codata: request.source,
451
- tipoAnexo: "N"
452
- }
453
- };
454
- const applicationDataFetcher = await this._application.getDataFetcher();
455
- const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
456
- const records = [];
457
- anexo.forEach((param) => {
458
- records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
459
- name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
460
- }] }, param));
461
- });
462
- return Promise.resolve({ records });
448
+ if (!Number.isNaN(Number(request.source))) {
449
+ const criteria = {
450
+ criteria: {
451
+ codata: request.source,
452
+ tipoAnexo: "N"
453
+ }
454
+ };
455
+ const applicationDataFetcher = await this._application.getDataFetcher();
456
+ const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
457
+ const records = [];
458
+ anexo.forEach((param) => {
459
+ records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
460
+ name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
461
+ }] }, param));
462
+ });
463
+ this._records = records;
464
+ }
465
+ let records = applyFilter(this._records, dataUnit, request.filters);
466
+ records = applySorting(records, dataUnit, request.sort);
467
+ return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
463
468
  }
464
469
  saveLoader(changes, fetcher) {
465
470
  return new Promise((resolve) => {
@@ -639,7 +644,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
639
644
  this.back.emit();
640
645
  });
641
646
  };
642
- this.fetcherType = "AnexoSistema";
647
+ this.fetcherType = undefined;
643
648
  this.fetcher = undefined;
644
649
  this.dataUnit = undefined;
645
650
  this.dataUnitBuilder = undefined;
@@ -651,8 +656,8 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
651
656
  this.crudConfig = undefined;
652
657
  }
653
658
  registerKeyWatcher(newRegisterKey, oldRegisterKey) {
654
- var _a, _b, _c, _d;
655
- if (this._currentDataUnit == null) {
659
+ var _a, _b, _c, _d, _e, _f;
660
+ if (!this._currentDataUnit) {
656
661
  this.loadAttachmentDataUnit();
657
662
  }
658
663
  if (oldRegisterKey !== newRegisterKey) {
@@ -667,11 +672,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
667
672
  if (hasMoreOneItem)
668
673
  return;
669
674
  }
670
- return this._currentDataUnit
671
- .loadMetadata()
672
- .then(() => {
673
- this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
674
- });
675
+ return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
675
676
  }
676
677
  }
677
678
  /**
@@ -737,7 +738,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
737
738
  if (!this._currentDataUnit.metadata) {
738
739
  this._currentDataUnit
739
740
  .loadMetadata()
740
- .then(() => this.crudConfig = anexoSistemaCrudConfig);
741
+ .then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
741
742
  }
742
743
  this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
743
744
  this._currentDataUnit.addFilterProvider({
@@ -749,25 +750,29 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
749
750
  this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
750
751
  }
751
752
  loadAttach() {
752
- var _a;
753
+ var _a, _b, _c;
753
754
  this._currentFetcher = new AttachFetcher();
754
- this._currentDataUnit = new DataUnit();
755
+ this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
755
756
  this._currentDataUnit.addInterceptor({
756
- interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
757
+ interceptAction: (action) => {
758
+ var _a;
759
+ if (action.type === Action.METADATA_LOADED) {
760
+ this.crudConfig = Object.assign({}, attachCrudConfig);
761
+ (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
762
+ }
763
+ return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
764
+ }
757
765
  });
758
766
  this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
759
767
  (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
760
- await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
761
768
  this.returnToGridMode();
769
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
762
770
  });
763
771
  if (!this._currentDataUnit.metadata) {
764
- this._currentDataUnit
765
- .loadMetadata()
766
- .then(() => {
767
- this.crudConfig = attachCrudConfig;
768
- this._currentDataUnit
769
- .loadData(undefined, undefined, true, this.registerKey)
770
- .then(this.disableEditFieldsNotInForm.bind(this));
772
+ (_c = (_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata()) === null || _c === void 0 ? void 0 : _c.then(() => {
773
+ var _a, _b;
774
+ this.crudConfig = Object.assign({}, attachCrudConfig);
775
+ (_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
771
776
  });
772
777
  }
773
778
  }
@@ -785,15 +790,30 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
785
790
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
786
791
  }
787
792
  componentWillRender() {
793
+ if (!this.fetcherType) {
794
+ this.fetcherType = "AnexoSistema";
795
+ }
788
796
  if (this._currentDataUnit == null) {
789
797
  this.loadAttachmentDataUnit();
790
798
  }
791
799
  }
800
+ async handleOnDataStateChange({ detail }) {
801
+ if (this.fetcherType !== 'Attach')
802
+ return;
803
+ if (!detail.insertionMode) {
804
+ this._currentDataUnit.disableField('DESCRICAO');
805
+ }
806
+ else {
807
+ this._currentDataUnit.enableField('DESCRICAO');
808
+ }
809
+ await this._currentDataUnit.loadMetadata();
810
+ }
811
+ ;
792
812
  render() {
793
813
  var _a, _b;
794
814
  if (!this._currentDataUnit)
795
815
  return null;
796
- return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
816
+ return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
797
817
  }
798
818
  static get watchers() { return {
799
819
  "registerKey": ["registerKeyWatcher"]
@@ -1,16 +1,15 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
4
- import './DataFetcher.js';
4
+ import './form-config-fetcher.js';
5
5
  import './dataunit-fetcher.js';
6
- import { P as PresentationMode } from './index2.js';
7
- import { d as defineCustomElement$w } from './snk-actions-button2.js';
6
+ import { P as PresentationMode } from './ISave.js';
8
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
9
  import './filter-item-type.enum.js';
11
- import './form-config-fetcher.js';
12
10
  import { V as VIEW_MODE } from './constants.js';
13
11
  import { A as AutorizationType } from './auth-fetcher.js';
12
+ import { d as defineCustomElement$w } from './snk-actions-button2.js';
14
13
  import { d as defineCustomElement$v } from './snk-attach2.js';
15
14
  import { d as defineCustomElement$u } from './snk-config-options2.js';
16
15
  import { d as defineCustomElement$t } from './snk-configurator2.js';