@sankhyalabs/sankhyablocks 8.16.0-rc.2 → 8.16.0-rc.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-ecc0ed20.js} +2 -2
  2. package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-29b65619.js} +39 -6
  3. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
  4. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  5. package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-f1c92f79.js} +72 -16
  6. package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-bae64d0d.js} +6 -2
  7. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
  8. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-f89461c1.js} +46 -18
  9. package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
  10. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-ca89181c.js} +1 -1
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
  15. package/dist/cjs/snk-application.cjs.entry.js +17 -7
  16. package/dist/cjs/snk-attach.cjs.entry.js +38 -29
  17. package/dist/cjs/snk-crud.cjs.entry.js +21 -8
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
  19. package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-d8279f5f.js} +43 -22
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +11 -11
  22. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  23. package/dist/cjs/snk-filter-bar.cjs.entry.js +40 -25
  24. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  26. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  27. package/dist/cjs/snk-form-config.cjs.entry.js +17 -5
  28. package/dist/cjs/snk-form.cjs.entry.js +7 -6
  29. package/dist/cjs/snk-grid.cjs.entry.js +66 -21
  30. package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-b9920385.js} +29 -13
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
  32. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  34. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  35. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +56 -21
  37. package/dist/cjs/snk-taskbar.cjs.entry.js +61 -36
  38. package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
  39. package/dist/collection/components/snk-application/snk-application.js +41 -1
  40. package/dist/collection/components/snk-attach/snk-attach.js +25 -16
  41. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
  42. package/dist/collection/components/snk-crud/snk-crud.js +103 -3
  43. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  44. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
  45. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +72 -6
  46. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  47. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  48. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  49. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  50. package/dist/collection/components/snk-data-unit/snk-data-unit.js +41 -20
  51. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  52. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
  55. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +77 -21
  56. package/dist/collection/components/snk-form/snk-form.js +2 -2
  57. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +70 -14
  58. package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
  59. package/dist/collection/components/snk-grid/snk-grid.css +2 -0
  60. package/dist/collection/components/snk-grid/snk-grid.js +100 -8
  61. package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
  62. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
  63. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
  64. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +82 -10
  65. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  66. package/dist/collection/components/snk-taskbar/snk-taskbar.js +103 -36
  67. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
  68. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
  69. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
  70. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
  71. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  72. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
  73. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
  74. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  75. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  76. package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
  77. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  78. package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
  79. package/dist/components/DataFetcher.js +22 -16
  80. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  81. package/dist/components/SnkFormConfigManager.js +70 -14
  82. package/dist/components/SnkMessageBuilder.js +6 -2
  83. package/dist/components/dataunit-fetcher.js +45 -15
  84. package/dist/components/form-config-fetcher.js +4 -1
  85. package/dist/components/snk-actions-button2.js +12 -9
  86. package/dist/components/snk-application2.js +12 -1
  87. package/dist/components/snk-attach2.js +34 -25
  88. package/dist/components/snk-crud.js +20 -3
  89. package/dist/components/snk-data-exporter2.js +2 -2
  90. package/dist/components/snk-data-unit2.js +44 -60
  91. package/dist/components/snk-detail-view2.js +29 -10
  92. package/dist/components/snk-exporter-email-sender2.js +1 -1
  93. package/dist/components/snk-filter-bar2.js +39 -22
  94. package/dist/components/snk-filter-binary-select.js +1 -1
  95. package/dist/components/snk-filter-checkbox-list.js +1 -1
  96. package/dist/components/snk-form-config2.js +16 -3
  97. package/dist/components/snk-form.js +2 -2
  98. package/dist/components/snk-grid2.js +60 -12
  99. package/dist/components/snk-personalized-filter-editor.js +1 -1
  100. package/dist/components/snk-print-selector.js +1 -1
  101. package/dist/components/snk-simple-bar2.js +1 -1
  102. package/dist/components/snk-simple-crud2.js +49 -10
  103. package/dist/components/snk-taskbar2.js +63 -38
  104. package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-7b36d041.js} +2 -2
  105. package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-30caa626.js} +40 -8
  106. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
  107. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  108. package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-139f09fa.js} +72 -16
  109. package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-6fff4a4c.js} +6 -2
  110. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
  111. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-c24c76c6.js} +46 -16
  112. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  113. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
  114. package/dist/esm/loader.js +1 -1
  115. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-8edaa8cd.js} +1 -1
  116. package/dist/esm/sankhyablocks.js +1 -1
  117. package/dist/esm/snk-actions-button_4.entry.js +17 -14
  118. package/dist/esm/snk-application.entry.js +17 -7
  119. package/dist/esm/snk-attach.entry.js +38 -29
  120. package/dist/esm/snk-crud.entry.js +21 -8
  121. package/dist/esm/snk-data-exporter.entry.js +9 -9
  122. package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-d10910d9.js} +43 -22
  123. package/dist/esm/snk-data-unit.entry.js +5 -5
  124. package/dist/esm/snk-detail-view.entry.js +11 -11
  125. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  126. package/dist/esm/snk-filter-bar.entry.js +40 -25
  127. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  128. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  129. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  130. package/dist/esm/snk-form-config.entry.js +17 -5
  131. package/dist/esm/snk-form.entry.js +7 -6
  132. package/dist/esm/snk-grid.entry.js +61 -16
  133. package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-beb6baef.js} +29 -13
  134. package/dist/esm/snk-guides-viewer.entry.js +9 -9
  135. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  136. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  137. package/dist/esm/snk-print-selector.entry.js +1 -1
  138. package/dist/esm/snk-simple-bar.entry.js +1 -1
  139. package/dist/esm/snk-simple-crud.entry.js +52 -17
  140. package/dist/esm/snk-taskbar.entry.js +62 -37
  141. package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
  142. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  143. package/dist/sankhyablocks/p-17425c72.js +1 -0
  144. package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
  145. package/dist/sankhyablocks/{p-47db7e88.entry.js → p-212213d9.entry.js} +1 -1
  146. package/dist/sankhyablocks/p-23736d75.js +1 -0
  147. package/dist/sankhyablocks/p-2923c1b5.js +1 -0
  148. package/dist/sankhyablocks/{p-871aa14e.entry.js → p-31e74634.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-38b85e5a.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
  151. package/dist/sankhyablocks/p-43acd479.entry.js +11 -0
  152. package/dist/sankhyablocks/{p-52920496.js → p-4d9549cf.js} +1 -1
  153. package/dist/sankhyablocks/p-50a3623b.entry.js +1 -0
  154. package/dist/sankhyablocks/p-520c7c38.entry.js +1 -0
  155. package/dist/sankhyablocks/p-52816250.entry.js +1 -0
  156. package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
  157. package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
  158. package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
  159. package/dist/sankhyablocks/p-62f5f14b.entry.js +1 -0
  160. package/dist/sankhyablocks/p-7ac7932c.js +60 -0
  161. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  162. package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
  163. package/dist/sankhyablocks/p-93592aae.js +1 -0
  164. package/dist/sankhyablocks/p-afbb070d.js +1 -0
  165. package/dist/sankhyablocks/p-bd1a1ca6.entry.js +1 -0
  166. package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
  167. package/dist/sankhyablocks/p-c5546f92.js +1 -0
  168. package/dist/sankhyablocks/p-c6db5eeb.entry.js +1 -0
  169. package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
  170. package/dist/sankhyablocks/p-d0a6fc0f.entry.js +1 -0
  171. package/dist/sankhyablocks/p-dcead955.entry.js +1 -0
  172. package/dist/sankhyablocks/p-eb9f0407.entry.js +1 -0
  173. package/dist/sankhyablocks/p-f3434fc4.js +1 -0
  174. package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-fb34e0cf.entry.js} +1 -1
  175. package/dist/sankhyablocks/p-fbb1b675.entry.js +1 -0
  176. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  177. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  178. package/dist/types/components/snk-application/snk-application.d.ts +6 -1
  179. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  180. package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
  181. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
  182. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
  183. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +9 -0
  184. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
  185. package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
  186. package/dist/types/components/snk-grid/snk-grid.d.ts +15 -0
  187. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -0
  188. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  189. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  190. package/dist/types/components.d.ts +119 -0
  191. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
  192. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  193. package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
  194. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  195. package/package.json +2 -2
  196. package/dist/sankhyablocks/p-17def7cd.js +0 -1
  197. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  198. package/dist/sankhyablocks/p-2a408684.js +0 -1
  199. package/dist/sankhyablocks/p-3a212712.js +0 -1
  200. package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
  201. package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
  202. package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
  203. package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
  204. package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
  205. package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
  206. package/dist/sankhyablocks/p-7619bdb1.entry.js +0 -11
  207. package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
  208. package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
  209. package/dist/sankhyablocks/p-80042dc6.entry.js +0 -1
  210. package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
  211. package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
  212. package/dist/sankhyablocks/p-9863d682.js +0 -1
  213. package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
  214. package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
  215. package/dist/sankhyablocks/p-c2495304.js +0 -1
  216. package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
  217. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  218. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  219. package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
  220. package/dist/sankhyablocks/p-fe79f83a.js +0 -60
  221. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -1,19 +1,20 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
