@sankhyalabs/sankhyablocks 8.15.0-rc.8 → 8.15.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 (237) hide show
  1. package/dist/cjs/{ConfigStorage-d4c99a5e.js → ConfigStorage-942ce74b.js} +70 -7
  2. package/dist/cjs/{DataFetcher-99f0f6ed.js → DataFetcher-313debd8.js} +13 -5
  3. package/dist/cjs/{SnkFormConfigManager-3621bfc4.js → SnkFormConfigManager-f9dc0d28.js} +21 -13
  4. package/dist/cjs/{SnkMessageBuilder-e7dcf408.js → SnkMessageBuilder-66aa2557.js} +6 -1
  5. package/dist/cjs/SnkMultiSelectionListDataSource-303e85d1.js +140 -0
  6. package/dist/cjs/{auth-fetcher-5161d082.js → auth-fetcher-54f5ff9d.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-9f1a13ca.js → form-config-fetcher-2dd00e5b.js} +13 -1
  8. package/dist/cjs/index-f9e81701.js +2 -10
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-8bbee432.js → pesquisa-fetcher-213797ec.js} +273 -50
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/{snk-actions-button_2.cjs.entry.js → snk-actions-button_4.cjs.entry.js} +519 -4
  13. package/dist/cjs/snk-application.cjs.entry.js +13 -8
  14. package/dist/cjs/snk-attach.cjs.entry.js +67 -47
  15. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-crud.cjs.entry.js +26 -18
  17. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +6 -2
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +10 -6
  19. package/dist/cjs/{snk-data-unit-82c08a8c.js → snk-data-unit-41c29713.js} +1 -1
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +31 -7
  23. package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
  24. package/dist/cjs/snk-filter-item.cjs.entry.js +10 -6
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-form-config.cjs.entry.js +8 -2
  27. package/dist/cjs/snk-form.cjs.entry.js +11 -4
  28. package/dist/cjs/snk-grid.cjs.entry.js +41 -22
  29. package/dist/cjs/{snk-guides-viewer-100c3098.js → snk-guides-viewer-4b6ecda8.js} +21 -12
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  32. package/dist/cjs/snk-simple-crud.cjs.entry.js +256 -22
  33. package/dist/cjs/snk-taskbar.cjs.entry.js +75 -17
  34. package/dist/cjs/{taskbar-elements-1e4fb2e0.js → taskbar-elements-3ecd1278.js} +1 -1
  35. package/dist/collection/collection-manifest.json +6 -6
  36. package/dist/collection/components/snk-application/snk-application.js +42 -2
  37. package/dist/collection/components/snk-attach/snk-attach.js +39 -24
  38. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
  39. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
  40. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -1
  41. package/dist/collection/components/snk-crud/snk-crud.js +71 -11
  42. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  43. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +50 -7
  44. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.css +1 -1
  45. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.js +22 -1
  46. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +7 -3
  47. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
  48. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +28 -6
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -1
  50. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +44 -3
  51. package/dist/collection/components/snk-form/snk-form.js +25 -1
  52. package/dist/collection/components/{snk-form → snk-form-config}/SnkFormConfigManager.js +20 -12
  53. package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.js +11 -5
  54. package/dist/collection/components/snk-grid/snk-grid.js +86 -16
  55. package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.js +130 -123
  56. package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.js +1 -1
  57. package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
  58. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +10 -2
  59. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +421 -17
  60. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -1
  61. package/dist/collection/components/snk-taskbar/snk-taskbar.js +91 -16
  62. package/dist/collection/lib/configs/ConfigStorage.js +63 -3
  63. package/dist/collection/lib/dataUnit/InMemoryLoader.js +9 -40
  64. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
  65. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +13 -5
  66. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
  67. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
  68. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -1
  69. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  70. package/dist/collection/lib/utils/CrudUtils.js +13 -1
  71. package/dist/components/ConfigStorage.js +68 -5
  72. package/dist/components/DataFetcher.js +13 -5
  73. package/dist/components/SnkFormConfigManager.js +19 -11
  74. package/dist/components/SnkMessageBuilder.js +6 -1
  75. package/dist/components/dataunit-fetcher.js +41 -39
  76. package/dist/components/field-search.js +93 -3
  77. package/dist/components/form-config-fetcher.js +12 -0
  78. package/dist/components/index.d.ts +6 -6
  79. package/dist/components/snk-application2.js +9 -1
  80. package/dist/components/snk-attach2.js +115 -52
  81. package/dist/components/snk-configurator2.js +1 -1
  82. package/dist/components/snk-crud.js +23 -11
  83. package/dist/components/snk-custom-slot-elements.js +7 -3
  84. package/dist/components/snk-data-exporter2.js +7 -3
  85. package/dist/components/snk-detail-view2.js +48 -11
  86. package/dist/components/snk-filter-bar2.js +29 -4
  87. package/dist/components/snk-filter-detail2.js +5 -1
  88. package/dist/components/snk-filter-item2.js +11 -6
  89. package/dist/components/snk-form-config2.js +7 -1
  90. package/dist/components/snk-form.js +8 -0
  91. package/dist/components/snk-grid-config2.js +128 -102
  92. package/dist/components/snk-grid2.js +42 -18
  93. package/dist/components/snk-simple-crud2.js +317 -29
  94. package/dist/components/snk-taskbar2.js +81 -20
  95. package/dist/esm/{ConfigStorage-39ed8aeb.js → ConfigStorage-86187da3.js} +70 -7
  96. package/dist/esm/{DataFetcher-a650ae58.js → DataFetcher-c1baf61d.js} +13 -5
  97. package/dist/esm/{SnkFormConfigManager-692e20c7.js → SnkFormConfigManager-f53f9f87.js} +21 -13
  98. package/dist/esm/{SnkMessageBuilder-0fb796b9.js → SnkMessageBuilder-0a4becdd.js} +6 -1
  99. package/dist/esm/SnkMultiSelectionListDataSource-36918dbf.js +133 -0
  100. package/dist/esm/{auth-fetcher-17dc5b5e.js → auth-fetcher-039abba3.js} +1 -1
  101. package/dist/esm/{form-config-fetcher-f121f880.js → form-config-fetcher-30fb808f.js} +13 -1
  102. package/dist/esm/index-a7d3d3f1.js +2 -10
  103. package/dist/esm/loader.js +1 -1
  104. package/dist/esm/{pesquisa-fetcher-5a8cae10.js → pesquisa-fetcher-fe6f3826.js} +262 -43
  105. package/dist/esm/sankhyablocks.js +1 -1
  106. package/dist/esm/{snk-actions-button_2.entry.js → snk-actions-button_4.entry.js} +518 -5
  107. package/dist/esm/snk-application.entry.js +13 -8
  108. package/dist/esm/snk-attach.entry.js +66 -46
  109. package/dist/esm/snk-configurator.entry.js +1 -1
  110. package/dist/esm/snk-crud.entry.js +26 -18
  111. package/dist/esm/snk-custom-slot-elements.entry.js +7 -3
  112. package/dist/esm/snk-data-exporter.entry.js +10 -6
  113. package/dist/esm/{snk-data-unit-5d201fb3.js → snk-data-unit-de1d140d.js} +1 -1
  114. package/dist/esm/snk-data-unit.entry.js +2 -2
  115. package/dist/esm/snk-detail-view.entry.js +9 -10
  116. package/dist/esm/snk-filter-bar.entry.js +31 -7
  117. package/dist/esm/snk-filter-detail.entry.js +4 -1
  118. package/dist/esm/snk-filter-item.entry.js +10 -6
  119. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  120. package/dist/esm/snk-form-config.entry.js +9 -3
  121. package/dist/esm/snk-form.entry.js +11 -4
  122. package/dist/esm/snk-grid.entry.js +42 -23
  123. package/dist/esm/{snk-guides-viewer-36a01f1c.js → snk-guides-viewer-113be3fd.js} +21 -12
  124. package/dist/esm/snk-guides-viewer.entry.js +7 -8
  125. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  126. package/dist/esm/snk-simple-crud.entry.js +257 -23
  127. package/dist/esm/snk-taskbar.entry.js +76 -18
  128. package/dist/esm/{taskbar-elements-846c027c.js → taskbar-elements-2473c8ac.js} +1 -1
  129. package/dist/sankhyablocks/p-032fe52e.js +1 -0
  130. package/dist/sankhyablocks/p-07a61550.entry.js +1 -0
  131. package/dist/sankhyablocks/p-0899e0b5.entry.js +1 -0
  132. package/dist/sankhyablocks/p-14a08904.entry.js +1 -0
  133. package/dist/sankhyablocks/p-154a7f33.entry.js +1 -0
  134. package/dist/sankhyablocks/p-15802c59.entry.js +1 -0
  135. package/dist/sankhyablocks/p-164666b1.js +65 -0
  136. package/dist/sankhyablocks/p-21a81901.entry.js +1 -0
  137. package/dist/sankhyablocks/p-32556aa6.js +1 -0
  138. package/dist/sankhyablocks/p-328585d0.entry.js +1 -0
  139. package/dist/sankhyablocks/p-47bad461.entry.js +11 -0
  140. package/dist/sankhyablocks/{p-f3d1c48e.js → p-52c8e589.js} +1 -1
  141. package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
  142. package/dist/sankhyablocks/p-5cb07080.js +1 -0
  143. package/dist/sankhyablocks/p-74d349c3.entry.js +1 -0
  144. package/dist/sankhyablocks/p-7663f597.entry.js +1 -0
  145. package/dist/sankhyablocks/{p-50783a8b.js → p-913a9979.js} +1 -1
  146. package/dist/sankhyablocks/{p-827e4b01.entry.js → p-a1d72395.entry.js} +1 -1
  147. package/dist/sankhyablocks/p-add17f6a.entry.js +1 -0
  148. package/dist/sankhyablocks/p-ae4fc9a9.js +1 -0
  149. package/dist/sankhyablocks/p-af1ac81f.entry.js +1 -0
  150. package/dist/sankhyablocks/p-aff76a53.js +56 -0
  151. package/dist/sankhyablocks/p-b4525fc0.entry.js +1 -0
  152. package/dist/sankhyablocks/p-cce0865d.js +1 -0
  153. package/dist/sankhyablocks/{p-be75153c.js → p-dc7c9047.js} +1 -1
  154. package/dist/sankhyablocks/p-dec65f6c.entry.js +1 -0
  155. package/dist/sankhyablocks/p-df5451c7.js +26 -0
  156. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  157. package/dist/sankhyablocks/{p-9d608b62.entry.js → p-eae7a817.entry.js} +1 -1
  158. package/dist/sankhyablocks/p-ee9536bc.entry.js +1 -0
  159. package/dist/sankhyablocks/p-f13f7616.entry.js +1 -0
  160. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  161. package/dist/types/components/snk-application/snk-application.d.ts +8 -0
  162. package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
  163. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
  164. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
  165. package/dist/types/components/snk-crud/snk-crud.d.ts +12 -0
  166. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -1
  167. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +11 -1
  168. package/dist/types/components/snk-custom-slot-elements/snk-custom-slot-elements.d.ts +6 -0
  169. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
  170. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +6 -2
  171. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +8 -0
  172. package/dist/types/components/snk-form/snk-form.d.ts +6 -1
  173. package/dist/types/components/{snk-form → snk-form-config}/SnkFormConfigManager.d.ts +2 -1
  174. package/dist/types/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.d.ts +4 -3
  175. package/dist/types/components/snk-grid/snk-grid.d.ts +14 -1
  176. package/dist/types/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.d.ts +11 -6
  177. package/dist/types/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.d.ts +1 -1
  178. package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
  179. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +76 -3
  180. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  181. package/dist/types/components.d.ts +171 -10
  182. package/dist/types/lib/configs/ConfigStorage.d.ts +21 -1
  183. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
  184. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
  185. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
  186. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  187. package/dist/types/lib/utils/CrudUtils.d.ts +3 -0
  188. package/package.json +1 -1
  189. package/dist/cjs/PreloadManager-84466da6.js +0 -224
  190. package/dist/cjs/SnkMultiSelectionListDataSource-ba5838c2.js +0 -49
  191. package/dist/cjs/snk-grid-config.cjs.entry.js +0 -483
  192. package/dist/cjs/snk-select-box.cjs.entry.js +0 -25
  193. package/dist/esm/PreloadManager-c1c2f2b4.js +0 -222
  194. package/dist/esm/SnkMultiSelectionListDataSource-44494b0e.js +0 -43
  195. package/dist/esm/snk-grid-config.entry.js +0 -479
  196. package/dist/esm/snk-select-box.entry.js +0 -21
  197. package/dist/sankhyablocks/p-05243555.js +0 -1
  198. package/dist/sankhyablocks/p-094c30cb.js +0 -1
  199. package/dist/sankhyablocks/p-11ad137d.entry.js +0 -1
  200. package/dist/sankhyablocks/p-2ae395fe.entry.js +0 -1
  201. package/dist/sankhyablocks/p-3e2e2424.entry.js +0 -1
  202. package/dist/sankhyablocks/p-3e91d5ea.entry.js +0 -1
  203. package/dist/sankhyablocks/p-453c01a8.entry.js +0 -1
  204. package/dist/sankhyablocks/p-5e681b7b.js +0 -65
  205. package/dist/sankhyablocks/p-5f74c859.entry.js +0 -1
  206. package/dist/sankhyablocks/p-67aedbe0.js +0 -56
  207. package/dist/sankhyablocks/p-69754d94.entry.js +0 -1
  208. package/dist/sankhyablocks/p-725d04ba.js +0 -1
  209. package/dist/sankhyablocks/p-86801b08.entry.js +0 -1
  210. package/dist/sankhyablocks/p-8c13d8d6.entry.js +0 -1
  211. package/dist/sankhyablocks/p-8c49760e.js +0 -1
  212. package/dist/sankhyablocks/p-98674137.entry.js +0 -1
  213. package/dist/sankhyablocks/p-a13ccb86.js +0 -26
  214. package/dist/sankhyablocks/p-bf658a8a.entry.js +0 -11
  215. package/dist/sankhyablocks/p-c143a240.js +0 -1
  216. package/dist/sankhyablocks/p-c22c1d8e.js +0 -1
  217. package/dist/sankhyablocks/p-c4874327.entry.js +0 -1
  218. package/dist/sankhyablocks/p-d0844d18.entry.js +0 -1
  219. package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
  220. package/dist/sankhyablocks/p-d7cda92f.entry.js +0 -1
  221. package/dist/sankhyablocks/p-d7d85fa9.entry.js +0 -1
  222. package/dist/sankhyablocks/p-e3bd000e.entry.js +0 -1
  223. package/dist/sankhyablocks/p-ee619e29.entry.js +0 -1
  224. package/dist/sankhyablocks/p-fcdcb0e2.entry.js +0 -1
  225. package/dist/sankhyablocks/p-fdc4cb9b.entry.js +0 -1
  226. /package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.css +0 -0
  227. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.css +0 -0
  228. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.js +0 -0
  229. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.css +0 -0
  230. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.js +0 -0
  231. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.css +0 -0
  232. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.js +0 -0
  233. /package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.css +0 -0
  234. /package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.css +0 -0
  235. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.d.ts +0 -0
  236. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.d.ts +0 -0
  237. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -0
