@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-57523.0 → 0.0.0-bugfix-dev-59880.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/cjs/{ConfigStorage-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
  2. package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
  3. package/dist/cjs/{IExporterProvider-c307e2b1.js → IExporterProvider-e286ef6a.js} +55 -12
  4. package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-7b222c78.js} +4 -4
  5. package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
  6. package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
  7. package/dist/cjs/{pesquisa-fetcher-cbdaba63.js → dataunit-fetcher-7a08e4dd.js} +74 -175
  8. package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
  13. package/dist/cjs/snk-application.cjs.entry.js +49 -39
  14. package/dist/cjs/snk-attach.cjs.entry.js +19 -17
  15. package/dist/cjs/snk-crud.cjs.entry.js +95 -10
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +11 -9
  17. package/dist/cjs/snk-data-unit-3718477f.js +670 -0
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
  20. package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -3
  21. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
  22. package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
  23. package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
  24. package/dist/cjs/snk-form.cjs.entry.js +53 -7
  25. package/dist/cjs/snk-grid.cjs.entry.js +103 -11
  26. package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-66dd6949.js} +36 -7
  27. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
  28. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
  29. package/dist/cjs/snk-simple-crud.cjs.entry.js +153 -14
  30. package/dist/collection/collection-manifest.json +1 -1
  31. package/dist/collection/components/snk-application/snk-application.js +37 -17
  32. package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
  33. package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
  34. package/dist/collection/components/snk-crud/snk-crud.js +230 -7
  35. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
  36. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
  37. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
  38. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
  39. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
  40. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +499 -176
  42. package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
  43. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
  44. package/dist/collection/components/snk-form/snk-form.js +101 -4
  45. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
  46. package/dist/collection/components/snk-grid/snk-grid.js +219 -8
  47. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +283 -9
  48. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
  49. package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
  50. package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
  51. package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
  52. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
  53. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
  54. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +51 -1
  55. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
  56. package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
  57. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
  58. package/dist/components/ConfigStorage.js +2 -1
  59. package/dist/components/DataFetcher.js +7024 -0
  60. package/dist/components/IExporterProvider.js +54 -12
  61. package/dist/components/SnkFormConfigManager.js +2 -2
  62. package/dist/components/SnkMessageBuilder.js +6 -12
  63. package/dist/components/dataunit-fetcher.js +64 -166
  64. package/dist/components/form-config-fetcher.js +3 -7023
  65. package/dist/components/pesquisa-fetcher.js +164 -0
  66. package/dist/components/snk-actions-button2.js +4 -2
  67. package/dist/components/snk-application2.js +26 -17
  68. package/dist/components/snk-attach2.js +4 -2
  69. package/dist/components/snk-crud.js +101 -10
  70. package/dist/components/snk-data-exporter2.js +6 -4
  71. package/dist/components/snk-data-unit2.js +424 -177
  72. package/dist/components/snk-detail-view2.js +87 -9
  73. package/dist/components/snk-filter-bar2.js +6 -1
  74. package/dist/components/snk-form-config2.js +1 -1
  75. package/dist/components/snk-form-view2.js +72 -1
  76. package/dist/components/snk-form.js +52 -5
  77. package/dist/components/snk-grid2.js +109 -12
  78. package/dist/components/snk-simple-crud2.js +157 -11
  79. package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
  80. package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
  81. package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-cf5a56ee.js} +54 -12
  82. package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-3bdb3e1f.js} +4 -4
  83. package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
  84. package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
  85. package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-f3fa35b9.js} +63 -165
  86. package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
  87. package/dist/esm/loader.js +1 -1
  88. package/dist/esm/pesquisa-fetcher-9cfab836.js +164 -0
  89. package/dist/esm/sankhyablocks.js +1 -1
  90. package/dist/esm/snk-actions-button_4.entry.js +5 -3
  91. package/dist/esm/snk-application.entry.js +30 -20
  92. package/dist/esm/snk-attach.entry.js +5 -3
  93. package/dist/esm/snk-crud.entry.js +95 -10
  94. package/dist/esm/snk-data-exporter.entry.js +8 -6
  95. package/dist/esm/snk-data-unit-8d6afa43.js +668 -0
  96. package/dist/esm/snk-data-unit.entry.js +10 -2
  97. package/dist/esm/snk-detail-view.entry.js +48 -7
  98. package/dist/esm/snk-filter-bar.entry.js +8 -3
  99. package/dist/esm/snk-filter-modal-item.entry.js +3 -2
  100. package/dist/esm/snk-form-config.entry.js +2 -1
  101. package/dist/esm/snk-form-view.entry.js +67 -0
  102. package/dist/esm/snk-form.entry.js +53 -7
  103. package/dist/esm/snk-grid.entry.js +104 -12
  104. package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-11cf8dc7.js} +36 -7
  105. package/dist/esm/snk-guides-viewer.entry.js +8 -6
  106. package/dist/esm/snk-personalized-filter.entry.js +3 -2
  107. package/dist/esm/snk-simple-crud.entry.js +153 -14
  108. package/dist/sankhyablocks/p-010d475f.js +1 -0
  109. package/dist/sankhyablocks/p-0a28cb19.entry.js +1 -0
  110. package/dist/sankhyablocks/p-188e1432.entry.js +1 -0
  111. package/dist/sankhyablocks/p-1c6debe6.entry.js +1 -0
  112. package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
  113. package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
  114. package/dist/sankhyablocks/p-2cc2d8fd.entry.js +1 -0
  115. package/dist/sankhyablocks/p-3e4c2cfe.entry.js +11 -0
  116. package/dist/sankhyablocks/p-4a8a149d.entry.js +1 -0
  117. package/dist/sankhyablocks/p-4ce73e88.js +1 -0
  118. package/dist/sankhyablocks/p-50e72d6c.js +1 -0
  119. package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
  120. package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
  121. package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
  122. package/dist/sankhyablocks/p-6b2be902.js +6 -0
  123. package/dist/sankhyablocks/p-8171e586.entry.js +1 -0
  124. package/dist/sankhyablocks/p-a6dfa396.js +1 -0
  125. package/dist/sankhyablocks/p-a97060b0.js +1 -0
  126. package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
  127. package/dist/sankhyablocks/p-b27114c4.js +1 -0
  128. package/dist/sankhyablocks/p-b643f746.entry.js +1 -0
  129. package/dist/sankhyablocks/p-b68918fc.entry.js +1 -0
  130. package/dist/sankhyablocks/p-da7c81d6.entry.js +1 -0
  131. package/dist/sankhyablocks/p-e0c27486.js +26 -0
  132. package/dist/sankhyablocks/p-e238279a.entry.js +1 -0
  133. package/dist/sankhyablocks/p-eae66367.js +1 -0
  134. package/dist/sankhyablocks/p-fde91811.js +60 -0
  135. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  136. package/dist/types/components/snk-application/snk-application.d.ts +6 -2
  137. package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
  138. package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
  139. package/dist/types/components/snk-crud/snk-crud.d.ts +32 -1
  140. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
  141. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
  142. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +19 -0
  143. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
  144. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +61 -2
  145. package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
  146. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  147. package/dist/types/components/snk-form/snk-form.d.ts +14 -0
  148. package/dist/types/components/snk-grid/snk-grid.d.ts +42 -3
  149. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +40 -2
  150. package/dist/types/components.d.ts +180 -4
  151. package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
  152. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  153. package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
  154. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
  155. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
  156. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
  157. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
  158. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
  159. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +2 -0
  160. package/package.json +1 -1
  161. package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
  162. package/dist/esm/snk-data-unit-29eba11a.js +0 -425
  163. package/dist/sankhyablocks/p-029bfc09.js +0 -1
  164. package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
  165. package/dist/sankhyablocks/p-07825198.js +0 -1
  166. package/dist/sankhyablocks/p-0e8702f0.js +0 -1
  167. package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
  168. package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
  169. package/dist/sankhyablocks/p-32556aa6.js +0 -1
  170. package/dist/sankhyablocks/p-3357af48.js +0 -1
  171. package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
  172. package/dist/sankhyablocks/p-3e7167dd.js +0 -1
  173. package/dist/sankhyablocks/p-536eeb16.js +0 -26
  174. package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
  175. package/dist/sankhyablocks/p-61984566.entry.js +0 -1
  176. package/dist/sankhyablocks/p-61b6126e.entry.js +0 -1
  177. package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
  178. package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
  179. package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
  180. package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
  181. package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
  182. package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
  183. package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
  184. package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
  185. package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
  186. package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
