@sankhyalabs/sankhyablocks 8.15.0-dev.61 → 8.15.0-dev.63

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 (169) 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-98a012a4.js} +55 -12
  4. package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-dda10d75.js} +2 -2
  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-e2109392.js} +68 -173
  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 +43 -9
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -7
  17. package/dist/cjs/snk-data-unit-dee38ccd.js +614 -0
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
  20. package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -2
  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 +36 -0
  24. package/dist/cjs/snk-form.cjs.entry.js +28 -7
  25. package/dist/cjs/snk-grid.cjs.entry.js +55 -10
  26. package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-af4a6ae5.js} +19 -6
  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 +96 -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/snk-crud.js +109 -6
  33. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +79 -0
  34. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +41 -4
  35. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
  36. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
  37. package/dist/collection/components/snk-data-unit/snk-data-unit.js +413 -165
  38. package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
  39. package/dist/collection/components/snk-form/snk-form.js +50 -4
  40. package/dist/collection/components/snk-grid/snk-grid.js +96 -7
  41. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +156 -8
  42. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
  43. package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
  44. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
  45. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
  46. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +51 -1
  47. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
  48. package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
  49. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
  50. package/dist/components/ConfigStorage.js +2 -1
  51. package/dist/components/DataFetcher.js +7024 -0
  52. package/dist/components/IExporterProvider.js +54 -12
  53. package/dist/components/SnkMessageBuilder.js +6 -12
  54. package/dist/components/dataunit-fetcher.js +58 -164
  55. package/dist/components/form-config-fetcher.js +3 -7023
  56. package/dist/components/pesquisa-fetcher.js +164 -0
  57. package/dist/components/snk-actions-button2.js +4 -2
  58. package/dist/components/snk-application2.js +26 -17
  59. package/dist/components/snk-attach2.js +4 -2
  60. package/dist/components/snk-crud.js +46 -9
  61. package/dist/components/snk-data-exporter2.js +4 -2
  62. package/dist/components/snk-data-unit2.js +356 -166
  63. package/dist/components/snk-detail-view2.js +21 -6
  64. package/dist/components/snk-form-config2.js +1 -1
  65. package/dist/components/snk-form-view2.js +39 -1
  66. package/dist/components/snk-form.js +26 -5
  67. package/dist/components/snk-grid2.js +58 -11
  68. package/dist/components/snk-simple-crud2.js +96 -10
  69. package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
  70. package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
  71. package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-8f085554.js} +54 -12
  72. package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-87bd8082.js} +2 -2
  73. package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
  74. package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
  75. package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-87ecba4a.js} +57 -163
  76. package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
  77. package/dist/esm/loader.js +1 -1
  78. package/dist/esm/pesquisa-fetcher-9cfab836.js +164 -0
  79. package/dist/esm/sankhyablocks.js +1 -1
  80. package/dist/esm/snk-actions-button_4.entry.js +5 -3
  81. package/dist/esm/snk-application.entry.js +30 -20
  82. package/dist/esm/snk-attach.entry.js +5 -3
  83. package/dist/esm/snk-crud.entry.js +43 -9
  84. package/dist/esm/snk-data-exporter.entry.js +6 -4
  85. package/dist/esm/snk-data-unit-1132e40b.js +612 -0
  86. package/dist/esm/snk-data-unit.entry.js +10 -2
  87. package/dist/esm/snk-detail-view.entry.js +8 -6
  88. package/dist/esm/snk-filter-bar.entry.js +3 -2
  89. package/dist/esm/snk-filter-modal-item.entry.js +3 -2
  90. package/dist/esm/snk-form-config.entry.js +2 -1
  91. package/dist/esm/snk-form-view.entry.js +36 -0
  92. package/dist/esm/snk-form.entry.js +28 -7
  93. package/dist/esm/snk-grid.entry.js +56 -11
  94. package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-359e39a7.js} +19 -6
  95. package/dist/esm/snk-guides-viewer.entry.js +8 -6
  96. package/dist/esm/snk-personalized-filter.entry.js +3 -2
  97. package/dist/esm/snk-simple-crud.entry.js +95 -13
  98. package/dist/sankhyablocks/p-00a7ede4.entry.js +1 -0
  99. package/dist/sankhyablocks/p-010d475f.js +1 -0
  100. package/dist/sankhyablocks/p-08fee6e8.js +60 -0
  101. package/dist/sankhyablocks/p-0bcc6e83.js +1 -0
  102. package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-0e8702f0.js → p-2eb90860.js} +1 -1
  104. package/dist/sankhyablocks/p-33f695d6.entry.js +1 -0
  105. package/dist/sankhyablocks/p-4ce73e88.js +1 -0
  106. package/dist/sankhyablocks/p-4ef47eb8.entry.js +1 -0
  107. package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
  108. package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
  109. package/dist/sankhyablocks/p-66a31d30.entry.js +11 -0
  110. package/dist/sankhyablocks/p-6b2be902.js +6 -0
  111. package/dist/sankhyablocks/p-7ecaaea2.entry.js +1 -0
  112. package/dist/sankhyablocks/p-80031650.js +1 -0
  113. package/dist/sankhyablocks/p-83950924.entry.js +1 -0
  114. package/dist/sankhyablocks/p-873d2e6a.entry.js +1 -0
  115. package/dist/sankhyablocks/p-931343a1.entry.js +1 -0
  116. package/dist/sankhyablocks/p-a6dfa396.js +1 -0
  117. package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
  118. package/dist/sankhyablocks/p-b11921ca.entry.js +1 -0
  119. package/dist/sankhyablocks/p-cb91634d.js +1 -0
  120. package/dist/sankhyablocks/p-cf9d2d1e.entry.js +1 -0
  121. package/dist/sankhyablocks/p-d799aa7f.entry.js +1 -0
  122. package/dist/sankhyablocks/p-da6e3dcf.entry.js +1 -0
  123. package/dist/sankhyablocks/p-e0c27486.js +26 -0
  124. package/dist/sankhyablocks/p-f72e8835.entry.js +1 -0
  125. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  126. package/dist/types/components/snk-application/snk-application.d.ts +6 -2
  127. package/dist/types/components/snk-crud/snk-crud.d.ts +14 -1
  128. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +13 -1
  129. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -0
  130. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
  131. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +45 -1
  132. package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
  133. package/dist/types/components/snk-form/snk-form.d.ts +6 -0
  134. package/dist/types/components/snk-grid/snk-grid.d.ts +19 -3
  135. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +22 -0
  136. package/dist/types/components.d.ts +68 -4
  137. package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
  138. package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
  139. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
  140. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
  141. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
  142. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
  143. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +2 -0
  144. package/package.json +1 -1
  145. package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
  146. package/dist/esm/snk-data-unit-29eba11a.js +0 -425
  147. package/dist/sankhyablocks/p-029bfc09.js +0 -1
  148. package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
  149. package/dist/sankhyablocks/p-07825198.js +0 -1
  150. package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
  151. package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
  152. package/dist/sankhyablocks/p-32556aa6.js +0 -1
  153. package/dist/sankhyablocks/p-3357af48.js +0 -1
  154. package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
  155. package/dist/sankhyablocks/p-3e7167dd.js +0 -1
  156. package/dist/sankhyablocks/p-536eeb16.js +0 -26
  157. package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
  158. package/dist/sankhyablocks/p-61984566.entry.js +0 -1
  159. package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
  160. package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
  161. package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
  162. package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
  163. package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
  164. package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
  165. package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
  166. package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
  167. package/dist/sankhyablocks/p-df73ac00.entry.js +0 -1
  168. package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
  169. 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,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
