@sankhyalabs/sankhyablocks 10.1.0-dev.23 → 10.1.0-dev.24

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 (158) hide show
  1. package/dist/cjs/{ConfigStorage-a4e1e518.js → ConfigStorage-f61eedd2.js} +2 -2
  2. package/dist/cjs/{DataFetcher-0b6aa084.js → DataFetcher-0c830777.js} +2 -2743
  3. package/dist/cjs/{ISave-2c455a77.js → ISave-e1e8ec96.js} +1 -1
  4. package/dist/cjs/ImageUtils-5e3f406b.js +142 -0
  5. package/dist/cjs/{SnkFormConfigManager-b8c81493.js → SnkFormConfigManager-421f3581.js} +2 -2
  6. package/dist/cjs/SnkMessageBuilder-32950342.js +2785 -0
  7. package/dist/cjs/{SnkMultiSelectionListDataSource-03b58f5a.js → SnkMultiSelectionListDataSource-d30a96ef.js} +4 -4
  8. package/dist/cjs/{auth-fetcher-7e7796c9.js → auth-fetcher-761d54c4.js} +1 -1
  9. package/dist/cjs/{dataunit-fetcher-8dffbcdf.js → dataunit-fetcher-86e286bb.js} +3 -2
  10. package/dist/cjs/{form-config-fetcher-5516d68a.js → form-config-fetcher-227b2db2.js} +1 -1
  11. package/dist/cjs/index-1894343a.js +4 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -4
  14. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  15. package/dist/cjs/snk-actions-button_9.cjs.entry.js +6 -5
  16. package/dist/cjs/snk-application.cjs.entry.js +8 -7
  17. package/dist/cjs/snk-attach.cjs.entry.js +7 -6
  18. package/dist/cjs/snk-crud.cjs.entry.js +6 -5
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -5
  20. package/dist/cjs/{snk-data-unit-036ce58c.js → snk-data-unit-c06263da.js} +11 -11
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -3
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +11 -10
  23. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +4 -3
  24. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -3
  25. package/dist/cjs/snk-form-view.cjs.entry.js +56 -2
  26. package/dist/cjs/snk-form_2.cjs.entry.js +5 -4
  27. package/dist/cjs/snk-grid.cjs.entry.js +7 -6
  28. package/dist/cjs/{snk-guides-viewer-164c063e.js → snk-guides-viewer-92dadfa6.js} +9 -8
  29. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -7
  30. package/dist/cjs/snk-image-input.cjs.entry.js +148 -0
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +4 -3
  32. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -4
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -7
  34. package/dist/collection/collection-manifest.json +1 -0
  35. package/dist/collection/components/snk-application/snk-application.js +1 -1
  36. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -1
  37. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +75 -2
  38. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +4 -3
  39. package/dist/collection/components/snk-image-input/snk-image-input.css +3 -0
  40. package/dist/collection/components/snk-image-input/snk-image-input.js +326 -0
  41. package/dist/collection/components/snk-image-input/utils/ImageUtils.js +133 -0
  42. package/dist/collection/lib/message/messageResourceEnUSUtils.js +2 -0
  43. package/dist/collection/lib/message/messageResourceEsESUtils.js +2 -0
  44. package/dist/collection/lib/message/messageResourcePtBRUtils.js +2 -0
  45. package/dist/collection/lib/message/resources/en-us/snk-image-input.msg.js +11 -0
  46. package/dist/collection/lib/message/resources/es-es/snk-image-input.msg.js +11 -0
  47. package/dist/collection/lib/message/resources/pt-br/snk-image-input.msg.js +11 -0
  48. package/dist/components/DataFetcher.js +3 -2743
  49. package/dist/components/SnkMessageBuilder.js +2783 -0
  50. package/dist/components/dataunit-fetcher.js +2 -1
  51. package/dist/components/index.d.ts +1 -0
  52. package/dist/components/index.js +1 -0
  53. package/dist/components/snk-application2.js +2 -1
  54. package/dist/components/snk-attach2.js +2 -1
  55. package/dist/components/snk-crud.js +69 -63
  56. package/dist/components/snk-data-unit2.js +1 -1
  57. package/dist/components/snk-detail-view2.js +100 -87
  58. package/dist/components/snk-form-view2.js +65 -5
  59. package/dist/components/snk-image-input.d.ts +11 -0
  60. package/dist/components/snk-image-input.js +6 -0
  61. package/dist/components/snk-image-input2.js +302 -0
  62. package/dist/esm/{ConfigStorage-39ac8fef.js → ConfigStorage-175813dc.js} +2 -2
  63. package/dist/esm/{DataFetcher-0b9da57d.js → DataFetcher-49594174.js} +3 -2743
  64. package/dist/esm/{ISave-f1c9269b.js → ISave-4bdffce4.js} +1 -1
  65. package/dist/esm/ImageUtils-8fc8d905.js +136 -0
  66. package/dist/esm/{SnkFormConfigManager-a87566c8.js → SnkFormConfigManager-0bda2ef5.js} +2 -2
  67. package/dist/esm/SnkMessageBuilder-1c0fada0.js +2783 -0
  68. package/dist/esm/{SnkMultiSelectionListDataSource-01b3744b.js → SnkMultiSelectionListDataSource-e13b72f7.js} +4 -4
  69. package/dist/esm/{auth-fetcher-acdc1cb4.js → auth-fetcher-62c5abf1.js} +1 -1
  70. package/dist/esm/{dataunit-fetcher-4c312b43.js → dataunit-fetcher-b7a9ef67.js} +2 -1
  71. package/dist/esm/{form-config-fetcher-7cda6254.js → form-config-fetcher-5e29a152.js} +1 -1
  72. package/dist/esm/index-04f73a26.js +4 -0
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/esm/pesquisa-grid_2.entry.js +5 -4
  75. package/dist/esm/sankhyablocks.js +1 -1
  76. package/dist/esm/snk-actions-button_9.entry.js +6 -5
  77. package/dist/esm/snk-application.entry.js +7 -6
  78. package/dist/esm/snk-attach.entry.js +6 -5
  79. package/dist/esm/snk-crud.entry.js +6 -5
  80. package/dist/esm/snk-data-exporter.entry.js +6 -5
  81. package/dist/esm/{snk-data-unit-130021b3.js → snk-data-unit-865a1e27.js} +2 -2
  82. package/dist/esm/snk-data-unit.entry.js +4 -3
  83. package/dist/esm/snk-detail-view.entry.js +9 -8
  84. package/dist/esm/snk-filter-bar_4.entry.js +4 -3
  85. package/dist/esm/snk-filter-modal-item.entry.js +4 -3
  86. package/dist/esm/snk-form-view.entry.js +57 -3
  87. package/dist/esm/snk-form_2.entry.js +5 -4
  88. package/dist/esm/snk-grid.entry.js +7 -6
  89. package/dist/esm/{snk-guides-viewer-3fd18298.js → snk-guides-viewer-2e2f48af.js} +9 -8
  90. package/dist/esm/snk-guides-viewer.entry.js +8 -7
  91. package/dist/esm/snk-image-input.entry.js +144 -0
  92. package/dist/esm/snk-personalized-filter.entry.js +4 -3
  93. package/dist/esm/snk-pesquisa.entry.js +5 -4
  94. package/dist/esm/snk-simple-crud.entry.js +8 -7
  95. package/dist/sankhyablocks/p-0fbd3f2f.entry.js +1 -0
  96. package/dist/sankhyablocks/p-164721f4.entry.js +1 -0
  97. package/dist/sankhyablocks/{p-2ac55a5d.js → p-1d0e4e8f.js} +1 -1
  98. package/dist/sankhyablocks/p-3448ebdc.js +60 -0
  99. package/dist/sankhyablocks/{p-7ee6b1bf.js → p-34d56802.js} +1 -1
  100. package/dist/sankhyablocks/p-36a82166.entry.js +1 -0
  101. package/dist/sankhyablocks/p-3f762af3.entry.js +1 -0
  102. package/dist/sankhyablocks/p-4005bd63.entry.js +1 -0
  103. package/dist/sankhyablocks/p-4ff3b494.js +1 -0
  104. package/dist/sankhyablocks/{p-5e2dffc1.entry.js → p-71ea8d08.entry.js} +2 -2
  105. package/dist/sankhyablocks/p-8bf2a358.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-d714b6ca.js → p-8e5f4851.js} +1 -1
  107. package/dist/sankhyablocks/{p-1f310bc6.js → p-93f4104a.js} +1 -1
  108. package/dist/sankhyablocks/p-abcfff93.entry.js +1 -0
  109. package/dist/sankhyablocks/p-b10e79bb.js +1 -0
  110. package/dist/sankhyablocks/p-bafeda2d.entry.js +1 -0
  111. package/dist/sankhyablocks/{p-48a5c311.js → p-bf37b0e2.js} +2 -2
  112. package/dist/sankhyablocks/p-c5d6717d.entry.js +1 -0
  113. package/dist/sankhyablocks/p-d2581c6b.entry.js +1 -0
  114. package/dist/sankhyablocks/p-d4e3e549.js +1 -0
  115. package/dist/sankhyablocks/p-ddb20d9e.entry.js +1 -0
  116. package/dist/sankhyablocks/p-e19a65a2.js +1 -0
  117. package/dist/sankhyablocks/p-e892ae6c.entry.js +1 -0
  118. package/dist/sankhyablocks/p-e9bbd66b.js +1 -0
  119. package/dist/sankhyablocks/p-e9e9ff1c.entry.js +1 -0
  120. package/dist/sankhyablocks/p-f21109d6.entry.js +1 -0
  121. package/dist/sankhyablocks/p-f455a553.entry.js +1 -0
  122. package/dist/sankhyablocks/p-f61fef9a.entry.js +1 -0
  123. package/dist/sankhyablocks/{p-998a9d6f.js → p-f63e1093.js} +1 -1
  124. package/dist/sankhyablocks/p-fc0736ad.entry.js +1 -0
  125. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  126. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  127. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +9 -0
  128. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +1 -0
  129. package/dist/types/components/snk-image-input/snk-image-input.d.ts +56 -0
  130. package/dist/types/components/snk-image-input/utils/ImageUtils.d.ts +15 -0
  131. package/dist/types/components.d.ts +89 -0
  132. package/dist/types/lib/message/resources/en-us/snk-image-input.msg.d.ts +1 -0
  133. package/dist/types/lib/message/resources/es-es/snk-image-input.msg.d.ts +1 -0
  134. package/dist/types/lib/message/resources/pt-br/snk-image-input.msg.d.ts +1 -0
  135. package/package.json +1 -1
  136. package/react/components.d.ts +1 -0
  137. package/react/components.js +1 -0
  138. package/react/components.js.map +1 -1
  139. package/dist/sankhyablocks/p-12f595a6.entry.js +0 -1
  140. package/dist/sankhyablocks/p-18d66638.entry.js +0 -1
  141. package/dist/sankhyablocks/p-2a33d4cf.entry.js +0 -1
  142. package/dist/sankhyablocks/p-2c6be187.entry.js +0 -1
  143. package/dist/sankhyablocks/p-3a443150.entry.js +0 -1
  144. package/dist/sankhyablocks/p-3b6d8d33.entry.js +0 -1
  145. package/dist/sankhyablocks/p-3db72758.entry.js +0 -1
  146. package/dist/sankhyablocks/p-52691b42.js +0 -1
  147. package/dist/sankhyablocks/p-6768f176.js +0 -1
  148. package/dist/sankhyablocks/p-6d322b0a.js +0 -1
  149. package/dist/sankhyablocks/p-877d9614.entry.js +0 -1
  150. package/dist/sankhyablocks/p-94267a30.entry.js +0 -1
  151. package/dist/sankhyablocks/p-9e4555ab.js +0 -60
  152. package/dist/sankhyablocks/p-acd2ba28.entry.js +0 -1
  153. package/dist/sankhyablocks/p-b533edab.entry.js +0 -1
  154. package/dist/sankhyablocks/p-c2d33fc8.entry.js +0 -1
  155. package/dist/sankhyablocks/p-cd40c8cf.entry.js +0 -1
  156. package/dist/sankhyablocks/p-cd412add.entry.js +0 -1
  157. package/dist/sankhyablocks/p-d6dad5e4.entry.js +0 -1
  158. package/dist/sankhyablocks/p-f8c5395a.entry.js +0 -1