3
+ import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
4
4
  import { P as ParamType } from './ParamType-d5152b06.js';
5
- import './pesquisa-fetcher-03c8f919.js';
5
+ import './pesquisa-fetcher-8edaa8cd.js';
6
6
  import './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-264191b2.js';
10
+ import './dataunit-fetcher-c24c76c6.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-30fb808f.js';
12
+ import './form-config-fetcher-adbe5d34.js';
13
+ import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
13
14
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
14
15
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
15
16
  import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
16
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
17
+ import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
17
18
  import { O as ORDER_VALUES } from './constants-8457af36.js';
18
19
  import './PrintUtils-3e4ff0f5.js';
19
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -169,7 +170,6 @@ var RefreshType;
169
170
 
170
171
  const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
171
172
  const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
172
- const NUFIN_COLUMN = 'NUFIN';
173
173
  const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
174
174
  class Actions {
175
175
  constructor(actionsExecuteInterface, dataUnit, appResourceId) {
@@ -181,6 +181,10 @@ class Actions {
181
181
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
182
182
  this._appResourceId = appResourceId;
183
183
  }
184
+ getPrimaryKeys() {
185
+ const ids = getSelectedRecordsIDsInfo(this._dataUnit);
186
+ return ids.map(({ name }) => name);
187
+ }
184
188
  apply(action, hasParamsToSave) {
185
189
  this._application.closePopUp();
186
190
  this._actionsExecuteInterface.execute(action, this._dataUnit)
@@ -449,6 +453,7 @@ class Actions {
449
453
  executeAction(execSource);
450
454
  }
451
455
  addRows(execSource) {
456
+ const primaryKeys = this.getPrimaryKeys();
452
457
  const rows = {
453
458
  row: []
454
459
  };
@@ -462,15 +467,13 @@ class Actions {
462
467
  delete sourceRow[MASTER_ROW_PROPERTY];
463
468
  delete sourceRow[ENTITY_NAME_PROPERTY];
464
469
  }
465
- for (const fieldName in sourceRow) {
466
- if (fieldName !== NUFIN_COLUMN)
467
- continue;
468
- if (!row.field) {
469
- row.field = [];
470
- }
470
+ if (!row.field) {
471
+ row.field = [];
472
+ }
473
+ for (const primaryKey of primaryKeys) {
471
474
  row.field.push({
472
- fieldName: fieldName,
473
- $: sourceRow[fieldName]
475
+ fieldName: primaryKey,
476
+ $: sourceRow[primaryKey]
474
477
  });
475
478
  }
476
479
  rows.row.push(row);
@@ -1,13 +1,13 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
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
- import { C as ConfigStorage } from './ConfigStorage-3806514e.js';
5
- import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-c1baf61d.js';
6
- import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-039abba3.js';
7
- import { D as DataUnitFetcher } from './dataunit-fetcher-264191b2.js';
8
- import { P as PesquisaFetcher } from './pesquisa-fetcher-03c8f919.js';
9
- import { S as SnkMessageBuilder } from './SnkMessageBuilder-571462fb.js';
10
- import './form-config-fetcher-30fb808f.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
5
+ import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-a9c598f2.js';
6
+ import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-749d880f.js';
7
+ import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-c24c76c6.js';
8
+ import { P as PesquisaFetcher } from './pesquisa-fetcher-8edaa8cd.js';
9
+ import { S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
10
+ import './form-config-fetcher-adbe5d34.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
12
  import './PrintUtils-3e4ff0f5.js';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -782,6 +782,16 @@ const SnkApplication = class {
782
782
  async isLoadedByPk() {
783
783
  return Promise.resolve(this._isLoadedByPk);
784
784
  }
785
+ /**
786
+ * Remove registro do cache do PreLoader do dataunit.
787
+ * Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
788
+ */
789
+ async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
790
+ const records = recordsIDs.map(id => {
791
+ return { "__record__id__": id };
792
+ });
793
+ PreloadManager.removeRecords(dataUnit, records);
794
+ }
785
795
  async getAuthList(auth) {
786
796
  return await (new MGEAuthorization()).parseFromJSON(auth);
787
797
  }
@@ -1,14 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js';
2
2
  import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
4
- import './pesquisa-fetcher-03c8f919.js';
3
+ import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
4
+ import './pesquisa-fetcher-8edaa8cd.js';
5
5
  import './index-3aa4977a.js';
6
6
  import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
7
- import { P as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-264191b2.js';
7
+ import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-c24c76c6.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-30fb808f.js';
9
+ import './form-config-fetcher-adbe5d34.js';
10
10
  import { d as VIEW_MODE } from './constants-8457af36.js';
11
- import { A as AutorizationType } from './auth-fetcher-039abba3.js';
11
+ import { A as AutorizationType } from './auth-fetcher-749d880f.js';
12
12
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
13
13
  import './PrintUtils-3e4ff0f5.js';
14
14
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -113,21 +113,23 @@ const SERVICE = {
113
113
  download: "AnexoSistemaSP.baixar",
114
114
  };
115
115
  class AnexoSistemaFetcher {
116
- constructor(entityName, registerKey, dataUnitName) {
116
+ constructor(entityName, dataUnitName) {
117
117
  var _a;
118
118
  this.entityName = entityName;
119
- this.registerKey = registerKey;
120
119
  this.dataUnitName = dataUnitName;
121
120
  this.validateFields = (fields) => {
122
121
  if (!!fields.LINK && !!fields.NOMEARQUIVO)
123
122
  throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
124
123
  if (!fields.LINK && !fields.NOMEARQUIVO)
125
124
  throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
126
- if (!this.registerKey)
125
+ if (!this._registerKey)
127
126
  throw new Error('Register key can not be null');
128
127
  };
129
128
  this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
130
129
  }
130
+ set registerKey(registerKey) {
131
+ this._registerKey = registerKey;
132
+ }
131
133
  async save(change) {
132
134
  var _a, _b;
133
135
  let { updatingFields: fields } = change;
@@ -146,7 +148,7 @@ class AnexoSistemaFetcher {
146
148
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
147
149
  link: fields.LINK,
148
150
  nameEntity: this.entityName,
149
- pkEntity: this.registerKey,
151
+ pkEntity: this._registerKey,
150
152
  typeAcess: fields.TIPOACESSO,
151
153
  typeApres: fields.TIPOAPRES,
152
154
  }
@@ -186,7 +188,7 @@ class AnexoSistemaFetcher {
186
188
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
187
189
  link: fields.LINK,
188
190
  nameEntity: this.entityName,
189
- pkEntity: this.registerKey,
191
+ pkEntity: this._registerKey,
190
192
  typeAcess: fields.TIPOACESSO,
191
193
  typeApres: fields.TIPOAPRES,
192
194
  }
@@ -458,9 +460,7 @@ class AttachFetcherDataUnitFactory {
458
460
  });
459
461
  this._records = records;
460
462
  }
461
- let records = applyFilter(this._records, dataUnit, request.filters);
462
- records = applySorting(records, dataUnit, request.sort);
463
- return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
463
+ return buildLoadDataResponse(this._records, dataUnit, request);
464
464
  }
465
465
  saveLoader(changes, fetcher) {
466
466
  return new Promise((resolve) => {
@@ -656,11 +656,20 @@ const SnkAttach = class {
656
656
  this.loadAttachmentDataUnit();
657
657
  }
658
658
  if (oldRegisterKey !== newRegisterKey) {
659
+ if (this._currentFetcher instanceof AnexoSistemaFetcher) {
660
+ this._currentFetcher.registerKey = newRegisterKey;
661
+ }
659
662
  await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
660
663
  }
661
664
  }
665
+ getAnexoSistemaFetcherInstance() {
666
+ var _a;
667
+ const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
668
+ anexoSistemaFetcher.registerKey = this.registerKey;
669
+ return anexoSistemaFetcher;
670
+ }
662
671
  async initAttach() {
663
- var _a, _b, _c, _d, _e, _f;
672
+ var _a, _b, _c, _d, _e;
664
673
  if (!this.fetcherType && !this.registerKey)
665
674
  return;
666
675
  if (!this.fetcherType) {
@@ -668,18 +677,18 @@ const SnkAttach = class {
668
677
  }
669
678
  this.returnToGridMode();
670
679
  if (this.fetcherType === "AnexoSistema") {
671
- this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
672
- (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
673
- await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
680
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
681
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
682
+ await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
674
683
  return;
675
684
  }
676
685
  if (this.fetcherType === "Attach") {
677
- const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
686
+ const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
678
687
  if (hasMoreOneItem)
679
688
  return;
680
689
  }
681
- await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata());
682
- await ((_f = this._currentDataUnit) === null || _f === void 0 ? void 0 : _f.loadData(undefined, undefined, true, this.registerKey));
690
+ await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
691
+ await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
683
692
  }
684
693
  /**
685
694
  * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
@@ -738,11 +747,11 @@ const SnkAttach = class {
738
747
  }
739
748
  }
740
749
  async loadAnexoSistema() {
741
- var _a, _b, _c;
750
+ var _a, _b;
742
751
  this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
743
- this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
752
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
744
753
  if (!this._currentDataUnit.metadata) {
745
- await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata());
754
+ await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
746
755
  this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
747
756
  }
748
757
  this.initDataUnitLoaders();
@@ -752,7 +761,7 @@ const SnkAttach = class {
752
761
  this._currentDataUnit.addInterceptor({
753
762
  interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
754
763
  });
755
- await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
764
+ await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
756
765
  this.disableEditFieldsNotInForm();
757
766
  }
758
767
  async loadAttach() {
@@ -778,16 +787,16 @@ const SnkAttach = class {
778
787
  }
779
788
  }
780
789
  initDataUnitLoaders() {
781
- var _a, _b, _c;
790
+ var _a, _b;
782
791
  if (this.fetcherType === "AnexoSistema") {
783
- this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
792
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
784
793
  this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
785
- (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
794
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
786
795
  }
787
796
  if (this.fetcherType === "Attach") {
788
797
  this._currentFetcher = new AttachFetcher();
789
798
  this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
790
- (_c = this._currentDataUnitBuilder) === null || _c === void 0 ? void 0 : _c.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
799
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
791
800
  this.returnToGridMode();
792
801
  await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
793
802
  });
@@ -831,7 +840,7 @@ const SnkAttach = class {
831
840
  var _a, _b;
832
841
  if (!this._currentDataUnit)
833
842
  return null;
834
- 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")))))))));
843
+ 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 ez-padding-bottom--medium" }, this.getMessage("snkAttach.description")))))))));
835
844
  }
836
845
  static get watchers() { return {
837
846
  "registerKey": ["registerKeyWatcher"]
@@ -1,17 +1,17 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
4
- import './DataFetcher-c1baf61d.js';
5
- import './pesquisa-fetcher-03c8f919.js';
4
+ import './DataFetcher-a9c598f2.js';
5
+ import './pesquisa-fetcher-8edaa8cd.js';
6
6
  import { P as PresentationMode } from './index-3aa4977a.js';
7
7
  import './ISave-d8c8bc59.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './dataunit-fetcher-264191b2.js';
10
+ import './dataunit-fetcher-c24c76c6.js';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-30fb808f.js';
12
+ import './form-config-fetcher-adbe5d34.js';
13
13
  import { d as VIEW_MODE } from './constants-8457af36.js';
14
- import { A as AutorizationType } from './auth-fetcher-039abba3.js';
14
+ import { A as AutorizationType } from './auth-fetcher-749d880f.js';
15
15
  import './index-bdf75557.js';
16
16
  import './PrintUtils-3e4ff0f5.js';
17
17
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -27,6 +27,7 @@ const SnkCrud = class {
27
27
  this.configuratorSave = createEvent(this, "configuratorSave", 7);
28
28
  this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
29
29
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
30
+ this.viewModeChanged = createEvent(this, "viewModeChanged", 7);
30
31
  this._keyDownHandler = async (event) => this.keyDownListener(event);
31
32
  this._viewHistory = [];
32
33
  this._customEditors = new Map();
@@ -55,7 +56,11 @@ const SnkCrud = class {
55
56
  this.disablePersonalizedFilter = undefined;
56
57
  this.autoLoad = undefined;
57
58
  this.autoFocus = true;
59
+ this.enableGridInsert = false;
58
60
  this.domainMessagesBuilder = undefined;
61
+ this.ignoreReadOnlyFormFields = undefined;
62
+ this.enableLockManger = false;
63
+ this.setCustomFormTitle = undefined;
59
64
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
60
65
  }
61
66
  /**
@@ -164,6 +169,7 @@ const SnkCrud = class {
164
169
  else if (viewMode === VIEW_MODE.FORM) {
165
170
  this._guidesViewer.setFocus();
166
171
  }
172
+ this.viewModeChanged.emit(viewMode);
167
173
  }
168
174
  openConfig(viewMode) {
169
175
  this._snkConfigurator.close();
@@ -179,6 +185,8 @@ const SnkCrud = class {
179
185
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
180
186
  }
181
187
  insertionModeHandler() {
188
+ if (this.enableGridInsert)
189
+ return;
182
190
  this.gridToForm();
183
191
  }
184
192
  cancelHandler() {
@@ -292,11 +300,16 @@ const SnkCrud = class {
292
300
  if (!isDocumentBody)
293
301
  element.focus();
294
302
  }
303
+ async function handleAddRecord() {
304
+ if (!dataUnit.hasNewRecord()) {
305
+ dataUnit.addRecord();
306
+ }
307
+ }
295
308
  keyboardManager
296
309
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
297
310
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
298
311
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
299
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
312
+ .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
300
313
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
301
314
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
302
315
  .bind("ctrl + .", () => {
@@ -392,8 +405,8 @@ const SnkCrud = class {
392
405
  if (this._resourceID == undefined) {
393
406
  return;
394
407
  }
395
- this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
396
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
408
+ this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
409
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
397
410
  }
398
411
  get _element() { return getElement(this); }
399
412
  static get watchers() { return {
@@ -3,19 +3,19 @@ import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtil
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './index-3aa4977a.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-8457af36.js';
6
- import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-f5cbe64b.js';
8
- import './pesquisa-fetcher-03c8f919.js';
6
+ import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-d10910d9.js';
8
+ import './pesquisa-fetcher-8edaa8cd.js';
9
9
  import './ISave-d8c8bc59.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
- import './dataunit-fetcher-264191b2.js';
12
+ import './dataunit-fetcher-c24c76c6.js';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import './form-config-fetcher-30fb808f.js';
14
+ import './form-config-fetcher-adbe5d34.js';
15
15
  import './PrintUtils-3e4ff0f5.js';
16
- import './SnkMessageBuilder-571462fb.js';
17
- import './RecordIDUtils-87d02110.js';
16
+ import './SnkMessageBuilder-6fff4a4c.js';
18
17
  import '@sankhyalabs/core/dist/dataunit/metadata/DataType';
18
+ import './GetSelectedRecordsIDsInfo-9fa41508.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
20
20
  import '@sankhyalabs/core/dist/utils/SortingUtils';
21
21
  import './ResourceIDUtils-a114189a.js';
@@ -131,7 +131,7 @@ class ItemBuilder {
131
131
  getExportToXLS(groupName) {
132
132
  return {
133
133
  id: DataExporterOption.EXPORT_TO_XLS,
134
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,
134
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,
135
135
  group: groupName
136
136
  };
137
137
  }
@@ -174,7 +174,7 @@ class ItemBuilder {
174
174
  getExportPageToXLS() {
175
175
  return {
176
176
  id: DataExporterOption.EXPORT_PAGE_TO_XLS,
177
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
177
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`
178
178
  };
179
179
  }
180
180
  /**
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-a7d3d3f1.js';
2
2
  import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-571462fb.js';
5
- import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-264191b2.js';
6
- import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
4
+ import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
5
+ import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-c24c76c6.js';
7
6
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
+ import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
8
8
 
9
9
  const SnkDataUnit = class {
10
10
  constructor(hostRef) {
@@ -23,7 +23,7 @@ const SnkDataUnit = class {
23
23
  this._rowMetadataCache = new Map();
24
24
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
25
25
  this._dataUnitObserver = async (action) => {
26
- const duState = this.buildDataState(action.type);
26
+ const duState = await this.buildDataState(action.type);
27
27
  this.dataState = duState;
28
28
  this.messagesBuilder.currentOperation = this.getMessageOperation();
29
29
  switch (action.type) {
@@ -115,7 +115,7 @@ const SnkDataUnit = class {
115
115
  * @returns Retorna a lista de IDs dos registros selecionados.
116
116
  */
117
117
  async getSelectedRecordsIDsInfo() {
118
- return Promise.resolve(getSelectedIDs(this.dataUnit));
118
+ return getSelectedRecordsIDsInfo(this.dataUnit);
119
119
  }
120
120
  /**
121
121
  * Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
@@ -135,14 +135,22 @@ const SnkDataUnit = class {
135
135
  async getRowMetadata(record) {
136
136
  return this.doGetRowMetadata(record);
137
137
  }
138
- doGetRowMetadata(record) {
138
+ async doGetRowMetadata(record) {
139
139
  const selectedRecord = this.dataUnit.getSelectedRecord();
140
140
  if (!record && !selectedRecord) {
141
141
  return;
142
142
  }
143
143
  const currentRecord = record || selectedRecord;
144
144
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
145
- const rowMetadata = this._metadataByRow.get(recordId);
145
+ let rowMetadata = this._metadataByRow.get(recordId);
146
+ /*
147
+ Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
148
+ muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
149
+ corretos nao confiando apenas no _metadataByRow
150
+ */
151
+ if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
152
+ rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
153
+ }
146
154
  if (!rowMetadata) {
147
155
  return;
148
156
  }
@@ -336,7 +344,7 @@ const SnkDataUnit = class {
336
344
  case Action.RECORDS_COPIED:
337
345
  return this.interceptRecordsCopied(action);
338
346
  case Action.DATA_CHANGED:
339
- await this.handleLoadRowMetadata(action);
347
+ await this.handleLoadRowMetadata(action.payload);
340
348
  return await this.interceptDataChange(action);
341
349
  case Action.CHANGING_DATA:
342
350
  return await this.interceptDataChange(action);
@@ -356,8 +364,9 @@ const SnkDataUnit = class {
356
364
  return action;
357
365
  }
358
366
  }
359
- async handleLoadRowMetadata(action) {
360
- const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
367
+ async handleLoadRowMetadata(record) {
368
+ if (!record)
369
+ return;
361
370
  const keysPayload = Object.keys(record);
362
371
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
363
372
  if (rmpField) {
@@ -436,7 +445,7 @@ const SnkDataUnit = class {
436
445
  isAllowed(flag) {
437
446
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
438
447
  }
439
- buildDataState(actionType) {
448
+ async buildDataState(actionType) {
440
449
  var _a;
441
450
  const selectionInfo = this.dataUnit.getSelectionInfo();
442
451
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -444,7 +453,7 @@ const SnkDataUnit = class {
444
453
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
445
454
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
446
455
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
447
- rowMetadata = this.doGetRowMetadata(selectedRecord);
456
+ rowMetadata = await this.doGetRowMetadata(selectedRecord);
448
457
  }
449
458
  else if (rowMetadata) {
450
459
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -466,17 +475,20 @@ const SnkDataUnit = class {
466
475
  });
467
476
  }
468
477
  async handleDataSaved(action) {
469
- const newRowMetadata = await this.handleLoadRowMetadata(action);
478
+ var _a, _b, _c;
479
+ const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
470
480
  if (newRowMetadata) {
471
481
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
472
482
  }
473
483
  const recordId = action.payload.records[0].__record__id__;
474
484
  this._metadataByRow.set(recordId, newRowMetadata);
475
- this.dataState = this.buildDataState();
476
- if (this.ignoreSaveMessage) {
485
+ this.dataState = await this.buildDataState();
486
+ let saveOperation = action.payload.changes[0]._operation.toLowerCase();
487
+ if (saveOperation == 'copy')
488
+ saveOperation = OperationMap.CLONE;
489
+ if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
477
490
  return;
478
491
  }
479
- const saveOperation = action.payload.changes[0]._operation.toLowerCase();
480
492
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
481
493
  if (msg != undefined) {
482
494
  this.showSuccessMessage(msg);
@@ -545,21 +557,30 @@ const SnkDataUnit = class {
545
557
  return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
546
558
  }
547
559
  }
560
+ updateMetadataWithRMP() {
561
+ this.fillFieldsWithRmp(this.dataUnit.metadata);
562
+ this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
563
+ const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
564
+ this.dataUnit.metadata = dataUnitUpdatedMetadata;
565
+ }
548
566
  async loadDataUnit() {
549
- var _a;
567
+ var _a, _b;
550
568
  if (this.dataUnit == null && this._application && this.entityName) {
551
569
  this.dataUnit = await this.getDataUnitParentOrChild();
552
570
  }
553
571
  if (this.dataUnit) {
554
572
  this.dataUnit.pageSize = this.pageSize;
555
573
  this.dataUnit.unsubscribe(this._dataUnitObserver);
556
- this.dataUnit.addInterceptor(this);
557
574
  this.dataUnit.subscribe(this._dataUnitObserver);
558
- await this.dataUnit.loadMetadata();
559
- if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
560
- this.getMetadataByRow(this.dataUnit);
575
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
576
+ this.updateMetadataWithRMP();
577
+ }
578
+ this.dataUnit.addInterceptor(this);
579
+ if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
580
+ const { records } = this.getMetadataByRow(this.dataUnit);
581
+ this.dataUnit.records = records;
561
582
  }
562
- this.dataState = this.buildDataState();
583
+ this.dataState = await this.buildDataState();
563
584
  let resolver;
564
585
  while (resolver = this._onDataUnitResolve.pop()) {
565
586
  resolver(this.dataUnit);
@@ -1,15 +1,15 @@
1
- export { S as snk_data_unit } from './snk-data-unit-f5cbe64b.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-d10910d9.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
- import './SnkMessageBuilder-571462fb.js';
6
- import './dataunit-fetcher-264191b2.js';
7
- import './DataFetcher-c1baf61d.js';
5
+ import './SnkMessageBuilder-6fff4a4c.js';
6
+ import './dataunit-fetcher-c24c76c6.js';
7
+ import './DataFetcher-a9c598f2.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
12
12
  import '@sankhyalabs/core/dist/utils/SortingUtils';
13
13
  import './ResourceIDUtils-a114189a.js';
14
- import './RecordIDUtils-87d02110.js';
15
14
  import '@sankhyalabs/core/dist/dataunit/metadata/DataType';
15
+ import './GetSelectedRecordsIDsInfo-9fa41508.js';