74
76
  this._formEditorConfigManager = undefined;
75
77
  this._formEditorDataUnit = undefined;
76
78
  this._fieldToGetFocus = undefined;
79
+ this._fieldsProps = {};
77
80
  }
78
81
  observeDataUnit() {
79
82
  this.loadGuides(true);
@@ -104,6 +107,15 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
104
107
  async findField() {
105
108
  await openFieldSearch(this._moreOptions, this._fieldSearch);
106
109
  }
110
+ /**
111
+ * Altera/adiciona uma propriedade nos metadados do campo.
112
+ */
113
+ async setFieldProp(fieldName, propName, value) {
114
+ const newFieldsProps = {
115
+ [fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
116
+ };
117
+ this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
118
+ }
107
119
  exitViewer() {
108
120
  if (this.dataUnit.isDirty()) {
109
121
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -246,7 +258,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
246
258
  if (sheet == undefined) {
247
259
  return;
248
260
  }
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); } });
261
+ 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); }, fieldsProps: params.fieldsProps });
250
262
  })));
251
263
  }
252
264
  wrapDetail(levels, content) {
@@ -295,7 +307,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
295
307
  const sheet = this._masterFormMetadata.getSheet(cardId);
296
308
  if (sheet) {
297
309
  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());
310
+ 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(), fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
299
311
  }
