@sankhyalabs/sankhyablocks 5.4.2 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/cjs/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-26da04f7.js} +35 -1
  2. package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
  3. package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-application.cjs.entry.js +3 -315
  7. package/dist/cjs/snk-attach.cjs.entry.js +449 -0
  8. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-crud.cjs.entry.js +22 -13
  11. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  12. package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-c43df27b.js} +4 -1
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -5
  15. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
  17. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-grid.cjs.entry.js +11 -4
  20. package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-e6a65393.js} +2 -2
  21. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
  22. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  23. package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +47 -5
  24. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-taskbar.cjs.entry.js +5 -4
  26. package/dist/cjs/taskbar-elements-80285601.js +313 -0
  27. package/dist/collection/collection-manifest.json +2 -1
  28. package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
  29. package/dist/collection/components/snk-attach/snk-attach.css +8 -0
  30. package/dist/collection/components/snk-attach/snk-attach.js +202 -0
  31. package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
  32. package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
  33. package/dist/collection/components/snk-attach/structure/index.js +3 -0
  34. package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
  35. package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
  36. package/dist/collection/components/snk-crud/snk-crud.js +22 -11
  37. package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
  39. package/dist/collection/components/snk-grid/snk-grid.js +11 -3
  40. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
  41. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
  42. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  43. package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
  44. package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
  45. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
  46. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
  47. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
  48. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
  49. package/dist/collection/lib/message/SnkMessageBuilder.js +5 -1
  50. package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
  51. package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
  52. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  53. package/dist/collection/lib/utils/constants.js +1 -0
  54. package/dist/components/SnkMessageBuilder.js +35 -1
  55. package/dist/components/constants.js +1 -0
  56. package/dist/components/dataunit-fetcher.js +317 -0
  57. package/dist/components/index.d.ts +1 -0
  58. package/dist/components/index.js +1 -0
  59. package/dist/components/snk-application2.js +2 -314
  60. package/dist/components/snk-attach.d.ts +11 -0
  61. package/dist/components/snk-attach.js +6 -0
  62. package/dist/components/snk-attach2.js +498 -0
  63. package/dist/components/snk-crud.js +77 -48
  64. package/dist/components/snk-data-unit2.js +4 -0
  65. package/dist/components/snk-filter-bar2.js +1 -1
  66. package/dist/components/snk-grid2.js +11 -4
  67. package/dist/components/snk-simple-bar.js +1 -41
  68. package/dist/components/snk-simple-bar2.js +59 -0
  69. package/dist/components/snk-simple-crud.js +1 -328
  70. package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
  71. package/dist/components/snk-taskbar2.js +7 -2
  72. package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-7a9392e6.js} +35 -1
  73. package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
  74. package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/sankhyablocks.js +1 -1
  77. package/dist/esm/snk-application.entry.js +3 -315
  78. package/dist/esm/snk-attach.entry.js +445 -0
  79. package/dist/esm/snk-config-options.entry.js +1 -1
  80. package/dist/esm/snk-configurator.entry.js +1 -1
  81. package/dist/esm/snk-crud.entry.js +23 -14
  82. package/dist/esm/snk-data-exporter.entry.js +3 -3
  83. package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-f9e4c694.js} +4 -1
  84. package/dist/esm/snk-data-unit.entry.js +2 -2
  85. package/dist/esm/snk-detail-view.entry.js +4 -5
  86. package/dist/esm/snk-field-config.entry.js +1 -1
  87. package/dist/esm/snk-filter-bar.entry.js +1 -1
  88. package/dist/esm/snk-form-config.entry.js +1 -1
  89. package/dist/esm/snk-grid-config.entry.js +1 -1
  90. package/dist/esm/snk-grid.entry.js +11 -4
  91. package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-62a9f74d.js} +2 -2
  92. package/dist/esm/snk-guides-viewer.entry.js +3 -4
  93. package/dist/esm/snk-select-box.entry.js +1 -1
  94. package/dist/esm/snk-simple-bar_2.entry.js +324 -0
  95. package/dist/esm/snk-tab-config.entry.js +1 -1
  96. package/dist/esm/snk-taskbar.entry.js +5 -4
  97. package/dist/esm/taskbar-elements-055ba1ad.js +309 -0
  98. package/dist/sankhyablocks/p-17375123.js +1 -0
  99. package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
  100. package/dist/sankhyablocks/p-4512cc6c.entry.js +1 -0
  101. package/dist/sankhyablocks/p-5cbbe1f7.entry.js +1 -0
  102. package/dist/sankhyablocks/p-63d01871.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
  104. package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-741b00ef.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
  108. package/dist/sankhyablocks/p-92a0fca4.js +1 -0
  109. package/dist/sankhyablocks/p-999d1953.entry.js +1 -0
  110. package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-a412992c.entry.js} +1 -1
  111. package/dist/sankhyablocks/{p-703dddb9.js → p-aeffd219.js} +1 -1
  112. package/dist/sankhyablocks/p-b2523981.entry.js +11 -0
  113. package/dist/sankhyablocks/p-c3efd4eb.entry.js +1 -0
  114. package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
  115. package/dist/sankhyablocks/p-ebe876f5.entry.js +1 -0
  116. package/dist/sankhyablocks/p-ed438690.js +1 -0
  117. package/dist/sankhyablocks/p-f2223502.js +1 -0
  118. package/dist/sankhyablocks/p-f3d0c744.entry.js +1 -0
  119. package/dist/sankhyablocks/p-f821768b.js +74 -0
  120. package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
  121. package/dist/sankhyablocks/{p-adf50831.entry.js → p-fac37198.entry.js} +1 -1
  122. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  123. package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
  124. package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
  125. package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
  126. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
  127. package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
  128. package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
  129. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
  130. package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
  131. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  132. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
  133. package/dist/types/components.d.ts +67 -0
  134. package/dist/types/global.d.ts +9 -0
  135. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
  136. package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
  137. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
  138. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
  139. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
  140. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
  141. package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
  142. package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
  143. package/dist/types/lib/utils/constants.d.ts +2 -1
  144. package/package.json +1 -1
  145. package/react/components.d.ts +1 -0
  146. package/react/components.js +1 -0
  147. package/react/components.js.map +1 -1
  148. package/dist/cjs/index-fc7ca86c.js +0 -200
  149. package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
  150. package/dist/cjs/taskbar-elements-5e87cf44.js +0 -115
  151. package/dist/esm/index-e467ade5.js +0 -198
  152. package/dist/esm/snk-simple-bar.entry.js +0 -26
  153. package/dist/esm/taskbar-elements-10d80c79.js +0 -112
  154. package/dist/sankhyablocks/p-1393dc00.entry.js +0 -1
  155. package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
  156. package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
  157. package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
  158. package/dist/sankhyablocks/p-74724fa7.js +0 -1
  159. package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
  160. package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
  161. package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
  162. package/dist/sankhyablocks/p-98f7f796.js +0 -1
  163. package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
  164. package/dist/sankhyablocks/p-bc281de0.js +0 -1
  165. package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
  166. package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
  167. package/dist/sankhyablocks/p-f587a454.js +0 -1
  168. package/dist/types/components/snk-application/snk-application.d.ts +0 -259
  169. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
  170. package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
  171. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
  172. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
  173. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
  174. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
  175. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
  176. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
  177. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
  178. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
  179. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
  180. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
  181. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -0,0 +1,445 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-cfd4bb13.js';
