@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-47941.0 → 0.0.0-bugfix-dev-59880.1

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 (114) hide show
  1. package/dist/cjs/{IExporterProvider-d3a3ccd1.js → IExporterProvider-e286ef6a.js} +3 -3
  2. package/dist/cjs/{SnkFormConfigManager-dda10d75.js → SnkFormConfigManager-7b222c78.js} +2 -2
  3. package/dist/cjs/{dataunit-fetcher-e2109392.js → dataunit-fetcher-7a08e4dd.js} +6 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-attach.cjs.entry.js +16 -21
  9. package/dist/cjs/snk-crud.cjs.entry.js +54 -3
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  11. package/dist/cjs/{snk-data-unit-dee38ccd.js → snk-data-unit-3718477f.js} +79 -23
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +43 -4
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
  15. package/dist/cjs/snk-form-view.cjs.entry.js +31 -0
  16. package/dist/cjs/snk-form.cjs.entry.js +28 -3
  17. package/dist/cjs/snk-grid.cjs.entry.js +50 -3
  18. package/dist/cjs/{snk-guides-viewer-af4a6ae5.js → snk-guides-viewer-66dd6949.js} +21 -5
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-simple-crud.cjs.entry.js +64 -7
  21. package/dist/collection/components/snk-attach/snk-attach.js +21 -29
  22. package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
  23. package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
  24. package/dist/collection/components/snk-crud/snk-crud.js +122 -2
  25. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
  26. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +82 -0
  27. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +73 -3
  28. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -1
  29. package/dist/collection/components/snk-data-unit/snk-data-unit.js +98 -23
  30. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
  31. package/dist/collection/components/snk-form/snk-form.js +53 -2
  32. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
  33. package/dist/collection/components/snk-grid/snk-grid.js +123 -1
  34. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +130 -4
  35. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +1 -1
  36. package/dist/collection/lib/dataUnit/InMemoryLoader.js +6 -2
  37. package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
  38. package/dist/components/IExporterProvider.js +2 -2
  39. package/dist/components/SnkFormConfigManager.js +2 -2
  40. package/dist/components/dataunit-fetcher.js +6 -2
  41. package/dist/components/snk-attach2.js +15 -20
  42. package/dist/components/snk-crud.js +56 -2
  43. package/dist/components/snk-data-unit2.js +80 -23
  44. package/dist/components/snk-detail-view2.js +68 -5
  45. package/dist/components/snk-filter-bar2.js +6 -1
  46. package/dist/components/snk-form-view2.js +33 -0
  47. package/dist/components/snk-form.js +28 -2
  48. package/dist/components/snk-grid2.js +51 -1
  49. package/dist/components/snk-simple-crud2.js +64 -4
  50. package/dist/esm/{IExporterProvider-640e1f6b.js → IExporterProvider-cf5a56ee.js} +3 -3
  51. package/dist/esm/{SnkFormConfigManager-87bd8082.js → SnkFormConfigManager-3bdb3e1f.js} +2 -2
  52. package/dist/esm/{dataunit-fetcher-87ecba4a.js → dataunit-fetcher-f3fa35b9.js} +6 -2
  53. package/dist/esm/loader.js +1 -1
  54. package/dist/esm/sankhyablocks.js +1 -1
  55. package/dist/esm/snk-actions-button_4.entry.js +1 -1
  56. package/dist/esm/snk-application.entry.js +1 -1
  57. package/dist/esm/snk-attach.entry.js +16 -21
  58. package/dist/esm/snk-crud.entry.js +54 -3
  59. package/dist/esm/snk-data-exporter.entry.js +2 -2
  60. package/dist/esm/{snk-data-unit-1132e40b.js → snk-data-unit-8d6afa43.js} +80 -24
  61. package/dist/esm/snk-data-unit.entry.js +2 -2
  62. package/dist/esm/snk-detail-view.entry.js +43 -4
  63. package/dist/esm/snk-filter-bar.entry.js +5 -1
  64. package/dist/esm/snk-form-view.entry.js +31 -0
  65. package/dist/esm/snk-form.entry.js +28 -3
  66. package/dist/esm/snk-grid.entry.js +50 -3
  67. package/dist/esm/{snk-guides-viewer-359e39a7.js → snk-guides-viewer-11cf8dc7.js} +21 -5
  68. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  69. package/dist/esm/snk-simple-crud.entry.js +64 -7
  70. package/dist/sankhyablocks/p-0a28cb19.entry.js +1 -0
  71. package/dist/sankhyablocks/p-188e1432.entry.js +1 -0
  72. package/dist/sankhyablocks/p-1c6debe6.entry.js +1 -0
  73. package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
  74. package/dist/sankhyablocks/p-2cc2d8fd.entry.js +1 -0
  75. package/dist/sankhyablocks/{p-66a31d30.entry.js → p-3e4c2cfe.entry.js} +1 -1
  76. package/dist/sankhyablocks/{p-9c70f37e.entry.js → p-4a8a149d.entry.js} +1 -1
  77. package/dist/sankhyablocks/p-50e72d6c.js +1 -0
  78. package/dist/sankhyablocks/p-5bd78e4c.entry.js +1 -0
  79. package/dist/sankhyablocks/{p-b11921ca.entry.js → p-8171e586.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-d29a252c.js → p-a97060b0.js} +1 -1
  81. package/dist/sankhyablocks/p-b27114c4.js +1 -0
  82. package/dist/sankhyablocks/{p-83950924.entry.js → p-b643f746.entry.js} +1 -1
  83. package/dist/sankhyablocks/{p-d799aa7f.entry.js → p-b68918fc.entry.js} +1 -1
  84. package/dist/sankhyablocks/p-da7c81d6.entry.js +1 -0
  85. package/dist/sankhyablocks/{p-da6e3dcf.entry.js → p-e238279a.entry.js} +1 -1
  86. package/dist/sankhyablocks/p-eae66367.js +1 -0
  87. package/dist/sankhyablocks/{p-08fee6e8.js → p-fde91811.js} +1 -1
  88. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  89. package/dist/types/components/snk-attach/snk-attach.d.ts +9 -9
  90. package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
  91. package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
  92. package/dist/types/components/snk-crud/snk-crud.d.ts +18 -0
  93. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
  94. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +15 -2
  95. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -0
  96. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +16 -1
  97. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  98. package/dist/types/components/snk-form/snk-form.d.ts +8 -0
  99. package/dist/types/components/snk-grid/snk-grid.d.ts +23 -0
  100. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +18 -2
  101. package/dist/types/components.d.ts +112 -0
  102. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  103. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
  104. package/package.json +1 -1
  105. package/dist/sankhyablocks/p-0bcc6e83.js +0 -1
  106. package/dist/sankhyablocks/p-2eb90860.js +0 -1
  107. package/dist/sankhyablocks/p-33f695d6.entry.js +0 -1
  108. package/dist/sankhyablocks/p-3519a984.entry.js +0 -1
  109. package/dist/sankhyablocks/p-5c8a9e27.entry.js +0 -1
  110. package/dist/sankhyablocks/p-7ecaaea2.entry.js +0 -1
  111. package/dist/sankhyablocks/p-931343a1.entry.js +0 -1
  112. package/dist/sankhyablocks/p-cb91634d.js +0 -1
  113. package/dist/sankhyablocks/p-cf9d2d1e.entry.js +0 -1
  114. package/dist/sankhyablocks/p-f72e8835.entry.js +0 -1