300
312
  }
301
313
  return content;
@@ -501,7 +513,8 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
501
513
  dataUnit: this.dataUnit,
502
514
  recordsValidator: this.recordsValidator,
503
515
  fieldToFocus: this._fieldToGetFocus,
504
- onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
516
+ onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
517
+ fieldsProps: this._fieldsProps
505
518
  }), 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
519
  }
507
520
  static get watchers() { return {
@@ -532,8 +545,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
532
545
  "_formEditorConfigManager": [32],
533
546
  "_formEditorDataUnit": [32],
534
547
  "_fieldToGetFocus": [32],
548
+ "_fieldsProps": [32],
535
549
  "showFormConfig": [64],
536
- "findField": [64]
550
+ "findField": [64],
551
+ "setFieldProp": [64]
537
552
  }, [[2, "actionClick", "onActionClick"], [0, "snkContentCardChanged", "onContentCardChanged"]]]);
538
553
  function defineCustomElement$1() {
539
554
  if (typeof customElements === "undefined") {
@@ -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,7 @@ 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._fieldProps = new Map();
15
16
  this.levelPath = undefined;
16
17
  this.label = undefined;
17
18
  this.name = undefined;
@@ -25,12 +26,29 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
25
26
  this.canFix = true;
26
27
  this.recordsValidator = undefined;
27
28
  this.fieldToFocus = undefined;
29
+ this.fieldsProps = undefined;
28
30
  }
29
31
  async showUp() {
30
32
  if (this._formView) {
31
33
  this._formView.showUp();
32
34
  }
33
35
  }
36
+ /**
37
+ * Altera/adiciona uma propriedade nos metadados do campo.
38
+ */
39
+ async setFieldProp(fieldName, propName, value) {
40
+ const props = this._fieldProps.get(fieldName) || [];
41
+ this._fieldProps.set(fieldName, [...props, { propName, value }]);
42
+ }
43
+ async observeFieldsProps(newValue) {
44
+ for (const field in newValue) {
45
+ const fieldProps = newValue[field];
46
+ const propNames = Object.keys(fieldProps);
47
+ for (const propName of propNames) {
48
+ await this.setFieldProp(field, propName, fieldProps[propName]);
49
+ }
50
+ }
51
+ }
34
52
  changeFix() {
35
53
  this.fixed = !this.fixed;
36
54
  this.emitEvent("fixed");
@@ -89,7 +107,11 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
89
107
  this._dataBinder.onDisconnectedCallback();
90
108
  }
91
109
  }
110
+ componentDidLoad() {
111
+ this.observeFieldsProps(this.fieldsProps);
112
+ }
92
113
  componentDidRender() {
114
+ this.setFieldProps();
93
115
  if (this.fieldToFocus == undefined) {
94
116
  return;
95
117
  }
@@ -101,6 +123,17 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
123
  this.snkRequestClearFieldToFocus.emit();
102
124
  });
103
125
  }