2
+ import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
3
+ import { D as DataFetcher } from './DataFetcher-b3d8b2d5.js';
4
+ import { c as VIEW_MODE } from './constants-e916ccc3.js';
5
+ import { D as DataUnitFetcher } from './dataunit-fetcher-d32c6a47.js';
6
+ import { T as TaskbarElement } from './taskbar-elements-055ba1ad.js';
7
+ import './_commonjsHelpers-9943807e.js';
8
+ import './index-6519a79e.js';
9
+
10
+ var SaveErrorsEnum;
11
+ (function (SaveErrorsEnum) {
12
+ SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
13
+ SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
14
+ SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
15
+ })(SaveErrorsEnum || (SaveErrorsEnum = {}));
16
+
17
+ class AttachFetcher {
18
+ constructor(entityName, registerKey, dataUnitName) {
19
+ var _a;
20
+ this.entityName = entityName;
21
+ this.registerKey = registerKey;
22
+ this.dataUnitName = dataUnitName;
23
+ this.validateFields = (fields) => {
24
+ if (!!fields.LINK && !!fields.NOMEARQUIVO)
25
+ throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
26
+ if (!fields.LINK && !fields.NOMEARQUIVO)
27
+ throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
28
+ if (!this.registerKey)
29
+ throw new Error('Register key can not be null');
30
+ };
31
+ this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
32
+ }
33
+ async save(change) {
34
+ var _a, _b;
35
+ const serviceName = "AnexoSistemaSP.salvar";
36
+ let { updatingFields: fields } = change;
37
+ fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
38
+ try {
39
+ this.validateFields(fields);
40
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
41
+ const reqBody = {
42
+ serviceName,
43
+ requestBody: {
44
+ params: {
45
+ resourceID: this.resourceID,
46
+ description: fields.DESCRICAO,
47
+ fileSelect: fileInfo ? 1 : 0,
48
+ keySession: (_b = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _b === void 0 ? void 0 : _b.fileNameTmp,
49
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
50
+ link: fields.LINK,
51
+ nameEntity: this.entityName,
52
+ pkEntity: this.registerKey,
53
+ typeAcess: fields.TIPOACESSO,
54
+ typeApres: fields.TIPOAPRES,
55
+ }
56
+ }
57
+ };
58
+ const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
59
+ 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 })]);
60
+ }
61
+ catch (error) {
62
+ return Promise.reject(error);
63
+ }
64
+ }
65
+ async edit(change) {
66
+ var _a, _b, _c;
67
+ const serviceName = "AnexoSistemaSP.salvar";
68
+ let { updatingFields: fields, record } = change;
69
+ const getFieldValue = (fieldValue) => {
70
+ if (fields[fieldValue] !== undefined)
71
+ return fields[fieldValue];
72
+ return record[fieldValue];
73
+ };
74
+ const attachField = getFieldValue('NOMEARQUIVO');
75
+ const hasNewAttachment = (_b = (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.downloadURL;
76
+ fields = Object.assign(Object.assign({}, fields), { DESCRICAO: getFieldValue('DESCRICAO'), LINK: getFieldValue('LINK'), TIPOACESSO: getFieldValue('TIPOACESSO'), TIPOAPRES: getFieldValue('TIPOAPRES'), CHAVEARQUIVO: record.CHAVEARQUIVO, NOMEARQUIVO: attachField === null || attachField === void 0 ? void 0 : attachField[0] });
77
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
78
+ try {
79
+ this.validateFields(fields);
80
+ const reqBody = {
81
+ serviceName,
82
+ requestBody: {
83
+ params: {
84
+ resourceID: this.resourceID,
85
+ nuAttach: record === null || record === void 0 ? void 0 : record.NUATTACH,
86
+ description: fields.DESCRICAO,
87
+ fileSelect: hasNewAttachment ? 1 : 0,
88
+ keySession: (_c = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _c === void 0 ? void 0 : _c.fileNameTmp,
89
+ keyAttach: fields.CHAVEARQUIVO,
90
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
91
+ link: fields.LINK,
92
+ nameEntity: this.entityName,
93
+ pkEntity: this.registerKey,
94
+ typeAcess: fields.TIPOACESSO,
95
+ typeApres: fields.TIPOAPRES,
96
+ }
97
+ }
98
+ };
99
+ const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
100
+ 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 })]);
101
+ }
102
+ catch (error) {
103
+ return Promise.reject(error);
104
+ }
105
+ }
106
+ delete(record) {
107
+ var _a;
108
+ const serviceName = "AnexoSistemaSP.excluir";
109
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
110
+ const reqBody = {
111
+ serviceName,
112
+ requestBody: {
113
+ paramsDelete: {
114
+ keyAttach: record.CHAVEARQUIVO,
115
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
116
+ nameEntity: record.NOMEINSTANCIA,
117
+ nuAttach: record.NUATTACH,
118
+ pkEntity: record.PKREGISTRO
119
+ }
120
+ }
121
+ };
122
+ return new Promise((resolve, reject) => {
123
+ DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
124
+ .then(result => resolve(result))
125
+ .catch(error => reject(error));
126
+ });
127
+ }
128
+ getDownloadKey(record) {
129
+ var _a;
130
+ const serviceName = "AnexoSistemaSP.baixar";
131
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
132
+ const reqBody = {
133
+ serviceName,
134
+ requestBody: {
135
+ paramsDown: {
136
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
137
+ nameEntity: record.NOMEINSTANCIA,
138
+ nuAttach: record.NUATTACH,
139
+ pkEntity: record.PKREGISTRO,
140
+ keyAttach: record.CHAVEARQUIVO,
141
+ }
142
+ }
143
+ };
144
+ return new Promise((resolve, reject) => {
145
+ DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
146
+ .then(result => resolve(result))
147
+ .catch(error => reject(error));
148
+ });
149
+ }
150
+ }
151
+
152
+ class AttachmentDataUnitBuilder {
153
+ constructor(entityName, getMessage) {
154
+ this.entityName = entityName;
155
+ this.getMessage = getMessage;
156
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
157
+ }
158
+ initLoaders(dataUnit, attachFetcher, onSuccess) {
159
+ if (!this.loader)
160
+ this.loader = dataUnit.dataLoader;
161
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
162
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
163
+ if (recordIds.length)
164
+ onSuccess();
165
+ return recordIds;
166
+ });
167
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
168
+ if (recordIds.length)
169
+ onSuccess();
170
+ return recordIds;
171
+ });
172
+ }
173
+ dataLoader(dataUnit, request) {
174
+ return new Promise(resolve => {
175
+ this.loader(dataUnit, request).then(response => {
176
+ const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
177
+ let fileInfo;
178
+ if (!record.LINK)
179
+ fileInfo = [{
180
+ name: record.NOMEARQUIVO,
181
+ }];
182
+ return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
183
+ });
184
+ resolve(Object.assign(Object.assign({}, response), { records }));
185
+ });
186
+ });
187
+ }
188
+ saveLoader(changes, attachFetcher) {
189
+ return new Promise((resolve) => {
190
+ var _a;
191
+ const change = Array.isArray(changes) ? changes[0] : {};
192
+ 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);
193
+ savePromise(change).then((records) => {
194
+ resolve(records);
195
+ }).catch((error) => {
196
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
197
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
198
+ return resolve([]);
199
+ }
200
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
201
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
202
+ return resolve([]);
203
+ }
204
+ if (error.message) {
205
+ this._application.error((error.title || error.name), error.message);
206
+ return resolve([]);
207
+ }
208
+ resolve([]);
209
+ });
210
+ });
211
+ }
212
+ removeLoader(dataUnit, ids, attachFetcher) {
213
+ return new Promise((resolve) => {
214
+ const { records } = dataUnit.getSelectionInfo();
215
+ attachFetcher.delete(records[0]).then(() => {
216
+ resolve(ids);
217
+ });
218
+ resolve([]);
219
+ });
220
+ }
221
+ getFilters(registerKey) {
222
+ return [
223
+ {
224
+ name: 'AttachmentsByPK',
225
+ expression: 'this.PKREGISTRO = :PKREGISTRO',
226
+ params: [{
227
+ name: "PKREGISTRO",
228
+ dataType: DataType.TEXT,
229
+ value: `${registerKey}_${this.entityName}`
230
+ }]
231
+ }
232
+ ];
233
+ }
234
+ getInterceptions(dataUnit, action, crudRef) {
235
+ return new Promise((resolve) => {
236
+ if (action.type === Action.EDITION_CANCELED) {
237
+ if (!dataUnit.isDirty())
238
+ return resolve(action);
239
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
240
+ if (cancellationConfirmed) {
241
+ crudRef.goToView(VIEW_MODE.GRID);
242
+ return resolve(action);
243
+ }
244
+ return resolve(undefined);
245
+ });
246
+ }
247
+ if (action.type === Action.DATA_SAVED) {
248
+ dataUnit.loadData();
249
+ return resolve(action);
250
+ }
251
+ resolve(action);
252
+ });
253
+ }
254
+ }
255
+
256
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
257
+ const getMessage = (key) => {
258
+ var _a, _b;
259
+ return (_b = (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
260
+ };
261
+ const TaskbarAttachButtons = {
262
+ DOWNLOAD: {
263
+ hint: getMessage("snkAttach.taskbar.titleDownload"),
264
+ name: "DOWNLOAD",
265
+ iconName: 'file-download'
266
+ },
267
+ LINK: {
268
+ hint: getMessage("snkAttach.taskbar.titleLink"),
269
+ name: "LINK",
270
+ iconName: "launch"
271
+ }
272
+ };
273
+ const buildTaskBarManager = () => {
274
+ const disabledButtonsWithoutSelection = [
275
+ TaskbarElement.REMOVE,
276
+ "DOWNLOAD",
277
+ "LINK"
278
+ ];
279
+ return {
280
+ getButtons: (_, dataState, currentButtons) => {
281
+ if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
282
+ return currentButtons.reverse();
283
+ else
284
+ currentButtons.splice(currentButtons.indexOf(TaskbarElement.REFRESH), 1);
285
+ const { selectedRecord } = dataState || {};
286
+ const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
287
+ currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
288
+ const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== TaskbarElement.CLONE)));
289
+ updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
290
+ return updatedButtons;
291
+ },
292
+ isEnabled: (_, dataState, currentButton) => {
293
+ const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
294
+ const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
295
+ if (disabledButton && !hasSelectedRecord)
296
+ return false;
297
+ return true;
298
+ }
299
+ };
300
+ };
301
+
302
+ const crudConfig = {
303
+ grid: {
304
+ columns: [
305
+ { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
306
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
307
+ { name: "DHCAD", orderIndex: 2, width: 0 },
308
+ { name: "DHALTER", orderIndex: 3, width: 0 },
309
+ { name: "TIPOAPRES", orderIndex: 4, width: 0 },
310
+ { name: "TIPOACESSO", orderIndex: 5, width: 0 },
311
+ { name: "CODUSU", orderIndex: 6, width: 0 },
312
+ { name: "CODUSUALT", orderIndex: 7, width: 0 }
313
+ ]
314
+ },
315
+ form: {
316
+ emptyConfig: false,
317
+ fields: [
318
+ {
319
+ name: "DESCRICAO",
320
+ required: true
321
+ },
322
+ {
323
+ name: "TIPOAPRES",
324
+ required: true,
325
+ },
326
+ {
327
+ name: "TIPOACESSO",
328
+ required: true,
329
+ },
330
+ {
331
+ name: "LINK"
332
+ },
333
+ {
334
+ name: "NOMEARQUIVO"
335
+ }
336
+ ]
337
+ },
338
+ };
339
+
340
+ const snkAttachCss = ".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}";
341
+
342
+ const RESOURCE_ID = 'AnexoSistema';
343
+ const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
344
+ const SnkAttach = class {
345
+ constructor(hostRef) {
346
+ registerInstance(this, hostRef);
347
+ this.back = createEvent(this, "back", 7);
348
+ this.handleTaskbarClick = ({ detail: taskbar }) => {
349
+ if (["DOWNLOAD", "LINK"].includes(taskbar))
350
+ return this.downloadAttachment(this.dataUnit.getSelectedRecord());
351
+ };
352
+ this.handleBack = () => {
353
+ this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
354
+ if (cancelationConfirmed)
355
+ this.back.emit();
356
+ });
357
+ };
358
+ this.handleFinish = () => {
359
+ if (!this.dataUnit.isDirty())
360
+ return this.back.emit();
361
+ this.dataUnit.saveData().then(() => {
362
+ this.showFinishedToast();
363
+ this.back.emit();
364
+ });
365
+ };
366
+ this.registerKey = undefined;
367
+ this.entityName = undefined;
368
+ this.messagesBuilder = undefined;
369
+ this.dataUnit = undefined;
370
+ this.crudConfig = {};
371
+ }
372
+ registerKeyWatcher(newRegisterKey, oldRegisterKey) {
373
+ var _a;
374
+ if (oldRegisterKey !== newRegisterKey) {
375
+ this.returnToGridMode();
376
+ this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
377
+ this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
378
+ this.dataUnit.loadData();
379
+ }
380
+ }
381
+ /**
382
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
383
+ * através de um pequeno modulo na estrutura da aplicação:
384
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
385
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
386
+ */
387
+ getMessage(key, params) {
388
+ if (this.messagesBuilder)
389
+ return this.messagesBuilder.getMessage(key, params);
390
+ }
391
+ showFinishedToast() {
392
+ this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
393
+ }
394
+ downloadAttachment(selectedRecord) {
395
+ if (!selectedRecord)
396
+ throw new Error('Nenhum registro selecionado');
397
+ if (selectedRecord.LINK) {
398
+ window.open(`${selectedRecord.LINK}`);
399
+ return;
400
+ }
401
+ this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
402
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
403
+ });
404
+ }
405
+ returnToGridMode() {
406
+ this.dataUnit.clearSelection();
407
+ if (this._crudElement)
408
+ this._crudElement.goToView(VIEW_MODE.GRID);
409
+ }
410
+ loadAttachmentDataUnit() {
411
+ var _a;
412
+ try {
413
+ const dataUnit = this.dataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
414
+ this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
415
+ if (!dataUnit.metadata)
416
+ dataUnit.loadMetadata().then(() => {
417
+ this.crudConfig = crudConfig;
418
+ });
419
+ this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
420
+ dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
421
+ dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
422
+ this.dataUnit = dataUnit;
423
+ this.dataUnit.loadData();
424
+ return this.dataUnit;
425
+ }
426
+ catch (error) {
427
+ throw new Error('There was an error while creating the data unit');
428
+ }
429
+ }
430
+ componentWillLoad() {
431
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
432
+ this.loadAttachmentDataUnit();
433
+ }
434
+ render() {
435
+ if (!this.dataUnit)
436
+ return null;
437
+ return (h("main", null, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: this.crudConfig.grid, formConfig: this.crudConfig.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
438
+ }
439
+ static get watchers() { return {
440
+ "registerKey": ["registerKeyWatcher"]
441
+ }; }
442
+ };
443
+ SnkAttach.style = snkAttachCss;
444
+
445
+ export { SnkAttach as snk_attach };
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
2
2
  import { UserInterface, ObjectUtils, StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { DataType, getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
4
4
  import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import { V as VARS_BY_TYPE, D as DEFAULT_TYPE, a as TAGS_BY_TYPE } from './constants-15617e7d.js';
5
+ import { V as VARS_BY_TYPE, D as DEFAULT_TYPE, a as TAGS_BY_TYPE } from './constants-e916ccc3.js';
6
6
 
7
7
  const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-cfd4bb13.js';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
4
- import { c as VIEW_MODE } from './constants-15617e7d.js';
4
+ import { c as VIEW_MODE } from './constants-e916ccc3.js';
5
5
 
6
6
  const snkConfiguratorCss = ".sc-snk-configurator-h{--snk-configurator__button-close--padding-left:var(--space--medium, 12px);--snk-configurator__title--color:var(--title--primary, #2B3A54);--snk-configurator__title--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__title--font-size:var(--title--large, 20px);--snk-configurator__title--font-weight:var(--text-weight--extra-large, 700);--snk-configurator__subtitle--color:var(--title--primary, #2B3A54);--snk-configurator__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__subtitle--font-size:var(--text--medium, 14px);--snk-configurator__subtitle--font-weight:var(--text-weight--large, 600);--snk-configurator__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-configurator__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-configurator__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-configurator__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-configurator__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-configurator__scrollbar--width:var(--space--medium, 12px)}.snk-configurator.sc-snk-configurator{display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.snk-configurator.sc-snk-configurator{width:359px;max-width:359px}}.snk-configurator__button-config.sc-snk-configurator{--ez-button--min-width:100%}.snk-configurator__header.sc-snk-configurator{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-configurator__title.sc-snk-configurator{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-configurator__title--color);font-size:var(--snk-configurator__title--font-size);font-family:var(--snk-configurator__title--font-family);font-weight:var(--snk-configurator__title--font-weight)}.snk-configurator__subtitle.sc-snk-configurator{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-configurator__subtitle--color);font-size:var(--snk-configurator__subtitle--font-size);font-family:var(--snk-configurator__subtitle--font-family);font-weight:var(--snk-configurator__subtitle--font-weight)}.snk-configurator__button-close.sc-snk-configurator{padding-left:var(--snk-configurator__button-close--padding-left)}.snk-configurator__main.sc-snk-configurator{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-configurator__scrollbar--color-clicked) var(--snk-configurator__scrollbar--color-background)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar{background-color:var(--snk-configurator__scrollbar--color-background);width:var(--snk-configurator__scrollbar--width);max-width:var(--snk-configurator__scrollbar--width);min-width:var(--snk-configurator__scrollbar--width)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-track{background-color:var(--snk-configurator__scrollbar--color-background);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb{background-color:var(--snk-configurator__scrollbar--color-default);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:hover,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-configurator__scrollbar--color-hover)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:active,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-configurator__scrollbar--color-clicked)}";
7
7
 
@@ -1,11 +1,10 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
- import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { T as TaskbarElement } from './taskbar-elements-10d80c79.js';
2
+ import { ElementIDUtils, ApplicationContext, VersionUtils } from '@sankhyalabs/core';
3
+ import { T as TaskbarElement } from './taskbar-elements-055ba1ad.js';
4
4
  import './DataFetcher-b3d8b2d5.js';
5
5
  import './pesquisa-fetcher-bd6af0e3.js';
6
6
  import { P as PresentationMode } from './index-6519a79e.js';
7
- import { c as VIEW_MODE } from './constants-15617e7d.js';
8
- import './index-e467ade5.js';
7
+ import { c as VIEW_MODE } from './constants-e916ccc3.js';
9
8
  import './_commonjsHelpers-9943807e.js';
10
9
 
11
10
  const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
@@ -16,6 +15,7 @@ const SnkCrud = class {
16
15
  this.actionClick = createEvent(this, "actionClick", 7);
17
16
  this._dataUnit = undefined;
18
17
  this._dataState = undefined;
18
+ this.attachmentRegisterKey = undefined;
19
19
  this._currentViewMode = VIEW_MODE.GRID;
20
20
  this.configName = undefined;
21
21
  this.actionsList = undefined;
@@ -37,15 +37,17 @@ const SnkCrud = class {
37
37
  this.setViewMode(VIEW_MODE.FORM);
38
38
  }
39
39
  async executeAction(act) {
40
- if (act === TaskbarElement.GRID_MODE) {
41
- this.setViewMode(VIEW_MODE.GRID);
42
- }
43
- else if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE) {
44
- this.gridToForm(act !== TaskbarElement.UPDATE);
45
- }
46
- else if (act === TaskbarElement.CONFIGURATOR) {
47
- this._snkConfigurator.open();
48
- }
40
+ if (act === TaskbarElement.GRID_MODE)
41
+ return this.setViewMode(VIEW_MODE.GRID);
42
+ if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE)
43
+ return this.gridToForm(act !== TaskbarElement.UPDATE);
44
+ if (act === TaskbarElement.CONFIGURATOR)
45
+ return this._snkConfigurator.open();
46
+ if (act === "ATTACH")
47
+ return this.setViewMode(VIEW_MODE.ATTACHMENT);
48
+ }
49
+ handleAttachBack() {
50
+ this.setViewMode(VIEW_MODE.GRID);
49
51
  }
50
52
  setViewMode(viewMode) {
51
53
  this._viewStack.show(viewMode);
@@ -108,8 +110,15 @@ const SnkCrud = class {
108
110
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
109
111
  }
110
112
  }
113
+ async canRenderAttachment() {
114
+ var _a, _b, _c, _d, _e;
115
+ const isValidVersion = VersionUtils.isRequiredVersion((_a = window.envContext) === null || _a === void 0 ? void 0 : _a.sysVersion, '4.22');
116
+ const recordCriteria = await ((_c = (_b = this._snkDataUnit) === null || _b === void 0 ? void 0 : _b.getSelectedRecordsIDsInfo) === null || _c === void 0 ? void 0 : _c.call(_b));
117
+ this.attachmentRegisterKey = (_d = recordCriteria.find(criteria => !!criteria.value)) === null || _d === void 0 ? void 0 : _d.value;
118
+ return isValidVersion && ((_e = this._dataState) === null || _e === void 0 ? void 0 : _e.selectedRecord) !== undefined;
119
+ }
111
120
  render() {
112
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form" }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
121
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form" }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, this.canRenderAttachment() && (h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.handleAttachBack.bind(this) }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
113
122
  }
114
123
  get _element() { return getElement(this); }
115
124
  };
@@ -2,11 +2,11 @@ import { r as registerInstance, h, H as Host, g as getElement } from './index-cf
2
2
  import { ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './index-6519a79e.js';
5
- import { d as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-15617e7d.js';
5
+ import { d as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-e916ccc3.js';
6
6
  import { D as DataFetcher } from './DataFetcher-b3d8b2d5.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-5ed93c0e.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-f9e4c694.js';
8
8
  import './_commonjsHelpers-9943807e.js';
9
- import './SnkMessageBuilder-a15d22f8.js';
9
+ import './SnkMessageBuilder-7a9392e6.js';
10
10
 
11
11
  class ItemBuilder {
12
12
  constructor(getMessage, selectedNumber) {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-cfd4bb13.js';
2
2
  import { Action, ObjectUtils, JSUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-a15d22f8.js';
4
+ import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-7a9392e6.js';
5
5
 
6
6
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";
7
7
 
@@ -64,6 +64,7 @@ const SnkDataUnit = class {
64
64
  this.dataUnit = undefined;
65
65
  this.beforeSave = undefined;
66
66
  this.afterSave = undefined;
67
+ this.useCancelConfirm = true;
67
68
  }
68
69
  observePageSize() {
69
70
  if (this.dataUnit) {
@@ -212,6 +213,8 @@ const SnkDataUnit = class {
212
213
  }
213
214
  break;
214
215
  case Action.EDITION_CANCELED:
216
+ if (!this.useCancelConfirm)
217
+ return resolve(action);
215
218
  if (this.dataState.hasDirtyRecords) {
216
219
  const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
217
220
  if ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) {
@@ -1,5 +1,5 @@
1
- export { S as snk_data_unit } from './snk-data-unit-5ed93c0e.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-f9e4c694.js';
2
2
  import './index-cfd4bb13.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
- import './SnkMessageBuilder-a15d22f8.js';
5
+ import './SnkMessageBuilder-7a9392e6.js';
@@ -5,14 +5,13 @@ import './DataFetcher-b3d8b2d5.js';
5
5
  import './pesquisa-fetcher-bd6af0e3.js';
6
6
  import '@sankhyalabs/core';
7
7
  import { P as PresentationMode } from './index-6519a79e.js';
8
- import { T as TaskbarElement } from './taskbar-elements-10d80c79.js';
9
- import { c as VIEW_MODE } from './constants-15617e7d.js';
10
- import { S as SnkGuidesViewer } from './snk-guides-viewer-1e7c21f6.js';
11
- import { S as SnkMessageBuilder } from './SnkMessageBuilder-a15d22f8.js';
8
+ import { T as TaskbarElement } from './taskbar-elements-055ba1ad.js';
9
+ import { c as VIEW_MODE } from './constants-e916ccc3.js';
10
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-62a9f74d.js';
11
+ import { S as SnkMessageBuilder } from './SnkMessageBuilder-7a9392e6.js';
12
12
  import './ConfigStorage-ac77ff39.js';
13
13
  import './form-config-fetcher-018e7e73.js';
14
14
  import './_commonjsHelpers-9943807e.js';
15
- import './index-e467ade5.js';
16
15
  import './taskbar-processor-94402e6e.js';
17
16
 
18
17
  class GuideBuilder {
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { A as ACTION_CONFIG } from './constants-15617e7d.js';
3
+ import { A as ACTION_CONFIG } from './constants-e916ccc3.js';
4
4
 
5
5
  const snkFieldConfigCss = ".sc-snk-field-config-h{--snk-field-config--height:42px;--snk-field-config--width:100%;--snk-field-config__icon--width:48px;--snk-field-config-slim--height:32px;--snk-field-config--border-radius:var(--border--radius-medium, 12px);--snk-field-config--font-size:var(--text--medium, 14px);--snk-field-config--font-family:var(--font-pattern, Arial);--snk-field-config--font-weight:var(--text-weight--medium, 400);--snk-field-config--color:var(--title--primary, #000);--snk-field-config--padding-left:var(--space--medium, 6px);--snk-field-config__input--background-color:var(--background--medium, #e0e0e0);--snk-field-config__input--border:var(--border--medium, 2px solid);--snk-field-config__input--border-color:var(--background--xlight, #fff);--snk-field-config__required--color:var(--color--error, #FF0000);--snk-field-config__label--gap:var(--space--extra-small, 3px);--snk-field-config__transition--visibility:var(--transition, 0.2s linear);--snk-field-config__transition--opacity:var(--transition, 0.15s linear);--snk-field-config__config-popover--z-index:var(--more-visible, 2);--snk-field-config__config-outer-arrow--background-color:var(--color--secondary-200, #D2D3DA);--snk-field-config__draggable--padding-right:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--snk-field-config--width)}.field-config.sc-snk-field-config{width:100%;box-sizing:border-box;display:flex;align-items:center;padding-left:var(--snk-field-config--padding-left);font-weight:var(--snk-field-config--font-weight);height:var(--snk-field-config--height);border-radius:var(--snk-field-config--border-radius);font-family:var(--snk-field-config--font-family);font-size:var(--snk-field-config--font-size);border:var(--snk-field-config__input--border);border-color:var(--snk-field-config__input--border-color);background-color:var(--snk-field-config__input--background-color);color:var(--snk-field-config--color)}.field-config__config-popover.sc-snk-field-config{width:40px;margin-left:auto;z-index:var(--snk-field-config__config-popover--z-index)}.field-config__label.sc-snk-field-config{display:flex;flex-direction:row-reverse;line-height:calc(var(--snk-field-config--font-size) + 2px);gap:var(--snk-field-config__label--gap)}.field-config__label-text.sc-snk-field-config{overflow:hidden;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;display:-webkit-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;word-break:break-word}.field-config__label-required.sc-snk-field-config{color:var(--snk-field-config__required--color)}.field-config__add.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options--is-active.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config__remove-icon.sc-snk-field-config{margin-right:-15px}.field-config.sc-snk-field-config:hover .field-config__options.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config.sc-snk-field-config:hover .field-config__add.sc-snk-field-config{visibility:visible;opacity:1}.field-config__draggable.sc-snk-field-config{padding-right:var(--snk-field-config__draggable--padding-right)}.field-config__config-outer-arrow.sc-snk-field-config{clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px;padding-top:3px;border-bottom:1px solid #FFFFFF;background-color:var(--snk-field-config__config-outer-arrow--background-color)}.field-config__config-inner-arrow.sc-snk-field-config{background-color:#FFFFFF;clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px}.ez-box__container.sc-snk-field-config ez-collapsible-box.sc-snk-field-config{--snk-collapsible-box__header--padding-left:6px}ez-icon.sc-snk-field-config{--snk-icon--color:var(--snk-field-config--color)}ez-popover.sc-snk-field-config{--snk-popover__box--background-color:transparent;--snk-popover__box--box-shadow:none}.field-config__options.sc-snk-field-config ez-button.sc-snk-field-config{--snk-button--background-color:transparent;--snk-button--focus--border:none;--snk-button--focus--box-shadow:none}@media screen and (min-width: 1200px){.field-config__label.sc-snk-field-config{flex-direction:row}}";
6
6
 
@@ -403,7 +403,7 @@ const SnkFilterBar = class {
403
403
  instance.loadFilterBarConfig(this.configName)
404
404
  .then((filters) => {
405
405
  this.filterConfig = filters.map(item => this.normalizeItem(item));
406
- if (this.dataUnit && this._loadingPending) {
406
+ if (this.dataUnit) {
407
407
  this.dataUnit.loadData(undefined, undefined, true);
408
408
  }
409
409
  })
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
2
2
  import { d as draggable_bundle } from './draggable.bundle-41d56f06.js';
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import { C as CONFIG_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-15617e7d.js';
5
+ import { C as CONFIG_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-e916ccc3.js';
6
6
  import { U as UserConfigType } from './form-config-fetcher-018e7e73.js';
7
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
8
8
  import './_commonjsHelpers-9943807e.js';