@@ -8,15 +8,16 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const IFetchDataExporterParams = require('./IFetchDataExporterParams-e78ec415.js');
9
9
  const index = require('./index-e3e39724.js');
10
10
  const constants = require('./constants-6d82e405.js');
11
- const DataFetcher = require('./DataFetcher-0b6aa084.js');
12
- const snkDataUnit = require('./snk-data-unit-036ce58c.js');
13
- require('./ISave-2c455a77.js');
11
+ const DataFetcher = require('./DataFetcher-0c830777.js');
12
+ const snkDataUnit = require('./snk-data-unit-c06263da.js');
13
+ require('./ISave-e1e8ec96.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
- require('./dataunit-fetcher-8dffbcdf.js');
16
+ require('./dataunit-fetcher-86e286bb.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
- require('./form-config-fetcher-5516d68a.js');
18
+ require('./form-config-fetcher-227b2db2.js');
19
19
  require('./PrintUtils-bcaeb82f.js');
20
+ require('./SnkMessageBuilder-32950342.js');
20
21
  require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
21
22
  require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
22
23
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
@@ -3,8 +3,8 @@
3
3
  const index = require('./index-1894343a.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
- const DataFetcher = require('./DataFetcher-0b6aa084.js');
7
- const dataunitFetcher = require('./dataunit-fetcher-8dffbcdf.js');
6
+ const SnkMessageBuilder = require('./SnkMessageBuilder-32950342.js');
7
+ const dataunitFetcher = require('./dataunit-fetcher-86e286bb.js');
8
8
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
9
9
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
10
10
 
@@ -700,7 +700,7 @@ const SnkDataUnit = class {
700
700
  this.dataState = await this.buildDataState();
701
701
  let saveOperation = changes[0]._operation.toLowerCase();
702
702
  if (saveOperation == 'copy') {
703
- saveOperation = DataFetcher.OperationMap.CLONE;
703
+ saveOperation = SnkMessageBuilder.OperationMap.CLONE;
704
704
  }
705
705
  if (this.canIgnoreOperationMessage(saveOperation))
706
706
  return;
@@ -713,7 +713,7 @@ const SnkDataUnit = class {
713
713
  return this.ignoreSaveMessage && !this.isCloneOrInsertOperation(saveOperation);
714
714
  }
715
715
  isCloneOrInsertOperation(saveOperation) {
716
- return [DataFetcher.OperationMap.CLONE, DataFetcher.OperationMap.INSERT].includes(saveOperation);
716
+ return [SnkMessageBuilder.OperationMap.CLONE, SnkMessageBuilder.OperationMap.INSERT].includes(saveOperation);
717
717
  }
718
718
  buildOperationMessage(saveOperation, records) {
719
719
  if (this.isMultiplesUpdate(saveOperation, records)) {
@@ -728,10 +728,10 @@ const SnkDataUnit = class {
728
728
  * de um registro se trata de uma chave composta.
729
729
  */
730
730
  const key = `snkDataUnit.${isCancel ? 'cancelInfo' : 'saveInfo'}`;
731
- return this.getMessage(key, { records: records }, DataFetcher.OperationMap.UPDATE_MULTIPLES);
731
+ return this.getMessage(key, { records: records }, SnkMessageBuilder.OperationMap.UPDATE_MULTIPLES);
732
732
  }
733
733
  isMultiplesUpdate(saveOperation, records) {
734
- return saveOperation === DataFetcher.OperationMap.UPDATE && records.length > 1;
734
+ return saveOperation === SnkMessageBuilder.OperationMap.UPDATE && records.length > 1;
735
735
  }
736
736
  handleRecordsRemoved(action) {
737
737
  var _a, _b;
@@ -776,15 +776,15 @@ const SnkDataUnit = class {
776
776
  }
777
777
  getMessageOperation() {
778
778
  if (this.dataState.copyMode) {
779
- return DataFetcher.OperationMap.CLONE;
779
+ return SnkMessageBuilder.OperationMap.CLONE;
780
780
  }
781
781
  if (this.dataState.insertionMode || this.dataState.isStartingInsertionMode) {
782
- return DataFetcher.OperationMap.INSERT;
782
+ return SnkMessageBuilder.OperationMap.INSERT;
783
783
  }
784
784
  if (this.dataState.isDirty) {
785
- return DataFetcher.OperationMap.UPDATE;
785
+ return SnkMessageBuilder.OperationMap.UPDATE;
786
786
  }
787
- return DataFetcher.OperationMap.CLEAN;
787
+ return SnkMessageBuilder.OperationMap.CLEAN;
788
788
  }
789
789
  async getDataUnitParentOrChild() {
790
790
  var _a;
@@ -887,7 +887,7 @@ const SnkDataUnit = class {
887
887
  if (this.messagesBuilder) {
888
888
  return;
889
889
  }
890
- this.messagesBuilder = new DataFetcher.SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
890
+ this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
891
891
  }
892
892
  //---------------------------------------------
893
893
  // Lifecycle web component
@@ -2,14 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkDataUnit = require('./snk-data-unit-036ce58c.js');
5
+ const snkDataUnit = require('./snk-data-unit-c06263da.js');
6
6
  require('./index-1894343a.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
- require('./DataFetcher-0b6aa084.js');
9
+ require('./SnkMessageBuilder-32950342.js');
10
+ require('./dataunit-fetcher-86e286bb.js');
11
+ require('./DataFetcher-0c830777.js');
10
12
  require('./PrintUtils-bcaeb82f.js');
11
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
12
- require('./dataunit-fetcher-8dffbcdf.js');
13
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
15
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
15
16
  require('@sankhyalabs/core/dist/utils/SortingUtils');
@@ -4,21 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-b8c81493.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-421f3581.js');
8
8
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
9
- const DataFetcher = require('./DataFetcher-0b6aa084.js');
10
- require('./ISave-2c455a77.js');
9
+ require('./DataFetcher-0c830777.js');
10
+ require('./ISave-e1e8ec96.js');
11
11
  const index$1 = require('./index-e3e39724.js');
12
12
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./dataunit-fetcher-8dffbcdf.js');
14
+ require('./dataunit-fetcher-86e286bb.js');
15
15
  require('./filter-item-type.enum-a7ffdaa6.js');
16
- require('./form-config-fetcher-5516d68a.js');
16
+ require('./form-config-fetcher-227b2db2.js');
17
17
  const constants = require('./constants-6d82e405.js');
18
18
  const taskbarElements = require('./taskbar-elements-8a80420e.js');
19
- const snkGuidesViewer = require('./snk-guides-viewer-164c063e.js');
19
+ const snkGuidesViewer = require('./snk-guides-viewer-92dadfa6.js');
20
+ const SnkMessageBuilder = require('./SnkMessageBuilder-32950342.js');
20
21
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
21
- require('./ConfigStorage-a4e1e518.js');
22
+ require('./ConfigStorage-f61eedd2.js');
22
23
  require('./PrintUtils-bcaeb82f.js');
23
24
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
24
25
  require('@sankhyalabs/core/dist/utils/SortingUtils');
@@ -34,7 +35,7 @@ class GuideBuilder {
34
35
  this._dataUnit = dataUnit;
35
36
  this._messageBuilder = messageBuilder;
36
37
  if (!this._messageBuilder) {
37
- this._messageBuilder = new DataFetcher.SnkMessageBuilder();
38
+ this._messageBuilder = new SnkMessageBuilder.SnkMessageBuilder();
38
39
  }
39
40
  }
40
41
  get id() {
@@ -303,7 +304,7 @@ const SnkDetailView = class {
303
304
  this.formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata(), this.dataUnit);
304
305
  this.formConfigManager.loadConfig();
305
306
  if (this.messagesBuilder == undefined) {
306
- this.messagesBuilder = new DataFetcher.SnkMessageBuilder(this.entityName);
307
+ this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
307
308
  }
308
309
  }
309
310
  async componentDidLoad() {
@@ -373,7 +374,7 @@ const SnkDetailView = class {
373
374
  render() {
374
375
  this.updateLabel();
375
376
  //const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
376
- return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
377
+ return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
377
378
  }
378
379
  get _element() { return index.getElement(this); }
379
380
  static get watchers() { return {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index$1 = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
8
- const ConfigStorage = require('./ConfigStorage-a4e1e518.js');
8
+ const ConfigStorage = require('./ConfigStorage-f61eedd2.js');
9
9
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-eccb267a.js');
10
10
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
11
11
  const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
@@ -16,9 +16,10 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
16
16
  const defaultFilters = require('./default-filters-a09bf82b.js');
17
17
  const filterType_enum = require('./filter-type.enum-2bb46d2a.js');
18
18
  const filterValidate = require('./filter-validate-cb4ed41a.js');
19
- require('./form-config-fetcher-5516d68a.js');
20
- require('./DataFetcher-0b6aa084.js');
19
+ require('./form-config-fetcher-227b2db2.js');
20
+ require('./DataFetcher-0c830777.js');
21
21
  require('./PrintUtils-bcaeb82f.js');
22
+ require('./SnkMessageBuilder-32950342.js');
22
23
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
23
24
 
24
25
  const buildFilter = (item) => {
@@ -4,13 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const ConfigStorage = require('./ConfigStorage-a4e1e518.js');
7
+ const ConfigStorage = require('./ConfigStorage-f61eedd2.js');
8
8
  const presentationMode = require('./presentationMode-52ec3bdd.js');
9
9
  const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
10
10
  const filterType_enum = require('./filter-type.enum-2bb46d2a.js');
11
- require('./form-config-fetcher-5516d68a.js');
12
- require('./DataFetcher-0b6aa084.js');
11
+ require('./form-config-fetcher-227b2db2.js');
12
+ require('./DataFetcher-0c830777.js');
13
13
  require('./PrintUtils-bcaeb82f.js');
14
+ require('./SnkMessageBuilder-32950342.js');
14
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
16
 
16
17
  const snkFilterModalItemCss = ".grow{flex-grow:1}.gap{gap:4px}";
@@ -6,9 +6,22 @@ const index = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
8
8
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
9
+ const ImageUtils = require('./ImageUtils-5e3f406b.js');
9
10
 
10
11
  const snkFormViewCss = ".sc-snk-form-view-h{display:flex;width:100%;--ez-form-card-summary-field-content-weight:700}.level-path.sc-snk-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";
11
12
 
13
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s)
16
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
+ t[p] = s[p];
18
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
21
+ t[p[i]] = s[p[i]];
22
+ }
23
+ return t;
24
+ };
12
25
  const SnkFormView = class {
13
26
  constructor(hostRef) {
14
27
  index.registerInstance(this, hostRef);
@@ -17,6 +30,21 @@ const SnkFormView = class {
17
30
  this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
18
31
  this._customEditors = new Map();
19
32
  this._fieldProps = new Map();
33
+ this.dataUnitObserver = async (action) => {
34
+ if (action.type === core.Action.RECORDS_COPIED) {
35
+ const sourcePK = this.buildSourceRecordPK(action);
36
+ this.getImageField().forEach(async (field) => {
37
+ this.dataUnit.setFieldValue(field.name, JSON.stringify(sourcePK));
38
+ });
39
+ }
40
+ };
41
+ this.customUiBuilders = new Map([
42
+ [core.UserInterface.IMAGE, (_a) => {
43
+ var { name } = _a, props = __rest(_a, ["name"]);
44
+ return index.h("snk-image-input", Object.assign({ dataUnit: this.dataUnit, maxSize: Infinity, fieldName: name, entityName: this.entityPath }, props));
45
+ }
46
+ ]
47
+ ]);
20
48
  this._singleColumn = false;
21
49
  this.levelPath = undefined;
22
50
  this.fieldSearch = undefined;
@@ -34,6 +62,7 @@ const SnkFormView = class {
34
62
  this.fieldToFocus = undefined;
35
63
  this.customEditors = undefined;
36
64
  this.fieldsProps = undefined;
65
+ this.entityPath = undefined;
37
66
  }
38
67
  async showUp() {
39
68
  if (this._formView) {
@@ -83,6 +112,11 @@ const SnkFormView = class {
83
112
  }
84
113
  }
85
114
  }
115
+ async observeDataUnit(newValue, oldValue) {
116
+ if (newValue !== oldValue && newValue) {
117
+ newValue.subscribe(this.dataUnitObserver);
118
+ }
119
+ }
86
120
  changeFix() {
87
121
  this.fixed = !this.fixed;
88
122
  this.emitEvent("fixed");
@@ -140,6 +174,9 @@ const SnkFormView = class {
140
174
  if (this._dataBinder != undefined) {
141
175
  this._dataBinder.onDisconnectedCallback();
142
176
  }
177
+ if (this.dataUnit) {
178
+ this.dataUnit.unsubscribe(this.dataUnitObserver);
179
+ }
143
180
  }
144
181
  componentDidLoad() {
145
182
  this.observePropsCustomEditor(this.customEditors);
@@ -198,6 +235,22 @@ const SnkFormView = class {
198
235
  });
199
236
  }
200
237
  }
238
+ buildSourceRecordPK(action) {
239
+ var _a, _b;
240
+ const currentRecord = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a[0]) || {};
241
+ const sourceBase64 = currentRecord["__record__source__id__"];
242
+ const sourceRecord = JSON.parse(atob(sourceBase64 || ''));
243
+ delete sourceRecord["__DATA_UNIT_NAME__"];
244
+ const pkFields = Object.keys(ImageUtils.getPKs(this.dataUnit));
245
+ const filteredSourceRecord = {};
246
+ for (const pkField of pkFields) {
247
+ filteredSourceRecord[pkField] = (_b = sourceRecord[pkField]) === null || _b === void 0 ? void 0 : _b.value;
248
+ }
249
+ return filteredSourceRecord;
250
+ }
251
+ getImageField() {
252
+ return this.dataUnit.metadata.fields.filter(field => field.userInterface === core.UserInterface.IMAGE);
253
+ }
201
254
  render() {
202
255
  return (index.h(index.Host, { class: "ez-box__container" }, index.h("div", { class: "summary-header ez-flex ez-size-width--full", ref: ref => this._headerContainer = ref }, index.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 ? index.h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), index.h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
203
256
  index.h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": core.ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
@@ -205,11 +258,12 @@ const SnkFormView = class {
205
258
  ?
206
259
  index.h("snk-form-summary", { summary: this.getCardSummary() })
207
260
  :
208
- index.h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event), singleColumn: this._singleColumn }), this.fieldSearch && index.h("ez-popover", { ref: elem => (this._ezPopoverFieldColumn = elem), overlayType: "none" }, this.fieldSearch)));
261
+ index.h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event), singleColumn: this._singleColumn, customUiBuilders: this.customUiBuilders }), this.fieldSearch && index.h("ez-popover", { ref: elem => (this._ezPopoverFieldColumn = elem), overlayType: "none" }, this.fieldSearch)));
209
262
  }
210
263
  static get watchers() { return {
211
264
  "customEditors": ["observePropsCustomEditor"],
212
- "fieldsProps": ["observeFieldsProps"]
265
+ "fieldsProps": ["observeFieldsProps"],
266
+ "dataUnit": ["observeDataUnit"]
213
267
  }; }
214
268
  };
215
269
  SnkFormView.style = snkFormViewCss;
@@ -4,16 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-b8c81493.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-421f3581.js');
8
8
  const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
9
9
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
10
10
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
11
- const formConfigFetcher = require('./form-config-fetcher-5516d68a.js');
11
+ const formConfigFetcher = require('./form-config-fetcher-227b2db2.js');
12
12
  const constants = require('./constants-6d82e405.js');
13
13
  const FormConfigHelper = require('./FormConfigHelper-28fe4668.js');
14
- require('./ConfigStorage-a4e1e518.js');
15
- require('./DataFetcher-0b6aa084.js');
14
+ require('./ConfigStorage-f61eedd2.js');
15
+ require('./DataFetcher-0c830777.js');
16
16
  require('./PrintUtils-bcaeb82f.js');
17
+ require('./SnkMessageBuilder-32950342.js');
17
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
18
19
  require('./filter-item-type.enum-a7ffdaa6.js');
19
20
 
@@ -6,23 +6,24 @@ const index = require('./index-1894343a.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
8
8
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
9
- require('./DataFetcher-0b6aa084.js');
10
- require('./ISave-2c455a77.js');
11
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-03b58f5a.js');
9
+ require('./DataFetcher-0c830777.js');
10
+ require('./ISave-e1e8ec96.js');
11
+ const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-d30a96ef.js');
12
12
  const index$1 = require('./index-e3e39724.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
- require('./dataunit-fetcher-8dffbcdf.js');
15
+ require('./dataunit-fetcher-86e286bb.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
- require('./form-config-fetcher-5516d68a.js');
17
+ require('./form-config-fetcher-227b2db2.js');
18
18
  require('./constants-6d82e405.js');
19
- const ConfigStorage = require('./ConfigStorage-a4e1e518.js');
19
+ const ConfigStorage = require('./ConfigStorage-f61eedd2.js');
20
20
  const index$2 = require('./index-f0fe7e6e.js');
21
21
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
22
22
  const filterValidate = require('./filter-validate-cb4ed41a.js');
23
23
  const taskbarElements = require('./taskbar-elements-8a80420e.js');
24
24
  const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
26
+ require('./SnkMessageBuilder-32950342.js');
26
27
  require('./IFetchDataExporterParams-e78ec415.js');
27
28
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
28
29
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
@@ -5,16 +5,16 @@ const core = require('@sankhyalabs/core');
5
5
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
6
6
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
7
7
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
8
- require('./DataFetcher-0b6aa084.js');
9
- require('./ISave-2c455a77.js');
8
+ require('./DataFetcher-0c830777.js');
9
+ require('./ISave-e1e8ec96.js');
10
10
  const index$1 = require('./index-e3e39724.js');
11
11
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
12
12
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
13
- require('./dataunit-fetcher-8dffbcdf.js');
13
+ require('./dataunit-fetcher-86e286bb.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
- require('./form-config-fetcher-5516d68a.js');
15
+ require('./form-config-fetcher-227b2db2.js');
16
16
  const constants = require('./constants-6d82e405.js');
17
- const SnkFormConfigManager = require('./SnkFormConfigManager-b8c81493.js');
17
+ const SnkFormConfigManager = require('./SnkFormConfigManager-421f3581.js');
18
18
  const taskbarElements = require('./taskbar-elements-8a80420e.js');
19
19
  const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
20
20
 
@@ -302,7 +302,7 @@ const SnkGuidesViewer = class {
302
302
  if (sheet == undefined) {
303
303
  return;
304
304
  }
305
- 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 });
305
+ 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, entityPath: params.entityPath });
306
306
  })));
307
307
  }
