@sankhyalabs/sankhyablocks 2.5.2 → 2.7.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 (147) hide show
  1. package/dist/cjs/{SnkMessageBuilder-370e23ae.js → SnkMessageBuilder-09b25b0a.js} +20 -1
  2. package/dist/cjs/data-exporter-option-417da37a.js +19 -0
  3. package/dist/cjs/{index-20e8b68a.js → index-2cd6f753.js} +26 -0
  4. package/dist/cjs/index-696b5c3b.js +200 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  7. package/dist/cjs/snk-application.cjs.entry.js +11 -3
  8. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-configurator_3.cjs.entry.js +71 -13
  10. package/dist/cjs/snk-crud.cjs.entry.js +3 -2
  11. package/dist/cjs/{snk-exporter-email-sender_8.cjs.entry.js → snk-data-exporter_9.cjs.entry.js} +305 -8
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  14. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  17. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-filter-personalized.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  23. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  24. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  25. package/dist/cjs/{taskbar-elements-3807c809.js → taskbar-elements-bbb89cdb.js} +8 -5
  26. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  27. package/dist/collection/collection-manifest.json +1 -0
  28. package/dist/collection/components/snk-data-exporter/enum/data-exporter-option.js +11 -0
  29. package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +4 -4
  30. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -0
  31. package/dist/collection/components/snk-data-exporter/snk-data-exporter.css +19 -0
  32. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +181 -0
  33. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +140 -0
  34. package/dist/collection/components/snk-grid/snk-grid.js +69 -10
  35. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +7 -4
  36. package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -2
  37. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +9 -1
  38. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +33 -0
  39. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.js +1 -0
  40. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.js +1 -0
  41. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterResponse.js +1 -0
  42. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  43. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +16 -0
  44. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  45. package/dist/collection/lib/store/index.js +5 -0
  46. package/dist/collection/lib/utils/fileViewer/index.js +3 -0
  47. package/dist/collection/lib/utils/fileViewer/interfaces/IFileViewerParams.js +1 -0
  48. package/dist/components/ConfigStorage.js +3 -6694
  49. package/dist/components/DataFetcher.js +6695 -0
  50. package/dist/components/SnkMessageBuilder.js +20 -1
  51. package/dist/components/index.d.ts +1 -0
  52. package/dist/components/index.js +1 -0
  53. package/dist/components/snk-application2.js +11 -2
  54. package/dist/components/snk-crud.js +10 -4
  55. package/dist/components/snk-data-exporter.d.ts +11 -0
  56. package/dist/components/snk-data-exporter.js +6 -0
  57. package/dist/components/snk-data-exporter2.js +330 -0
  58. package/dist/components/snk-form-config2.js +1 -1
  59. package/dist/components/snk-form2.js +8 -2
  60. package/dist/components/snk-grid2.js +74 -10
  61. package/dist/components/snk-taskbar2.js +212 -9
  62. package/dist/esm/{SnkMessageBuilder-7d583c9a.js → SnkMessageBuilder-47db5d75.js} +20 -1
  63. package/dist/esm/data-exporter-option-006307dd.js +19 -0
  64. package/dist/esm/{index-e4121713.js → index-a77b6f35.js} +25 -1
  65. package/dist/esm/index-d89e384f.js +198 -0
  66. package/dist/esm/loader.js +2 -2
  67. package/dist/esm/sankhyablocks.js +2 -2
  68. package/dist/esm/snk-application.entry.js +11 -3
  69. package/dist/esm/snk-config-options.entry.js +1 -1
  70. package/dist/esm/snk-configurator_3.entry.js +68 -10
  71. package/dist/esm/snk-crud.entry.js +3 -2
  72. package/dist/esm/{snk-exporter-email-sender_8.entry.js → snk-data-exporter_9.entry.js} +304 -8
  73. package/dist/esm/snk-data-unit.entry.js +2 -2
  74. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  75. package/dist/esm/snk-filter-detail.entry.js +1 -1
  76. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  77. package/dist/esm/snk-filter-number.entry.js +1 -1
  78. package/dist/esm/snk-filter-period.entry.js +1 -1
  79. package/dist/esm/snk-filter-personalized.entry.js +1 -1
  80. package/dist/esm/snk-filter-search.entry.js +1 -1
  81. package/dist/esm/snk-filter-text.entry.js +1 -1
  82. package/dist/esm/snk-form-config.entry.js +1 -1
  83. package/dist/esm/snk-form.entry.js +1 -1
  84. package/dist/esm/snk-pesquisa.entry.js +1 -1
  85. package/dist/esm/snk-tab-config.entry.js +1 -1
  86. package/dist/esm/{taskbar-elements-b2bbe275.js → taskbar-elements-beec3b27.js} +8 -5
  87. package/dist/esm/teste-pesquisa.entry.js +1 -1
  88. package/dist/sankhyablocks/p-04581d0c.entry.js +1 -0
  89. package/dist/sankhyablocks/p-112bb324.js +1 -0
  90. package/dist/sankhyablocks/{p-c17be74f.entry.js → p-12ebe36a.entry.js} +1 -1
  91. package/dist/sankhyablocks/p-13116d05.entry.js +1 -0
  92. package/dist/sankhyablocks/{p-14af45cc.entry.js → p-187b0d06.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-570cc474.entry.js → p-1a2533d0.entry.js} +1 -1
  94. package/dist/sankhyablocks/{p-fd3b562d.entry.js → p-1ccaea51.entry.js} +1 -1
  95. package/dist/sankhyablocks/p-1d7a0daf.js +1 -0
  96. package/dist/sankhyablocks/p-50c8bcb7.entry.js +1 -0
  97. package/dist/sankhyablocks/{p-44ce5b90.entry.js → p-57895452.entry.js} +1 -1
  98. package/dist/sankhyablocks/{p-48bbbd2c.entry.js → p-68fcc226.entry.js} +1 -1
  99. package/dist/sankhyablocks/p-719e570a.js +1 -0
  100. package/dist/sankhyablocks/{p-00b3c5d8.entry.js → p-772f1c44.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-c30d0966.entry.js → p-82e20fc0.entry.js} +1 -1
  102. package/dist/sankhyablocks/{p-eff899b0.entry.js → p-91c23d20.entry.js} +1 -1
  103. package/dist/sankhyablocks/p-a77dd79a.js +2 -0
  104. package/dist/sankhyablocks/{p-f50c6ef6.entry.js → p-ab4ff312.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-c8327a5c.js +1 -0
  106. package/dist/sankhyablocks/{p-2664ae24.entry.js → p-d3e402d3.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-9593c937.entry.js → p-d7ae56ce.entry.js} +1 -1
  108. package/dist/sankhyablocks/{p-70e52fee.entry.js → p-d96bf6a7.entry.js} +1 -1
  109. package/dist/sankhyablocks/{p-b0a0222f.entry.js → p-df5d94c6.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-db111acd.entry.js → p-e075dba7.entry.js} +1 -1
  111. package/dist/sankhyablocks/{p-a3871147.entry.js → p-f8fdd16c.entry.js} +11 -4
  112. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  113. package/dist/types/components/snk-data-exporter/data/attachment.d.ts +1 -1
  114. package/dist/types/components/snk-data-exporter/data/email.d.ts +3 -3
  115. package/dist/types/components/snk-data-exporter/data/export-config.d.ts +5 -5
  116. package/dist/types/components/snk-data-exporter/data/export-result.d.ts +5 -5
  117. package/dist/types/components/snk-data-exporter/data/report.d.ts +1 -1
  118. package/dist/types/components/snk-data-exporter/enum/data-exporter-option.d.ts +10 -0
  119. package/dist/types/components/snk-data-exporter/exporter-email-sender/email-info-step.d.ts +4 -4
  120. package/dist/types/components/snk-data-exporter/exporter-email-sender/options-step.d.ts +4 -4
  121. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +9 -0
  122. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +40 -0
  123. package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +61 -0
  124. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -2
  125. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -1
  126. package/dist/types/components.d.ts +33 -3
  127. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +3 -0
  128. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +9 -0
  129. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +14 -0
  130. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterResponse.d.ts +7 -0
  131. package/dist/types/lib/message/resources/snk-data-exporter.msg.d.ts +1 -0
  132. package/dist/types/lib/store/index.d.ts +4 -0
  133. package/dist/types/lib/utils/fileViewer/index.d.ts +2 -0
  134. package/dist/types/lib/utils/fileViewer/interfaces/IFileViewerParams.d.ts +4 -0
  135. package/package.json +2 -1
  136. package/react/components.d.ts +1 -0
  137. package/react/components.js +1 -0
  138. package/react/components.js.map +1 -1
  139. package/dist/cjs/AuthorizationConfig-79ffae4b.js +0 -7
  140. package/dist/esm/AuthorizationConfig-dcbd207a.js +0 -7
  141. package/dist/sankhyablocks/p-8a872a35.entry.js +0 -1
  142. package/dist/sankhyablocks/p-9ba3df4c.js +0 -2
  143. package/dist/sankhyablocks/p-9e67cf79.entry.js +0 -1
  144. package/dist/sankhyablocks/p-c118ef2a.entry.js +0 -1
  145. package/dist/sankhyablocks/p-dbaad88c.js +0 -1
  146. package/dist/sankhyablocks/p-dc36cfbf.js +0 -1
  147. package/dist/sankhyablocks/p-e7f772ed.js +0 -1
@@ -60,6 +60,7 @@ const snkTaskbarMessages = {
60
60
  titlePrevious: "Anterior",
61
61
  titleNext: "Próximo",
62
62
  titleRefresh: "Atualizar",
63
+ titleDataExporter: "Exportar",
63
64
  titleClone: "Duplicar",
64
65
  titleRemove: "Excluir",
65
66
  titleMoreOptions: "Mais Opções",
@@ -205,6 +206,23 @@ const snkGridConfigMessages = {
205
206
  }
206
207
  };
207
208
 
209
+ const snkDataExporterMessages = {
210
+ group: {
211
+ export: {
212
+ default: "Exportar para",
213
+ multiSelected: "Exportar {0} linhas selecionadas",
214
+ selectedLine: "Exportar somente 1 linha selecionada",
215
+ },
216
+ custom: "Personalizado"
217
+ },
218
+ label: {
219
+ currentPage: "Somente a página atual",
220
+ spreadsheet: "Planilha",
221
+ cube: "Cubo",
222
+ sendByEmail: "Enviar por email",
223
+ }
224
+ };
225
+
208
226
  class SnkMessageBuilder {
209
227
  constructor() {
210
228
  this._defaults = {
@@ -220,7 +238,8 @@ class SnkMessageBuilder {
220
238
  crudUtils: crudUtilsMessages,
221
239
  snkGrid: snkGridMessages,
222
240
  snkGridConfig: snkGridConfigMessages,
223
- snkExporter: snkExporterMessages
241
+ snkExporter: snkExporterMessages,
242
+ snkDataExporter: snkDataExporterMessages
224
243
  };
225
244
  this._currentOperation = OperationMap.CLEAN;
226
245
  this.loadAppMessages().then((msgs) => {
@@ -3,6 +3,7 @@ export { SnkApplication as SnkApplication } from '../types/components/snk-applic
3
3
  export { SnkConfigOptions as SnkConfigOptions } from '../types/components/snk-form/subcomponents/snk-config-options/snk-config-options';
4
4
  export { SnkConfigurator as SnkConfigurator } from '../types/components/snk-configurator/snk-configurator';
5
5
  export { SnkCrud as SnkCrud } from '../types/components/snk-crud/snk-crud';
6
+ export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
6
7
  export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
7
8
  export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
8
9
  export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/subcomponents/snk-field-config/snk-field-config';
@@ -3,6 +3,7 @@ export { SnkApplication, defineCustomElement as defineCustomElementSnkApplicatio
3
3
  export { SnkConfigOptions, defineCustomElement as defineCustomElementSnkConfigOptions } from './snk-config-options.js';
4
4
  export { SnkConfigurator, defineCustomElement as defineCustomElementSnkConfigurator } from './snk-configurator.js';
5
5
  export { SnkCrud, defineCustomElement as defineCustomElementSnkCrud } from './snk-crud.js';
6
+ export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
6
7
  export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
7
8
  export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
8
9
  export { SnkFieldConfig, defineCustomElement as defineCustomElementSnkFieldConfig } from './snk-field-config.js';
@@ -1,7 +1,8 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataType, DataUnit, StringUtils, ChangeOperation, DateUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
3
- import { d as dist, D as DataFetcher, R as ResourceFetcher, U as UrlUtils, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
3
+ import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
4
4
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
5
+ import { R as ResourceFetcher, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
5
6
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
6
7
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
7
8
 
@@ -238,6 +239,13 @@ class DataUnitFetcher {
238
239
  expression
239
240
  }
240
241
  }
242
+ children{
243
+ name
244
+ links{
245
+ source
246
+ target
247
+ }
248
+ }
241
249
  }
242
250
  }`);
243
251
  this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
@@ -300,7 +308,8 @@ class DataUnitFetcher {
300
308
  const metadata = {
301
309
  name: resp.name,
302
310
  label: resp.name,
303
- fields: [],
311
+ children: [...resp.children],
312
+ fields: []
304
313
  };
305
314
  (_a = resp.fields) === null || _a === void 0 ? void 0 : _a.forEach((source) => {
306
315
  let properties = undefined;
@@ -2,8 +2,9 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { V as VIEW_MODE } from './constants.js';
4
4
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
5
- import { d as defineCustomElement$h } from './snk-config-options2.js';
6
- import { d as defineCustomElement$g } from './snk-configurator2.js';
5
+ import { d as defineCustomElement$i } from './snk-config-options2.js';
6
+ import { d as defineCustomElement$h } from './snk-configurator2.js';
7
+ import { d as defineCustomElement$g } from './snk-data-exporter2.js';
7
8
  import { d as defineCustomElement$f } from './snk-exporter-email-sender2.js';
8
9
  import { d as defineCustomElement$e } from './snk-field-config2.js';
9
10
  import { d as defineCustomElement$d } from './snk-filter-bar2.js';
@@ -135,7 +136,7 @@ function defineCustomElement$1() {
135
136
  if (typeof customElements === "undefined") {
136
137
  return;
137
138
  }
138
- const components = ["snk-crud", "snk-config-options", "snk-configurator", "snk-exporter-email-sender", "snk-field-config", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal", "snk-form", "snk-form-config", "snk-grid", "snk-grid-config", "snk-select-box", "snk-tab-config", "snk-taskbar"];
139
+ const components = ["snk-crud", "snk-config-options", "snk-configurator", "snk-data-exporter", "snk-exporter-email-sender", "snk-field-config", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal", "snk-form", "snk-form-config", "snk-grid", "snk-grid-config", "snk-select-box", "snk-tab-config", "snk-taskbar"];
139
140
  components.forEach(tagName => { switch (tagName) {
140
141
  case "snk-crud":
141
142
  if (!customElements.get(tagName)) {
@@ -144,10 +145,15 @@ function defineCustomElement$1() {
144
145
  break;
145
146
  case "snk-config-options":
146
147
  if (!customElements.get(tagName)) {
147
- defineCustomElement$h();
148
+ defineCustomElement$i();
148
149
  }
149
150
  break;
150
151
  case "snk-configurator":
152
+ if (!customElements.get(tagName)) {
153
+ defineCustomElement$h();
154
+ }
155
+ break;
156
+ case "snk-data-exporter":
151
157
  if (!customElements.get(tagName)) {
152
158
  defineCustomElement$g();
153
159
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkDataExporter extends Components.SnkDataExporter, HTMLElement {}
4
+ export const SnkDataExporter: {
5
+ prototype: SnkDataExporter;
6
+ new (): SnkDataExporter;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkDataExporter$1, d as defineCustomElement$1 } from './snk-data-exporter2.js';
2
+
3
+ const SnkDataExporter = SnkDataExporter$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkDataExporter, defineCustomElement };
@@ -0,0 +1,330 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { D as DataFetcher } from './DataFetcher.js';
4
+
5
+ var DataExporterOption;
6
+ (function (DataExporterOption) {
7
+ DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
8
+ DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
9
+ DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
10
+ DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
11
+ DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
12
+ DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
13
+ DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
14
+ DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
15
+ })(DataExporterOption || (DataExporterOption = {}));
16
+
17
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
18
+ var t = {};
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20
+ t[p] = s[p];
21
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
22
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
24
+ t[p[i]] = s[p[i]];
25
+ }
26
+ return t;
27
+ };
28
+ function fetchDataExporter(_a) {
29
+ var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
30
+ const serviceName = `DataExporterSPBean.${methodName}`;
31
+ const payload = { serviceName, requestBody };
32
+ return new Promise((resolve, reject) => {
33
+ DataFetcher.get()
34
+ .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
35
+ .then(result => resolve(getFormatResponse(result)))
36
+ .catch(error => reject(error));
37
+ });
38
+ }
39
+ function getFormatResponse(result) {
40
+ var _a;
41
+ const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
42
+ if (response == undefined) {
43
+ return;
44
+ }
45
+ return ObjectUtils.stringToObject(response);
46
+ }
47
+
48
+ function fileViewer({ fileSessionKey }) {
49
+ window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${fileSessionKey}&download=S`);
50
+ }
51
+
52
+ class ItemBuilder {
53
+ constructor(getMessage, selectedNumber) {
54
+ this._selectedNumber = 0;
55
+ this._getMessage = getMessage;
56
+ this._selectedNumber = selectedNumber;
57
+ }
58
+ /**
59
+ * Método responsável por inserir os items no array de opções.
60
+ * @param option - Nome da opção que será inserida no array.
61
+ * @param items - Array que será alimentado com as opções permitidas.
62
+ */
63
+ setExportOption(option, items) {
64
+ const groupName = this.getExportGroupName();
65
+ if (option === DataExporterOption.EXPORT_TO_PDF) {
66
+ items.push(this.getExportToPDF(groupName));
67
+ }
68
+ if (option === DataExporterOption.EXPORT_TO_XLS) {
69
+ items.push(this.getExportToXLS(groupName));
70
+ }
71
+ this.setExportCurrentPage(option, items);
72
+ this.setExportByEmail(option, items);
73
+ }
74
+ /**
75
+ * Método responsável por inserir os itens de exportação personalizada.
76
+ * @param option - Nome da opção que será inserida no array.
77
+ * @param items - Array que será alimentado com as opções permitidas.
78
+ */
79
+ setExportCurrentPage(option, items) {
80
+ var _a;
81
+ const pageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
82
+ if (option === DataExporterOption.EXPORT_CURRENT_PAGE) {
83
+ items.push(this.getCurrentPage());
84
+ }
85
+ if (pageOptions.includes(option)) {
86
+ let item = items.find((item) => item.id === DataExporterOption.EXPORT_CURRENT_PAGE);
87
+ if (item == undefined) {
88
+ items.push(this.getCurrentPage());
89
+ item = items.find((item) => item.id === DataExporterOption.EXPORT_CURRENT_PAGE);
90
+ }
91
+ if (!((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length)) {
92
+ item.children = [];
93
+ }
94
+ if (option === DataExporterOption.EXPORT_PAGE_TO_PDF) {
95
+ item.children.push(this.getExportPageToPDF());
96
+ }
97
+ if (option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
98
+ item.children.push(this.getExportPageToXLS());
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Método responsável por inserir os itens de exportação por e-mail.
104
+ * @param option - Nome da opção que será inserida no array.
105
+ * @param items - Array que será alimentado com as opções permitidas.
106
+ */
107
+ setExportByEmail(option, items) {
108
+ if (option === DataExporterOption.EXPORT_BY_EMAIL) {
109
+ items.push(this.getExportByEmail());
110
+ }
111
+ }
112
+ /**
113
+ * Método responsável por capturar o objeto com os dados de exportação em PDF.
114
+ * @param groupName - Nome do grupo da opção que será inserida na lista.
115
+ * @returns Retorna o objeto com os dados de exportação em PDF.
116
+ */
117
+ getExportToPDF(groupName) {
118
+ return {
119
+ id: DataExporterOption.EXPORT_TO_PDF,
120
+ label: "PDF (.pdf)",
121
+ group: groupName
122
+ };
123
+ }
124
+ /**
125
+ * Método responsável por capturar o objeto com os dados de exportação em XLS.
126
+ * @param groupName - Nome do grupo da opção que será inserida na lista.
127
+ * @returns Retorna o objeto com os dados de exportação em XLS.
128
+ */
129
+ getExportToXLS(groupName) {
130
+ return {
131
+ id: DataExporterOption.EXPORT_TO_XLS,
132
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,
133
+ group: groupName
134
+ };
135
+ }
136
+ /**
137
+ * Método responsável por capturar o objeto com os dados de exportação personalizada.
138
+ * @returns Retorna o objeto com os dados de exportação personalizada.
139
+ */
140
+ getCurrentPage() {
141
+ return {
142
+ id: DataExporterOption.EXPORT_CURRENT_PAGE,
143
+ label: this._getMessage("snkDataExporter.label.currentPage"),
144
+ group: this._getMessage("snkDataExporter.group.custom")
145
+ };
146
+ }
147
+ /**
148
+ * Método responsável por capturar o objeto com os dados de exportação personalizada em PDF.
149
+ * @returns Retorna o objeto com os dados de exportação personalizada em PDF.
150
+ */
151
+ getExportPageToPDF() {
152
+ return {
153
+ id: DataExporterOption.EXPORT_PAGE_TO_PDF,
154
+ label: "PDF (.pdf)"
155
+ };
156
+ }
157
+ /**
158
+ * Método responsável por capturar o objeto com os dados de exportação personalizada em XLS.
159
+ * @returns Retorna o objeto com os dados de exportação personalizada em XLS.
160
+ */
161
+ getExportPageToXLS() {
162
+ return {
163
+ id: DataExporterOption.EXPORT_PAGE_TO_XLS,
164
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
165
+ };
166
+ }
167
+ /**
168
+ * Método responsável por capturar o objeto com os dados de exportação por e-mail.
169
+ * @returns Retorna o objeto com os dados de exportação por e-mail.
170
+ */
171
+ getExportByEmail() {
172
+ return {
173
+ id: DataExporterOption.EXPORT_BY_EMAIL,
174
+ label: `${this._getMessage("snkDataExporter.label.sendByEmail")}...`
175
+ };
176
+ }
177
+ /**
178
+ * Método responsável por capturar o nome do grupo da opção que será inserida na lista.
179
+ * @returns Retorna o nome do grupo da opção que será inserida na lista.
180
+ */
181
+ getExportGroupName() {
182
+ if (this._selectedNumber === 1) {
183
+ return this._getMessage("snkDataExporter.group.export.selectedLine");
184
+ }
185
+ if (this._selectedNumber > 1) {
186
+ return this._getMessage("snkDataExporter.group.export.multiSelected").replace('{0}', this._selectedNumber.toString());
187
+ }
188
+ return this._getMessage("snkDataExporter.group.export.default");
189
+ }
190
+ }
191
+
192
+ const snkDataExporterCss = ".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--more-visible, 2);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content;z-index:var(--snk-data-exporter--z-index)}";
193
+
194
+ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
195
+ constructor() {
196
+ super();
197
+ this.__registerHost();
198
+ this.ezClickDataExporter = createEvent(this, "ezClickDataExporter", 7);
199
+ this._items = [];
200
+ this._selectedNumber = 0;
201
+ this._showDropdown = false;
202
+ this._releasedToExport = [
203
+ DataExporterOption.EXPORT_TO_PDF,
204
+ DataExporterOption.EXPORT_BY_EMAIL,
205
+ DataExporterOption.EXPORT_PDF_TO_EMAIL,
206
+ DataExporterOption.EXPORT_XLS_TO_EMAIL
207
+ ];
208
+ /**
209
+ * Provedor das informações para exportação dos dados.
210
+ */
211
+ this.provider = null;
212
+ }
213
+ /**
214
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
215
+ * através de um pequeno modulo na estrutura da aplicação:
216
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
217
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-exporter.msg.ts"
218
+ */
219
+ getMessage(key, params) {
220
+ return this._application.messagesBuilder.getMessage(key, params);
221
+ }
222
+ positionDropdown() {
223
+ var _a;
224
+ const bounding = (_a = this._ezButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
225
+ if (bounding == undefined || this._ezDropdown == undefined) {
226
+ return;
227
+ }
228
+ this._ezDropdown.style.top = (bounding.y + bounding.height + 5) + "px";
229
+ this._ezDropdown.style.left = bounding.x + "px";
230
+ }
231
+ closeDropdown(evt) {
232
+ const target = evt === null || evt === void 0 ? void 0 : evt.target;
233
+ if (target == undefined) {
234
+ return;
235
+ }
236
+ if (!target.closest(".snk-data-exporter")) {
237
+ this._showDropdown = false;
238
+ }
239
+ }
240
+ setEvents() {
241
+ document.removeEventListener("click", this.closeDropdown.bind(this));
242
+ document.addEventListener("click", this.closeDropdown.bind(this));
243
+ document.removeEventListener("scroll", this.positionDropdown.bind(this));
244
+ document.addEventListener("scroll", this.positionDropdown.bind(this));
245
+ }
246
+ controlDropdown() {
247
+ this._showDropdown = !this._showDropdown;
248
+ }
249
+ async processExporter(evt) {
250
+ const item = evt === null || evt === void 0 ? void 0 : evt.detail;
251
+ if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
252
+ return;
253
+ }
254
+ if (item.id !== DataExporterOption.EXPORT_BY_EMAIL) {
255
+ if (this.provider == undefined) {
256
+ return;
257
+ }
258
+ const filters = this.provider.getFilters();
259
+ const columns = this.provider.getColumnsMetadata();
260
+ const sort = this.provider.getOrders();
261
+ const resourceURI = this.provider.getResourceURI();
262
+ fetchDataExporter({ filters, columns, sort, resourceURI, methodName: item.id })
263
+ .then((response) => fileViewer(Object.assign(Object.assign({}, response), { fileType: "PDF" })))
264
+ .catch(err => console.log(err));
265
+ }
266
+ this.ezClickDataExporter.emit(item);
267
+ this._showDropdown = false;
268
+ }
269
+ getItems() {
270
+ const items = [];
271
+ this._releasedToExport
272
+ .forEach((option) => {
273
+ this._itemBuilder.setExportOption(option, items);
274
+ });
275
+ return items;
276
+ }
277
+ loadDropdown() {
278
+ var _a;
279
+ this._selectedNumber = ((_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedNumber()) || 0;
280
+ this._itemBuilder = new ItemBuilder(this.getMessage.bind(this), this._selectedNumber);
281
+ this._items = this.getItems();
282
+ }
283
+ componentWillLoad() {
284
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
285
+ this.loadDropdown();
286
+ this.setEvents();
287
+ }
288
+ componentDidLoad() {
289
+ if (this._element == undefined) {
290
+ return;
291
+ }
292
+ ElementIDUtils.addIDInfo(this._element);
293
+ }
294
+ componentWillUpdate() {
295
+ if (this._showDropdown) {
296
+ this.loadDropdown();
297
+ }
298
+ }
299
+ componentDidUpdate() {
300
+ if (this._showDropdown) {
301
+ this.positionDropdown();
302
+ }
303
+ }
304
+ render() {
305
+ return (h(Host, null, h("div", { class: "snk-data-exporter" }, h("ez-button", Object.assign({ ref: (ref) => this._ezButton = ref, iconName: "file-download", size: "small", mode: "icon", onClick: () => this.controlDropdown() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("button")}` })), this._showDropdown &&
306
+ h("ez-dropdown", Object.assign({ ref: (ref) => this._ezDropdown = ref, items: this._items, onEzClick: (evt) => this.processExporter(evt) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("dropdown")}` }))), this._showDropdown &&
307
+ h("div", Object.assign({ class: "ez-scrim ez-scrim-light" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("ezScrim")}` }))));
308
+ }
309
+ get _element() { return this; }
310
+ static get style() { return snkDataExporterCss; }
311
+ }, [2, "snk-data-exporter", {
312
+ "provider": [16],
313
+ "_showDropdown": [32],
314
+ "_releasedToExport": [32]
315
+ }]);
316
+ function defineCustomElement() {
317
+ if (typeof customElements === "undefined") {
318
+ return;
319
+ }
320
+ const components = ["snk-data-exporter"];
321
+ components.forEach(tagName => { switch (tagName) {
322
+ case "snk-data-exporter":
323
+ if (!customElements.get(tagName)) {
324
+ customElements.define(tagName, SnkDataExporter);
325
+ }
326
+ break;
327
+ } });
328
+ }
329
+
330
+ export { DataExporterOption as D, SnkDataExporter as S, defineCustomElement as d };
@@ -3,7 +3,7 @@ import { a as draggable_bundle, d as defineCustomElement$1 } from './snk-tab-con
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
6
- import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage.js';
6
+ import { U as UserConfigType, C as ConfigStorage } from './ConfigStorage.js';
7
7
  import { d as defineCustomElement$3 } from './snk-config-options2.js';
8
8
  import { d as defineCustomElement$2 } from './snk-field-config2.js';
9
9
 
@@ -2,7 +2,8 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { DateUtils, ObjectUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { T as TaskbarProcessor } from './taskbar-processor.js';
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
- import { d as defineCustomElement$5 } from './snk-config-options2.js';
5
+ import { d as defineCustomElement$6 } from './snk-config-options2.js';
6
+ import { d as defineCustomElement$5 } from './snk-data-exporter2.js';
6
7
  import { d as defineCustomElement$4 } from './snk-field-config2.js';
7
8
  import { d as defineCustomElement$3 } from './snk-form-config2.js';
8
9
  import { d as defineCustomElement$2 } from './snk-tab-config2.js';
@@ -220,7 +221,7 @@ function defineCustomElement() {
220
221
  if (typeof customElements === "undefined") {
221
222
  return;
222
223
  }
223
- const components = ["snk-form", "snk-config-options", "snk-field-config", "snk-form-config", "snk-tab-config", "snk-taskbar"];
224
+ const components = ["snk-form", "snk-config-options", "snk-data-exporter", "snk-field-config", "snk-form-config", "snk-tab-config", "snk-taskbar"];
224
225
  components.forEach(tagName => { switch (tagName) {
225
226
  case "snk-form":
226
227
  if (!customElements.get(tagName)) {
@@ -228,6 +229,11 @@ function defineCustomElement() {
228
229
  }
229
230
  break;
230
231
  case "snk-config-options":
232
+ if (!customElements.get(tagName)) {
233
+ defineCustomElement$6();
234
+ }
235
+ break;
236
+ case "snk-data-exporter":
231
237
  if (!customElements.get(tagName)) {
232
238
  defineCustomElement$5();
233
239
  }