@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
@@ -39,7 +39,11 @@ export class SnkCrud {
39
39
  this.disablePersonalizedFilter = undefined;
40
40
  this.autoLoad = undefined;
41
41
  this.autoFocus = true;
42
+ this.enableGridInsert = false;
42
43
  this.domainMessagesBuilder = undefined;
44
+ this.ignoreReadOnlyFormFields = undefined;
45
+ this.enableLockManger = false;
46
+ this.setCustomFormTitle = undefined;
43
47
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
44
48
  }
45
49
  /**
@@ -148,6 +152,7 @@ export class SnkCrud {
148
152
  else if (viewMode === VIEW_MODE.FORM) {
149
153
  this._guidesViewer.setFocus();
150
154
  }
155
+ this.viewModeChanged.emit(viewMode);
151
156
  }
152
157
  openConfig(viewMode) {
153
158
  this._snkConfigurator.close();
@@ -163,6 +168,8 @@ export class SnkCrud {
163
168
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
164
169
  }
165
170
  insertionModeHandler() {
171
+ if (this.enableGridInsert)
172
+ return;
166
173
  this.gridToForm();
167
174
  }
168
175
  cancelHandler() {
@@ -277,11 +284,16 @@ export class SnkCrud {
277
284
  if (!isDocumentBody)
278
285
  element.focus();
279
286
  }
287
+ async function handleAddRecord() {
288
+ if (!dataUnit.hasNewRecord()) {
289
+ dataUnit.addRecord();
290
+ }
291
+ }
280
292
  keyboardManager
281
293
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
282
294
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
283
295
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
284
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
296
+ .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
285
297
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
286
298
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
287
299
  .bind("ctrl + .", () => {
@@ -377,8 +389,8 @@ export class SnkCrud {
377
389
  if (this._resourceID == undefined) {
378
390
  return;
379
391
  }
380
- this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
381
- 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" }))));
392
+ this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
393
+ 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" }))));
382
394
  }
383
395
  static get is() { return "snk-crud"; }
384
396
  static get encapsulation() { return "scoped"; }
@@ -735,6 +747,24 @@ export class SnkCrud {
735
747
  "reflect": false,
736
748
  "defaultValue": "true"
737
749
  },
750
+ "enableGridInsert": {
751
+ "type": "boolean",
752
+ "mutable": false,
753
+ "complexType": {
754
+ "original": "boolean",
755
+ "resolved": "boolean",
756
+ "references": {}
757
+ },
758
+ "required": false,
759
+ "optional": true,
760
+ "docs": {
761
+ "tags": [],
762
+ "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
763
+ },
764
+ "attribute": "enable-grid-insert",
765
+ "reflect": false,
766
+ "defaultValue": "false"
767
+ },
738
768
  "domainMessagesBuilder": {
739
769
  "type": "string",
740
770
  "mutable": false,
@@ -751,6 +781,56 @@ export class SnkCrud {
751
781
  },
752
782
  "attribute": "domain-messages-builder",
753
783
  "reflect": false
784
+ },
785
+ "ignoreReadOnlyFormFields": {
786
+ "type": "boolean",
787
+ "mutable": false,
788
+ "complexType": {
789
+ "original": "boolean",
790
+ "resolved": "boolean",
791
+ "references": {}
792
+ },
793
+ "required": false,
794
+ "optional": true,
795
+ "docs": {
796
+ "tags": [],
797
+ "text": "Ignora os campos \"somente leitura\" no modo de inser\u00E7\u00E3o."
798
+ },
799
+ "attribute": "ignore-read-only-form-fields",
800
+ "reflect": false
801
+ },
802
+ "enableLockManger": {
803
+ "type": "boolean",
804
+ "mutable": false,
805
+ "complexType": {
806
+ "original": "boolean",
807
+ "resolved": "boolean",
808
+ "references": {}
809
+ },
810
+ "required": false,
811
+ "optional": true,
812
+ "docs": {
813
+ "tags": [],
814
+ "text": "Ativa o gerenciamento de locks na grade."
815
+ },
816
+ "attribute": "enable-lock-manger",
817
+ "reflect": false,
818
+ "defaultValue": "false"
819
+ },
820
+ "setCustomFormTitle": {
821
+ "type": "unknown",
822
+ "mutable": false,
823
+ "complexType": {
824
+ "original": "() => string",
825
+ "resolved": "() => string",
826
+ "references": {}
827
+ },
828
+ "required": false,
829
+ "optional": false,
830
+ "docs": {
831
+ "tags": [],
832
+ "text": "Define uma fun\u00E7\u00E3o para configurar um t\u00EDtulo cusotmizado no modo formul\u00E1rio."
833
+ }
754
834
  }
755
835
  };
756
836
  }
@@ -833,6 +913,26 @@ export class SnkCrud {
833
913
  }
834
914
  }
835
915
  }
916
+ }, {
917
+ "method": "viewModeChanged",
918
+ "name": "viewModeChanged",
919
+ "bubbles": true,
920
+ "cancelable": true,
921
+ "composed": true,
922
+ "docs": {
923
+ "tags": [],
924
+ "text": ""
925
+ },
926
+ "complexType": {
927
+ "original": "VIEW_MODE",
928
+ "resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
929
+ "references": {
930
+ "VIEW_MODE": {
931
+ "location": "import",
932
+ "path": "../../lib/utils/constants"
933
+ }
934
+ }
935
+ }
836
936
  }];
837
937
  }
838
938
  static get methods() {
@@ -198,7 +198,7 @@ export class SnkDetailView {
198
198
  this.emitSwitchEvent(VIEW_MODE.GRID);
199
199
  evt.stopPropagation();
200
200
  }
201
- if (evt.detail === TaskbarElement.FORM_MODE) {
201
+ if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE) {
202
202
  this.emitSwitchEvent(VIEW_MODE.FORM);
203
203
  evt.stopPropagation();
204
204
  }
@@ -222,7 +222,7 @@ export class SnkDetailView {
222
222
  }
223
223
  componentWillLoad() {
224
224
  this._configName = `dynaform.${this.entityName}`;
225
- this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
225
+ this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata(), this.dataUnit);
226
226
  this.formConfigManager.loadConfig();
227
227
  if (this.messagesBuilder == undefined) {
228
228
  this.messagesBuilder = new SnkMessageBuilder(this.entityName);
@@ -2,9 +2,9 @@
2
2
  /*@doc Define o espaçamento maior utilizado no componente.*/