308
308
  wrapDetail(levels, content) {
@@ -347,7 +347,7 @@ const SnkGuidesViewer = class {
347
347
  if (!sheet)
348
348
  return;
349
349
  const cardConfig = (_b = (_a = this.masterFormConfig) === null || _a === void 0 ? void 0 : _a.cardsState) === null || _b === void 0 ? void 0 : _b.get(cardId);
350
- return (index.h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == index$1.PresentationMode.SECONDARY && this.buildTaskBar()));
350
+ return (index.h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch, entityPath: this.entityPath }, this.presentationMode == index$1.PresentationMode.SECONDARY && this.buildTaskBar()));
351
351
  }
352
352
  isDetailGuide(childEntityName, levels) {
353
353
  return childEntityName || levels.length > 0;
@@ -619,7 +619,8 @@ const SnkGuidesViewer = class {
619
619
  fieldToFocus: this._fieldToGetFocus,
620
620
  onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
621
621
  propsCustomEditor: this._customEditors,
622
- fieldsProps: this._fieldsProps
622
+ fieldsProps: this._fieldsProps,
623
+ entityPath: this.entityPath
623
624
  }), 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 })));
624
625
  }
625
626
  render() {
@@ -2,27 +2,28 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-164c063e.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-92dadfa6.js');
6
6
  require('./index-1894343a.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/core/dist/dataunit/DataUnit');
9
9
  require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  require('@sankhyalabs/ezui/dist/collection/utils/form');
11
- require('./DataFetcher-0b6aa084.js');
11
+ require('./DataFetcher-0c830777.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
+ require('./SnkMessageBuilder-32950342.js');
13
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./ISave-2c455a77.js');
15
+ require('./ISave-e1e8ec96.js');
15
16
  require('./index-e3e39724.js');
16
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
17
- require('./dataunit-fetcher-8dffbcdf.js');
18
+ require('./dataunit-fetcher-86e286bb.js');
18
19
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
19
20
  require('@sankhyalabs/core/dist/utils/SortingUtils');
20
21
  require('./ResourceIDUtils-5ff86aa7.js');
21
22
  require('./filter-item-type.enum-a7ffdaa6.js');
22
- require('./form-config-fetcher-5516d68a.js');
23
+ require('./form-config-fetcher-227b2db2.js');
23
24
  require('./constants-6d82e405.js');
24
- require('./SnkFormConfigManager-b8c81493.js');
25
- require('./ConfigStorage-a4e1e518.js');
25
+ require('./SnkFormConfigManager-421f3581.js');
26
+ require('./ConfigStorage-f61eedd2.js');
26
27
  require('./taskbar-elements-8a80420e.js');
27
28
  require('./index-f0fe7e6e.js');
28
29
  require('./taskbar-processor-2fba34a8.js');
@@ -0,0 +1,148 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1894343a.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const SnkMessageBuilder = require('./SnkMessageBuilder-32950342.js');
8
+ const ImageUtils = require('./ImageUtils-5e3f406b.js');
9
+
10
+ const snkImageInputCss = ":host{display:block}";
11
+
12
+ const SnkImageInput = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.imageError = index.createEvent(this, "imageError", 7);
16
+ this.dataUnitObserver = async (action) => {
17
+ var _a;
18
+ const actionsMoveSelection = [core.Action.NEXT_SELECTED, core.Action.PREVIOUS_SELECTED];
19
+ if (actionsMoveSelection.includes(action.type)) {
20
+ await this.loadImage();
21
+ return;
22
+ }
23
+ const selection = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.selection) || [];
24
+ if (action.type === core.Action.SELECTION_CHANGED && selection.length > 0) {
25
+ await this.loadImage();
26
+ return;
27
+ }
28
+ if (action.type === core.Action.RECORDS_ADDED) {
29
+ await this.clearImage();
30
+ return;
31
+ }
32
+ };
33
+ this.dataUnit = undefined;
34
+ this.fieldName = undefined;
35
+ this.entityName = undefined;
36
+ this.enabled = true;
37
+ this.acceptType = undefined;
38
+ this.maxSize = undefined;
39
+ this.label = undefined;
40
+ this.imageValue = undefined;
41
+ this.loading = true;
42
+ }
43
+ /**
44
+ * Força o reload da imagem
45
+ */
46
+ async reloadImage(pks) {
47
+ await this.loadImage(pks);
48
+ }
49
+ getMessage(key, params) {
50
+ if (!this.messagesBuilder) {
51
+ this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder();
52
+ }
53
+ return this.messagesBuilder.getMessage(key, params);
54
+ }
55
+ async clearImage() {
56
+ this.imageValue = undefined;
57
+ }
58
+ async handleImageChange(event) {
59
+ const base64 = event.detail;
60
+ if (!base64) {
61
+ await this.clearImage();
62
+ await this.updatedataUnitField(true);
63
+ return;
64
+ }
65
+ const blob = await ImageUtils.base64ToBlob(base64);
66
+ if (this.maxSize && blob.size > this.maxSize * 1024) {
67
+ const errorMsg = this.getMessage('snkImageInput.errorImageSize') + this.maxSize + '(KB)';
68
+ this.imageError.emit(errorMsg);
69
+ if (this.application) {
70
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), errorMsg);
71
+ }
72
+ return;
73
+ }
74
+ this.imageValue = base64;
75
+ await ImageUtils.sessionFileUpload(blob, this.entityName, this.fieldName);
76
+ await this.updatedataUnitField();
77
+ }
78
+ async updatedataUnitField(deleted = false) {
79
+ if (!this.dataUnit || !this.dataUnit.getSelectedRecord()) {
80
+ return;
81
+ }
82
+ if (deleted) {
83
+ await this.dataUnit.setFieldValue(this.fieldName, 'deletado');
84
+ }
85
+ else {
86
+ await this.dataUnit.setFieldValue(this.fieldName, `$file.session.key{${ImageUtils.buildFileKey(this.entityName, this.fieldName)}}`);
87
+ }
88
+ }
89
+ async handleImageError(event) {
90
+ this.imageError.emit(event.detail);
91
+ if (this.application) {
92
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), event.detail);
93
+ }
94
+ }
95
+ getPksFromDataUnit() {
96
+ if (!this.dataUnit) {
97
+ return undefined;
98
+ }
99
+ const selectedRecord = this.dataUnit.getSelectedRecord();
100
+ if (!selectedRecord) {
101
+ return undefined;
102
+ }
103
+ const fieldValue = selectedRecord[this.fieldName];
104
+ if (!fieldValue) {
105
+ return undefined;
106
+ }
107
+ try {
108
+ const pk = JSON.parse(fieldValue);
109
+ return pk;
110
+ }
111
+ catch (error) {
112
+ console.error('Error parsing PK from data unit field:', error);
113
+ return undefined;
114
+ }
115
+ }
116
+ async loadImage(pks) {
117
+ var _a;
118
+ this.loading = true;
119
+ if (this.dataUnit && this.entityName) {
120
+ pks = (_a = pks !== null && pks !== void 0 ? pks : this.getPksFromDataUnit()) !== null && _a !== void 0 ? _a : ImageUtils.getPKs(this.dataUnit);
121
+ this.imageValue = await ImageUtils.downloadImage(pks, this.fieldName, this.entityName);
122
+ }
123
+ this.loading = false;
124
+ }
125
+ async componentWillLoad() {
126
+ this.application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
127
+ if (!this.messagesBuilder) {
128
+ this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder();
129
+ }
130
+ if (this.dataUnit) {
131
+ this.dataUnit.subscribe(this.dataUnitObserver);
132
+ }
133
+ }
134
+ disconnectedCallback() {
135
+ if (this.dataUnit) {
136
+ this.dataUnit.unsubscribe(this.dataUnitObserver);
137
+ }
138
+ }
139
+ async componentDidLoad() {
140
+ await this.loadImage();
141
+ }
142
+ render() {
143
+ return (index.h(index.Host, null, index.h("ez-image-input", { enabled: this.enabled, label: this.label, name: this.fieldName, value: this.imageValue, maxFileSize: this.maxSize ? this.maxSize * 1024 : undefined, accept: this.acceptType || 'image/png,image/jpeg,image/gif', onEzChange: (e) => this.handleImageChange(e), onEzError: (e) => this.handleImageError(e), loading: this.loading })));
144
+ }
145
+ };
146
+ SnkImageInput.style = snkImageInputCss;
147
+
148
+ exports.snk_image_input = SnkImageInput;