@@ -2,12 +2,14 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, forceUpdate,
2
2
  import { Action, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
4
4
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
- import './form-config-fetcher.js';
6
- import './dataunit-fetcher.js';
5
+ import './DataFetcher.js';
6
+ import './pesquisa-fetcher.js';
7
7
  import { P as PresentationMode } from './ISave.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
+ import './dataunit-fetcher.js';
10
11
  import './filter-item-type.enum.js';
12
+ import './form-config-fetcher.js';
11
13
  import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
12
14
  import { V as VIEW_MODE } from './constants.js';
13
15
  import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './IExporterProvider.js';
@@ -74,6 +76,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
74
76
  this._formEditorConfigManager = undefined;
75
77
  this._formEditorDataUnit = undefined;
76
78
  this._fieldToGetFocus = undefined;
79
+ this._customEditors = undefined;
80
+ this._customRenders = undefined;
81
+ this._fieldsProps = {};
77
82
  }
78
83
  observeDataUnit() {
79
84
  this.loadGuides(true);
@@ -104,6 +109,28 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
104
109
  async findField() {
105
110
  await openFieldSearch(this._moreOptions, this._fieldSearch);
106
111
  }
112
+ /**
113
+ * Registra um editor customizado para campos da grade e formulário
114
+ */
115
+ async addCustomEditor(fieldName, customEditor) {
116
+ this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
117
+ }
118
+ /**
119
+ * Registra um render customizado para colunas da grid.
120
+ */
121
+ async addGridCustomRender(fieldName, customRender) {
122
+ this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
123
+ }
124
+ ;
125
+ /**
126
+ * Altera/adiciona uma propriedade nos metadados do campo.
127
+ */
128
+ async setFieldProp(fieldName, propName, value) {
129
+ const newFieldsProps = {
130
+ [fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
131
+ };
132
+ this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
133
+ }
107
134
  exitViewer() {
108
135
  if (this.dataUnit.isDirty()) {
109
136
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -246,7 +273,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
246
273
  if (sheet == undefined) {
247
274
  return;
248
275
  }
249
- return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
276
+ return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps });
250
277
  })));
