@sankhyalabs/sankhyablocks 8.15.0-dev.8 → 8.15.0-rc.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 (159) hide show
  1. package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
  2. package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{dataunit-fetcher-14108bec.js → pesquisa-fetcher-e4a7c4c3.js} +235 -26
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_2.cjs.entry.js +5 -4
  7. package/dist/cjs/snk-application.cjs.entry.js +12 -4
  8. package/dist/cjs/snk-attach.cjs.entry.js +388 -57
  9. package/dist/cjs/snk-crud.cjs.entry.js +3 -4
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  11. package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -5
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -1
  15. package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
  16. package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -1
  17. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
  18. package/dist/cjs/{snk-guides-viewer-c8b9374f.js → snk-guides-viewer-d32c096f.js} +2 -3
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
  20. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-simple-crud.cjs.entry.js +17 -6
  22. package/dist/collection/collection-manifest.json +1 -1
  23. package/dist/collection/components/snk-application/snk-application.js +52 -9
  24. package/dist/collection/components/snk-attach/snk-attach.js +188 -39
  25. package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
  26. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
  27. package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
  28. package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
  29. package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
  30. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
  31. package/dist/collection/components/snk-attach/structure/index.js +6 -3
  32. package/dist/collection/components/snk-crud/snk-crud.js +1 -1
  33. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
  34. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
  35. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -0
  36. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +19 -1
  37. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -0
  38. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
  39. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
  40. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
  41. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +3 -1
  42. package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
  43. package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
  44. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
  45. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
  46. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
  47. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
  48. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
  49. package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
  50. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +29 -2
  51. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +37 -23
  52. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +7 -1
  53. package/dist/collection/lib/index.js +1 -1
  54. package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
  55. package/dist/components/SnkMessageBuilder.js +13 -0
  56. package/dist/components/dataunit-fetcher.js +74 -27
  57. package/dist/components/snk-actions-button2.js +1 -0
  58. package/dist/components/snk-application2.js +11 -1
  59. package/dist/components/snk-attach2.js +394 -57
  60. package/dist/components/snk-crud.js +1 -1
  61. package/dist/components/snk-data-exporter2.js +1 -1
  62. package/dist/components/snk-filter-bar2.js +9 -1
  63. package/dist/components/snk-filter-item2.js +3 -0
  64. package/dist/components/snk-filter-modal.js +4 -2
  65. package/dist/components/snk-filter-multi-select.js +2 -1
  66. package/dist/components/snk-pesquisa2.js +1 -1
  67. package/dist/components/snk-simple-crud2.js +15 -1
  68. package/dist/components/taskbar-actions-button2.js +3 -1
  69. package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
  70. package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/{dataunit-fetcher-cbec1594.js → pesquisa-fetcher-fa0c2540.js} +235 -27
  73. package/dist/esm/sankhyablocks.js +1 -1
  74. package/dist/esm/snk-actions-button_2.entry.js +5 -4
  75. package/dist/esm/snk-application.entry.js +11 -3
  76. package/dist/esm/snk-attach.entry.js +389 -58
  77. package/dist/esm/snk-crud.entry.js +3 -4
  78. package/dist/esm/snk-data-exporter.entry.js +3 -3
  79. package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
  80. package/dist/esm/snk-data-unit.entry.js +2 -2
  81. package/dist/esm/snk-detail-view.entry.js +4 -5
  82. package/dist/esm/snk-filter-bar.entry.js +8 -1
  83. package/dist/esm/snk-filter-item.entry.js +3 -0
  84. package/dist/esm/snk-filter-modal.entry.js +2 -1
  85. package/dist/esm/snk-filter-multi-select.entry.js +2 -1
  86. package/dist/esm/{snk-guides-viewer-8da24475.js → snk-guides-viewer-f49613c6.js} +2 -3
  87. package/dist/esm/snk-guides-viewer.entry.js +3 -4
  88. package/dist/esm/snk-pesquisa.entry.js +1 -1
  89. package/dist/esm/snk-simple-crud.entry.js +15 -4
  90. package/dist/sankhyablocks/p-02e3a45b.entry.js +1 -0
  91. package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
  92. package/dist/sankhyablocks/p-0ec5b2e5.js +1 -0
  93. package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
  94. package/dist/sankhyablocks/p-2582537c.entry.js +1 -0
  95. package/dist/sankhyablocks/p-282789a6.entry.js +1 -0
  96. package/dist/sankhyablocks/p-3b0e4e08.js +65 -0
  97. package/dist/sankhyablocks/{p-0874adb5.entry.js → p-40915359.entry.js} +1 -1
  98. package/dist/sankhyablocks/p-62896624.entry.js +1 -0
  99. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
  101. package/dist/sankhyablocks/p-9b5944a4.entry.js +1 -0
  102. package/dist/sankhyablocks/p-9bdbc7d8.entry.js +1 -0
  103. package/dist/sankhyablocks/p-ac384baf.entry.js +1 -0
  104. package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
  105. package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-ba3d3fa9.entry.js → p-e817f254.entry.js} +3 -3
  108. package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
  109. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  110. package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
  111. package/dist/types/components/snk-application/snk-application.d.ts +7 -0
  112. package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
  113. package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
  114. package/dist/types/components/snk-attach/snk-attach.d.ts +27 -6
  115. package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
  116. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
  117. package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
  118. package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
  119. package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
  120. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
  121. package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
  122. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  123. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -0
  124. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
  125. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -1
  126. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
  127. package/dist/types/components.d.ts +74 -2
  128. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  129. package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
  130. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
  131. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
  132. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
  133. package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
  134. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -0
  135. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
  136. package/dist/types/lib/index.d.ts +1 -1
  137. package/package.json +7 -5
  138. package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
  139. package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
  140. package/dist/sankhyablocks/p-20726710.entry.js +0 -1
  141. package/dist/sankhyablocks/p-25927311.entry.js +0 -1
  142. package/dist/sankhyablocks/p-3891ae6f.js +0 -60
  143. package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
  144. package/dist/sankhyablocks/p-7d8d7fe9.entry.js +0 -1
  145. package/dist/sankhyablocks/p-8d70b5d5.entry.js +0 -1
  146. package/dist/sankhyablocks/p-a9e4bb55.entry.js +0 -1
  147. package/dist/sankhyablocks/p-a9e5b094.entry.js +0 -1
  148. package/dist/sankhyablocks/p-aa0ae6bc.entry.js +0 -1
  149. package/dist/sankhyablocks/p-c4d19840.entry.js +0 -1
  150. package/dist/sankhyablocks/p-c6e477ff.js +0 -1
  151. package/dist/sankhyablocks/p-d81f20c4.entry.js +0 -1
  152. package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
  153. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
  154. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
  155. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
  156. /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
  157. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
  158. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
  159. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -5,20 +5,117 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const DataFetcher = require('./DataFetcher-ba94ed5b.js');