@@ -3,6 +3,7 @@ import { h, Host } from '@stencil/core';
3
3
  import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
4
4
  import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
5
5
  import { PresentationMode } from '../../lib/@types';
6
+ import { Action as DUAction } from '@sankhyalabs/core';
6
7
  export class SnkTaskbar {
7
8
  constructor() {
8
9
  this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
@@ -25,12 +26,27 @@ export class SnkTaskbar {
25
26
  [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
26
27
  [TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
27
28
  };
29
+ this.onSaveEvent = (action) => {
30
+ switch (action.type) {
31
+ case DUAction.FIELD_INVALIDATED:
32
+ case DUAction.DATA_SAVED:
33
+ case DUAction.SAVING_ERROR:
34
+ this._isWaitingForSave = false;
35
+ break;
36
+ case DUAction.SAVING_DATA:
37
+ this._isWaitingForSave = true;
38
+ break;
39
+ }
40
+ };
28
41
  this._permissions = undefined;
29
42
  this._overFlowedElements = [];
30
43
  this._customElements = undefined;
31
44
  this._customElementsId = undefined;
32
45
  this._slotContainer = undefined;
33
46
  this._hiddenActionsList = [];
47
+ this._lastWidth = undefined;
48
+ this._hasToUpdateOverFlow = false;
49
+ this._isWaitingForSave = false;
34
50
  this.alignRigth = false;
35
51
  this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
36
52
  this.customContainerId = undefined;
@@ -46,9 +62,28 @@ export class SnkTaskbar {
46
62
  this.presentationMode = PresentationMode.PRIMARY;
47
63
  this.messagesBuilder = undefined;
48
64
  }
65
+ handleCustomSlotElementsLoaded(event) {
66
+ if (this.hasToSearchCustomElements(event)) {
67
+ this.getCustomElements(true);
68
+ }
69
+ }
70
+ hasToSearchCustomElements(event) {
71
+ return this.customSlotId === event.detail && !this._slotContainer;
72
+ }
49
73
  observeButtons() {
50
74
  this._definitions = undefined;
51
- requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
75
+ requestAnimationFrame(() => {
76
+ requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
77
+ });
78
+ }
79
+ observeDisabledButtons() {
80
+ var _a;
81
+ (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
82
+ }
83
+ observeLastWidth(newValue, oldValue) {
84
+ if (oldValue === 0 && newValue !== 0) {
85
+ this._hasToUpdateOverFlow = true;
86
+ }
52
87
  }
53
88
  // Internal methods
54
89
  elementsFromString(strButtons) {
@@ -118,7 +153,13 @@ export class SnkTaskbar {
118
153
  this.dataUnit.cancelEdition();
119
154
  break;
120
155
  case TaskbarElement.SAVE:
121
- this.dataUnit.saveData();
156
+ if (!this._isWaitingForSave) {
157
+ this._isWaitingForSave = true;
158
+ this.dataUnit.saveData()
159
+ .finally(() => {
160
+ this._isWaitingForSave = false;
161
+ });
162
+ }
122
163
  break;
123
164
  }
124
165
  }
@@ -203,24 +244,30 @@ export class SnkTaskbar {
203
244
  this._customElementsId.push(elementId);
204
245
  (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.addNotOverFlowElement(elementId);
205
246
  }
206
- return h("span", { key: elementId, id: elementId });
247
+ return h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
207
248
  }
208
- getCustomElements() {
249
+ getCustomElements(searchOnDocument) {
209
250
  var _a, _b;
210
251
  this._customElementsId = [];
211
252
  this._customElements = new Map();
212
- this._slotContainer = this.buildSlotContainer();
253
+ this._slotContainer = this.buildSlotContainer(searchOnDocument);
213
254
  const customElementsArray = Array.from((_b = (_a = this._slotContainer) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
214
255
  customElementsArray.forEach(item => this._customElements.set(item.id, item));
215
256
  }
216
- buildSlotContainer() {
257
+ buildSlotContainer(searchOnDocument) {
258
+ let slotContainer;
217
259
  if (this.customContainerId) {
218
260
  const container = document.querySelector(`#${this.customContainerId}`);
219
- return container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
261
+ slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
220
262
  }
221
263
  else {
222
- return this._element.querySelector(`#${this.customSlotId}`);
264
+ slotContainer = this._element.querySelector(`#${this.customSlotId}`);
223
265
  }
266
+ // Caso nõa encontre o slot container dentro do próprio elemento, tenta buscar na DOM do document.
267
+ if (searchOnDocument && !slotContainer) {
268
+ slotContainer = document.querySelector(`#${this.customSlotId}`);
269
+ }
270
+ return slotContainer;
224
271
  }
225
272
  componentWillLoad() {
226
273
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -233,10 +280,20 @@ export class SnkTaskbar {
233
280
  this.getCustomElements();
234
281
  }
235
282
  componentWillRender() {
283
+ this.handleDefinitions();
284
+ this.validatePresentationMode();
285
+ this.updateOverFlowIfNeeded();
286
+ }
287
+ handleDefinitions() {
236
288
  if (this._definitions == undefined && this._permissions) {
237
289
  this._definitions = this.elementsFromString(this.buttons);
238
290
  }
239
- this.validatePresentationMode();
291
+ }
292
+ updateOverFlowIfNeeded() {
293
+ if (this._hasToUpdateOverFlow) {
294
+ requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
295
+ this._hasToUpdateOverFlow = false;
296
+ }
240
297
  }
241
298
  handleOverFlow(overFlowingElements) {
242
299
  const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
@@ -300,9 +357,14 @@ export class SnkTaskbar {
300
357
  const dataInfo = { dataUnit: this.dataUnit };
301
358
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
302
359
  this.handleOverFlowStrategy();
360
+ this.dataUnit.subscribe(this.onSaveEvent);
303
361
  }
304
362
  componentDidRender() {
305
363
  this.appendCustomElementsInTaskbar();
364
+ this.updateLastWidth();
365
+ }
366
+ updateLastWidth() {
367
+ this._lastWidth = this._element.getBoundingClientRect().width;
306
368
  }
307
369
  disconnectedCallback() {
308
370
  var _a;
@@ -327,12 +389,7 @@ export class SnkTaskbar {
327
389
  let index = 0;
328
390
  return (h(Host, { class: this.getHostClasses() }, this.removeEmpty(this._definitions.map((elem) => {
329
391
  var _a, _b;
330
- if (elem === TaskbarElement.DIVIDER) {
331
- index = 0;
332
- }
333
- else {
334
- index++;
335
- }
392
+ index++;
336
393
  if (TaskbarElement[elem]) {
337
394
  return this.getElement(index, TaskbarElement[elem]);
338
395
  }
@@ -639,7 +696,10 @@ export class SnkTaskbar {
639
696
  "_customElements": {},
640
697
  "_customElementsId": {},
641
698
  "_slotContainer": {},
642
- "_hiddenActionsList": {}
699
+ "_hiddenActionsList": {},
700
+ "_lastWidth": {},
701
+ "_hasToUpdateOverFlow": {},
702
+ "_isWaitingForSave": {}
643
703
  };
644
704
  }
645
705
  static get events() {
@@ -665,6 +725,21 @@ export class SnkTaskbar {
665
725
  return [{
666
726
  "propName": "buttons",
667
727
  "methodName": "observeButtons"
728
+ }, {
729
+ "propName": "disabledButtons",
730
+ "methodName": "observeDisabledButtons"
731
+ }, {
732
+ "propName": "_lastWidth",
733
+ "methodName": "observeLastWidth"
734
+ }];
735
+ }
736
+ static get listeners() {
737
+ return [{
738
+ "name": "snkCustomSlotElementsLoaded",
739
+ "method": "handleCustomSlotElementsLoaded",
740
+ "target": "window",
741
+ "capture": false,
742
+ "passive": false
668
743
  }];
669
744
  }
670
745
  }
@@ -2,18 +2,37 @@ import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fet
2
2
  import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
3
3
  import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
4
4
  import PersonalizedFilterFetcher from "../http/data-fetcher/fetchers/personalized-filter-fetcher";
5
- var CONFIG_SOURCE;
5
+ export var CONFIG_SOURCE;
6
6
  (function (CONFIG_SOURCE) {
7
7
  CONFIG_SOURCE["form"] = "form";
8
8
  CONFIG_SOURCE["grid"] = "grid";
9
9
  CONFIG_SOURCE["filterBar"] = "filterBar";
10
10
  })(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
11
11
  export class ConfigStorage {
12
- static preload(resourceID, configName) {
12
+ static addFilterBarLegacyConfig(configName, legacyConfigName) {
13
+ this.validateConfigName(configName, legacyConfigName);
14
+ this.filterBarLegacyConfig.set(configName, legacyConfigName);
15
+ }
16
+ static addFormLegacyConfig(configName, legacyConfigName) {
17
+ this.validateConfigName(configName, legacyConfigName);
18
+ this.formLegacyConfig.set(configName, legacyConfigName);
19
+ }
20
+ static addGridLegacyConfig(configName, legacyConfigName) {
21
+ this.validateConfigName(configName, legacyConfigName);
22
+ this.gridLegacyConfig.set(configName, legacyConfigName);
23
+ }
24
+ static preload(resourceID, configName, legacyConfigs) {
25
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.gridLegacyConfig)) {
26
+ ConfigStorage.addGridLegacyConfig(configName, legacyConfigs.gridLegacyConfig);
27
+ }
28
+ if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.formLegacyConfig)) {
29
+ ConfigStorage.addFormLegacyConfig(configName, legacyConfigs.formLegacyConfig);
30
+ }
13
31
  ConfigStorage.loadFormConfig(configName, resourceID);
14
32
  ConfigStorage.loadGridConfig(configName, resourceID);
15
33
  }
16
34
  static async loadFilterBarConfig(name, resourceID, urlParams) {
35
+ urlParams = this.handleLegacyConfig(name, CONFIG_SOURCE.filterBar, urlParams);
17
36
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
18
37
  if (!ConfigStorage.configById.has(cacheID)) {
19
38
  ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
@@ -21,6 +40,7 @@ export class ConfigStorage {
21
40
  return ConfigStorage.configById.get(cacheID);
22
41
  }
23
42
  static async loadFormConfig(name, resourceID) {
43
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
24
44
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
25
45
  if (!ConfigStorage.configById.has(cacheID)) {
26
46
  ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
@@ -28,6 +48,7 @@ export class ConfigStorage {
28
48
  return ConfigStorage.configById.get(cacheID);
29
49
  }
30
50
  static async loadGridConfig(name, resourceID) {
51
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
31
52
  const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
32
53
  if (!ConfigStorage.configById.has(cacheID)) {
33
54
  ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
@@ -39,6 +60,7 @@ export class ConfigStorage {
39
60
  return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
40
61
  }
41
62
  static async saveFormConfig(config, name, resourceID) {
63
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
42
64
  await this.deleteFormConfigCache(name, resourceID);
43
65
  return this.formConfigFetcher.saveConfig(config, name, resourceID);
44
66
  }
@@ -53,7 +75,8 @@ export class ConfigStorage {
53
75
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
54
76
  }
55
77
  static async loadPersonalizedFilter(filterId, resourceID, configName) {
56
- return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
78
+ const legacyConfigName = this.filterBarLegacyConfig.get(configName);
79
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
57
80
  }
58
81
  static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
59
82
  //Ao criar ou alterar um filtro personalizado,
@@ -76,6 +99,38 @@ export class ConfigStorage {
76
99
  static async deleteFilterBarConfigCache(name, resourceID) {
77
100
  await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
78
101
  }
102
+ static validateConfigName(configName, legacyConfigName) {
103
+ if (!configName)
104
+ throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
105
+ if (!legacyConfigName)
106
+ throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
107
+ }
108
+ static handleLegacyConfig(configName, configSource, urlParams) {
109
+ let legacyConfigName;
110
+ switch (configSource) {
111
+ case CONFIG_SOURCE.filterBar:
112
+ legacyConfigName = this.filterBarLegacyConfig.get(configName);
113
+ break;
114
+ case CONFIG_SOURCE.grid:
115
+ legacyConfigName = this.gridLegacyConfig.get(configName);
116
+ break;
117
+ case CONFIG_SOURCE.form:
118
+ legacyConfigName = this.formLegacyConfig.get(configName);
119
+ }
120
+ const params = urlParams ? Object.assign({}, urlParams) : {};
121
+ if (legacyConfigName) {
122
+ params['legacyResourceID'] = legacyConfigName;
123
+ }
124
+ return params;
125
+ }
126
+ static handleLegacyConfigAsString(name, source) {
127
+ const params = this.handleLegacyConfig(name, source);
128
+ const legacyResourceID = params['legacyResourceID'];
129
+ if (legacyResourceID) {
130
+ name = name + `?legacyResourceID=${legacyResourceID}`;
131
+ }
132
+ return name;
133
+ }
79
134
  static async deleteConfigCache(name, resourceID, source) {
80
135
  const cacheID = ConfigStorage.buildCacheID(name, source, resourceID);
81
136
  this.configById.delete(cacheID);
@@ -87,6 +142,11 @@ export class ConfigStorage {
87
142
  return `req_${source}_${name}_${resourceID}`;
88
143
  }
89
144
  }
145
+ ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
146
+ ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
147
+ ConfigStorage.filterBarLegacyConfig = new Map();
148
+ ConfigStorage.formLegacyConfig = new Map();
149
+ ConfigStorage.gridLegacyConfig = new Map();
90
150
  ConfigStorage.configById = new Map();
91
151
  ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
92
152
  ConfigStorage.formConfigFetcher = new FormConfigFetcher();
@@ -1,6 +1,5 @@
1
1
  import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
2
- import { ColumnFilterManager } from "@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";
3
- import PreloadManager from '../http/data-fetcher/fetchers/data-unit/cache/PreloadManager';
2
+ import { applyFilter, applySorting, buildPaginationInfo } from './dataUnitInMemoryUtils';
4
3
  export default class InMemoryLoader {
5
4
  constructor(metadata, records) {
6
5
  this.metadata = metadata;
@@ -13,9 +12,13 @@ export default class InMemoryLoader {
13
12
  this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
14
13
  }
15
14
  getRecordsToLoad() {
16
- if (this._initialRecords == undefined || this.dataUnit.records.length > 0) {
15
+ if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
17
16
  this._initialRecords = this.dataUnit.records;
18
17
  }
18
+ const addedRecords = this.dataUnit.getAddedRecords();
19
+ if (addedRecords) {
20
+ return [...this._initialRecords, ...addedRecords];
21
+ }
19
22
  return this._initialRecords;
20
23
  }
21
24
  get dataUnit() {
@@ -74,30 +77,9 @@ export default class InMemoryLoader {
74
77
  return StringUtils.generateUUID();
75
78
  }
76
79
  inMemoryLoader(dataUnit, request, recordsIn) {
77
- let records = this.applyFilter(recordsIn, dataUnit, request.filters);
78
- records = this.applySorting(records, dataUnit, request.sort);
79
- return Promise.resolve({ records, paginationInfo: buildPaginationInfo(request, records) });
80
- }
81
- applyFilter(records, dataUnit, filters) {
82
- const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
83
- if (columnFilters == undefined || columnFilters.size == 0) {
84
- return records;
85
- }
86
- const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
87
- if (filterFunciton == undefined) {
88
- return records;
89
- }
90
- return records.filter(filterFunciton);
91
- }
92
- applySorting(records, dataUnit, sorting) {
93
- if (sorting == undefined || sorting.length == 0) {
94
- return records;
95
- }
96
- const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
97
- if (sortingFunction == undefined) {
98
- return records;
99
- }
100
- return records.sort(sortingFunction);
80
+ let records = applyFilter(recordsIn, dataUnit, request.filters);
81
+ records = applySorting(records, dataUnit, request.sort);
82
+ return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
101
83
  }
102
84
  metadaLoader() {
103
85
  return Promise.resolve(this._metadata);
@@ -130,16 +112,3 @@ export default class InMemoryLoader {
130
112
  }
131
113
  }
132
114
  InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
133
- function buildPaginationInfo({ offset, limit }, records) {
134
- if (offset === undefined || limit === undefined) {
135
- return undefined;
136
- }
137
- const lastRecord = Math.min(offset + limit, records.length);
138
- return {
139
- currentPage: Math.ceil(offset / limit),
140
- firstRecord: offset,
141
- lastRecord: lastRecord,
142
- total: records.length,
143
- hasMore: !!(records.length - lastRecord),
144
- };
145
- }
@@ -0,0 +1,33 @@
1
+ import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
2
+ import PreloadManager from '../http/data-fetcher/fetchers/data-unit/cache/PreloadManager';
3
+ export function applyFilter(records, dataUnit, filters) {
4
+ const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
5
+ if (!(columnFilters === null || columnFilters === void 0 ? void 0 : columnFilters.size)) {
6
+ return records;
7
+ }
8
+ const filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
9
+ if (filterFunction == undefined) {
10
+ return records;
11
+ }
12
+ return records.filter(filterFunction);
13
+ }
14
+ export function applySorting(records, dataUnit, sorting) {
15
+ if (sorting == undefined || sorting.length == 0) {
16
+ return records;
17
+ }
18
+ const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
19
+ if (sortingFunction == undefined) {
20
+ return records;
21
+ }
22
+ return records.sort(sortingFunction);
23
+ }
24
+ export function buildPaginationInfo(records, offset = 0, limit = 0) {
25
+ const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
26
+ return {
27
+ currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
28
+ firstRecord: offset,
29
+ lastRecord: lastRecord,
30
+ total: records === null || records === void 0 ? void 0 : records.length,
31
+ hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
32
+ };
33
+ }
@@ -364,12 +364,19 @@ export class DataFetcher {
364
364
  //Reject promises with errors from query
365
365
  errorsResponse.forEach((errorResponse) => {
366
366
  Object.entries(errorResponse).forEach(async ([key, val]) => {
367
- var _a;
368
367
  const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
369
368
  const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
370
- if (!hasClientEvent) {
371
- (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
372
- }
369
+ Promise.race([
370
+ waitingRequest.promise,
371
+ new Promise((resolve) => {
372
+ resolve(false);
373
+ })
374
+ ]).then((data) => {
375
+ var _a;
376
+ if (!hasClientEvent || data === false) {
377
+ (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
378
+ }
379
+ });
373
380
  });
374
381
  });
375
382
  //Resolve promises with data from query
@@ -382,7 +389,8 @@ export class DataFetcher {
382
389
  });
383
390
  }
384
391
  buildGraphQlURL(quietMode) {
385
- const mgeSession = window["mgeSession"];
392
+ const urlParams = UrlUtils.getQueryParams(location.search);
393
+ const mgeSession = `${window['mgeSession'] || urlParams.get("mgeSession")}`;
386
394
  let url = `${this.resolveURL() + DataFetcher.getGraphQLPath()}`;
387
395
  if (mgeSession) {
388
396
  url += `?mgeSession=${mgeSession}`;
@@ -168,6 +168,18 @@ export class FormConfigFetcher extends ResourceFetcher {
168
168
  }
169
169
  return `cfg://${authority}/${resourceID}`;
170
170
  }
171
+ async fetchLegacyConfigurableForm(configName) {
172
+ const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
173
+ const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
174
+ if (ObjectUtils.isEmpty(response))
175
+ return undefined;
176
+ return this.buildLegacyConfigurableForm(response);
177
+ }
178
+ buildLegacyConfigurableForm(config) {
179
+ var _a, _b, _c;
180
+ const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
181
+ return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
182
+ }
171
183
  }
172
184
  export var UserConfigType;
173
185
  (function (UserConfigType) {
@@ -52,7 +52,7 @@ export default class PersonalizedFilterFetcher {
52
52
  assistent
53
53
  }
54
54
  }`);
55
- this.templateByQuery.set("savePersonalizedFilter", gql `
55
+ this.templateByQuery.set("savePersonalizedFilter", gql `
56
56
  mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
57
57
  $queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
58
58
  id
@@ -74,11 +74,11 @@ export default class PersonalizedFilterFetcher {
74
74
  }
75
75
  }`);
76
76
  }
77
- async loadPersonalizedFilter(resourceID, filterID, configName) {
77
+ async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName) {
78
78
  return new Promise((resolve, reject) => {
79
79
  DataFetcher.get()
80
80
  .callGraphQL({
81
- values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
81
+ values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
82
82
  query: this.templateByQuery.get("fetchFilterAssistent"),
83
83
  })
84
84
  .then((resp) => {
@@ -90,6 +90,9 @@ export default class PersonalizedFilterFetcher {
90
90
  });
91
91
  });
92
92
  }
93
+ resolveLegacyConfigName(legacyConfigName) {
94
+ return legacyConfigName ? `?legacyResourceID=${legacyConfigName}` : '';
95
+ }
93
96
  async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
94
97
  if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
95
98
  return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
@@ -16,7 +16,8 @@ export const snkDataExporterMessages = {
16
16
  },
17
17
  message: {
18
18
  emailSuccess: "E-mail enviado com sucesso",
19
- exportError: "Usuário sem permissão",
19
+ exportError: "Falha ao exportar dados",
20
+ unknownFailure: "O motivo da falha não pode ser identificado.",
20
21
  exportPermission: "O usuário não possui permissão para exportar o arquivo.",
21
22
  },
22
23
  title: {
@@ -1,4 +1,8 @@
1
1
  export const snkSimpleCrudMessages = {
2
2
  findColumn: "Busca de colunas",
3
+ formConfigUnavaliable: {
4
+ title: "Aviso",
5
+ message: 'A opção "Configurar formulário" será disponibilizada em breve. Enquanto isso, acesse a configuração do fomulário através dos layouts anteriores, HTML5 ou Flex.'
6
+ }
3
7
  };
4
8
  export default snkSimpleCrudMessages;
@@ -1,6 +1,18 @@
1
1
  import { DataFetcher } from '../';
2
- import { ApplicationContext } from '@sankhyalabs/core';
2
+ import { ApplicationContext, SortMode } from '@sankhyalabs/core';
3
3
  export class CrudUtils {
4
+ static assertDefaultSorting(gridConfig, dataUnit) {
5
+ if (gridConfig && dataUnit) {
6
+ dataUnit.defaultSorting = gridConfig
7
+ .columns
8
+ .filter(col => col.ascending != undefined)
9
+ .sort((colA, colB) => colA.orderIndex - colB.orderIndex)
10
+ .map(({ name: field, ascending }) => {
11
+ const { dataType } = dataUnit.getField(field);
12
+ return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
13
+ });
14
+ }
15
+ }
4
16
  static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
5
17
  const SERVICE_CRUD_FIND = "mge@crud.find";
6
18
  let parsedFields = [];