@@ -4,7 +4,7 @@ const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
6
  const SnkMessageBuilder = require('./SnkMessageBuilder-4a95fe86.js');
7
- const dataunitFetcher = require('./dataunit-fetcher-e2109392.js');
7
+ const dataunitFetcher = require('./dataunit-fetcher-7a08e4dd.js');
8
8
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
9
9
 
10
10
  const SnkDataUnit = class {
@@ -13,6 +13,7 @@ const SnkDataUnit = class {
13
13
  this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
14
14
  this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
15
15
  this.messagesBuilderUpdated = index.createEvent(this, "messagesBuilderUpdated", 3);
16
+ this.dataUnitFieldsHidded = index.createEvent(this, "dataUnitFieldsHidded", 7);
16
17
  this.insertionMode = index.createEvent(this, "insertionMode", 3);
17
18
  this.cancelEdition = index.createEvent(this, "cancelEdition", 3);
18
19
  this._onDataUnitResolve = [];
@@ -21,6 +22,7 @@ const SnkDataUnit = class {
21
22
  this._fieldsWithRmPrecision = [];
22
23
  this._metadataByRow = new Map();
23
24
  this._rowMetadataCache = new Map();
25
+ this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
24
26
  this._dataUnitObserver = async (action) => {
25
27
  const duState = this.buildDataState(action.type);
26
28
  this.dataState = duState;
@@ -41,6 +43,7 @@ const SnkDataUnit = class {
41
43
  break;
42
44
  }
43
45
  };
46
+ this.fieldsToLink = [];
44
47
  this.dataState = undefined;
45
48
  this.messagesBuilder = undefined;
46
49
  this.dataUnitName = undefined;
@@ -230,23 +233,14 @@ const SnkDataUnit = class {
230
233
  utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
231
234
  return;
232
235
  }
233
- return action;
236
+ return new core.DataUnitAction(core.Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload));
234
237
  }
235
238
  interceptRecordsCopied(action) {
236
239
  if (!this.isAllowed("CLONE")) {
237
240
  utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
238
241
  return;
239
242
  }
240
- const cleanFields = this.getCleanOnCopyFields();
241
- if (cleanFields.length > 0) {
242
- const records = action.payload;
243
- action = new core.DataUnitAction(core.Action.RECORDS_COPIED, records.map(record => {
244
- const newRecord = Object.assign({}, record);
245
- cleanFields.forEach(fieldName => delete newRecord[fieldName]);
246
- return newRecord;
247
- }));
248
- }
249
- return action;
243
+ return new core.DataUnitAction(core.Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload));
250
244
  }
