@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
@@ -3,6 +3,8 @@ import { Host, h } from "@stencil/core";
3
3
  import { DataBinder } from "@sankhyalabs/ezui/dist/collection/utils/form";
4
4
  export class SnkFormView {
5
5
  constructor() {
6
+ this._customEditors = new Map();
7
+ this._fieldProps = new Map();
6
8
  this.levelPath = undefined;
7
9
  this.label = undefined;
8
10
  this.name = undefined;
@@ -16,12 +18,47 @@ export class SnkFormView {
16
18
  this.canFix = true;
17
19
  this.recordsValidator = undefined;
18
20
  this.fieldToFocus = undefined;
21
+ this.customEditors = undefined;
22
+ this.fieldsProps = undefined;
19
23
  }
20
24
  async showUp() {
21
25
  if (this._formView) {
22
26
  this._formView.showUp();
23
27
  }
24
28
  }
29
+ /**
30
+ * Registra um editor customizado para campos da grade e formulário
31
+ */
32
+ async addCustomEditor(fieldName, customEditor, detailContext) {
33
+ if (this._formView) {
34
+ this._formView.addCustomEditor(fieldName, customEditor, detailContext);
35
+ return;
36
+ }
37
+ const newCustomEditors = new Map(this._customEditors);
38
+ newCustomEditors.set(fieldName, { customEditor, detailContext });
39
+ this._customEditors = newCustomEditors;
40
+ }
41
+ observePropsCustomEditor(newValue) {
42
+ for (const fieldName in newValue) {
43
+ this.addCustomEditor(fieldName, newValue[fieldName]);
44
+ }
45
+ }
46
+ /**
47
+ * Altera/adiciona uma propriedade nos metadados do campo.
48
+ */
49
+ async setFieldProp(fieldName, propName, value) {
50
+ const props = this._fieldProps.get(fieldName) || [];
51
+ this._fieldProps.set(fieldName, [...props, { propName, value }]);
52
+ }
53
+ async observeFieldsProps(newValue) {
54
+ for (const field in newValue) {
55
+ const fieldProps = newValue[field];
56
+ const propNames = Object.keys(fieldProps);
57
+ for (const propName of propNames) {
58
+ await this.setFieldProp(field, propName, fieldProps[propName]);
59
+ }
60
+ }
61
+ }
25
62
  changeFix() {
26
63
  this.fixed = !this.fixed;
27
64
  this.emitEvent("fixed");
@@ -80,7 +117,13 @@ export class SnkFormView {
80
117
  this._dataBinder.onDisconnectedCallback();
81
118
  }
82
119
  }
120
+ componentDidLoad() {
121
+ this.observePropsCustomEditor(this.customEditors);
122
+ this.observeFieldsProps(this.fieldsProps);
123
+ }
83
124
  componentDidRender() {
125
+ this.setCustomEditors();
126
+ this.setFieldProps();
84
127
  if (this.fieldToFocus == undefined) {
85
128
  return;
86
129
  }
@@ -92,6 +135,26 @@ export class SnkFormView {
92
135
  this.snkRequestClearFieldToFocus.emit();
93
136
  });
94
137
  }
138
+ setCustomEditors() {
139
+ if (!this._formView) {
140
+ return;
141
+ }
142
+ for (const [fieldName, customEditorProps] of this._customEditors) {
143
+ this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
144
+ this._customEditors.delete(fieldName);
145
+ }
146
+ }
147
+ setFieldProps() {
148
+ if (!this._formView) {
149
+ return;
150
+ }
151
+ for (const [fieldName, propsToChange] of this._fieldProps) {
152
+ propsToChange.forEach(prop => {
153
+ this._formView.setFieldProp(fieldName, prop.propName, prop.value);
154
+ this._fieldProps.delete(fieldName);
155
+ });
156
+ }
157
+ }
95
158
  render() {
96
159
  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 &&
97
160
  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 &&
@@ -361,6 +424,41 @@ export class SnkFormView {
361
424
  },
362
425
  "attribute": "field-to-focus",
363
426
  "reflect": false
427
+ },
428
+ "customEditors": {
429
+ "type": "unknown",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "PropsCustomEditor",
433
+ "resolved": "PropsCustomEditor",
434
+ "references": {
435
+ "PropsCustomEditor": {
436
+ "location": "import",
437
+ "path": "../interfaces/PropsCustomEditor"
438
+ }
439
+ }
440
+ },
441
+ "required": false,
442
+ "optional": false,
443
+ "docs": {
444
+ "tags": [],
445
+ "text": "Registra um editor customizado para campos da grade e formul\u00E1rio."
446
+ }
447
+ },
448
+ "fieldsProps": {
449
+ "type": "unknown",
450
+ "mutable": false,
451
+ "complexType": {
452
+ "original": "object",
453
+ "resolved": "object",
454
+ "references": {}
455
+ },
456
+ "required": false,
457
+ "optional": false,
458
+ "docs": {
459
+ "tags": [],
460
+ "text": "Lista de propriedades que ser\u00E3o alteradas/adicionadas por coluna."
461
+ }
364
462
  }
365
463
  };
366
464
  }