8
- const ISave = require('./ISave-d68ce3cd.js');
8
+ const pesquisaFetcher = require('./pesquisa-fetcher-e4a7c4c3.js');
9
+ require('./index-0922807b.js');
10
+ const ISave = require('./ISave-e91b70a7.js');
11
+ require('./filter-item-type.enum-a7ffdaa6.js');
12
+ require('./form-config-fetcher-df043d3d.js');
9
13
  const constants = require('./constants-35ddd366.js');
10
- const dataunitFetcher = require('./dataunit-fetcher-14108bec.js');
11
14
  const PreloadManager = require('./PreloadManager-84466da6.js');
15
+ const authFetcher = require('./auth-fetcher-c8467c07.js');
12
16
  const taskbarElements = require('./taskbar-elements-01b85b99.js');
13
17
  require('./PrintUtils-bcaeb82f.js');
14
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
19
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
20
  require('./ResourceIDUtils-5ff86aa7.js');
17
21
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
18
- require('./index-0922807b.js');
19
22
  require('./index-102ba62d.js');
20
23
 
24
+ const SERVICE$1 = {
25
+ save: "Attach.save",
26
+ delete: "Attach.remove",
27
+ view: "Attach.view",
28
+ repository: "RepositorioArquivoSP.abreArquivo"
29
+ };
21
30
  class AttachFetcher {
31
+ constructor(dataUnitName) {
32
+ this.dataUnitName = dataUnitName;
33
+ }
34
+ async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
35
+ var _a, _b;
36
+ const isInsert = operation == "INSERT";
37
+ const dataBody = isInsert ? fields : record;
38
+ if (!isInsert && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) !== (record === null || record === void 0 ? void 0 : record.DESCRICAO)) {
39
+ throw new Error(ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
40
+ }
41
+ const reqBody = {
42
+ "anexo": {
43
+ "codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
44
+ "sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
45
+ "tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
46
+ "descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
47
+ "arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
48
+ "ehInclusao": isInsert ? "S" : "N",
49
+ "ehArquivoRepositorio": "N"
50
+ }
51
+ };
52
+ return new Promise((resolve, reject) => {
53
+ DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.save, JSON.stringify(reqBody))
54
+ .then(result => {
55
+ var _a;
56
+ return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
57
+ })
58
+ .catch(error => reject(error));
59
+ });
60
+ }
61
+ async edit(change) {
62
+ throw new Error("Method not implemented.");
63
+ }
64
+ async delete(record) {
65
+ var request = {
66
+ anexo: {
67
+ codata: record.CODATA,
68
+ tipo: record.TIPO,
69
+ descricao: record.DESCRICAO,
70
+ }
71
+ };
72
+ const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.delete, JSON.stringify(request));
73
+ return Promise.resolve(result);
74
+ }
75
+ async getDownloadKey(record) {
76
+ var _a, _b, _c;
77
+ if (record.EHARQUIVOREPOSITORIO == 'S') {
78
+ const request = {
79
+ config: {
80
+ path: record.ARQUIVO,
81
+ tipoconteudo: record.TIPOCONTEUDO
82
+ }
83
+ };
84
+ const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.repository, JSON.stringify(request));
85
+ return Promise.resolve({
86
+ chave: {
87
+ valor: (_b = (_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.chave) === null || _b === void 0 ? void 0 : _b.valor
88
+ }
89
+ });
90
+ }
91
+ const criteria = {
92
+ anexo: {
93
+ codata: record.CODATA,
94
+ codemp: record.CODEMP,
95
+ sequencia: record.SEQUENCIA,
96
+ tipo: record.TIPO,
97
+ descricao: record.DESCRICAO,
98
+ tipoConteudo: record.TIPOCONTEUDO
99
+ }
100
+ };
101
+ const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE$1.view, JSON.stringify(criteria));
102
+ if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
103
+ return Promise.resolve({
104
+ chave: {
105
+ valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
106
+ }
107
+ });
108
+ }
109
+ return Promise.reject(new Error("File not found."));
110
+ }
111
+ }
112
+
113
+ const SERVICE = {
114
+ save: "AnexoSistemaSP.salvar",
115
+ delete: "AnexoSistemaSP.excluir",
116
+ download: "AnexoSistemaSP.baixar",
117
+ };
118
+ class AnexoSistemaFetcher {
22
119
  constructor(entityName, registerKey, dataUnitName) {
23
120
  var _a;
24
121
  this.entityName = entityName;
@@ -36,14 +133,13 @@ class AttachFetcher {
36
133
  }
37
134
  async save(change) {
38
135
  var _a, _b;
39
- const serviceName = "AnexoSistemaSP.salvar";
40
136
  let { updatingFields: fields } = change;
41
137
  fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
42
138
  try {
43
139
  this.validateFields(fields);
44
140
  const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
45
141
  const reqBody = {
46
- serviceName,
142
+ serviceName: SERVICE.save,
47
143
  requestBody: {
48
144
  params: {
49
145
  resourceID: this.resourceID,
@@ -59,7 +155,7 @@ class AttachFetcher {
59
155
  }
60
156
  }
61
157
  };
62
- const result = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
158
+ const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
63
159
  return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
64
160
  }
65
161
  catch (error) {
@@ -68,7 +164,6 @@ class AttachFetcher {
68
164
  }
69
165
  async edit(change) {
70
166
  var _a, _b, _c;
71
- const serviceName = "AnexoSistemaSP.salvar";
72
167
  let { updatingFields: fields, record } = change;
73
168
  const getFieldValue = (fieldValue) => {
74
169
  if (fields[fieldValue] !== undefined)
@@ -82,7 +177,7 @@ class AttachFetcher {
82
177
  try {
83
178
  this.validateFields(fields);
84
179
  const reqBody = {
85
- serviceName,
180
+ serviceName: SERVICE.save,
86
181
  requestBody: {
87
182
  params: {
88
183
  resourceID: this.resourceID,
@@ -100,7 +195,7 @@ class AttachFetcher {
100
195
  }
101
196
  }
102
197
  };
103
- const result = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
198
+ const result = await DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
104
199
  return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
105
200
  }
106
201
  catch (error) {
@@ -109,10 +204,9 @@ class AttachFetcher {
109
204
  }
110
205
  delete(record) {
111
206
  var _a;
112
- const serviceName = "AnexoSistemaSP.excluir";
113
207
  const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
114
208
  const reqBody = {
115
- serviceName,
209
+ serviceName: SERVICE.delete,
116
210
  requestBody: {
117
211
  paramsDelete: {
118
212
  keyAttach: record.CHAVEARQUIVO,
@@ -124,17 +218,16 @@ class AttachFetcher {
124
218
  }
125
219
  };
126
220
  return new Promise((resolve, reject) => {
127
- DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
221
+ DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
128
222
  .then(result => resolve(result))
129
223
  .catch(error => reject(error));
130
224
  });
131
225
  }
132
226
  getDownloadKey(record) {
133
227
  var _a;
134
- const serviceName = "AnexoSistemaSP.baixar";
135
228
  const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
136
229
  const reqBody = {
137
- serviceName,
230
+ serviceName: SERVICE.download,
138
231
  requestBody: {
139
232
  paramsDown: {
140
233
  nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
@@ -146,34 +239,37 @@ class AttachFetcher {
146
239
  }
147
240
  };
148
241
  return new Promise((resolve, reject) => {
149
- DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
242
+ DataFetcher.DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
150
243
  .then(result => resolve(result))
151
244
  .catch(error => reject(error));
152
245
  });
153
246
  }
154
247
  }
155
248
 
156
- class AttachmentDataUnitBuilder {
249
+ class AnexoSistemaDataUnitFactory {
157
250
  constructor(entityName, getMessage) {
158
251
  this.entityName = entityName;
159
252
  this.getMessage = getMessage;
160
253
  this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
161
254
  }
162
- initLoaders(dataUnit, attachFetcher, onSuccess) {
255
+ initLoaders(dataUnit, fetcher, onSuccess) {
163
256
  if (!this.loader)
164
257
  this.loader = dataUnit.dataLoader;
165
258
  dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
166
- dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
259
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
167
260
  if (recordIds.length)
168
261
  onSuccess();
169
262
  return recordIds;
170
263
  });
171
- dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
264
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
172
265
  if (recordIds.length)
173
266
  onSuccess();
174
267
  return recordIds;
175
268
  });
176
269
  }
270
+ metadataLoader(dataUnit) {
271
+ throw new Error("Method not implemented.");
272
+ }
177
273
  dataLoader(dataUnit, request) {
178
274
  return new Promise(resolve => {
179
275
  this.loader(dataUnit, request).then(response => {
@@ -189,11 +285,11 @@ class AttachmentDataUnitBuilder {
189
285
  });
190
286
  });
191
287
  }
192
- saveLoader(changes, attachFetcher) {
288
+ saveLoader(changes, fetcher) {
193
289
  return new Promise((resolve) => {
194
290
  var _a;
195
291
  const change = Array.isArray(changes) ? changes[0] : {};
196
- const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? attachFetcher.edit.bind(attachFetcher) : attachFetcher.save.bind(attachFetcher);
292
+ const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
197
293
  savePromise(change).then((records) => {
198
294
  resolve(records);
199
295
  }).catch((error) => {
@@ -213,11 +309,11 @@ class AttachmentDataUnitBuilder {
213
309
  });
214
310
  });
215
311
  }
216
- removeLoader(dataUnit, ids, attachFetcher) {
312
+ removeLoader(dataUnit, ids, fetcher) {
217
313
  return new Promise((resolve) => {
218
314
  const { records } = dataUnit.getSelectionInfo();
219
315
  const recordToDelete = records[0];
220
- attachFetcher.delete(recordToDelete).then(() => {
316
+ fetcher.delete(recordToDelete).then(() => {
221
317
  PreloadManager.PreloadManager.removeRecords(dataUnit, [recordToDelete]);
222
318
  return resolve(ids);
223
319
  });
@@ -258,6 +354,175 @@ class AttachmentDataUnitBuilder {
258
354
  }
259
355
  }
260
356
 
357
+ const application$1 = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
358
+ const getMessage$1 = (key) => {
359
+ var _a, _b;
360
+ return (_b = (_a = application$1 === null || application$1 === void 0 ? void 0 : application$1.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
361
+ };
362
+ const attachCrudConfig = {
363
+ grid: {
364
+ columns: [
365
+ { name: "CODATA", orderIndex: 0, width: 0 },
366
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
367
+ { name: "ARQUIVO", orderIndex: 2, width: 0 },
368
+ { name: "DTALTER", orderIndex: 3, width: 0 },
369
+ { name: "USUARIO", orderIndex: 4, width: 0 },
370
+ ],
371
+ },
372
+ form: {
373
+ emptyConfig: false,
374
+ fields: [
375
+ {
376
+ name: "DESCRICAO",
377
+ label: getMessage$1("snkAttach.attachMetadata.lblDescription"),
378
+ visible: true,
379
+ readOnly: false,
380
+ required: true,
381
+ },
382
+ {
383
+ name: "CAMINHO_ARQUIVO",
384
+ label: getMessage$1("snkAttach.attachMetadata.lblFile"),
385
+ visible: true,
386
+ readOnly: false,
387
+ required: true,
388
+ },
389
+ ],
390
+ },
391
+ };
392
+ const attachFetcherMetadataBuilder = {
393
+ name: "Attach",
394
+ label: "Attach List",
395
+ fields: [
396
+ { name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: core.DataType.TEXT },
397
+ { name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: core.DataType.TEXT },
398
+ { name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: core.DataType.TEXT },
399
+ { name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: core.DataType.TEXT },
400
+ { name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: core.DataType.TEXT },
401
+ {
402
+ name: "CAMINHO_ARQUIVO",
403
+ label: getMessage$1("snkAttach.attachMetadata.lblFileUpload"),
404
+ dataType: core.DataType.OBJECT,
405
+ userInterface: core.UserInterface.FILE,
406
+ readOnly: false,
407
+ required: true,
408
+ visible: true,
409
+ properties: {
410
+ subTitle: getMessage$1("snkAttach.attachMetadata.lblSubTitle"),
411
+ MAX_FILES: 1,
412
+ STORAGESTRATEGY: "SESSION",
413
+ INTERNAL_FILENAME: "Attach.upload",
414
+ }
415
+ },
416
+ ],
417
+ };
418
+
419
+ const SERVICE_LOAD = "Attach.load";
420
+ class AttachFetcherDataUnitFactory {
421
+ constructor(getMessage) {
422
+ this.getMessage = getMessage;
423
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
424
+ }
425
+ initLoaders(dataUnit, fetcher, onSuccess) {
426
+ dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
427
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
428
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
429
+ if (recordIds.length)
430
+ onSuccess();
431
+ return recordIds;
432
+ });
433
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
434
+ if (recordIds.length)
435
+ onSuccess();
436
+ return recordIds;
437
+ });
438
+ }
439
+ metadataLoader(_) {
440
+ return Promise.resolve(attachFetcherMetadataBuilder);
441
+ }
442
+ async dataLoader(_, request) {
443
+ if (!request.source) {
444
+ return Promise.resolve({ records: [] });
445
+ }
446
+ const criteria = {
447
+ criteria: {
448
+ codata: request.source,
449
+ tipoAnexo: "N"
450
+ }
451
+ };
452
+ const applicationDataFetcher = await this._application.getDataFetcher();
453
+ const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
454
+ const records = [];
455
+ anexo.forEach((param) => {
456
+ records.push(Object.assign({ __record__id__: core.StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
457
+ name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
458
+ }] }, param));
459
+ });
460
+ return Promise.resolve({ records });
461
+ }
462
+ saveLoader(changes, fetcher) {
463
+ return new Promise((resolve) => {
464
+ const change = Array.isArray(changes) ? changes[0] : {};
465
+ fetcher.save(change)
466
+ .then(resolve)
467
+ .catch((error) => {
468
+ if (error.message === ISave.SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
469
+ this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
470
+ return resolve([]);
471
+ }
472
+ if (error.message === ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
473
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
474
+ return resolve([]);
475
+ }
476
+ if (error.message === ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
477
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
478
+ return resolve([]);
479
+ }
480
+ if (error.message) {
481
+ this._application.error((error.title || error.name), error.message);
482
+ return resolve([]);
483
+ }
484
+ resolve([]);
485
+ });
486
+ });
487
+ }
488
+ removeLoader(dataUnit, ids, fetcher) {
489
+ return new Promise((resolve) => {
490
+ dataUnit.getSelectionInfo().records.forEach(async (record) => {
491
+ this._application.hasAccess(authFetcher.AutorizationType.REMOVE)
492
+ .then(async (hasAccess) => {
493
+ if (hasAccess) {
494
+ await fetcher.delete(record);
495
+ resolve(ids);
496
+ }
497
+ });
498
+ });
499
+ });
500
+ }
501
+ getFilters() {
502
+ throw new Error('Method not implemented.');
503
+ }
504
+ getInterceptions(dataUnit, action, crudRef) {
505
+ return new Promise((resolve) => {
506
+ if (action.type === core.Action.EDITION_CANCELED) {
507
+ if (!dataUnit.isDirty())
508
+ return resolve(action);
509
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
510
+ if (cancellationConfirmed) {
511
+ crudRef.goToView(constants.VIEW_MODE.GRID);
512
+ return resolve(action);
513
+ }
514
+ return resolve(undefined);
515
+ });
516
+ }
517
+ if (action.type === core.Action.DATA_SAVED) {
518
+ dataUnit.loadData();
519
+ return resolve(action);
520
+ }
521
+ resolve(action);
522
+ });
523
+ }
524
+ }
525
+
261
526
  const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
262
527
  const getMessage = (key) => {
263
528
  var _a, _b;
@@ -304,7 +569,7 @@ const buildTaskBarManager = () => {
304
569
  };
305
570
  };
306
571
 
307
- const crudConfig = {
572
+ const anexoSistemaCrudConfig = {
308
573
  grid: {
309
574
  columns: [
310
575
  { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
@@ -350,40 +615,60 @@ const SnkAttach = class {
350
615
  constructor(hostRef) {
351
616
  index.registerInstance(this, hostRef);
352
617
  this.back = index.createEvent(this, "back", 7);
353
- this.handleTaskbarClick = ({ detail: taskbar }) => {
618
+ this.handleTaskbarClick = async ({ detail: taskbar }) => {
354
619
  if (["DOWNLOAD", "LINK"].includes(taskbar))
355
- return this.downloadAttachment(this.dataUnit.getSelectedRecord());
620
+ return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
621
+ if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
622
+ await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
623
+ }
356
624
  };
357
625
  this.handleBack = () => {
358
- this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
626
+ this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
359
627
  if (cancelationConfirmed)
360
628
  this.back.emit();
361
629
  });
362
630
  };
363
631
  this.handleFinish = () => {
364
- if (!this.dataUnit.isDirty())
632
+ if (!this._currentDataUnit.isDirty())
365
633
  return this.back.emit();
366
- this.dataUnit.saveData().then(() => {
634
+ this._currentDataUnit.saveData().then(() => {
367
635
  this.showFinishedToast();
368
636
  this.back.emit();
369
637
  });
370
638
  };
639
+ this.fetcherType = "AnexoSistema";
640
+ this.fetcher = undefined;
641
+ this.dataUnit = undefined;
642
+ this.dataUnitBuilder = undefined;
371
643
  this.registerKey = undefined;
372
644
  this.entityName = undefined;
373
645
  this.messagesBuilder = undefined;
374
- this.dataUnit = undefined;
646
+ this._currentFetcher = undefined;
647
+ this._currentDataUnit = undefined;
375
648
  this.crudConfig = undefined;
376
649
  }
377
650
  registerKeyWatcher(newRegisterKey, oldRegisterKey) {
378
- var _a;
379
- if (this.dataUnit == null) {
651
+ var _a, _b, _c, _d;
652
+ if (this._currentDataUnit == null) {
380
653
  this.loadAttachmentDataUnit();
381
654
  }
382
655
  if (oldRegisterKey !== newRegisterKey) {
383
656
  this.returnToGridMode();
384
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
385
- this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
386
- this.dataUnit.loadData();
657
+ if (this.fetcherType === "AnexoSistema") {
658
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
659
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
660
+ return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
661
+ }
662
+ if (this.fetcherType === "Attach") {
663
+ const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
664
+ if (hasMoreOneItem)
665
+ return;
666
+ }
667
+ return this._currentDataUnit
668
+ .loadMetadata()
669
+ .then(() => {
670
+ this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
671
+ });
387
672
  }
388
673
  }
389
674
  /**
@@ -406,44 +691,90 @@ const SnkAttach = class {
406
691
  window.open(`${selectedRecord.LINK}`);
407
692
  return;
408
693
  }
409
- this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
410
- window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
694
+ this._currentFetcher
695
+ .getDownloadKey(selectedRecord)
696
+ .then(({ chave }) => {
697
+ var _a;
698
+ let forceDownload = false;
699
+ if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
700
+ forceDownload = true;
701
+ }
702
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
411
703
  });
412
704
  }
413
705
  returnToGridMode() {
414
- this.dataUnit.clearSelection();
706
+ var _a;
707
+ (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
415
708
  if (this._crudElement)
416
709
  this._crudElement.goToView(constants.VIEW_MODE.GRID);
417
710
  }
418
711
  loadAttachmentDataUnit() {
419
- var _a;
420
712
  try {
421
- const dataUnit = this.dataUnit || new dataunitFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
422
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
423
- if (!dataUnit.metadata)
424
- dataUnit.loadMetadata().then(() => {
425
- this.crudConfig = crudConfig;
426
- });
427
- this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
428
- dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
429
- dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
430
- this.dataUnit = dataUnit;
431
- this.dataUnit.loadData().then(() => {
432
- this.disableEditFieldsNotInForm();
433
- });
434
- return this.dataUnit;
713
+ switch (this.fetcherType) {
714
+ case "AnexoSistema":
715
+ this.loadAnexoSistema();
716
+ break;
717
+ case "Attach":
718
+ this.loadAttach();
719
+ break;
720
+ default:
721
+ this._currentFetcher = this.fetcher;
722
+ this._currentDataUnit = this.dataUnit;
723
+ this._currentDataUnitBuilder = this.dataUnitBuilder;
724
+ }
435
725
  }
436
726
  catch (error) {
437
727
  throw new Error('There was an error while creating the data unit');
438
728
  }
439
729
  }
730
+ loadAnexoSistema() {
731
+ var _a;
732
+ this._currentDataUnit = this._currentDataUnit || new pesquisaFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
733
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
734
+ if (!this._currentDataUnit.metadata) {
735
+ this._currentDataUnit
736
+ .loadMetadata()
737
+ .then(() => this.crudConfig = anexoSistemaCrudConfig);
738
+ }
739
+ this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
740
+ this._currentDataUnit.addFilterProvider({
741
+ getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
742
+ });
743
+ this._currentDataUnit.addInterceptor({
744
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
745
+ });
746
+ this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
747
+ }
748
+ loadAttach() {
749
+ var _a;
750
+ this._currentFetcher = new AttachFetcher();
751
+ this._currentDataUnit = new core.DataUnit();
752
+ this._currentDataUnit.addInterceptor({
753
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
754
+ });
755
+ this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
756
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
757
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
758
+ this.returnToGridMode();
759
+ });
760
+ if (!this._currentDataUnit.metadata) {
761
+ this._currentDataUnit
762
+ .loadMetadata()
763
+ .then(() => {
764
+ this.crudConfig = attachCrudConfig;
765
+ this._currentDataUnit
766
+ .loadData(undefined, undefined, true, this.registerKey)
767
+ .then(this.disableEditFieldsNotInForm.bind(this));
768
+ });
769
+ }
770
+ }
440
771
  disableEditFieldsNotInForm() {
441
772
  var _a;
442
773
  (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
443
774
  var _a;
444
775
  const fieldName = column.name;
445
776
  if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
446
- this.dataUnit.disableField(fieldName);
777
+ this._currentDataUnit.disableField(fieldName);
447
778
  }
448
779
  });
449
780
  }
@@ -451,15 +782,15 @@ const SnkAttach = class {
451
782
  this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
452
783
  }
453
784
  componentWillRender() {
454
- if (this.dataUnit == null) {
785
+ if (this._currentDataUnit == null) {
455
786
  this.loadAttachmentDataUnit();
456
787
  }
457
788
  }
458
789
  render() {
459
790
  var _a, _b;
460
- if (!this.dataUnit)
791
+ if (!this._currentDataUnit)
461
792
  return null;
462
- return (index.h("main", { class: "snk-attach__main" }, index.h("header", { class: "snk-attach__header" }, index.h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "rightSlot" }, index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), index.h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, index.h("div", { class: "ez-box__container" }, index.h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "snkSimpleCrudHeader" }, index.h("div", { class: "ez-flex ez-flex--column" }, index.h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), index.h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
793
+ return (index.h("main", { class: "snk-attach__main" }, index.h("header", { class: "snk-attach__header" }, index.h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "rightSlot" }, index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), index.h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, index.h("div", { class: "ez-box__container" }, index.h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "snkSimpleCrudHeader" }, index.h("div", { class: "ez-flex ez-flex--column" }, index.h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), index.h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
463
794
  }
464
795
  static get watchers() { return {
465
796
  "registerKey": ["registerKeyWatcher"]