251
245
  async interceptDataChange(action) {
252
246
  if (this.isAllowed("UPDATE")) {
@@ -328,7 +322,7 @@ const SnkDataUnit = class {
328
322
  interceptMetadataLoaded(action) {
329
323
  this.fillFieldsWithRmp(action.payload);
330
324
  this.fillFieldsWithRmPrecision(action.payload);
331
- return action;
325
+ return new core.DataUnitAction(core.Action.METADATA_LOADED, this.handleDULinksOnMetadataLoaded(action.payload));
332
326
  }
333
327
  async interceptAction(action) {
334
328
  switch (action.type) {
@@ -387,6 +381,47 @@ const SnkDataUnit = class {
387
381
  return Object.assign({}, response._rmd);
388
382
  }
389
383
  }
384
+ handleDULinksOnMetadataLoaded(payload) {
385
+ const metadata = Object.assign({}, payload);
386
+ this.processLinks(metadata);
387
+ return metadata;
388
+ }
389
+ handleRecordsCopied(initialRecords) {
390
+ let records = [...initialRecords];
391
+ records = this.handleCleanOnCopy(records);
392
+ return this.handleLinksWithParent(records);
393
+ }
394
+ handleLinksWithParent(records) {
395
+ var _a, _b;
396
+ const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
397
+ if (!parentDataUnit)
398
+ return records;
399
+ const parentSelectedRecord = parentDataUnit.getSelectedRecord();
400
+ const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
401
+ const { links } = selfInfo;
402
+ if (!links || links.length === 0)
403
+ return records;
404
+ return records.map(record => {
405
+ return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
406
+ });
407
+ }
408
+ buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
409
+ const newRecord = Object.assign({}, record);
410
+ links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
411
+ return newRecord;
412
+ }
413
+ handleCleanOnCopy(records) {
414
+ const cleanFields = this.getCleanOnCopyFields();
415
+ if (cleanFields.length > 0) {
416
+ records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
417
+ }
418
+ return records;
419
+ }
420
+ buildCopyWithCleanedFields(record, cleanFields) {
421
+ const newRecord = Object.assign({}, record);
422
+ cleanFields.forEach(fieldName => delete newRecord[fieldName]);
423
+ return newRecord;
424
+ }
390
425
  showSuccessMessage(message) {
391
426
  utils.ApplicationUtils.info(message, { iconName: "check" });
392
427
  }
@@ -530,20 +565,40 @@ const SnkDataUnit = class {
530
565
  return;
531
566
  }
532
567
  handlerLinkFields() {
533
- var _a, _b;
534
- const metadata = Object.assign({}, this.dataUnit.metadata);
535
- if (!this._parentDataUnit)
568
+ var _a, _b, _c, _d;
569
+ const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
570
+ if (!parentDU)
536
571
  return;
537
- const child = this._parentDataUnit.getChildInfo(this.entityName);
572
+ const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
573
+ const child = parentDU.getChildInfo(childName);
538
574
  if (!child)
539
575
  return;
540
- const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
541
- (_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
542
- if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
576
+ const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
577
+ this.handleDUWithLinks(links);
578
+ }
579
+ handleDUWithLinks(fieldsToLink) {
580
+ this.fieldsToLink = fieldsToLink;
581
+ const metadata = Object.assign({}, this.dataUnit.metadata);
582
+ this.processLinks(metadata);
583
+ this.dataUnit.metadata = metadata;
584
+ this.dataUnitFieldsHidded.emit();
585
+ }
586
+ processLinks(metadata) {
587
+ var _a;
588
+ (_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
589
+ var _a;
590
+ if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
543
591
  field.visible = false;
544
592
  }
545
593
  });
546
- this.dataUnit.metadata = metadata;
594
+ }
595
+ getCleanDataUnitName() {
596
+ var _a;
597
+ const uri = this.dataUnit.name;
598
+ if (core.StringUtils.isEmpty(uri))
599
+ return uri;
600
+ const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
601
+ return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
547
602
  }
548
603
  static getNearestInstance(element) {
549
604
  let parent = element.parentElement;
@@ -570,8 +625,9 @@ const SnkDataUnit = class {
570
625
  this.dataUnit.releaseCallbacks();
571
626
  }
572
627
  }
573
- componentDidLoad() {
574
- this.loadDataUnit();
628
+ async componentDidLoad() {
629
+ await this.loadDataUnit();
630
+ this.handlerLinkFields();
575
631
  }
576
632
  render() {
577
633
  return (index.h(index.Host, null));
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkDataUnit = require('./snk-data-unit-dee38ccd.js');
5
+ const snkDataUnit = require('./snk-data-unit-3718477f.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
9
  require('./SnkMessageBuilder-4a95fe86.js');
10
- require('./dataunit-fetcher-e2109392.js');
10
+ require('./dataunit-fetcher-7a08e4dd.js');
11
11
  require('./DataFetcher-515bda03.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
8
8
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
9
9
  require('./DataFetcher-515bda03.js');
10
10
  require('./pesquisa-fetcher-916a935c.js');
@@ -12,12 +12,12 @@ const index$1 = require('./index-0922807b.js');
12
12
  require('./ISave-e91b70a7.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
- require('./dataunit-fetcher-e2109392.js');
15
+ require('./dataunit-fetcher-7a08e4dd.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-3f430aee.js');
18
18
  const taskbarElements = require('./taskbar-elements-d9392685.js');
19
19
  const constants = require('./constants-35ddd366.js');
20
- const snkGuidesViewer = require('./snk-guides-viewer-af4a6ae5.js');
20
+ const snkGuidesViewer = require('./snk-guides-viewer-66dd6949.js');
21
21
  const SnkMessageBuilder = require('./SnkMessageBuilder-4a95fe86.js');
22
22
  require('./ConfigStorage-9a53a42c.js');
23
23
  require('./PrintUtils-bcaeb82f.js');
@@ -95,6 +95,8 @@ const SnkDetailView = class {
95
95
  this.branchGuide = undefined;
96
96
  this.canEdit = true;
97
97
  this.taskbarCustomContainerId = undefined;
98
+ this.customEditors = undefined;
99
+ this.customRenders = undefined;
98
100
  }
99
101
  observeDataUnit(newDataUnit, oldDataUnit) {
100
102
  newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
@@ -162,10 +164,38 @@ const SnkDetailView = class {
162
164
  this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
163
165
  }
164
166
  }
167
+ /**
168
+ * Registra um editor customizado para campos da grade e formulário.
169
+ */
170
+ async addCustomEditor(fieldName, customEditor) {
171
+ var _a;
172
+ const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
173
+ this._snkGrid.addCustomEditor(fieldName, customEditor, detailContext);
174
+ this._snkFormView.addCustomEditor(fieldName, customEditor, detailContext);
175
+ }
176
+ async observerPropsCustomEditor(newValue) {
177
+ for (const fieldName in newValue) {
178
+ await this.addCustomEditor(fieldName, newValue[fieldName]);
179
+ }
180
+ }
181
+ /**
182
+ * Registra um render customizado para colunas da grid.
183
+ */
184
+ async addGridCustomRender(fieldName, customRender) {
185
+ var _a;
186
+ const detailContext = this.normalizeBranchGuideId((_a = this.branchGuide) === null || _a === void 0 ? void 0 : _a.id);
187
+ await this._snkGrid.addGridCustomRender(fieldName, customRender, detailContext);
188
+ }
165
189
  onContentCardChanged(evt) {
166
190
  snkGuidesViewer.SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => index.forceUpdate(this));
167
191
  evt.stopPropagation();
168
192
  }
193
+ async observeCustomRenders(newValue) {
194
+ for (const field in newValue) {
195
+ const customRender = newValue[field];
196
+ await this.addGridCustomRender(field, customRender);
197
+ }
198
+ }
169
199
  updateLabel() {
170
200
  const guideItemPathSize = this.guideItemPath ? this.guideItemPath.length : 0;
171
201
  if (guideItemPathSize > 0) {
@@ -268,6 +298,10 @@ const SnkDetailView = class {
268
298
  this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
269
299
  }
270
300
  }
301
+ async componentDidLoad() {
302
+ await this.observerPropsCustomEditor(this.customEditors);
303
+ await this.observeCustomRenders(this.customRenders);
304
+ }
271
305
  async dataUnitActionHandler(action) {
272
306
  if (action.type === core.Action.FIELD_INVALIDATED) {
273
307
  this.addErrorBadgeToBranchGuide();
@@ -277,6 +311,9 @@ const SnkDetailView = class {
277
311
  this.branchGuide = Object.assign(Object.assign({}, this.branchGuide), { badge: 'error' });
278
312
  this.snkDetailGuidesChange.emit(new GuideBuilder(this.branchGuide, this._formMetadata, this.dataUnit));
279
313
  }
314
+ normalizeBranchGuideId(id) {
315
+ return id === null || id === void 0 ? void 0 : id.replace(/child\[(.*?)\]/g, '$1').replace(/::/g, '>');
316
+ }
280
317
  render() {
281
318
  this.updateLabel();
282
319
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
@@ -284,7 +321,9 @@ const SnkDetailView = class {
284
321
  }
285
322
  static get watchers() { return {
286
323
  "dataUnit": ["observeDataUnit"],
287
- "dataState": ["observerDataState"]
324
+ "dataState": ["observerDataState"],
325
+ "customEditors": ["observerPropsCustomEditor"],
326
+ "customRenders": ["observeCustomRenders"]
288
327
  }; }
289
328
  };
290
329
  SnkDetailView.REGEX_FORM_ID = /__FORM:[^:]+/g;
@@ -286,6 +286,7 @@ const SnkFilterBar = class {
286
286
  this.messagesBuilder = undefined;
287
287
  this.disablePersonalizedFilter = undefined;
288
288
  this.filterBarLegacyConfigName = undefined;
289
+ this.autoLoad = undefined;
289
290
  this.allowDefault = undefined;
290
291
  this.scrollerLocked = false;
291
292
  this.showPersonalizedFilter = false;
@@ -432,7 +433,10 @@ const SnkFilterBar = class {
432
433
  }
433
434
  async doLoadData(forceReload = false) {
434
435
  try {
435
- if (this._firstLoad && !forceReload) {
436
+ if (this._firstLoad && this.autoLoad === false) {
437
+ return;
438
+ }
439
+ if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
436
440
  let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
437
441
  if (!autoLoad) {
438
442
  return;
@@ -14,6 +14,7 @@ const SnkFormView = class {
14
14
  this.snkContentCardChanged = index.createEvent(this, "snkContentCardChanged", 7);
15
15
  this.snkRequestClearFieldToFocus = index.createEvent(this, "snkRequestClearFieldToFocus", 7);
16
16
  this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
17
+ this._customEditors = new Map();
17
18
  this._fieldProps = new Map();
18
19
  this.levelPath = undefined;
19
20
  this.label = undefined;
@@ -28,6 +29,7 @@ const SnkFormView = class {
28
29
  this.canFix = true;
29
30
  this.recordsValidator = undefined;
30
31
  this.fieldToFocus = undefined;
32
+ this.customEditors = undefined;
31
33
  this.fieldsProps = undefined;
32
34
  }
33
35
  async showUp() {
@@ -35,6 +37,23 @@ const SnkFormView = class {
35
37
  this._formView.showUp();
36
38
  }
37
39
  }
40
+ /**
41
+ * Registra um editor customizado para campos da grade e formulário
42
+ */
43
+ async addCustomEditor(fieldName, customEditor, detailContext) {
44
+ if (this._formView) {
45
+ this._formView.addCustomEditor(fieldName, customEditor, detailContext);
46
+ return;
47
+ }
48
+ const newCustomEditors = new Map(this._customEditors);
49
+ newCustomEditors.set(fieldName, { customEditor, detailContext });
50
+ this._customEditors = newCustomEditors;
51
+ }
52
+ observePropsCustomEditor(newValue) {
53
+ for (const fieldName in newValue) {
54
+ this.addCustomEditor(fieldName, newValue[fieldName]);
55
+ }
56
+ }
38
57
  /**
39
58
  * Altera/adiciona uma propriedade nos metadados do campo.
40
59
  */
@@ -110,9 +129,11 @@ const SnkFormView = class {
110
129
  }
111
130
  }
112
131
  componentDidLoad() {
132
+ this.observePropsCustomEditor(this.customEditors);
113
133
  this.observeFieldsProps(this.fieldsProps);
114
134
  }
115
135
  componentDidRender() {
136
+ this.setCustomEditors();
116
137
  this.setFieldProps();
117
138
  if (this.fieldToFocus == undefined) {
118
139
  return;
@@ -125,6 +146,15 @@ const SnkFormView = class {
125
146
  this.snkRequestClearFieldToFocus.emit();
126
147
  });
127
148
  }
149
+ setCustomEditors() {
150
+ if (!this._formView) {
151
+ return;
152
+ }
153
+ for (const [fieldName, customEditorProps] of this._customEditors) {
154
+ this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
155
+ this._customEditors.delete(fieldName);
156
+ }
157
+ }
128
158
  setFieldProps() {
129
159
  if (!this._formView) {
130
160
  return;
@@ -146,6 +176,7 @@ const SnkFormView = class {
146
176
  index.h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
147
177
  }
148
178
  static get watchers() { return {
179
+ "customEditors": ["observePropsCustomEditor"],
149
180
  "fieldsProps": ["observeFieldsProps"]
150
181
  }; }
151
182
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
8
8
  const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
9
9
  require('./ConfigStorage-9a53a42c.js');
10
10
  require('./form-config-fetcher-3f430aee.js');
@@ -21,6 +21,7 @@ const SnkForm = class {
21
21
  this.exit = index.createEvent(this, "exit", 7);
22
22
  this.actionClick = index.createEvent(this, "actionClick", 7);
23
23
  this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
24
+ this._customEditors = new Map();
24
25
  this._dataUnit = undefined;
25
26
  this._dataState = undefined;
26
27
  this._showFormConfig = false;
@@ -43,6 +44,18 @@ const SnkForm = class {
43
44
  async hideConfig() {
44
45
  this._showFormConfig = false;
45
46
  }
47
+ /**
48
+ * Registra um editor customizado para campos da grade e formulário.
49
+ */
50
+ async addCustomEditor(fieldName, customEditor) {
51
+ if (this._form) {
52
+ this._form.addCustomEditor(fieldName, customEditor);
53
+ return;
54
+ }
55
+ const newCustomEditors = new Map(this._customEditors);
56
+ newCustomEditors.set(fieldName, customEditor);
57
+ this._customEditors = newCustomEditors;
58
+ }
46
59
  /**
47
60
  * Altera/adiciona uma propriedade nos metadados do campo.
48
61
  */
@@ -56,6 +69,18 @@ const SnkForm = class {
56
69
  const dataInfo = { dataUnit: this._dataUnit };
57
70
  core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
58
71
  }
72
+ setCustomEditors() {
73
+ if (!this._form) {
74
+ return;
75
+ }
76
+ for (const [fieldName, customEditor] of this._customEditors) {
77
+ this._form.addCustomEditor(fieldName, customEditor);
78
+ this._customEditors.delete(fieldName);
79
+ }
80
+ }
81
+ async componentDidRender() {
82
+ this.setCustomEditors();
83
+ }
59
84
  async componentWillLoad() {
60
85
  let parent = this._element.parentElement;
61
86
  while (parent) {
@@ -92,7 +117,7 @@ const SnkForm = class {
92
117
  continue;
93
118
  }
94
119
  const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
95
- if (!rmPrecision) {
120
+ if (!rmPrecision && rmPrecision !== 0) {
96
121
  continue;
97
122
  }
98
123
  await this.setFieldProp(field, 'precision', rmPrecision);
@@ -108,7 +133,7 @@ const SnkForm = class {
108
133
  if (!this._dataUnit || !this._dataState) {
109
134
  return undefined;
110
135
  }
111
- return (index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.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 &&
136
+ return (index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.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 &&
112
137
  index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
113
138
  }
114
139
  get _element() { return index.getElement(this); }
@@ -9,14 +9,14 @@ const ConfigStorage = require('./ConfigStorage-9a53a42c.js');
9
9
  const index$1 = require('./index-0922807b.js');
10
10
  const fieldSearch = require('./field-search-f56aa7d6.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const IExporterProvider = require('./IExporterProvider-d3a3ccd1.js');
12
+ const IExporterProvider = require('./IExporterProvider-e286ef6a.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-515bda03.js');
15
15
  require('./pesquisa-fetcher-916a935c.js');
16
16
  require('./ISave-e91b70a7.js');
17
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
- require('./dataunit-fetcher-e2109392.js');
19
+ require('./dataunit-fetcher-7a08e4dd.js');
20
20
  require('./filter-item-type.enum-a7ffdaa6.js');
21
21
  require('./form-config-fetcher-3f430aee.js');
22
22
  const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
@@ -87,6 +87,8 @@ const SnkGrid = class {
87
87
  index.registerInstance(this, hostRef);
88
88
  this.actionClick = index.createEvent(this, "actionClick", 7);
89
89
  this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
90
+ this._customEditors = new Map();
91
+ this._customRenders = new Map();
90
92
  this._topTaskbarProcessor = new fieldSearch.TaskbarProcessor({
91
93
  "snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
92
94
  "snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
@@ -140,6 +142,7 @@ const SnkGrid = class {
140
142
  this.disablePersonalizedFilter = undefined;
141
143
  this.gridLegacyConfigName = undefined;
142
144
  this.filterBarLegacyConfigName = undefined;
145
+ this.autoLoad = undefined;
143
146
  }
144
147
  /**
145
148
  * Exibe a janela de configurações da grade.
@@ -184,6 +187,30 @@ const SnkGrid = class {
184
187
  async findColumn() {
185
188
  await fieldSearch.openFieldSearch(this._moreOptions, this._columnSearch);
186
189
  }
190
+ /**
191
+ * Registra um editor customizado para campos da grade e formulário
192
+ */
193
+ async addCustomEditor(fieldName, customEditor, detailContext) {
194
+ if (this._grid) {
195
+ this._grid.addCustomEditor(fieldName, customEditor, detailContext);
196
+ return;
197
+ }
198
+ const newCustomEditors = new Map(this._customEditors);
199
+ newCustomEditors.set(fieldName, { customEditor, detailContext });
200
+ this._customEditors = newCustomEditors;
201
+ }
202
+ /**
203
+ * Registra um render customizado para colunas da grid.
204
+ */
205
+ async addGridCustomRender(fieldName, customRender, detailContext) {
206
+ if (this._grid) {
207
+ this._grid.addGridCustomRender(fieldName, customRender, detailContext);
208
+ return;
209
+ }
210
+ const newCustomRenders = new Map(this._customRenders);
211
+ newCustomRenders.set(fieldName, { customRender, detailContext });
212
+ this._customRenders = newCustomRenders;
213
+ }
187
214
  /**
188
215
  * Registra um formatador de valores para uma coluna da grid.
189
216
  */
@@ -282,6 +309,24 @@ const SnkGrid = class {
282
309
  this.columnFilterDataSource.setDataUnit(this._dataUnit);
283
310
  }
284
311
  }
312
+ setCustomRenders() {
313
+ if (!this._grid) {
314
+ return;
315
+ }
316
+ for (const [fieldName, customRenderProps] of this._customRenders) {
317
+ this._grid.addGridCustomRender(fieldName, customRenderProps.customRender, customRenderProps.detailContext);
318
+ this._customRenders.delete(fieldName);
319
+ }
320
+ }
321
+ setCustomEditors() {
322
+ if (!this._grid) {
323
+ return;
324
+ }
325
+ for (const [fieldName, customEditorProps] of this._customEditors) {
326
+ this._grid.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
327
+ this._customEditors.delete(fieldName);
328
+ }
329
+ }
285
330
  componentWillLoad() {
286
331
  this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
287
332
  //TODO: substituir pelo metodo nativo closest
@@ -319,6 +364,8 @@ const SnkGrid = class {
319
364
  componentDidRender() {
320
365
  this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
321
366
  this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
367
+ this.setCustomRenders();
368
+ this.setCustomEditors();
322
369
  }
323
370
  async handleDataStateChange(evt) {
324
371
  this._dataState = evt.detail;
@@ -436,7 +483,7 @@ const SnkGrid = class {
436
483
  return undefined;
437
484
  }
438
485
  return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
439
- index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
486
+ index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
440
487
  }
441
488
  get _element() { return index.getElement(this); }
442
489
  static get watchers() { return {
@@ -2,7 +2,7 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-dda10d75.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-7b222c78.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-f56aa7d6.js');
8
8
  const taskbarElements = require('./taskbar-elements-d9392685.js');
@@ -13,7 +13,7 @@ const index$1 = require('./index-0922807b.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-e2109392.js');
16
+ require('./dataunit-fetcher-7a08e4dd.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
18
  require('./form-config-fetcher-3f430aee.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -49,6 +49,8 @@ const SnkGuidesViewer = class {
49
49
  this._formEditorConfigManager = undefined;
50
50
  this._formEditorDataUnit = undefined;
51
51
  this._fieldToGetFocus = undefined;
52
+ this._customEditors = undefined;
53
+ this._customRenders = undefined;
52
54
  this._fieldsProps = {};
53
55
  }
54
56
  observeDataUnit() {
@@ -80,6 +82,19 @@ const SnkGuidesViewer = class {
80
82
  async findField() {
81
83
  await fieldSearch.openFieldSearch(this._moreOptions, this._fieldSearch);
82
84
  }
85
+ /**
86
+ * Registra um editor customizado para campos da grade e formulário
87
+ */
88
+ async addCustomEditor(fieldName, customEditor) {
89
+ this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
90
+ }
91
+ /**
92
+ * Registra um render customizado para colunas da grid.
93
+ */
94
+ async addGridCustomRender(fieldName, customRender) {
95
+ this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
96
+ }
97
+ ;
83
98
  /**
84
99
  * Altera/adiciona uma propriedade nos metadados do campo.
85
100
  */
@@ -231,7 +246,7 @@ const SnkGuidesViewer = class {
231
246
  if (sheet == undefined) {
232
247
  return;
233
248
  }
234
- return index.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 });
249
+ return index.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 });
235
250
  })));
236
251
  }
237
252
  wrapDetail(levels, content) {
@@ -273,14 +288,14 @@ const SnkGuidesViewer = class {
273
288
  else {
274
289
  detailBranch = this.selectedGuide;
275
290
  }
276
- content = this.wrapDetail(levels, index.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 }));
291
+ content = this.wrapDetail(levels, index.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 }));
277
292
  }
278
293
  else {
279
294
  const cardId = this.selectedGuide.id;
280
295
  const sheet = this._masterFormMetadata.getSheet(cardId);
281
296
  if (sheet) {
282
297
  const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
283
- content = index.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 == index$1.PresentationMode.SECONDARY && this.buildTaskBar());
298
+ content = index.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 == index$1.PresentationMode.SECONDARY && this.buildTaskBar());
284
299
  }
285
300
  }
286
301
  return content;
@@ -487,6 +502,7 @@ const SnkGuidesViewer = class {
487
502
  recordsValidator: this.recordsValidator,
488
503
  fieldToFocus: this._fieldToGetFocus,
489
504
  onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
505
+ propsCustomEditor: this._customEditors,
490
506
  fieldsProps: this._fieldsProps
491
507
  }), this.getContent())), index.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 })));
492
508
  }