@@ -441,7 +539,70 @@ export class SnkFormView {
441
539
  "text": "",
442
540
  "tags": []
443
541
  }
542
+ },
543
+ "addCustomEditor": {
544
+ "complexType": {
545
+ "signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
546
+ "parameters": [{
547
+ "tags": [],
548
+ "text": ""
549
+ }, {
550
+ "tags": [],
551
+ "text": ""
552
+ }, {
553
+ "tags": [],
554
+ "text": ""
555
+ }],
556
+ "references": {
557
+ "Promise": {
558
+ "location": "global"
559
+ },
560
+ "ICustomEditor": {
561
+ "location": "import",
562
+ "path": "@sankhyalabs/ezui/dist/types/utils/customEditor/interfaces/ICustomEditor"
563
+ }
564
+ },
565
+ "return": "Promise<void>"
566
+ },
567
+ "docs": {
568
+ "text": "Registra um editor customizado para campos da grade e formul\u00E1rio",
569
+ "tags": []
570
+ }
571
+ },
572
+ "setFieldProp": {
573
+ "complexType": {
574
+ "signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
575
+ "parameters": [{
576
+ "tags": [],
577
+ "text": ""
578
+ }, {
579
+ "tags": [],
580
+ "text": ""
581
+ }, {
582
+ "tags": [],
583
+ "text": ""
584
+ }],
585
+ "references": {
586
+ "Promise": {
587
+ "location": "global"
588
+ }
589
+ },
590
+ "return": "Promise<void>"
591
+ },
592
+ "docs": {
593
+ "text": "Altera/adiciona uma propriedade nos metadados do campo.",
594
+ "tags": []
595
+ }
444
596
  }
445
597
  };
446
598
  }
599
+ static get watchers() {
600
+ return [{
601
+ "propName": "customEditors",
602
+ "methodName": "observePropsCustomEditor"
603
+ }, {
604
+ "propName": "fieldsProps",
605
+ "methodName": "observeFieldsProps"
606
+ }];
607
+ }
447
608
  }
@@ -33,6 +33,9 @@ export class SnkGuidesViewer {
33
33
  this._formEditorConfigManager = undefined;
34
34
  this._formEditorDataUnit = undefined;
35
35
  this._fieldToGetFocus = undefined;
36
+ this._customEditors = undefined;
37
+ this._customRenders = undefined;
38
+ this._fieldsProps = {};
36
39
  }
37
40
  observeDataUnit() {
38
41
  this.loadGuides(true);
@@ -63,6 +66,28 @@ export class SnkGuidesViewer {
63
66
  async findField() {
64
67
  await openFieldSearch(this._moreOptions, this._fieldSearch);
65
68
  }
69
+ /**
70
+ * Registra um editor customizado para campos da grade e formulário
71
+ */
72
+ async addCustomEditor(fieldName, customEditor) {
73
+ this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
74
+ }
75
+ /**
76
+ * Registra um render customizado para colunas da grid.
77
+ */
78
+ async addGridCustomRender(fieldName, customRender) {
79
+ this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
80
+ }
81
+ ;
82
+ /**
83
+ * Altera/adiciona uma propriedade nos metadados do campo.
84
+ */
85
+ async setFieldProp(fieldName, propName, value) {
86
+ const newFieldsProps = {
87
+ [fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
88
+ };
89
+ this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
90
+ }
66
91
  exitViewer() {
67
92
  if (this.dataUnit.isDirty()) {
68
93
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -205,7 +230,7 @@ export class SnkGuidesViewer {
205
230
  if (sheet == undefined) {
206
231
  return;
207
232
  }
208
- 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); } });
233
+ 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 });
209
234
  })));
210
235
  }
211
236
  wrapDetail(levels, content) {
@@ -247,14 +272,14 @@ export class SnkGuidesViewer {
247
272
  else {
248
273
  detailBranch = this.selectedGuide;
249
274
  }
250
- 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 }));
275
+ 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 }));
251
276
  }
252
277
  else {
253
278
  const cardId = this.selectedGuide.id;
254
279
  const sheet = this._masterFormMetadata.getSheet(cardId);
255
280
  if (sheet) {
256
281
  const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
257
- 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());
282
+ 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());
258
283
  }
259
284
  }
260
285
  return content;
@@ -460,7 +485,9 @@ export class SnkGuidesViewer {
460
485
  dataUnit: this.dataUnit,
461
486
  recordsValidator: this.recordsValidator,
462
487
  fieldToFocus: this._fieldToGetFocus,
463
- onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
488
+ onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
489
+ propsCustomEditor: this._customEditors,
490
+ fieldsProps: this._fieldsProps
464
491
  }), 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 })));
465
492
  }
466
493
  static get is() { return "snk-guides-viewer"; }
@@ -774,7 +801,10 @@ export class SnkGuidesViewer {
774
801
  "_guides": {},
775
802
  "_formEditorConfigManager": {},
776
803
  "_formEditorDataUnit": {},
777
- "_fieldToGetFocus": {}
804
+ "_fieldToGetFocus": {},
805
+ "_customEditors": {},
806
+ "_customRenders": {},
807
+ "_fieldsProps": {}
778
808
  };
