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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) 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 +7 -7
  16. package/dist/cjs/snk-attach.cjs.entry.js +38 -29
  17. package/dist/cjs/snk-crud.cjs.entry.js +14 -7
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
  19. package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-47202e42.js} +18 -9
  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 +58 -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 +55 -21
  37. package/dist/cjs/snk-taskbar.cjs.entry.js +24 -1
  38. package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
  39. package/dist/collection/components/snk-attach/snk-attach.js +25 -16
  40. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
  41. package/dist/collection/components/snk-crud/snk-crud.js +78 -2
  42. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  43. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
  44. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +72 -6
  45. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  46. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  47. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  48. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  49. package/dist/collection/components/snk-data-unit/snk-data-unit.js +16 -7
  50. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  51. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
  52. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +77 -21
  55. package/dist/collection/components/snk-form/snk-form.js +2 -2
  56. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +70 -14
  57. package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
  58. package/dist/collection/components/snk-grid/snk-grid.css +2 -0
  59. package/dist/collection/components/snk-grid/snk-grid.js +74 -8
  60. package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
  61. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
  62. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
  63. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +63 -10
  64. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  65. package/dist/collection/components/snk-taskbar/snk-taskbar.js +65 -0
  66. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
  67. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
  68. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
  69. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
  70. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  71. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
  72. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
  73. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  74. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  75. package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
  76. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  77. package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
  78. package/dist/components/DataFetcher.js +22 -16
  79. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  80. package/dist/components/SnkFormConfigManager.js +70 -14
  81. package/dist/components/SnkMessageBuilder.js +6 -2
  82. package/dist/components/dataunit-fetcher.js +45 -15
  83. package/dist/components/form-config-fetcher.js +4 -1
  84. package/dist/components/snk-actions-button2.js +12 -9
  85. package/dist/components/snk-attach2.js +34 -25
  86. package/dist/components/snk-crud.js +12 -2
  87. package/dist/components/snk-data-exporter2.js +2 -2
  88. package/dist/components/snk-data-unit2.js +19 -47
  89. package/dist/components/snk-detail-view2.js +29 -10
  90. package/dist/components/snk-exporter-email-sender2.js +1 -1
  91. package/dist/components/snk-filter-bar2.js +39 -22
  92. package/dist/components/snk-filter-binary-select.js +1 -1
  93. package/dist/components/snk-filter-checkbox-list.js +1 -1
  94. package/dist/components/snk-form-config2.js +16 -3
  95. package/dist/components/snk-form.js +2 -2
  96. package/dist/components/snk-grid2.js +51 -12
  97. package/dist/components/snk-personalized-filter-editor.js +1 -1
  98. package/dist/components/snk-print-selector.js +1 -1
  99. package/dist/components/snk-simple-bar2.js +1 -1
  100. package/dist/components/snk-simple-crud2.js +47 -10
  101. package/dist/components/snk-taskbar2.js +25 -2
  102. package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-7b36d041.js} +2 -2
  103. package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-30caa626.js} +40 -8
  104. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
  105. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  106. package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-139f09fa.js} +72 -16
  107. package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-6fff4a4c.js} +6 -2
  108. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
  109. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-c24c76c6.js} +46 -16
  110. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  111. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
  112. package/dist/esm/loader.js +1 -1
  113. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-8edaa8cd.js} +1 -1
  114. package/dist/esm/sankhyablocks.js +1 -1
  115. package/dist/esm/snk-actions-button_4.entry.js +17 -14
  116. package/dist/esm/snk-application.entry.js +7 -7
  117. package/dist/esm/snk-attach.entry.js +38 -29
  118. package/dist/esm/snk-crud.entry.js +14 -7
  119. package/dist/esm/snk-data-exporter.entry.js +9 -9
  120. package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-de45e0e1.js} +18 -9
  121. package/dist/esm/snk-data-unit.entry.js +5 -5
  122. package/dist/esm/snk-detail-view.entry.js +11 -11
  123. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  124. package/dist/esm/snk-filter-bar.entry.js +40 -25
  125. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  126. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  127. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  128. package/dist/esm/snk-form-config.entry.js +17 -5
  129. package/dist/esm/snk-form.entry.js +7 -6
  130. package/dist/esm/snk-grid.entry.js +53 -16
  131. package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-beb6baef.js} +29 -13
  132. package/dist/esm/snk-guides-viewer.entry.js +9 -9
  133. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  134. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  135. package/dist/esm/snk-print-selector.entry.js +1 -1
  136. package/dist/esm/snk-simple-bar.entry.js +1 -1
  137. package/dist/esm/snk-simple-crud.entry.js +51 -17
  138. package/dist/esm/snk-taskbar.entry.js +24 -1
  139. package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
  140. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  141. package/dist/sankhyablocks/p-17425c72.js +1 -0
  142. package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
  143. package/dist/sankhyablocks/{p-47db7e88.entry.js → p-212213d9.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-23736d75.js +1 -0
  145. package/dist/sankhyablocks/p-2923c1b5.js +1 -0
  146. package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
  147. package/dist/sankhyablocks/{p-871aa14e.entry.js → p-31e74634.entry.js} +1 -1
  148. package/dist/sankhyablocks/p-38b85e5a.entry.js +1 -0
  149. package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
  150. package/dist/sankhyablocks/{p-52920496.js → p-4d9549cf.js} +1 -1
  151. package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
  152. package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
  153. package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
  154. package/dist/sankhyablocks/p-62e048c6.entry.js +1 -0
  155. package/dist/sankhyablocks/p-7ac7932c.js +60 -0
  156. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  157. package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
  158. package/dist/sankhyablocks/p-92eadb1c.entry.js +1 -0
  159. package/dist/sankhyablocks/{p-7619bdb1.entry.js → p-a42e7a1e.entry.js} +2 -2
  160. package/dist/sankhyablocks/p-a75d242d.entry.js +1 -0
  161. package/dist/sankhyablocks/p-afbb070d.js +1 -0
  162. package/dist/sankhyablocks/p-bccfc262.js +1 -0
  163. package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
  164. package/dist/sankhyablocks/p-c5546f92.js +1 -0
  165. package/dist/sankhyablocks/p-c6db5eeb.entry.js +1 -0
  166. package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
  167. package/dist/sankhyablocks/p-da34270e.entry.js +1 -0
  168. package/dist/sankhyablocks/p-dcead955.entry.js +1 -0
  169. package/dist/sankhyablocks/p-eb9f0407.entry.js +1 -0
  170. package/dist/sankhyablocks/p-f3434fc4.js +1 -0
  171. package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-fb34e0cf.entry.js} +1 -1
  172. package/dist/sankhyablocks/p-fbb1b675.entry.js +1 -0
  173. package/dist/sankhyablocks/p-fe7b6d1d.entry.js +1 -0
  174. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  175. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  176. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  177. package/dist/types/components/snk-crud/snk-crud.d.ts +13 -0
  178. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
  179. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
  180. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +9 -0
  181. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
  182. package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
  183. package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
  184. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +9 -0
  185. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  186. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  187. package/dist/types/components.d.ts +97 -0
  188. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
  189. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  190. package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
  191. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  192. package/package.json +2 -2
  193. package/dist/sankhyablocks/p-17def7cd.js +0 -1
  194. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  195. package/dist/sankhyablocks/p-2a408684.js +0 -1
  196. package/dist/sankhyablocks/p-3a212712.js +0 -1
  197. package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
  198. package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
  199. package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
  200. package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
  201. package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
  202. package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
  203. package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
  204. package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
  205. package/dist/sankhyablocks/p-80042dc6.entry.js +0 -1
  206. package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
  207. package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
  208. package/dist/sankhyablocks/p-9863d682.js +0 -1
  209. package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
  210. package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
  211. package/dist/sankhyablocks/p-c2495304.js +0 -1
  212. package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
  213. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  214. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  215. package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
  216. package/dist/sankhyablocks/p-fe79f83a.js +0 -60
  217. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -38,6 +38,7 @@ export class SnkFormConfig {
38
38
  this.dataUnit = undefined;
39
39
  this.configManager = undefined;
40
40
  this.messagesBuilder = undefined;
41
+ this.ignoreReadOnlyFormFields = undefined;
41
42
  }