3
3
  --snk-guides-viewer--space-large: var(--space--large, 24px);
4
4
  /*@doc Define o espaçamento médio utilizado no componente.*/
5
- --snk-guides-viewer--space-medium: var(--space--medium, 12px);
5
+ --snk-guides-viewer--space-small: var(--space--2xs, 8px);
6
6
  /*@doc Define a altura mínima do cabeçalho do componente.*/
7
- --snk-guides-viewer__header--min-height: 94px;
7
+ --snk-guides-viewer__header--min-height: 68px;
8
8
  /*@doc Define a posição de z-index do cabeçalho do componente.*/
9
9
  --snk-guides-viewer__header--z-index: var(--more-visible, 2);
10
10
  /*@doc Define a cor de fundo do cabeçalho do componente.*/
@@ -51,10 +51,10 @@ snk-form-view {
51
51
  padding-left: var(--snk-guides-viewer--space-large);
52
52
  padding-right: var(--snk-guides-viewer--space-large);
53
53
  padding-top: var(--snk-guides-viewer--space-large);
54
- padding-bottom: var(--snk-guides-viewer--space-medium);
54
+ padding-bottom: var(--snk-guides-viewer--space-small);
55
55
  margin-left: calc(var(--snk-guides-viewer--space-large) * -1);
56
56
  margin-right: calc(var(--snk-guides-viewer--space-large) * -1);
57
- margin-bottom: var(--snk-guides-viewer--space-medium);
57
+ margin-bottom: var(--snk-guides-viewer--space-small);
58
58
  }
59
59
 
60
60
  .snk-guides-viewer__header-breadcrumb{
@@ -81,8 +81,8 @@ snk-form-view {
81
81
  position: sticky;
82
82
 
83
83
  /*public*/
84
- top: calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));
85
- height: calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium));
84
+ top: calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-small));
85
+ height: calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-small));
86
86
  }
87
87
 