251
278
  }
252
279
  wrapDetail(levels, content) {
@@ -288,14 +315,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
288
315
  else {
289
316
  detailBranch = this.selectedGuide;
290
317
  }
291
- content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId }));
318
+ content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders }));
292
319
  }
293
320
  else {
294
321
  const cardId = this.selectedGuide.id;
295
322
  const sheet = this._masterFormMetadata.getSheet(cardId);
296
323
  if (sheet) {
297
324
  const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
298
- content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
325
+ content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
299
326
  }
300
327
  }
301
328
  return content;
@@ -501,7 +528,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
501
528
  dataUnit: this.dataUnit,
502
529
  recordsValidator: this.recordsValidator,
503
530
  fieldToFocus: this._fieldToGetFocus,
504
- onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
531
+ onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
532
+ propsCustomEditor: this._customEditors,
533
+ fieldsProps: this._fieldsProps
505
534
  }), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
506
535
  }
507
536
  static get watchers() { return {
@@ -532,8 +561,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
532
561
  "_formEditorConfigManager": [32],
533
562
  "_formEditorDataUnit": [32],
534
563
  "_fieldToGetFocus": [32],
564
+ "_customEditors": [32],
565
+ "_customRenders": [32],
566
+ "_fieldsProps": [32],
535
567
  "showFormConfig": [64],
536
- "findField": [64]
568
+ "findField": [64],
569
+ "addCustomEditor": [64],
570
+ "addGridCustomRender": [64],
571
+ "setFieldProp": [64]
537
572
  }, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
538
573
  function defineCustomElement$1() {
539
574
  if (typeof customElements === "undefined") {
@@ -767,6 +802,8 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
767
802
  this.branchGuide = undefined;
768
803
  this.canEdit = true;
769
804
  this.taskbarCustomContainerId = undefined;
805
+ this.customEditors = undefined;
806
+ this.customRenders = undefined;
770
807
  }
771
808
  observeDataUnit(newDataUnit, oldDataUnit) {
772
809
  newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
@@ -834,10 +871,38 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
834
871
  this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
835
872
  }
836
873
  }
874
+ /**
875
+ * Registra um editor customizado para campos da grade e formulário.
876
+ */
877
+ async addCustomEditor(fieldName, customEditor) {
878
+ var _a;
879
+ const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
880
+ this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
881
+ this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
882
+ }
883
+ async observerPropsCustomEditor(newValue) {
884
+ for (const fieldName in newValue) {
885
+ await this.addCustomEditor(fieldName, newValue[fieldName]);
886
+ }
887
+ }
888
+ /**
889
+ * Registra um render customizado para colunas da grid.
890
+ */
891
+ async addGridCustomRender(fieldName, customRender) {
892
+ var _a;
893
+ const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
894
+ await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
895
+ }
837
896
  onContentCardChanged(evt) {
838
897
  SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => forceUpdate(this));
839
898
  evt.stopPropagation();
840
899
  }