42
43
  observeConfigManager() {
43
44
  this.loadConfig(this._sortableTimer);
@@ -67,7 +68,7 @@ export class SnkFormConfig {
67
68
  }
68
69
  }
69
70
  getConfig() {
70
- let config = this.configManager.getConfig(this.dataUnit);
71
+ let config = this.configManager.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
71
72
  if (config.fields && config.fields.length === 0) {
72
73
  config = undefined;
73
74
  }
@@ -192,7 +193,12 @@ export class SnkFormConfig {
192
193
  this._optionFormConfigChanged = false;
193
194
  this.configManager.saveConfig(this.buildConfigToSave())
194
195
  .then(savedConfig => {
196
+ var _a;
195
197
  ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
198
+ const userOption = (_a = this._formConfigOptions) === null || _a === void 0 ? void 0 : _a.find((config) => {
199
+ return config.origin === UserConfigType.USER;
200
+ });
201
+ this.setFormConfig(userOption);
196
202
  this.configChange.emit(savedConfig);
197
203
  });
198
204
  }
@@ -529,9 +535,12 @@ export class SnkFormConfig {
529
535
  switch (this._optionFormConfigSelected.origin) {
530
536
  case UserConfigType.DEFAULT:
531
537
  config = await this.configManager.fetchDefaultConfig();
538
+ if (!config) {
539
+ config = this.configManager.getEmptyConfig();
540
+ }
532
541
  break;
533
- case UserConfigType.DEFAULT:
534
- config = await this.configManager.fetchDefaultConfig();
542
+ default:
543
+ config = this.getConfig();
535
544
  break;
536
545
  }
537
546
  if (config != undefined) {
@@ -734,6 +743,9 @@ export class SnkFormConfig {
734
743
  if (layoutFormConfig == undefined) {
735
744
  layoutFormConfig = [];
736
745
  }
746
+ if (this._formConfig.defaultConfiguration) {
747
+ return layoutFormConfig;
748
+ }
737
749
  return this._formConfig.tabs.map((tab) => {
738
750
  return layoutFormConfig.find(config => { var _a, _b; return ((_a = tab.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = config.tab) === null || _b === void 0 ? void 0 : _b.toLowerCase()); })
739
751
  || { tab: tab.label, groups: [], visible: tab.visible };
@@ -1055,6 +1067,23 @@ export class SnkFormConfig {
1055
1067
  "tags": [],
1056
1068
  "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
1057
1069
  }
1070
+ },
1071
+ "ignoreReadOnlyFormFields": {
1072
+ "type": "boolean",
1073
+ "mutable": false,
1074
+ "complexType": {
1075
+ "original": "boolean",
1076
+ "resolved": "boolean",
1077
+ "references": {}
1078
+ },
1079
+ "required": false,
1080
+ "optional": true,
1081
+ "docs": {
1082
+ "tags": [],
1083
+ "text": "Ignora os campos \"somente leitura\" no modo de inser\u00E7\u00E3o."
1084
+ },
1085
+ "attribute": "ignore-read-only-form-fields",
1086
+ "reflect": false
1058
1087
  }
1059
1088
  };
1060
1089
  }
@@ -1,11 +1,13 @@
1
1
  :host {
2
2
  --snk-grid-min-height: 300px;
3
+ --snk-grid-padding: var(--space--small);
3
4
  }
4
5
 
5
6
  .snk-grid__container {
6
7
  display: flex;
7
8
  height: 100%;
8
9
  width: 100%;
10
+ padding: var(--snk-grid-padding);
9
11
  }
10
12
 
11
13
  .snk-grid__header {
@@ -1,4 +1,4 @@
1
- import { h, Fragment } from '@stencil/core';
1
+ import { h, Fragment, } from '@stencil/core';
2
2
  import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
3
3
  import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
4
4
  import { ConfigStorage } from '../../lib/configs/ConfigStorage';
@@ -11,6 +11,7 @@ import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/
11
11
  import { CrudUtils } from '../../lib';
12
12
  import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
13
13
  import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
14
+ import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
14
15
  export class SnkGrid {
15
16
  constructor() {
16
17
  this._customEditors = new Map();
@@ -19,7 +20,7 @@ export class SnkGrid {
19
20
  "snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
20
21
  "snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
21
22
  "snkGridTopTaskbar.regular.singleTaskbar": [],
22
- "snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
23
+ "snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()],
23
24
  "snkGridTopTaskbar.finish_edition.secondary": [],
24
25
  "snkGridTopTaskbar.finish_edition.singleTaskbar": [],
25
26
  });
@@ -32,7 +33,7 @@ export class SnkGrid {
32
33
  "snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
33
34
  "snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
34
35
  "snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
35
- "snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
36
+ "snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()]
36
37
  });
37
38
  this.dataUnitInterceptor = {
38
39
  interceptAction: async (action) => {
@@ -47,6 +48,7 @@ export class SnkGrid {
47
48
  this._gridConfig = undefined;
48
49
  this._popUpGridConfig = false;
49
50
  this._showSnkFilterBar = true;
51
+ this._enableContinuousInsert = false;
50
52
  this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
51
53
  this.configName = undefined;
52
54
  this.filterBarTitle = undefined;
@@ -70,6 +72,7 @@ export class SnkGrid {
70
72
  this.filterBarLegacyConfigName = undefined;
71
73
  this.autoLoad = undefined;
72
74
  this.autoFocus = true;
75
+ this.enableGridInsert = false;
73
76
  }
74
77
  /**
75
78
  * Exibe a janela de configurações da grade.
@@ -156,6 +159,17 @@ export class SnkGrid {
156
159
  async setFocus() {
157
160
  this._grid.setFocus();
158
161
  }
162
+ async handleClick(event) {
163
+ if (this.hasToBlockEvent(event)) {
164
+ event.preventDefault();
165
+ event.stopPropagation();
166
+ await this._dataUnit.cancelEdition();
167
+ }
168
+ }
169
+ hasToBlockEvent(event) {
170
+ var _a;
171
+ return ((_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.contains(event.target)) && this.enableGridInsert && this._dataUnit.hasNewRecord();
172
+ }
159
173
  async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
160
174
  if (!newLegacyConfig) {
161
175
  return;
@@ -166,6 +180,9 @@ export class SnkGrid {
166
180
  this.addGridLegacyConfigName();
167
181
  this.loadConfig();
168
182
  }
183
+ handleAddFormMode() {
184
+ return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
185
+ }
169
186
  openGridConfig() {
170
187
  this._grid.getColumnsState()
171
188
  .then((gridColumns) => {
@@ -293,10 +310,15 @@ export class SnkGrid {
293
310
  this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
294
311
  this.addGridLegacyConfigName();
295
312
  this.loadConfig();
313
+ this._continuousInsertUtils = new ContinuousInsertUtils(this._application, this.resourceID, this.configName);
314
+ if (this.enableGridInsert) {
315
+ this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
316
+ }
296
317
  }
297
318
  componentDidRender() {
319
+ var _a, _b;
298
320
  this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
299
- this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
321
+ this.loadGridCustomFormatters((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields);
300
322
  this.setCustomRenders();
301
323
  this.setCustomEditors();
302
324
  }
@@ -309,7 +331,7 @@ export class SnkGrid {
309
331
  const disabledButtons = [];
310
332
  if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
311
333
  if (this._dataState.selectionInfo.length > 1) {
312
- disabledButtons.push(TaskbarElement.CLONE, "ATTACH");
334
+ disabledButtons.push(TaskbarElement.CLONE, "ATTACH", TaskbarElement.UPDATE);
313
335
  }
314
336
  if (this._dataState.selectionInfo.isAllRecords()) {
315
337
  disabledButtons.push("REMOVE");
@@ -394,6 +416,14 @@ export class SnkGrid {
394
416
  eagerInitialize: true,
395
417
  itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
396
418
  }];
419
+ if (this.enableGridInsert) {
420
+ hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, () => {
421
+ this._enableContinuousInsert = !this._enableContinuousInsert;
422
+ this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
423
+ }));
424
+ }
425
+ if (this.isGridInsertActive())
426
+ return hardList;
397
427
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
398
428
  const taskbarID = this.getTopTaskBarId();
399
429
  return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
@@ -411,12 +441,20 @@ export class SnkGrid {
411
441
  }
412
442
  this._showSnkFilterBar = true;
413
443
  }
444
+ getGridHeaderButtons() {
445
+ if (this.isGridInsertActive())
446
+ return TaskbarElement.MORE_OPTIONS;
447
+ return this._headerTaskbarProcessor.buttons;
448
+ }
449
+ isGridInsertActive() {
450
+ return this.enableGridInsert && this._dataUnit.hasNewRecord();
451
+ }
414
452
  render() {
415
453
  if (!this._dataUnit) {
416
454
  return undefined;
417
455
  }
418
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
419
- h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
456
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
457
+ h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
420
458
  }
421
459
  static get is() { return "snk-grid"; }
422
460
  static get encapsulation() { return "scoped"; }
@@ -862,6 +900,24 @@ export class SnkGrid {
862
900
  "attribute": "auto-focus",
863
901
  "reflect": false,
864
902
  "defaultValue": "true"
903
+ },
904
+ "enableGridInsert": {
905
+ "type": "boolean",
906
+ "mutable": false,
907
+ "complexType": {
908
+ "original": "boolean",
909
+ "resolved": "boolean",
910
+ "references": {}
911
+ },
912
+ "required": false,
913
+ "optional": true,
914
+ "docs": {
915
+ "tags": [],
916
+ "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
917
+ },
918
+ "attribute": "enable-grid-insert",
919
+ "reflect": false,
920
+ "defaultValue": "false"
865
921
  }
866
922
  };
867
923
  }
@@ -871,7 +927,8 @@ export class SnkGrid {
871
927
  "_dataState": {},
872
928
  "_gridConfig": {},
873
929
  "_popUpGridConfig": {},
874
- "_showSnkFilterBar": {}
930
+ "_showSnkFilterBar": {},
931
+ "_enableContinuousInsert": {}
875
932
  };
876
933
  }
877
934
  static get events() {
@@ -1143,4 +1200,13 @@ export class SnkGrid {
1143
1200
  "methodName": "handleGridLegacyConfigName"
1144
1201
  }];
1145
1202
  }
1203
+ static get listeners() {
1204
+ return [{
1205
+ "name": "click",
1206
+ "method": "handleClick",
1207
+ "target": undefined,
1208
+ "capture": true,
1209
+ "passive": false
1210
+ }];
1211
+ }
1146
1212
  }
@@ -146,7 +146,7 @@ export class SnkPrintSelector {
146
146
  render() {
147
147
  return (h(Host, null, h("ez-popup", Object.assign({ size: 'small', heightMode: 'full', useHeader: false, ref: (ref) => this._ezPopup = ref }, this.getElementID("snk-print-selector")), h("ez-modal-container", { modalTitle: this.getMessage("snkPrintSelector.title.printerSelection"), okButtonLabel: this.getMessage("snkPrintSelector.button.print"), okButtonStatus: this._selectedPrinter ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED, cancelButtonLabel: this.getMessage("snkPrintSelector.button.cancel"), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, this._isSingleJob &&
148
148
  h("div", { class: 'ez-flex ez-margin-bottom--large' }, h("div", { class: 'ez-flex ez-margin-right--large' }, h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this.getMessage("snkPrintSelector.subtitle.document")), h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].docTypeDescription)), h("div", { class: 'ez-flex ez-margin-right--large' }, h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this.getMessage("snkPrintSelector.subtitle.jobs")), h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].printJobCount))), h("ez-tabselector", { tabs: this.buildIdTabSelector(), onEzChange: (evt) => this.onChangeTab(evt), selectedTab: this._printServerActive ? this.REMOTE_PRINTERS_TAB : this.LOCAL_PRINTERS_TAB }), h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", { hidePolicy: 'hide' }, this._printServerActive &&
149
- h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, h("ez-list", { ref: (ref) => this._remotePrintersList = ref, class: `ez-padding-top--medium ${this._hasRemotePrinters ? '' : 'hidden'}`, dataSource: this._remotePrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, false), itemLeftSlotBuilder: this.buildPrinterIcon, useGroups: true, ezSelectable: true, hoverFeedback: true, "data-element-id": 'remotePrintersList' }), !this._hasRemotePrinters && this.renderNoPrinters())), h("stack-item", { hidePolicy: 'hide' }, h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, h("ez-list", { ref: (ref) => this._localPrintersList = ref, class: `ez-padding-top--medium ${this._hasLocalPrinters ? '' : 'hidden'}`, dataSource: this._localPrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, true), itemLeftSlotBuilder: this.buildPrinterIcon, ezSelectable: true, hoverFeedback: true }), !this._hasLocalPrinters && this.renderNoPrinters()))), h("ez-check", { label: this.getMessage("snkPrintSelector.message.savePrinter"), onEzChange: evt => this._saveSubstitute = evt.detail, compact: true })))));
149
+ h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, h("ez-list", { ref: (ref) => this._remotePrintersList = ref, class: `ez-padding-top--medium ${this._hasRemotePrinters ? '' : 'hidden'}`, dataSource: this._remotePrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, false), itemLeftSlotBuilder: this.buildPrinterIcon, useGroups: true, ezSelectable: true, hoverFeedback: true, "data-element-id": 'remotePrintersList' }), !this._hasRemotePrinters && this.renderNoPrinters())), h("stack-item", { hidePolicy: 'hide' }, h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, h("ez-list", { ref: (ref) => this._localPrintersList = ref, class: `ez-padding-top--medium ${this._hasLocalPrinters ? '' : 'hidden'}`, dataSource: this._localPrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, true), itemLeftSlotBuilder: this.buildPrinterIcon, ezSelectable: true, hoverFeedback: true }), !this._hasLocalPrinters && this.renderNoPrinters()))), h("ez-check", { label: this.getMessage("snkPrintSelector.message.savePrinter"), onEzChange: evt => this._saveSubstitute = evt.detail })))));
150
150
  }
151
151
  static get is() { return "snk-print-selector"; }
152
152
  static get encapsulation() { return "scoped"; }
@@ -26,7 +26,7 @@ export class SnkSimpleBar {
26
26
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
27
27
  }
28
28
  render() {
29
- return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
29
+ return (h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
30
30
  }
31
31
  static get is() { return "snk-simple-bar"; }
32
32
  static get encapsulation() { return "scoped"; }
@@ -10,7 +10,6 @@
10
10
  .simple-crud__container {
11
11
  display: grid;
12
12
  grid-template-rows: auto 1fr;
13
- row-gap: 12px;
14
13
  height: 100%;
15
14
  width: 100%;
16
15
  }
@@ -1,5 +1,5 @@
1
1
  import { ApplicationContext, DataType, ElementIDUtils, FloatingManager, JSUtils, ObjectUtils, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
- import { CSSVarsUtils } from "@sankhyalabs/ezui/dist/collection/utils";
2
+ import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { h } from '@stencil/core';
4
4
  import { SIMPLE_CRUD_MODE, VIEW_MODE } from '../../lib/utils/constants';
5
5
  import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
@@ -13,7 +13,8 @@ import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
13
13
  import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
14
14
  import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
15
15
  import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
16
- import store from "../../lib/store";
16
+ import store from '../../lib/store';
17
+ import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
17
18
  export class SnkSimpleCrud {
18
19
  constructor() {
19
20
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
@@ -26,7 +27,7 @@ export class SnkSimpleCrud {
26
27
  "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
27
28
  "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
28
29
  "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
29
- "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
30
+ "snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
30
31
  });
31
32
  this._showPopUpGridConfig = false;
32
33
  this._showFormConfig = false;
@@ -42,10 +43,12 @@ export class SnkSimpleCrud {
42
43
  this.formConfig = undefined;
43
44
  this._formFields = [];
44
45
  this._fieldsProps = new Map();
46
+ this._enableContinuousInsert = true;
45
47
  this.multipleSelection = undefined;
46
48
  this.useCancelConfirm = true;
47
49
  this.pageSize = 150;
48
50
  this.resourceID = undefined;
51
+ this.enableGridInsert = false;
49
52
  this.taskbarManager = undefined;
50
53
  this.messagesBuilder = undefined;
51
54
  this.useEnterLikeTab = false;
@@ -115,6 +118,13 @@ export class SnkSimpleCrud {
115
118
  newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
116
119
  this._fieldsProps = newCustomFieldProps;
117
120
  }
121
+ getFinishEditionButtonsCallback() {
122
+ const btns = ["CANCEL", "SAVE"];
123
+ if (this.enableGridInsert && this._currentViewMode !== VIEW_MODE.ATTACHMENT) {
124
+ btns.push(this._currentViewMode === VIEW_MODE.GRID ? TaskbarElement.FORM_MODE : TaskbarElement.GRID_MODE);
125
+ }
126
+ return btns;
127
+ }
118
128
  getButtons(selected, extraButtons) {
119
129
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
120
130
  .concat(extraButtons));
@@ -197,7 +207,6 @@ export class SnkSimpleCrud {
197
207
  await this.setFieldProp(field, 'precision', rmPrecision);
198
208
  await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
199
209
  }
200
- ;
201
210
  this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
202
211
  }
203
212
  async handleUpdateGridLegacyConfig(newValue, oldValue) {
@@ -279,7 +288,7 @@ export class SnkSimpleCrud {
279
288
  return;
280
289
  }
281
290
  if (this._formConfigManager == undefined) {
282
- this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
291
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
283
292
  this._formConfigManager.setConfig(this.formConfig);
284
293
  }
285
294
  if (this.formConfigIsLoaded() && !forceLoad) {
@@ -320,6 +329,10 @@ export class SnkSimpleCrud {
320
329
  this.onModeChange();
321
330
  this.configDatasource();
322
331
  this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
332
+ this._continuousInsertUtils = new ContinuousInsertUtils(this.application, this.resolveResourceID(), this.configName);
333
+ if (this.enableGridInsert) {
334
+ this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
335
+ }
323
336
  }
324
337
  componentDidLoad() {
325
338
  CSSVarsUtils.applyVarsGrid(this._element, this._grid);
@@ -554,6 +567,9 @@ export class SnkSimpleCrud {
554
567
  const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
555
568
  return Promise.resolve(options);
556
569
  }
570
+ isGridInsertActive() {
571
+ return this.enableGridInsert && this.dataUnit.hasNewRecord();
572
+ }
557
573
  getActionsList() {
558
574
  var _a, _b;
559
575
  const hardList = [{
@@ -565,11 +581,21 @@ export class SnkSimpleCrud {
565
581
  ? this.getColumnSearch(actionButton, item)
566
582
  : this.getFieldSearch(actionButton, item)
567
583
  }];
584
+ if (this.enableGridInsert) {
585
+ hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, () => {
586
+ this._enableContinuousInsert = !this._enableContinuousInsert;
587
+ this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
588
+ }));
589
+ }
590
+ if (this.isGridInsertActive())
591
+ return hardList;
568
592
  if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
569
593
  const taskbarID = this.getTopTaskBarId();
570
594
  return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
571
595
  }
572
- return hardList.concat(this.actionsList);
596
+ if (this.actionsList)
597
+ return hardList.concat(this.actionsList);
598
+ return hardList;
573
599
  }
574
600
  getTopTaskBarId() {
575
601
  var _a;
@@ -614,9 +640,11 @@ export class SnkSimpleCrud {
614
640
  window.removeEventListener("keydown", this._keyDownHandler);
615
641
  }
616
642
  gridConfigChangeHandler(evt) {
643
+ evt.stopPropagation();
644
+ if (!this.configName)
645
+ return;
617
646
  const config = evt.detail;
618
647
  ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
619
- evt.stopPropagation();
620
648
  }
621
649
  modalConfigChangeHandler(evt) {
622
650
  const config = evt.detail;
@@ -688,15 +716,21 @@ export class SnkSimpleCrud {
688
716
  }
689
717
  this._formConfigManager.setConfig(this.formConfig);
690
718
  }
719
+ handleDataUnitOnInsertionMode() {
720
+ if (this.enableGridInsert)
721
+ return;
722
+ this.goToView(VIEW_MODE.FORM);
723
+ }
691
724
  /* istanbul ignore next */
692
725
  render() {
693
726
  var _a;
694
727
  if (this.dataUnit == undefined) {
695
728
  return;
696
729
  }
697
- return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
730
+ const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
731
+ return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
698
732
  ? undefined
699
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
733
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
700
734
  }
701
735
  static get is() { return "snk-simple-crud"; }
702
736
  static get encapsulation() { return "scoped"; }
@@ -902,6 +936,24 @@ export class SnkSimpleCrud {
902
936
  "attribute": "resource-i-d",
903
937
  "reflect": false
904
938
  },
939
+ "enableGridInsert": {
940
+ "type": "boolean",
941
+ "mutable": false,
942
+ "complexType": {
943
+ "original": "boolean",
944
+ "resolved": "boolean",
945
+ "references": {}
946
+ },
947
+ "required": false,
948
+ "optional": true,
949
+ "docs": {
950
+ "tags": [],
951
+ "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
952
+ },
953
+ "attribute": "enable-grid-insert",
954
+ "reflect": false,
955
+ "defaultValue": "false"
956
+ },
905
957
  "taskbarManager": {
906
958
  "type": "unknown",
907
959
  "mutable": false,
@@ -1132,7 +1184,8 @@ export class SnkSimpleCrud {
1132
1184
  "_fieldToGetFocus": {},
1133
1185
  "_customContainerId": {},
1134
1186
  "_formFields": {},
1135
- "_fieldsProps": {}
1187
+ "_fieldsProps": {},
1188
+ "_enableContinuousInsert": {}
1136
1189
  };
1137
1190
  }
1138
1191
  static get events() {
@@ -29,12 +29,16 @@ export default class TaskbarProcessor {
29
29
  });
30
30
  }
31
31
  getButtonsArray(taskbarId, taskbarManager, dataState) {
32
- const defaults = this._defaultButtons[taskbarId];
32
+ const defaults = this.getButtonsFromKey(taskbarId);
33
33
  if (taskbarManager) {
34
34
  return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
35
35
  }
36
36
  return defaults;
37
37
  }
38
+ getButtonsFromKey(taskbarId) {
39
+ const btnsValue = this._defaultButtons[taskbarId];
40
+ return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
41
+ }
38
42
  isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
39
43
  const originalValue = disabled.includes(buttonName) ? false : true;
40
44
  if (taskbarManager && taskbarManager.isEnabled) {
@@ -29,8 +29,10 @@ export class SnkTaskbar {
29
29
  this.onSaveEvent = (action) => {
30
30
  switch (action.type) {
31
31
  case DUAction.FIELD_INVALIDATED:
32
+ case DUAction.INVALIDATE_CLEAN:
32
33
  case DUAction.DATA_SAVED:
33
34
  case DUAction.SAVING_ERROR:
35
+ case DUAction.SAVING_CANCELED:
34
36
  this._isWaitingForSave = false;
35
37
  break;
36
38
  case DUAction.SAVING_DATA:
@@ -67,6 +69,16 @@ export class SnkTaskbar {
67
69
  this.getCustomElements(true);
68
70
  }
69
71
  }
72
+ handleTaskbarSaveLocker() {
73
+ if (this._isWaitingForSave !== true) {
74
+ this._isWaitingForSave = true;
75
+ }
76
+ }
77
+ handleTaskbarSaveUnlocker() {
78
+ if (this._isWaitingForSave === true) {
79
+ this._isWaitingForSave = false;
80
+ }
81
+ }
70
82
  hasToSearchCustomElements(event) {
71
83
  return this.customSlotId === event.detail && !this._slotContainer;
72
84
  }
@@ -85,6 +97,14 @@ export class SnkTaskbar {
85
97
  this._hasToUpdateOverFlow = true;
86
98
  }
87
99
  }
100
+ observeIsWaitingForSave(newValue, oldValue) {
101
+ if (newValue == true && oldValue == false) {
102
+ this.taskbarSaveLocker.emit();
103
+ }
104
+ if (newValue == false && oldValue == true) {
105
+ this.taskbarSaveUnlocker.emit();
106
+ }
107
+ }
88
108
  // Internal methods
89
109
  elementsFromString(strButtons) {
90
110
  const elements = [];
@@ -719,6 +739,36 @@ export class SnkTaskbar {
719
739
  "resolved": "string",
720
740
  "references": {}
721
741
  }
742
+ }, {
743
+ "method": "taskbarSaveLocker",
744
+ "name": "taskbarSaveLocker",
745
+ "bubbles": true,
746
+ "cancelable": true,
747
+ "composed": true,
748
+ "docs": {
749
+ "tags": [],
750
+ "text": "Emitido sempre que um save \u00E9 iniciado pela taskbar."
751
+ },
752
+ "complexType": {
753
+ "original": "void",
754
+ "resolved": "void",
755
+ "references": {}
756
+ }
757
+ }, {
758
+ "method": "taskbarSaveUnlocker",
759
+ "name": "taskbarSaveUnlocker",
760
+ "bubbles": true,
761
+ "cancelable": true,
762
+ "composed": true,
763
+ "docs": {
764
+ "tags": [],
765
+ "text": "Emitido sempre que o ocorre alguma action que libera o save."
766
+ },
767
+ "complexType": {
768
+ "original": "void",
769
+ "resolved": "void",
770
+ "references": {}
771
+ }
722
772
  }];
723
773
  }
724
774
  static get elementRef() { return "_element"; }
@@ -732,6 +782,9 @@ export class SnkTaskbar {
732
782
  }, {
733
783
  "propName": "_lastWidth",
734
784
  "methodName": "observeLastWidth"
785
+ }, {
786
+ "propName": "_isWaitingForSave",
787
+ "methodName": "observeIsWaitingForSave"
735
788
  }];
736
789
  }
737
790
  static get listeners() {
@@ -741,6 +794,18 @@ export class SnkTaskbar {
741
794
  "target": "window",
742
795
  "capture": false,
743
796
  "passive": false
797
+ }, {
798
+ "name": "taskbarSaveLocker",
799
+ "method": "handleTaskbarSaveLocker",
800
+ "target": "window",
801
+ "capture": false,
802
+ "passive": false
803
+ }, {
804
+ "name": "taskbarSaveUnlocker",
805
+ "method": "handleTaskbarSaveUnlocker",
806
+ "target": "window",
807
+ "capture": false,
808
+ "passive": false
744
809
  }];
745
810
  }
746
811
  }