126
+ setFieldProps() {
127
+ if (!this._formView) {
128
+ return;
129
+ }
130
+ for (const [fieldName, propsToChange] of this._fieldProps) {
131
+ propsToChange.forEach(prop => {
132
+ this._formView.setFieldProp(fieldName, prop.propName, prop.value);
133
+ this._fieldProps.delete(fieldName);
134
+ });
135
+ }
136
+ }
104
137
  render() {
105
138
  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
139
  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 +143,9 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
110
143
  :
111
144
  h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
112
145
  }
146
+ static get watchers() { return {
147
+ "fieldsProps": ["observeFieldsProps"]
148
+ }; }
113
149
  static get style() { return snkFormViewCss; }
114
150
  }, [6, "snk-form-view", {
115
151
  "levelPath": [1, "level-path"],
@@ -125,7 +161,9 @@ const SnkFormView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
125
161
  "canFix": [4, "can-fix"],
126
162
  "recordsValidator": [16],
127
163
  "fieldToFocus": [1, "field-to-focus"],
128
- "showUp": [64]
164
+ "fieldsProps": [16],
165
+ "showUp": [64],
166
+ "setFieldProp": [64]
129
167
  }]);
130
168
  function defineCustomElement() {
131
169
  if (typeof customElements === "undefined") {
@@ -38,6 +38,12 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
38
38
  async hideConfig() {
39
39
  this._showFormConfig = false;
40
40
  }
41
+ /**
42
+ * Altera/adiciona uma propriedade nos metadados do campo.
43
+ */
44
+ async setFieldProp(fieldName, propName, value) {
45
+ await this._form.setFieldProp(fieldName, propName, value);
46
+ }
41
47
  closeConfig() {
42
48
  this.hideConfig();
43
49
  }
@@ -60,9 +66,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
60
66
  this._dataUnit = evt.detail;
61
67
  });
62
68
  }
63
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
64
- this._dataState = evt.detail;
65
- });
69
+ this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
66
70
  break;
67
71
  }
68
72
  parent = parent.parentElement;
@@ -74,6 +78,22 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
74
78
  this.addFormLegacyConfig();
75
79
  this._configManager.loadConfig();
76
80
  }
81
+ async handleDataStateChange(evt) {
82
+ var _a;
83
+ this._dataState = evt.detail;
84
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
85
+ for (const field of fieldsWithRmPrecision || []) {
86
+ if (!field) {
87
+ continue;
88
+ }
89
+ const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
90
+ if (!rmPrecision) {
91
+ continue;
92
+ }
93
+ await this.setFieldProp(field, 'precision', rmPrecision);
94
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
95
+ }
96
+ }
77
97
  addFormLegacyConfig() {
78
98
  if (this.formLegacyConfigName) {
79
99
  this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
@@ -83,7 +103,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
103
  if (!this._dataUnit || !this._dataState) {
84
104
  return undefined;
85
105
  }
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 &&
106
+ 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
107
  h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
88
108
  }
89
109
  get _element() { return this; }
@@ -99,7 +119,8 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
99
119
  "_showFormConfig": [32],
100
120
  "_configManager": [32],
101
121
  "showConfig": [64],
102
- "hideConfig": [64]
122
+ "hideConfig": [64],
123
+ "setFieldProp": [64]
103
124
  }]);
104
125
  function defineCustomElement$1() {
105
126
  if (typeof customElements === "undefined") {
@@ -1,16 +1,18 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
2
- import { ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
2
+ import { Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
3
3
  import { d as defineCustomElement$2, T as TaskbarElement } from './snk-taskbar2.js';
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
5
  import { P as PresentationMode } from './ISave.js';
6
- import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch, a as CrudUtils, b as buildFieldSearch } from './IExporterProvider.js';
6
+ import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionListDataSource, o as openFieldSearch, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as buildFieldSearch } from './IExporterProvider.js';
7
7
  import { s as store } from './index2.js';
8
8
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
9
- import './form-config-fetcher.js';
10
- import './dataunit-fetcher.js';
9
+ import './DataFetcher.js';
10
+ import './pesquisa-fetcher.js';
11
11
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
+ import './dataunit-fetcher.js';
13
14
  import './filter-item-type.enum.js';
15
+ import './form-config-fetcher.js';
14
16
  import { g as getSelectedIDs } from './snk-data-unit2.js';
15
17
  import { d as defineCustomElement$i } from './snk-actions-button2.js';
16
18
  import { d as defineCustomElement$h } from './snk-data-exporter2.js';
@@ -111,6 +113,14 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
111
113
  "snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
112
114
  "snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
113
115
  });