900
+ async observeCustomRenders(newValue) {
901
+ for (const field in newValue) {
902
+ const customRender = newValue[field];
903
+ await this.addGridCustomRender(field, customRender);
904
+ }
905
+ }
841
906
  updateLabel() {
842
907
  const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
843
908
  if (guideItemPathSize > 0) {
@@ -940,6 +1005,10 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
940
1005
  this.messagesBuilder = new SnkMessageBuilder(this.entityName);
941
1006
  }
942
1007
  }
1008
+ async componentDidLoad() {
1009
+ await this.observerPropsCustomEditor(this.customEditors);
1010
+ await this.observeCustomRenders(this.customRenders);
1011
+ }
943
1012
  async dataUnitActionHandler(action) {
944
1013
  if (action.type === Action.FIELD_INVALIDATED) {
945
1014
  this.addErrorBadgeToBranchGuide();
@@ -949,6 +1018,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
949
1018
  this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
950
1019
  this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
951
1020
  }
1021
+ normalizeBranchGuideId(id) {
1022
+ return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
1023
+ }
952
1024
  render() {
953
1025
  this.updateLabel();
954
1026
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
@@ -956,7 +1028,9 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
956
1028
  }
957
1029
  static get watchers() { return {
958
1030
  "dataUnit": ["observeDataUnit"],
959
- "dataState": ["observerDataState"]
1031
+ "dataState": ["observerDataState"],
1032
+ "customEditors": ["observerPropsCustomEditor"],
1033
+ "customRenders": ["observeCustomRenders"]
960
1034
  }; }
961
1035
  static get style() { return snkDetailViewCss; }
962
1036
  }, [6, "snk-detail-view", {
@@ -973,12 +1047,16 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
973
1047
  "branchGuide": [1040],
974
1048
  "canEdit": [4, "can-edit"],
975
1049
  "taskbarCustomContainerId": [1, "taskbar-custom-container-id"],
1050
+ "customEditors": [16],
1051
+ "customRenders": [16],
976
1052
  "_disabledButtons": [32],
977
1053
  "_currentView": [32],
978
1054
  "attachmentRegisterKey": [32],
979
1055
  "changeViewMode": [64],
980
1056
  "configGrid": [64],
981
- "showUp": [64]
1057
+ "showUp": [64],
1058
+ "addCustomEditor": [64],
1059
+ "addGridCustomRender": [64]
982
1060
  }, [[0, "snkContentCardChanged", "onContentCardChanged"]]]);
983
1061
  SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
984
1062
  function defineCustomElement() {
@@ -288,6 +288,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
288
288
  this.messagesBuilder = undefined;
289
289
  this.disablePersonalizedFilter = undefined;
290
290
  this.filterBarLegacyConfigName = undefined;
291
+ this.autoLoad = undefined;
291
292
  this.allowDefault = undefined;
292
293
  this.scrollerLocked = false;
293
294
  this.showPersonalizedFilter = false;
@@ -434,7 +435,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
434
435
  }