88
88
  .snk-guides-viewer__guide-navigator[open] {
@@ -27,6 +27,9 @@ export class SnkGuidesViewer {
27
27
  this.resourceID = undefined;
28
28
  this.detailTaskbarCustomContainerId = undefined;
29
29
  this.formLegacyConfigName = undefined;
30
+ this.enableGridInsert = false;
31
+ this.ignoreReadOnlyFormFields = undefined;
32
+ this.getCustomTitle = undefined;
30
33
  this._hasToCreateFieldSearch = true;
31
34
  this._breadcrumbItems = [];
32
35
  this._guides = undefined;
@@ -95,7 +98,7 @@ export class SnkGuidesViewer {
95
98
  this._container.focus();
96
99
  }
97
100
  exitViewer() {
98
- if (this.dataUnit.isDirty()) {
101
+ if (!this.enableGridInsert && this.dataUnit.isDirty()) {
99
102
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
100
103
  }
101
104
  else {
@@ -204,10 +207,13 @@ export class SnkGuidesViewer {
204
207
  const invisibleButtons = this.getInvisibleButtons();
205
208
  this._taskbarProcessor = new TaskbarProcessor({
206
209
  "snkGuideViewer.regular": btnsRegularMode,
207
- "snkGuideViewer.finish_edition": ["CANCEL", "SAVE"],
210
+ "snkGuideViewer.finish_edition": ["CANCEL", "SAVE", this.handleAddGridMode()],
208
211
  });
209
212
  this._taskbarProcessor.process(taskbarId, this.taskbarManager, this.dataState, disabledButtons, invisibleButtons);
210
213
  }
214
+ handleAddGridMode() {
215
+ return this.enableGridInsert ? TaskbarElement.GRID_MODE : "";
216
+ }
211
217
  getInvisibleButtons() {
212
218
  const invisibleButtons = [];
213
219
  if (this.dataState && this.dataState.selectionInfo.mode === SelectionMode.ALL_RECORDS)
@@ -360,11 +366,14 @@ export class SnkGuidesViewer {
360
366
  this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
361
367
  }
362
368
  }
369
+ setMasterFormConfig(config) {
370
+ this.masterFormConfig = config;
371
+ }
363
372
  componentWillLoad() {
364
373
  if (this.resourceID == undefined) {
365
374
  throw new Error("Erro interno: resourceID não informado");
366
375
  }
367
- this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
376
+ this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
368
377
  this.addFormLegacyConfigName();
369
378
  this._configManager.loadConfig();
370
379
  }
@@ -392,7 +401,7 @@ export class SnkGuidesViewer {
392
401
  return this._fieldSearch;
393
402
  }
394
403
  fieldsOptionLoader(argument) {
395
- return Promise.resolve(this._configManager.getFieldsList(this.dataUnit, argument)
404
+ return Promise.resolve(this._configManager.getFieldsList(argument)
396
405
  .map(field => ({ value: field.name, label: field.label })));
397
406
  }
398
407
  onSelectField(option, actionButton) {
@@ -430,6 +439,9 @@ export class SnkGuidesViewer {
430
439
  await this.addErrorBadgeToGuide(guideName);
431
440
  await this.openGuideNavigator(guideName);
432
441
  }
442
+ if (action.type === DUAction.METADATA_LOADED) {
443
+ this.loadGuides(false);
444
+ }
433
445
  }
434
446
  async addErrorBadgeToGuide(guideName) {
435
447
  var _a;
@@ -464,20 +476,24 @@ export class SnkGuidesViewer {
464
476
  }
465
477
  return "";
466
478
  }
479
+ getTitle() {
480
+ var _a, _b;
481
+ return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
482
+ }
467
483
  componentDidLoad() {
468
484
  this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
469
485
  }
470
486
  render() {
471
487
  var _a, _b;
472
488
  if (this._formEditorConfigManager != undefined) {
473
- return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
489
+ return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }));
474
490
  }
475
491
  if (!this.dataUnit || !this._configManager.isLoaded) {
476
492
  return;
477
493
  }
478
494
  this.loadTaskbarProcessor();
479
495
  const showGuides = this._guides && (this._guides.length > 1);
480
- return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getMessage("snkCrud.title")), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
496
+ return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
481
497
  h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
482
498
  h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
483
499
  :
@@ -794,6 +810,56 @@ export class SnkGuidesViewer {
794
810
  },
795
811
  "attribute": "form-legacy-config-name",
796
812
  "reflect": false
813
+ },
814
+ "enableGridInsert": {
815
+ "type": "boolean",
816
+ "mutable": false,
817
+ "complexType": {
818
+ "original": "boolean",
819
+ "resolved": "boolean",
820
+ "references": {}
821
+ },
822
+ "required": false,
823
+ "optional": true,
824
+ "docs": {
825
+ "tags": [],
826
+ "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
827
+ },
828
+ "attribute": "enable-grid-insert",
829
+ "reflect": false,
830
+ "defaultValue": "false"
831
+ },
832
+ "ignoreReadOnlyFormFields": {
833
+ "type": "boolean",
834
+ "mutable": false,
835
+ "complexType": {
836
+ "original": "boolean",
837
+ "resolved": "boolean",
838
+ "references": {}
839
+ },
840
+ "required": false,
841
+ "optional": true,
842
+ "docs": {
843
+ "tags": [],
844
+ "text": "Ignora os campos \"somente leitura\" no modo de inser\u00E7\u00E3o."
845
+ },
846
+ "attribute": "ignore-read-only-form-fields",
847
+ "reflect": false
848
+ },
849
+ "getCustomTitle": {
850
+ "type": "unknown",
851
+ "mutable": false,
852
+ "complexType": {
853
+ "original": "() => string",
854
+ "resolved": "() => string",
855
+ "references": {}
856
+ },
857
+ "required": false,
858
+ "optional": false,
859
+ "docs": {
860
+ "tags": [],
861
+ "text": "Fornece uma fun\u00E7\u00E3o para obter um t\u00EDtulo customizado do formul\u00E1rio."
862
+ }
797
863
  }
798
864
  };
799
865
  }