116
+ this.dataUnitInterceptor = {
117
+ interceptAction: async (action) => {
118
+ if (action.type === Action.METADATA_LOADED) {
119
+ return await this.interceptMetadataLoaded(action);
120
+ }
121
+ return action;
122
+ }
123
+ };
114
124
  this._dataUnit = undefined;
115
125
  this._dataState = undefined;
116
126
  this._gridConfig = undefined;
@@ -181,6 +191,18 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
181
191
  async findColumn() {
182
192
  await openFieldSearch(this._moreOptions, this._columnSearch);
183
193
  }
194
+ /**
195
+ * Registra um formatador de valores para uma coluna da grid.
196
+ */
197
+ async addCustomValueFormatter(columnName, customFormatter) {
198
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
199
+ }
200
+ /**
201
+ * Remove o formatador de valores de uma coluna da grid.
202
+ */
203
+ async removeCustomValueFormatter(columnName) {
204
+ this._grid.removeCustomValueFormatter(columnName);
205
+ }
184
206
  async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
185
207
  if (!newLegacyConfig) {
186
208
  return;
@@ -243,7 +265,23 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
243
265
  const dataInfo = { dataUnit: this._dataUnit };
244
266
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
245
267
  }
246
- finshLoading() {
268
+ loadGridCustomFormatters(fields) {
269
+ if (!fields || !this._grid) {
270
+ return;
271
+ }
272
+ fields.forEach((field) => {
273
+ var _a;
274
+ if ((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) {
275
+ this.addCustomValueFormatter(field.name, this._rmPrecisionCustomValueFormatter);
276
+ }
277
+ });
278
+ }
279
+ async interceptMetadataLoaded(action) {
280
+ this.loadGridCustomFormatters(action.payload.fields);
281
+ return action;
282
+ }
283
+ finishLoading() {
284
+ this._dataUnit.addInterceptor(this.dataUnitInterceptor);
247
285
  CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
248
286
  this.addElementID();
249
287
  if (this.columnFilterDataSource != undefined) {
@@ -262,17 +300,15 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
262
300
  if (!this._dataUnit) {
263
301
  this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
264
302
  this._dataUnit = evt.detail;
265
- this.finshLoading();
303
+ this.finishLoading();
266
304
  });
267
305
  }
268
306
  else {
269
- this.finshLoading();
307
+ this.finishLoading();
270
308
  }
271
309
  if (!this.messagesBuilder)
272
310
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
273
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
274
- this._dataState = evt.detail;
275
- });
311
+ this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
276
312
  this._snkDataUnit.addEventListener("cancelEdition", () => {
277
313
  var _a;
278
314
  if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
@@ -283,9 +319,18 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
283
319
  }
284
320
  parent = parent.parentElement;
285
321
  }
322
+ this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
286
323
  this.addGridLegacyConfigName();
287
324
  this.loadConfig();
288
325
  }
326
+ componentDidRender() {
327
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
328
+ this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
329
+ }
330
+ async handleDataStateChange(evt) {
331
+ this._dataState = evt.detail;
332
+ this._rmPrecisionCustomValueFormatter.setDataState(this._dataState);
333
+ }
289
334
  getHeaderDisabledButtons() {
290
335
  var _a;
291
336
  const disabledButtons = [];
@@ -437,7 +482,9 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
437
482
  "setConfig": [64],
438
483
  "reloadFilterBar": [64],
439
484
  "getFilterBar": [64],
440
- "findColumn": [64]
485
+ "findColumn": [64],
486
+ "addCustomValueFormatter": [64],
487
+ "removeCustomValueFormatter": [64]
441
488
  }]);