779
809
  }
780
810
  static get events() {
@@ -874,6 +904,83 @@ export class SnkGuidesViewer {
874
904
  "text": "Abre o localizador de campos",
875
905
  "tags": []
876
906
  }
907
+ },
908
+ "addCustomEditor": {
909
+ "complexType": {
910
+ "signature": "(fieldName: string, customEditor: ICustomEditor) => Promise<void>",
911
+ "parameters": [{
912
+ "tags": [],
913
+ "text": ""
914
+ }, {
915
+ "tags": [],
916
+ "text": ""
917
+ }],
918
+ "references": {
919
+ "Promise": {
920
+ "location": "global"
921
+ },
922
+ "ICustomEditor": {
923
+ "location": "import",
924
+ "path": "@sankhyalabs/ezui/dist/types/utils"
925
+ }
926
+ },
927
+ "return": "Promise<void>"
928
+ },
929
+ "docs": {
930
+ "text": "Registra um editor customizado para campos da grade e formul\u00E1rio",
931
+ "tags": []
932
+ }
933
+ },
934
+ "addGridCustomRender": {
935
+ "complexType": {
936
+ "signature": "(fieldName: string, customRender: ICustomRender) => Promise<void>",
937
+ "parameters": [{
938
+ "tags": [],
939
+ "text": ""
940
+ }, {
941
+ "tags": [],
942
+ "text": ""
943
+ }],
944
+ "references": {
945
+ "Promise": {
946
+ "location": "global"
947
+ },
948
+ "ICustomRender": {
949
+ "location": "import",
950
+ "path": "@sankhyalabs/ezui/dist/types/utils"
951
+ }
952
+ },
953
+ "return": "Promise<void>"
954
+ },
955
+ "docs": {
956
+ "text": "Registra um render customizado para colunas da grid.",
957
+ "tags": []
958
+ }
959
+ },
960
+ "setFieldProp": {
961
+ "complexType": {
962
+ "signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
963
+ "parameters": [{
964
+ "tags": [],
965
+ "text": ""
966
+ }, {
967
+ "tags": [],
968
+ "text": ""
969
+ }, {
970
+ "tags": [],
971
+ "text": ""
972
+ }],
973
+ "references": {
974
+ "Promise": {
975
+ "location": "global"
976
+ }
977
+ },
978
+ "return": "Promise<void>"
979
+ },
980
+ "docs": {
981
+ "text": "Altera/adiciona uma propriedade nos metadados do campo.",
982
+ "tags": []
983
+ }
877
984
  }
878
985
  };
879
986
  }
@@ -7,26 +7,31 @@ export class CommonsExporter {
7
7
  }
8
8
  async getColumnsMetadata() {
9
9
  var _a;
10
- const columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
11
- return this.buildColumnsMetadata(columnsState);
10
+ this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState()) || [];
11
+ return await this.buildColumnsMetadata(this.columnsState);
12
12
  }
13
- buildColumnsMetadata(gridColumns) {
13
+ getColumnsState() {
14
+ return this.columnsState;
15
+ }
16
+ async buildColumnsMetadata(gridColumns) {
17
+ var _a, _b;
14
18
  const columnsMetadata = [];
15
- gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
16
- var _a, _b;
19
+ for (const column of gridColumns) {
17
20
  /**
18
21
  * TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
19
22
  */
20
23
  if (column.hidden && column.name !== "RECDESP") {
21
- return;
24
+ continue;
22
25
  }
23
26
  const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
27
+ const customFormatter = await this.grid.getCustomValueFormatter(column.name);
24
28
  const columnData = {
25
29
  label: column.label,
26
30
  id: column.name,
27
31
  width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface.SEARCH ? 30 : column.width,
28
32
  type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
29
- userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
33
+ userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
34
+ customFormatter
30
35
  };
31
36
  columnsMetadata.push(columnData);
32
37
  if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
@@ -42,7 +47,8 @@ export class CommonsExporter {
42
47
  };
43
48
  columnsMetadata.push(descriptionColumn);
44
49
  }
45
- });
50
+ }
51
+ ;
46
52
  return columnsMetadata || [];
47
53
  }
48
54
  }
@@ -48,6 +48,11 @@ export default class ClientSideExporterProvider extends CommonsExporter {
48
48
  if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
49
49
  return value.value;
50
50
  }
51
+ if (column.customFormatter) {
52
+ const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
53
+ const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
54
+ return formattedValue;
55
+ }
51
56
  return this.dataUnit.getFormattedValue(id, value);
52
57
  }
53
58
  }
@@ -251,8 +251,8 @@ export class SnkDataExporter {
251
251
  }
252
252
  }
253
253
  loadDropdown() {
254
- var _a, _b;
255
- this._selectedNumber = ((_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs()) === null || _b === void 0 ? void 0 : _b.length) || 0;
254
+ var _a;
255
+ this._selectedNumber = ((_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedNumber()) || 0;
256
256
  this._itemBuilder = new ItemBuilder(this.getMessage.bind(this), this._selectedNumber);
257
257
  this.loadItems();
258
258
  }