@@ -4,7 +4,7 @@ export const OptionsStep = ({ getMessage, changeInfo, data }) => {
4
4
  const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
5
5
  const formatOptions = [
6
6
  { label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
7
- { label: getMessage("snkExporter.emailSenderOptStep_formatXLSX"), value: "xlsx" }
7
+ { label: getMessage("snkExporter.emailSenderOptStep_formatXLS"), value: "xls" }
8
8
  ];
9
9
  const typeOptions = [
10
10
  { label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
@@ -1,6 +1,6 @@
1
1
  import { CommonsExporter } from "../interfaces/IExporterProvider";
2
2
  import { UserInterface } from "@sankhyalabs/core";
3
- import { getSelectedIDs } from "../utils/RecordIDUtils";
3
+ import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
4
4
  import { DataExporterOption } from "../../../lib/@types";
5
5
  export default class ClientSideExporterProvider extends CommonsExporter {
6
6
  getSelectedNumber() {
@@ -1,5 +1,5 @@
1
1
  import { CommonsExporter } from "../interfaces/IExporterProvider";
2
- import { getSelectedIDs } from "../utils/RecordIDUtils";
2
+ import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
3
3
  export default class ServerSideExporterProvider extends CommonsExporter {
4
4
  getFilters() {
5
5
  var _a;
@@ -110,7 +110,7 @@ export class ItemBuilder {
110
110
  getExportToXLS(groupName) {
111
111
  return {
112
112
  id: DataExporterOption.EXPORT_TO_XLS,
113
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,
113
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,
114
114
  group: groupName
115
115
  };
116
116
  }
@@ -153,7 +153,7 @@ export class ItemBuilder {
153
153
  getExportPageToXLS() {
154
154
  return {
155
155
  id: DataExporterOption.EXPORT_PAGE_TO_XLS,
156
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
156
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`
157
157
  };
158
158
  }
159
159
  /**
@@ -4,8 +4,8 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
4
4
  import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
5
5
  import { DatasetStrategy } from '../../lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy';
6
6
  import { getRecordValue } from '../../lib/dataUnit/ValueFormatter';
7
- import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
8
7
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
8
+ import { getSelectedRecordsIDsInfo } from '../../lib/utils/GetSelectedRecordsIDsInfo';
9
9
  export class SnkDataUnit {
10
10
  constructor() {
11
11
  this._onDataUnitResolve = [];
@@ -16,7 +16,7 @@ export class SnkDataUnit {
16
16
  this._rowMetadataCache = new Map();
17
17
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
18
18
  this._dataUnitObserver = async (action) => {
19
- const duState = this.buildDataState(action.type);
19
+ const duState = await this.buildDataState(action.type);
20
20
  this.dataState = duState;
21
21
  this.messagesBuilder.currentOperation = this.getMessageOperation();
22
22
  switch (action.type) {
@@ -110,7 +110,7 @@ export class SnkDataUnit {
110
110
  * @returns Retorna a lista de IDs dos registros selecionados.
111
111
  */
112
112
  async getSelectedRecordsIDsInfo() {
113
- return Promise.resolve(getSelectedIDs(this.dataUnit));
113
+ return getSelectedRecordsIDsInfo(this.dataUnit);
114
114
  }
115
115
  /**
116
116
  * Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
@@ -130,14 +130,22 @@ export class SnkDataUnit {
130
130
  async getRowMetadata(record) {
131
131
  return this.doGetRowMetadata(record);
132
132
  }
133
- doGetRowMetadata(record) {
133
+ async doGetRowMetadata(record) {
134
134
  const selectedRecord = this.dataUnit.getSelectedRecord();
135
135
  if (!record && !selectedRecord) {
136
136
  return;
137
137
  }
138
138
  const currentRecord = record || selectedRecord;
139
139
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
140
- const rowMetadata = this._metadataByRow.get(recordId);
140
+ let rowMetadata = this._metadataByRow.get(recordId);
141
+ /*
142
+ Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
143
+ muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
144
+ corretos nao confiando apenas no _metadataByRow
145
+ */
146
+ if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
147
+ rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
148
+ }
141
149
  if (!rowMetadata) {
142
150
  return;
143
151
  }
@@ -331,7 +339,7 @@ export class SnkDataUnit {
331
339
  case Action.RECORDS_COPIED:
332
340
  return this.interceptRecordsCopied(action);
333
341
  case Action.DATA_CHANGED:
334
- await this.handleLoadRowMetadata(action);
342
+ await this.handleLoadRowMetadata(action.payload);
335
343
  return await this.interceptDataChange(action);
336
344
  case Action.CHANGING_DATA:
337
345
  return await this.interceptDataChange(action);
@@ -351,8 +359,9 @@ export class SnkDataUnit {
351
359
  return action;
352
360
  }
353
361
  }
354
- async handleLoadRowMetadata(action) {
355
- const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
362
+ async handleLoadRowMetadata(record) {
363
+ if (!record)
364
+ return;
356
365
  const keysPayload = Object.keys(record);
357
366
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
358
367
  if (rmpField) {
@@ -431,7 +440,7 @@ export class SnkDataUnit {
431
440
  isAllowed(flag) {
432
441
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
433
442
  }
434
- buildDataState(actionType) {
443
+ async buildDataState(actionType) {
435
444
  var _a;
436
445
  const selectionInfo = this.dataUnit.getSelectionInfo();
437
446
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -439,7 +448,7 @@ export class SnkDataUnit {
439
448
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
440
449
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
441
450
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
442
- rowMetadata = this.doGetRowMetadata(selectedRecord);
451
+ rowMetadata = await this.doGetRowMetadata(selectedRecord);
443
452
  }
444
453
  else if (rowMetadata) {
445
454
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -461,17 +470,20 @@ export class SnkDataUnit {
461
470
  });
462
471
  }
463
472
  async handleDataSaved(action) {
464
- const newRowMetadata = await this.handleLoadRowMetadata(action);
473
+ var _a, _b, _c;
474
+ 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);
465
475
  if (newRowMetadata) {
466
476
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
467
477
  }
468
478
  const recordId = action.payload.records[0].__record__id__;
469
479
  this._metadataByRow.set(recordId, newRowMetadata);
470
- this.dataState = this.buildDataState();
471
- if (this.ignoreSaveMessage) {
480
+ this.dataState = await this.buildDataState();
481
+ let saveOperation = action.payload.changes[0]._operation.toLowerCase();
482
+ if (saveOperation == 'copy')
483
+ saveOperation = OperationMap.CLONE;
484
+ if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
472
485
  return;
473
486
  }
474
- const saveOperation = action.payload.changes[0]._operation.toLowerCase();
475
487
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
476
488
  if (msg != undefined) {
477
489
  this.showSuccessMessage(msg);
@@ -540,21 +552,30 @@ export class SnkDataUnit {
540
552
  return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
541
553
  }
542
554
  }
555
+ updateMetadataWithRMP() {
556
+ this.fillFieldsWithRmp(this.dataUnit.metadata);
557
+ this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
558
+ const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
559
+ this.dataUnit.metadata = dataUnitUpdatedMetadata;
560
+ }
543
561
  async loadDataUnit() {
544
- var _a;
562
+ var _a, _b;
545
563
  if (this.dataUnit == null && this._application && this.entityName) {
546
564
  this.dataUnit = await this.getDataUnitParentOrChild();
547
565
  }
548
566
  if (this.dataUnit) {
549
567
  this.dataUnit.pageSize = this.pageSize;
550
568
  this.dataUnit.unsubscribe(this._dataUnitObserver);
551
- this.dataUnit.addInterceptor(this);
552
569
  this.dataUnit.subscribe(this._dataUnitObserver);
553
- await this.dataUnit.loadMetadata();
554
- if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
555
- this.getMetadataByRow(this.dataUnit);
570
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
571
+ this.updateMetadataWithRMP();
572
+ }
573
+ this.dataUnit.addInterceptor(this);
574
+ if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
575
+ const { records } = this.getMetadataByRow(this.dataUnit);
576
+ this.dataUnit.records = records;
556
577
  }
557
- this.dataState = this.buildDataState();
578
+ this.dataState = await this.buildDataState();
558
579
  let resolver;
559
580
  while (resolver = this._onDataUnitResolve.pop()) {
560
581
  resolver(this.dataUnit);
@@ -74,7 +74,7 @@ export class SnkFilterBinarySelect {
74
74
  }
75
75
  const [optOne, optTwo] = this.config.props.options;
76
76
  if (this.presentationMode === EPresentationMode.MODAL) {
77
- return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name), compact: true })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: this.isSelected(optTwo.name), compact: true })))));
77
+ return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name) })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: this.isSelected(optTwo.name) })))));
78
78
  }
79
79
  return (h(Host, null, h("ez-radio-button", { value: this._radioButtonValue }, h("ez-radio-button-option", { id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: optOne.name }), h("ez-radio-button-option", { id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: optTwo.name }), h("ez-radio-button-option", { id: `${this.config.id}_option3`, class: "sc-snk-filter-bar editor__ez-check", label: `${optOne.label} + ${optTwo.label}`, value: this._noOptionValue }))));
80
80
  }
@@ -19,7 +19,7 @@ export class SnkFilterCheckboxList {
19
19
  this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
20
20
  }
21
21
  renderOptions() {
22
- return this.optionsList.map(option => (h("ez-check", { label: option.label, compact: true, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
22
+ return this.optionsList.map(option => (h("ez-check", { label: option.label, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
23
23
  }
24
24
  isChecked(itemName) {
25
25
  var _a;
@@ -39,7 +39,7 @@ export class SnkFilterPersonalized {
39
39
  }
40
40
  getItemContent(item) {
41
41
  var _a, _b;
42
- const CheckboxElement = () => (h("ez-check", Object.assign({ class: "SnkFilterPersonalized_checkbox", id: `param_${item.id}`, key: item.id, compact: true, value: item.visible, label: item.label, onEzChange: ({ detail: visible }) => this.handleItemChange.bind(this)(visible, item.id) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`checkboxFilter_${item.id}`)}` })));
42
+ const CheckboxElement = () => (h("ez-check", Object.assign({ class: "SnkFilterPersonalized_checkbox", id: `param_${item.id}`, key: item.id, value: item.visible, label: item.label, onEzChange: ({ detail: visible }) => this.handleItemChange.bind(this)(visible, item.id) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`checkboxFilter_${item.id}`)}` })));
43
43
  const isVariable = !!((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters.length);
44
44
  return (h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, h(CheckboxElement, null), this.buildModalListActions(item, isVariable))), (item.visible && isVariable) && (h("div", { class: "ez-row ez-padding--small" }, this.getFormField(item)))));
45
45
  }
@@ -105,7 +105,7 @@
105
105
 
106
106
  .snk-filter-bar__filter-item-container {
107
107
  display: flex;
108
- align-self: center;
108
+ align-items: start;
109
109
  }
110
110
 
111
111
  .snk-filter-bar__scroller :first-child {