435
436
  async doLoadData(forceReload = false) {
436
437
  try {
437
- if (this._firstLoad && !forceReload) {
438
+ if (this._firstLoad && this.autoLoad === false) {
439
+ return;
440
+ }
441
+ if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
438
442
  let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
439
443
  if (!autoLoad) {
440
444
  return;
@@ -717,6 +721,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
717
721
  "messagesBuilder": [1040],
718
722
  "disablePersonalizedFilter": [4, "disable-personalized-filter"],
719
723
  "filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
724
+ "autoLoad": [4, "auto-load"],
720
725
  "allowDefault": [32],
721
726
  "scrollerLocked": [32],
722
727
  "showPersonalizedFilter": [32],
@@ -3,7 +3,7 @@ import { a as Sortable, d as defineCustomElement$1 } from './snk-tab-config2.js'
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, b as CONFIG_SORTABLE_EVENTS, c as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
6
- import { a as UserConfigType } from './form-config-fetcher.js';
6
+ import { U as UserConfigType } from './form-config-fetcher.js';
7
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
8
8
  import { d as defineCustomElement$3 } from './snk-config-options2.js';
9
9
  import { d as defineCustomElement$2 } from './snk-field-config2.js';
@@ -12,6 +12,8 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
12
12
  this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
13
13
  this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
14
14
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
15
+ this._customEditors = new Map();
16
+ this._fieldProps = new Map();
15
17
  this.levelPath = undefined;
16
18
  this.label = undefined;
17
19
  this.name = undefined;
@@ -25,12 +27,47 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
25
27
  this.canFix = true;
26
28
  this.recordsValidator = undefined;
27
29
  this.fieldToFocus = undefined;
30
+ this.customEditors = undefined;
31
+ this.fieldsProps = undefined;
28
32
  }
29
33
  async showUp() {
30
34
  if (this._formView) {
31
35
  this._formView.showUp();
32
36
  }
33
37
  }
38
+ /**
39
+ * Registra um editor customizado para campos da grade e formulário
40
+ */
41
+ async addCustomEditor(fieldName, customEditor, detailContext) {
42
+ if (this._formView) {
43
+ this._formView.addCustomEditor(fieldName, customEditor, detailContext);
44
+ return;
45
+ }
46
+ const newCustomEditors = new Map(this._customEditors);
47
+ newCustomEditors.set(fieldName, { customEditor, detailContext });
48
+ this._customEditors = newCustomEditors;
49
+ }
50
+ observePropsCustomEditor(newValue) {
51
+ for (const fieldName in newValue) {
52
+ this.addCustomEditor(fieldName, newValue[fieldName]);
53
+ }
54
+ }
55
+ /**
56
+ * Altera/adiciona uma propriedade nos metadados do campo.
57
+ */
58
+ async setFieldProp(fieldName, propName, value) {
59
+ const props = this._fieldProps.get(fieldName) || [];
60
+ this._fieldProps.set(fieldName, [...props, { propName, value }]);
61
+ }
62
+ async observeFieldsProps(newValue) {
63
+ for (const field in newValue) {
64
+ const fieldProps = newValue[field];
65
+ const propNames = Object.keys(fieldProps);
66
+ for (const propName of propNames) {
67
+ await this.setFieldProp(field, propName, fieldProps[propName]);
68
+ }
69
+ }
70
+ }
34
71
  changeFix() {
35
72
  this.fixed = !this.fixed;
36
73
  this.emitEvent("fixed");
@@ -89,7 +126,13 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
89
126
  this._dataBinder.onDisconnectedCallback();
90
127
  }
91
128
  }
129
+ componentDidLoad() {
130
+ this.observePropsCustomEditor(this.customEditors);
131
+ this.observeFieldsProps(this.fieldsProps);
132
+ }
92
133
  componentDidRender() {
134
+ this.setCustomEditors();
135
+ this.setFieldProps();
93
136
  if (this.fieldToFocus == undefined) {
94
137
  return;
95
138
  }
@@ -101,6 +144,26 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
144
  this.snkRequestClearFieldToFocus.emit();
102
145
  });
103
146
  }
147
+ setCustomEditors() {
148
+ if (!this._formView) {
149
+ return;
150
+ }
151
+ for (const [fieldName, customEditorProps] of this._customEditors) {
152
+ this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
153
+ this._customEditors.delete(fieldName);
154
+ }
155
+ }
156
+ setFieldProps() {
157
+ if (!this._formView) {
158
+ return;
159
+ }
160
+ for (const [fieldName, propsToChange] of this._fieldProps) {
161
+ propsToChange.forEach(prop => {
162
+ this._formView.setFieldProp(fieldName, prop.propName, prop.value);
163
+ this._fieldProps.delete(fieldName);
164
+ });
165
+ }
166
+ }
104
167
  render() {
105
168
  return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
106
169
  h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
@@ -110,6 +173,10 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
110
173
  :
111
174
  h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
112
175
  }
176
+ static get watchers() { return {
177
+ "customEditors": ["observePropsCustomEditor"],
178
+ "fieldsProps": ["observeFieldsProps"]
179
+ }; }
113
180
  static get style() { return snkFormViewCss; }