442
489
  function defineCustomElement() {
443
490
  if (typeof customElements === "undefined") {
@@ -3,13 +3,15 @@ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType,
3
3
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
5
5
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
6
- import { F as FormConfigFetcher } from './form-config-fetcher.js';
7
- import { I as InMemoryLoader } from './dataunit-fetcher.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './IExporterProvider.js';
6
+ import './DataFetcher.js';
7
+ import './pesquisa-fetcher.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './IExporterProvider.js';
9
9
  import { D as DataExporterOption, P as PresentationMode } from './ISave.js';
10
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
+ import { I as InMemoryLoader } from './dataunit-fetcher.js';
12
13
  import './filter-item-type.enum.js';
14
+ import { F as FormConfigFetcher } from './form-config-fetcher.js';
13
15
  import { C as ConfigStorage } from './ConfigStorage.js';
14
16
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
15
17
  import { g as getSelectedIDs, d as defineCustomElement$9 } from './snk-data-unit2.js';
@@ -75,6 +77,11 @@ class ClientSideExporterProvider extends CommonsExporter {
75
77
  if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
76
78
  return value.value;
77
79
  }
80
+ if (column.customFormatter) {
81
+ const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
82
+ const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
83
+ return formattedValue;
84
+ }
78
85
  return this.dataUnit.getFormattedValue(id, value);
79
86
  }
80
87
  }
@@ -114,6 +121,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
114
121
  this.gridConfig = undefined;
115
122
  this.formConfig = undefined;
116
123
  this._formFields = [];
124
+ this._fieldsProps = new Map();
117
125
  this.multipleSelection = undefined;
118
126
  this.useCancelConfirm = true;
119
127
  this.pageSize = 150;
@@ -138,6 +146,27 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
138
146
  this.loadFormConfig(true);
139
147
  this.loadGridConfig(true);
140
148
  }
149
+ /**
150
+ * Registra um formatador de valores para uma coluna da grid.
151
+ */
152
+ async addCustomValueFormatter(columnName, customFormatter) {
153
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
154
+ }
155
+ /**
156
+ * Remove o formatador de valores de uma coluna da grid.
157
+ */
158
+ async removeCustomValueFormatter(columnName) {
159
+ this._grid.removeCustomValueFormatter(columnName);
160
+ }
161
+ /**
162
+ * Altera/adiciona uma propriedade nos metadados do campo.
163
+ */
164
+ async setFieldProp(fieldName, propName, value) {
165
+ const newCustomFieldProps = new Map(this._fieldsProps);
166
+ const currentProps = this._fieldsProps.get(fieldName);
167
+ newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
168
+ this._fieldsProps = newCustomFieldProps;
169
+ }
141
170
  getButtons(selected, extraButtons) {
142
171
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
143
172
  .concat(extraButtons));
@@ -192,9 +221,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
192
221
  }
193
222
  }
194
223
  observeDataState(newValue, oldValue) {
195
- if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
196
- this.dataStateChange.emit(newValue);
197
- }
224
+ this.handleDataStateChange(newValue, oldValue);
198
225
  }
199
226
  async observeFormLegacy(newValue, oldValue) {
200
227
  await this.handleUpdateFormLegacyConfig(newValue, oldValue);
@@ -202,6 +229,28 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
202
229
  async observeGridLegacy(newValue, oldValue) {
203
230
  await this.handleUpdateGridLegacyConfig(newValue, oldValue);
204
231
  }
232
+ async handleDataStateChange(newValue, oldValue) {
233
+ if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
234
+ this.dataStateChange.emit(newValue);
235
+ }
236
+ await this.processRmPrecision();
237
+ }
238
+ async processRmPrecision() {
239
+ var _a, _b;
240
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
241
+ for (const field of fieldsWithRmPrecision || []) {
242
+ if (!field) {
243
+ continue;
244
+ }
245
+ const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
246
+ if (!rmPrecision) {
247
+ continue;
248
+ }
249
+ await this.setFieldProp(field, 'precision', rmPrecision);
250
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
251
+ }
252
+ this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
253
+ }
205
254
  async handleUpdateGridLegacyConfig(newValue, oldValue) {
206
255
  if (newValue == undefined || newValue == oldValue) {
207
256
  return;
@@ -310,10 +359,16 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
310
359
  this.loadGridConfig();
311
360
  this.loadFormConfig();
312
361
  }
362
+ componentDidRender() {
363
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
364
+ this.addGridCustomValueFormattters();
365
+ this.setFieldsProps();
366
+ }
313
367
  componentWillLoad() {
314
368
  this.processMetadata();
315
369
  this.onModeChange();
316
370
  this.configDatasource();
371
+ this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
317
372
  }
318
373
  componentDidLoad() {
319
374
  CSSVarsUtils.applyVarsGrid(this._element, this._grid);
@@ -322,6 +377,17 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
322
377
  this._multiSelectionListDataSource.setApplication(this.application);
323
378
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
324
379
  }
380
+ setFieldsProps() {
381
+ if (!this._form) {
382
+ return;
383
+ }
384
+ for (const [fieldName, props] of this._fieldsProps) {
385
+ for (const prop in props) {
386
+ this._form.setFieldProp(fieldName, prop, props[prop]);
387
+ }
388
+ this._fieldsProps.delete(fieldName);
389
+ }
390
+ }
325
391
  getTaskBarId() {
326
392
  var _a, _b;
327
393
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
@@ -374,12 +440,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
374
440
  var _a;
375
441
  (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
376
442
  }
377
- updateConfig() {
443
+ async updateConfig() {
378
444
  if (this._formConfigManager == undefined) {
379
445
  this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
380
446
  }
381
447
  this._formConfigManager.setConfig(this.formConfig);
382
- return;
383
448
  }
384
449
  processMetadata() {
385
450
  const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
@@ -411,6 +476,23 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
411
476
  };
412
477
  }
413
478
  }
479
+ addGridCustomValueFormattters() {
480
+ var _a, _b, _c;
481
+ const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
482
+ if (!metadataFields) {
483
+ return;
484
+ }
485
+ const fieldsWithRmPrecision = [];
486
+ metadataFields.forEach((field) => {
487
+ var _a;
488
+ if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
489
+ fieldsWithRmPrecision.push(field.name);
490
+ }
491
+ });
492
+ fieldsWithRmPrecision.forEach(field => {
493
+ this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
494
+ });
495
+ }
414
496
  onDataStateChange(evt) {
415
497
  this.dataState = Object.assign({}, evt.detail);
416
498
  }
@@ -631,9 +713,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
631
713
  if (this.dataUnit == undefined) {
632
714
  return;
633
715
  }
634
- return (h("snk-data-unit", { 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 }, 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)
716
+ 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 }, 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)
635
717
  ? undefined
636
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { 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() }))));
718
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, 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() }))));
637
719
  }
638
720
  get _element() { return this; }
639
721
  static get watchers() { return {
@@ -672,6 +754,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
672
754
  "_fieldToGetFocus": [32],
673
755
  "_customContainerId": [32],
674
756
  "_formFields": [32],
757
+ "_fieldsProps": [32],
758
+ "addCustomValueFormatter": [64],
759
+ "removeCustomValueFormatter": [64],
760
+ "setFieldProp": [64],
675
761
  "goToView": [64],
676
762
  "setMetadata": [64],
677
763
  "setRecords": [64],
@@ -1,6 +1,7 @@
1
- import { R as ResourceFetcher, d as dist, D as DataFetcher, F as FormConfigFetcher } from './form-config-fetcher-e3094014.js';
1
+ import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-5d72aaf1.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
3
3
  import { ObjectUtils } from '@sankhyalabs/core';
4
+ import { d as dist, D as DataFetcher } from './DataFetcher-4b4b7beb.js';
4
5
 
5
6
  class GridConfigFetcher extends ResourceFetcher {
6
7
  constructor() {