114
181
  }, [6, "snk-form-view", {
115
182
  "levelPath": [1, "level-path"],
@@ -125,7 +192,11 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
125
192
  "canFix": [4, "can-fix"],
126
193
  "recordsValidator": [16],
127
194
  "fieldToFocus": [1, "field-to-focus"],
128
- "showUp": [64]
195
+ "customEditors": [16],
196
+ "fieldsProps": [16],
197
+ "showUp": [64],
198
+ "addCustomEditor": [64],
199
+ "setFieldProp": [64]
129
200
  }]);
130
201
  function defineCustomElement() {
131
202
  if (typeof customElements === "undefined") {
@@ -16,6 +16,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
16
  this.exit = createEvent(this, "exit", 7);
17
17
  this.actionClick = createEvent(this, "actionClick", 7);
18
18
  this.formItemsReady = createEvent(this, "formItemsReady", 7);
19
+ this._customEditors = new Map();
19
20
  this._dataUnit = undefined;
20
21
  this._dataState = undefined;
21
22
  this._showFormConfig = false;
@@ -38,6 +39,24 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
38
39
  async hideConfig() {
39
40
  this._showFormConfig = false;
40
41
  }
42
+ /**
43
+ * Registra um editor customizado para campos da grade e formulário.
44
+ */
45
+ async addCustomEditor(fieldName, customEditor) {
46
+ if (this._form) {
47
+ this._form.addCustomEditor(fieldName, customEditor);
48
+ return;
49
+ }
50
+ const newCustomEditors = new Map(this._customEditors);
51
+ newCustomEditors.set(fieldName, customEditor);
52
+ this._customEditors = newCustomEditors;
53
+ }
54
+ /**
55
+ * Altera/adiciona uma propriedade nos metadados do campo.
56
+ */
57
+ async setFieldProp(fieldName, propName, value) {
58
+ await this._form.setFieldProp(fieldName, propName, value);
59
+ }
41
60
  closeConfig() {
42
61
  this.hideConfig();
43
62
  }
@@ -45,6 +64,18 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
45
64
  const dataInfo = { dataUnit: this._dataUnit };
46
65
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
47
66
  }
67
+ setCustomEditors() {
68
+ if (!this._form) {
69
+ return;
70
+ }
71
+ for (const [fieldName, customEditor] of this._customEditors) {
72
+ this._form.addCustomEditor(fieldName, customEditor);
73
+ this._customEditors.delete(fieldName);
74
+ }
75
+ }
76
+ async componentDidRender() {
77
+ this.setCustomEditors();
78
+ }
48
79
  async componentWillLoad() {
49
80
  let parent = this._element.parentElement;
50
81
  while (parent) {
@@ -60,9 +91,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
60
91
  this._dataUnit = evt.detail;
61
92
  });
62
93
  }
63
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
64
- this._dataState = evt.detail;
65
- });
94
+ this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
66
95
  break;
67
96
  }
68
97
  parent = parent.parentElement;
@@ -74,6 +103,22 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
74
103
  this.addFormLegacyConfig();
75
104
  this._configManager.loadConfig();
76
105
  }
106
+ async handleDataStateChange(evt) {
107
+ var _a;
108
+ this._dataState = evt.detail;
109
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
110
+ for (const field of fieldsWithRmPrecision || []) {
111
+ if (!field) {
112
+ continue;
113
+ }
114
+ const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
115
+ if (!rmPrecision && rmPrecision !== 0) {
116
+ continue;
117
+ }
118
+ await this.setFieldProp(field, 'precision', rmPrecision);
119
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
120
+ }
121
+ }
77
122
  addFormLegacyConfig() {
78
123
  if (this.formLegacyConfigName) {
79
124
  this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
@@ -83,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
128
  if (!this._dataUnit || !this._dataState) {
84
129
  return undefined;
85
130
  }
86
- return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
131
+ return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
87
132
  h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
88
133
  }
89
134
  get _element() { return this; }
@@ -99,7 +144,9 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
99
144
  "_showFormConfig": [32],
100
145
  "_configManager": [32],
101
146
  "showConfig": [64],
102
- "hideConfig": [64]
147
+ "hideConfig": [64],
148
+ "addCustomEditor": [64],
149
+ "setFieldProp": [64]
103
150
  }]);
104
151
  function defineCustomElement$1() {
105
152
  if (typeof customElements === "undefined") {