@sankhyalabs/sankhyablocks 2.4.8 → 2.4.9

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 (86) hide show
  1. package/dist/cjs/{SnkMessageBuilder-61f00e7f.js → SnkMessageBuilder-370e23ae.js} +24 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  5. package/dist/cjs/snk-configurator_3.cjs.entry.js +44 -6
  6. package/dist/cjs/snk-crud.cjs.entry.js +6 -2
  7. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  8. package/dist/cjs/{snk-filter-bar_7.cjs.entry.js → snk-exporter-email-sender_8.cjs.entry.js} +120 -9
  9. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  10. package/dist/cjs/{taskbar-elements-b995b84d.js → taskbar-elements-3807c809.js} +3 -0
  11. package/dist/cjs/{taskbar-processor-6bd0d35c.js → taskbar-processor-6f3d2a75.js} +9 -7
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/snk-crud/snk-crud.js +23 -1
  14. package/dist/collection/components/snk-data-exporter/data/attachment.js +1 -0
  15. package/dist/collection/components/snk-data-exporter/data/email.js +1 -0
  16. package/dist/collection/components/snk-data-exporter/data/export-config.js +1 -0
  17. package/dist/collection/components/snk-data-exporter/data/export-result.js +1 -0
  18. package/dist/collection/components/snk-data-exporter/data/report.js +1 -0
  19. package/dist/collection/components/snk-data-exporter/exporter-email-sender/email-info-step.js +6 -0
  20. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +21 -0
  21. package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +141 -0
  22. package/dist/collection/components/snk-grid/snk-grid.js +71 -6
  23. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +25 -8
  24. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  25. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +9 -7
  26. package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
  27. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  28. package/dist/collection/lib/message/resources/snk-exporter.msg.js +21 -0
  29. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  30. package/dist/components/SnkMessageBuilder.js +24 -1
  31. package/dist/components/index.d.ts +1 -0
  32. package/dist/components/index.js +1 -0
  33. package/dist/components/snk-crud.js +16 -5
  34. package/dist/components/snk-exporter-email-sender.d.ts +11 -0
  35. package/dist/components/snk-exporter-email-sender.js +6 -0
  36. package/dist/components/snk-exporter-email-sender2.js +136 -0
  37. package/dist/components/snk-grid-config2.js +6 -8
  38. package/dist/components/snk-grid2.js +53 -9
  39. package/dist/components/snk-taskbar2.js +5 -1
  40. package/dist/components/taskbar-processor.js +9 -7
  41. package/dist/esm/{SnkMessageBuilder-f5ef87df.js → SnkMessageBuilder-7d583c9a.js} +24 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/sankhyablocks.js +1 -1
  44. package/dist/esm/snk-application.entry.js +1 -1
  45. package/dist/esm/snk-configurator_3.entry.js +44 -6
  46. package/dist/esm/snk-crud.entry.js +6 -2
  47. package/dist/esm/snk-data-unit.entry.js +1 -1
  48. package/dist/esm/{snk-filter-bar_7.entry.js → snk-exporter-email-sender_8.entry.js} +122 -12
  49. package/dist/esm/snk-form.entry.js +1 -1
  50. package/dist/esm/{taskbar-elements-a0a8c3ac.js → taskbar-elements-b2bbe275.js} +3 -0
  51. package/dist/esm/{taskbar-processor-aa6772c9.js → taskbar-processor-c2a99aba.js} +9 -7
  52. package/dist/sankhyablocks/{p-a72a0a5d.entry.js → p-1b7f87cf.entry.js} +1 -1
  53. package/dist/sankhyablocks/p-37f489d3.entry.js +1 -0
  54. package/dist/sankhyablocks/p-5a3e0eb6.js +1 -0
  55. package/dist/sankhyablocks/{p-eb94df0b.entry.js → p-70e52fee.entry.js} +1 -1
  56. package/dist/sankhyablocks/p-c118ef2a.entry.js +1 -0
  57. package/dist/sankhyablocks/p-dbaad88c.js +1 -0
  58. package/dist/sankhyablocks/p-df53643b.entry.js +1 -0
  59. package/dist/sankhyablocks/p-e7f772ed.js +1 -0
  60. package/dist/sankhyablocks/{p-71997e4c.entry.js → p-fb96840c.entry.js} +1 -1
  61. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  62. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  63. package/dist/types/components/snk-data-exporter/data/attachment.d.ts +4 -0
  64. package/dist/types/components/snk-data-exporter/data/email.d.ts +7 -0
  65. package/dist/types/components/snk-data-exporter/data/export-config.d.ts +9 -0
  66. package/dist/types/components/snk-data-exporter/data/export-result.d.ts +8 -0
  67. package/dist/types/components/snk-data-exporter/data/report.d.ts +4 -0
  68. package/dist/types/components/snk-data-exporter/exporter-email-sender/email-info-step.d.ts +9 -0
  69. package/dist/types/components/snk-data-exporter/exporter-email-sender/options-step.d.ts +9 -0
  70. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +6 -3
  71. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  72. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -1
  73. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
  74. package/dist/types/components.d.ts +43 -0
  75. package/dist/types/lib/message/resources/snk-exporter.msg.d.ts +2 -0
  76. package/package.json +1 -1
  77. package/react/components.d.ts +1 -0
  78. package/react/components.js +1 -0
  79. package/react/components.js.map +1 -1
  80. package/dist/sankhyablocks/p-03f0a380.entry.js +0 -1
  81. package/dist/sankhyablocks/p-03f9c407.js +0 -1
  82. package/dist/sankhyablocks/p-4cbc4ae3.js +0 -1
  83. package/dist/sankhyablocks/p-877bd6cf.js +0 -1
  84. package/dist/sankhyablocks/p-e6e0efe7.entry.js +0 -1
  85. package/dist/sankhyablocks/p-f1de5d1f.entry.js +0 -1
  86. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -70
@@ -0,0 +1,21 @@
1
+ import { ElementIDUtils } from "@sankhyalabs/core";
2
+ import { h } from "@stencil/core";
3
+ export const OptionsStep = ({ getMessage, changeInfo, data }) => {
4
+ const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
5
+ const formatOptions = [
6
+ { label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
7
+ { label: getMessage("snkExporter.emailSenderOptStep_formatXLSX"), value: "xlsx" }
8
+ ];
9
+ const typeOptions = [
10
+ { label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
11
+ { label: getMessage("snkExporter.emailSenderOptStep_currentPage"), value: "page" },
12
+ ];
13
+ if (selectionCount > 0) {
14
+ const label = getMessage(selectionCount > 1 ? "snkExporter.emailSenderOptStep_someRecords" : "snkExporter.emailSenderOptStep_oneRecord", { SELECTION_COUNT: selectionCount });
15
+ typeOptions.push({
16
+ label,
17
+ value: "selection"
18
+ });
19
+ }
20
+ return h("div", null, h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("formato")}` }, { label: getMessage("snkExporter.emailSenderOptStep_lblFormat"), direction: "horizontal", value: (data === null || data === void 0 ? void 0 : data.format) || "pdf", onEzChange: evt => changeInfo("format", evt.detail), options: formatOptions })), h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("type")}` }, { label: getMessage("snkExporter.emailSenderOptStep_export"), value: (data === null || data === void 0 ? void 0 : data.type) || "all", onEzChange: evt => changeInfo("type", evt.detail), options: typeOptions })));
21
+ };
@@ -0,0 +1,141 @@
1
+ import { ElementIDUtils } from '@sankhyalabs/core';
2
+ import { h } from '@stencil/core';
3
+ import { EmailInfoStep } from './email-info-step';
4
+ import { OptionsStep } from './options-step';
5
+ export class SnkExporterEmailSender {
6
+ constructor() {
7
+ this._stepInfo = [
8
+ {
9
+ subTitle: "snkExporter.emailSenderOptStep_subtitle",
10
+ firstButton: "snkExporter.emailSenderCancelButton",
11
+ secondButton: "snkExporter.emailSenderNextButton",
12
+ firstButtonAction: () => this.close(),
13
+ secondButtonAction: () => this.changeStep(1)
14
+ },
15
+ {
16
+ subTitle: "snkExporter.emailSenderInfoStep_subtitle",
17
+ firstButton: "snkExporter.emailSenderBackButton",
18
+ secondButton: "snkExporter.emailSenderSendButton",
19
+ firstButtonAction: () => this.changeStep(0),
20
+ secondButtonAction: () => this.send(),
21
+ secondButtonEnabledTester: () => this.isFilled()
22
+ }
23
+ ];
24
+ this._opened = false;
25
+ this._currentStep = 0;
26
+ }
27
+ open(config) {
28
+ this._config = config;
29
+ this._opened = true;
30
+ this.changeStep(0);
31
+ return new Promise(accept => {
32
+ this._promiseResolver = accept;
33
+ });
34
+ }
35
+ getStepMessage(key) {
36
+ const stepInfo = this._stepInfo[this._currentStep] || {};
37
+ return this.getMessage(stepInfo[key]);
38
+ }
39
+ executeButtonAction(first) {
40
+ const stepInfo = this._stepInfo[this._currentStep] || {};
41
+ stepInfo[first ? "firstButtonAction" : "secondButtonAction"]();
42
+ }
43
+ checkButtonEnabled(first) {
44
+ const stepInfo = this._stepInfo[this._currentStep] || {};
45
+ const testFunction = stepInfo[first ? "firstButtonEnabledTester" : "secondButtonEnabledTester"];
46
+ if (testFunction) {
47
+ return testFunction();
48
+ }
49
+ return true;
50
+ }
51
+ changeStep(index) {
52
+ this._currentStep = index;
53
+ if (this._viewStack) {
54
+ this._viewStack.show(this._currentStep);
55
+ }
56
+ }
57
+ send() {
58
+ const { format, type, email } = this._config;
59
+ this._promiseResolver({ format, type, email, report: undefined });
60
+ }
61
+ close() {
62
+ this._opened = false;
63
+ }
64
+ isFilled() {
65
+ var _a, _b;
66
+ return ((_a = this._config.email) === null || _a === void 0 ? void 0 : _a.to) && ((_b = this._config.email) === null || _b === void 0 ? void 0 : _b.subject) ? true : false;
67
+ }
68
+ updateEmailInfo(field, value) {
69
+ this._config = Object.assign(Object.assign({}, this._config), { email: Object.assign(Object.assign({}, this._config.email), { [field]: value }) });
70
+ }
71
+ updateConfigInfo(field, value) {
72
+ this._config = Object.assign(Object.assign({}, this._config), { [field]: value });
73
+ }
74
+ render() {
75
+ var _a;
76
+ ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
77
+ return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: evt => {
78
+ if (evt.detail === "CLOSE")
79
+ this.close();
80
+ }, modalTitle: this.getMessage("snkExporter.emailSenderTitle"), modalSubTitle: this.getStepMessage("subTitle") }, h("ez-view-stack", { ref: ref => this._viewStack = ref }, h("stack-item", null, h(OptionsStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateConfigInfo(field, value) })), h("stack-item", null, h(EmailInfoStep, { getMessage: this.getMessage, data: (_a = this._config) === null || _a === void 0 ? void 0 : _a.email, changeInfo: (field, value) => this.updateEmailInfo(field, value) }))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-button--tertiary ez-padding-right--medium", label: this.getStepMessage("firstButton"), onClick: () => this.executeButtonAction(true), enabled: this.checkButtonEnabled(true) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("firstButton")}` })), h("ez-button", Object.assign({ class: "ez-button--secondary", label: this.getStepMessage("secondButton"), onClick: () => this.executeButtonAction(false), enabled: this.checkButtonEnabled(false) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("secondButton")}` }))))));
81
+ }
82
+ static get is() { return "snk-exporter-email-sender"; }
83
+ static get properties() {
84
+ return {
85
+ "getMessage": {
86
+ "type": "unknown",
87
+ "mutable": false,
88
+ "complexType": {
89
+ "original": "(key: string, params?: any) => string",
90
+ "resolved": "(key: string, params?: any) => string",
91
+ "references": {}
92
+ },
93
+ "required": false,
94
+ "optional": false,
95
+ "docs": {
96
+ "tags": [],
97
+ "text": ""
98
+ }
99
+ }
100
+ };
101
+ }
102
+ static get states() {
103
+ return {
104
+ "_config": {},
105
+ "_opened": {},
106
+ "_currentStep": {}
107
+ };
108
+ }
109
+ static get methods() {
110
+ return {
111
+ "open": {
112
+ "complexType": {
113
+ "signature": "(config: ExportConfig) => Promise<ExportResult>",
114
+ "parameters": [{
115
+ "tags": [],
116
+ "text": ""
117
+ }],
118
+ "references": {
119
+ "Promise": {
120
+ "location": "global"
121
+ },
122
+ "ExportResult": {
123
+ "location": "import",
124
+ "path": "../data/export-result"
125
+ },
126
+ "ExportConfig": {
127
+ "location": "import",
128
+ "path": "../data/export-config"
129
+ }
130
+ },
131
+ "return": "Promise<ExportResult>"
132
+ },
133
+ "docs": {
134
+ "text": "",
135
+ "tags": []
136
+ }
137
+ }
138
+ };
139
+ }
140
+ static get elementRef() { return "_element"; }
141
+ }
@@ -1,17 +1,22 @@
1
- import { ElementIDUtils } from '@sankhyalabs/core';
2
1
  import { h } from '@stencil/core';
2
+ import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
4
4
  import { ConfigStorage } from '../../lib/configs/ConfigStorage';
5
+ import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
6
  export class SnkGrid {
6
7
  constructor() {
7
8
  this._topTaskbarProcessor = new TaskbarProcessor({
8
9
  "snkGridTopTaskbar": ["FORM_MODE", "CONFIGURATOR", "INSERT"]
9
10
  });
10
11
  this._headerTaskbarProcessor = new TaskbarProcessor({
11
- "snkGridHeaderTaskbar.unselected": ["REFRESH"],
12
- "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
12
+ "snkGridHeaderTaskbar.unselected": ["REFRESH", "EXPORT"],
13
+ "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH", "EXPORT"]
13
14
  });
14
15
  this._popUpGridConfig = false;
16
+ /**
17
+ * Determina se haverá exportação de dados
18
+ */
19
+ this.enableDataExporter = false;
15
20
  }
16
21
  /**
17
22
  * Exibe a janela de configurações da grade.
@@ -37,6 +42,37 @@ export class SnkGrid {
37
42
  async setConfig(config) {
38
43
  this.setGridConfig(config);
39
44
  }
45
+ actionClickHandler(event) {
46
+ if (event.detail === TaskbarElement.EXPORT) {
47
+ // TODO: Quando o exportador de grades for implementado, essa ação
48
+ // vai fazer mostrar as opções disponíveis. Enviar por email será
49
+ // apenas mais uma
50
+ const selectedRows = this._dataState.selectedRecords.length;
51
+ const config = {
52
+ format: "pdf",
53
+ type: selectedRows > 0 ? "selection" : "all",
54
+ selectedRows,
55
+ email: {
56
+ attachments: [
57
+ { name: "Movimentação Financeira.pdf", size: 1024 * 231 }
58
+ ]
59
+ }
60
+ };
61
+ this._snkEmailSender.open(config)
62
+ .then((result) => {
63
+ this._application.message("resultado", JSON.stringify(result));
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
69
+ * através de um pequeno modulo na estrutura da aplicação:
70
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
71
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-grid.msg.ts"
72
+ */
73
+ getMessage(key, params) {
74
+ return this._application.messagesBuilder.getMessage(key, params);
75
+ }
40
76
  openGridConfig() {
41
77
  this._grid.getColumnsState()
42
78
  .then((gridColumns) => {
@@ -72,6 +108,7 @@ export class SnkGrid {
72
108
  });
73
109
  }
74
110
  componentWillLoad() {
111
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
75
112
  let parent = this._element.parentElement;
76
113
  while (parent) {
77
114
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -96,9 +133,10 @@ export class SnkGrid {
96
133
  this.loadConfig();
97
134
  }
98
135
  componentWillRender() {
136
+ const invisibleButtons = this.enableDataExporter ? [] : ["EXPORT"];
99
137
  const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
100
- this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
101
- this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
138
+ this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState, undefined, invisibleButtons);
139
+ this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState, undefined, invisibleButtons);
102
140
  }
103
141
  addElementID() {
104
142
  const dataInfo = { dataUnit: this._dataUnit };
@@ -108,7 +146,7 @@ export class SnkGrid {
108
146
  if (!this._dataUnit) {
109
147
  return undefined;
110
148
  }
111
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
149
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("snk-exporter-email-sender", { ref: ref => this._snkEmailSender = ref, getMessage: (key, params) => this.getMessage(key, params) }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
112
150
  }
113
151
  static get is() { return "snk-grid"; }
114
152
  static get encapsulation() { return "scoped"; }
@@ -220,6 +258,24 @@ export class SnkGrid {
220
258
  },
221
259
  "attribute": "multiple-selection",
222
260
  "reflect": false
261
+ },
262
+ "enableDataExporter": {
263
+ "type": "boolean",
264
+ "mutable": false,
265
+ "complexType": {
266
+ "original": "boolean",
267
+ "resolved": "boolean",
268
+ "references": {}
269
+ },
270
+ "required": false,
271
+ "optional": false,
272
+ "docs": {
273
+ "tags": [],
274
+ "text": "Determina se haver\u00E1 exporta\u00E7\u00E3o de dados"
275
+ },
276
+ "attribute": "enable-data-exporter",
277
+ "reflect": false,
278
+ "defaultValue": "false"
223
279
  }
224
280
  };
225
281
  }
@@ -324,4 +380,13 @@ export class SnkGrid {
324
380
  };
325
381
  }
326
382
  static get elementRef() { return "_element"; }
383
+ static get listeners() {
384
+ return [{
385
+ "name": "actionClick",
386
+ "method": "actionClickHandler",
387
+ "target": undefined,
388
+ "capture": false,
389
+ "passive": false
390
+ }];
391
+ }
327
392
  }
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
1
+ import { StringUtils, ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { h, Host } from '@stencil/core';
4
4
  import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
@@ -13,7 +13,7 @@ export class EzGridConfig {
13
13
  this._componenteInternalKey = Date.now();
14
14
  /**
15
15
  * Aba selecionada das configurações da grade.
16
- */
16
+ */
17
17
  this.selectedIndex = 0;
18
18
  }
19
19
  /* Creation Methods */
@@ -22,10 +22,10 @@ export class EzGridConfig {
22
22
  */
23
23
  async saveConfig(config) {
24
24
  var _a;
25
- if (config == undefined || ((_a = this._application) === null || _a === void 0 ? void 0 : _a.configName) == undefined) {
25
+ if (config == undefined || ((_a = this.application) === null || _a === void 0 ? void 0 : _a.configName) == undefined) {
26
26
  return;
27
27
  }
28
- ConfigStorage.saveGridConfig(config, this._application.configName)
28
+ ConfigStorage.saveGridConfig(config, this.application.configName)
29
29
  .then((response) => {
30
30
  if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
31
31
  this.configChange.emit(config);
@@ -40,7 +40,7 @@ export class EzGridConfig {
40
40
  * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-grid.msg.ts"
41
41
  */
42
42
  getMessage(key, params) {
43
- return this._application.messagesBuilder.getMessage(key, params);
43
+ return this.application.messagesBuilder.getMessage(key, params);
44
44
  }
45
45
  createOrderList() {
46
46
  let newList = [];
@@ -459,9 +459,6 @@ export class EzGridConfig {
459
459
  this.locateColumn(new KeyboardEvent("arrow-right", { key: "ArrowRight" }), this._searchElement.value);
460
460
  }
461
461
  }
462
- componentWillLoad() {
463
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
464
- }
465
462
  componentDidLoad() {
466
463
  ElementIDUtils.addIDInfo(this._element);
467
464
  }
@@ -501,6 +498,26 @@ export class EzGridConfig {
501
498
  "reflect": false,
502
499
  "defaultValue": "0"
503
500
  },
501
+ "application": {
502
+ "type": "unknown",
503
+ "mutable": false,
504
+ "complexType": {
505
+ "original": "SnkApplication",
506
+ "resolved": "SnkApplication",
507
+ "references": {
508
+ "SnkApplication": {
509
+ "location": "import",
510
+ "path": "../../../snk-application/snk-application"
511
+ }
512
+ }
513
+ },
514
+ "required": false,
515
+ "optional": false,
516
+ "docs": {
517
+ "tags": [],
518
+ "text": "Refer\u00EAncia para o SnkApplication"
519
+ }
520
+ },
504
521
  "columns": {
505
522
  "type": "unknown",
506
523
  "mutable": true,
@@ -15,6 +15,7 @@ export var TaskbarElement;
15
15
  TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
16
16
  TaskbarElement["DIVIDER"] = "DIVIDER";
17
17
  TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
18
+ TaskbarElement["EXPORT"] = "EXPORT";
18
19
  })(TaskbarElement || (TaskbarElement = {}));
19
20
  export var AuthorizationElements;
20
21
  (function (AuthorizationElements) {
@@ -69,6 +70,8 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
69
70
  return iconButton("list", element, className, dataElementId, title, action, isEnabled);
70
71
  case TaskbarElement.CONFIGURATOR:
71
72
  return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
73
+ case TaskbarElement.EXPORT:
74
+ return iconButton("file-download", element, className, dataElementId, title, action, isEnabled);
72
75
  case TaskbarElement.MORE_OPTIONS:
73
76
  return actionButton(element, className, dataElementId, title, action, isEnabled, actions);
74
77
  case TaskbarElement.DIVIDER:
@@ -2,7 +2,7 @@ export default class TaskbarProcessor {
2
2
  constructor(defaultButtons) {
3
3
  this._defaultButtons = defaultButtons;
4
4
  }
5
- process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
5
+ process(taskbarId, taskbarManager, dataState, disabledButtons = [], invisibleButtons = []) {
6
6
  var _a;
7
7
  this.customButtons = new Map();
8
8
  this.buttons = "";
@@ -17,13 +17,15 @@ export default class TaskbarProcessor {
17
17
  this.customButtons.set(customBtn.name, customBtn);
18
18
  buttonName = customBtn.name;
19
19
  }
20
- if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
21
- this.disabledButtons.push(buttonName);
20
+ if (!invisibleButtons.includes(buttonName)) {
21
+ if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
22
+ this.disabledButtons.push(buttonName);
23
+ }
24
+ if (this.buttons.length > 0) {
25
+ this.buttons += ",";
26
+ }
27
+ this.buttons += buttonName;
22
28
  }
23
- if (this.buttons.length > 0) {
24
- this.buttons += ",";
25
- }
26
- this.buttons += buttonName;
27
29
  });
28
30
  }
29
31
  getButtonsArray(taskbarId, taskbarManager, dataState) {
@@ -17,7 +17,8 @@ export class SnkTaskbar {
17
17
  [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
18
18
  [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
19
19
  [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
20
- [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator"
20
+ [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
21
+ [TaskbarElement.EXPORT]: "snkTaskbar.titleExportar"
21
22
  };
22
23
  }
23
24
  observeButtons() {
@@ -2,6 +2,7 @@ import snkDataUnitMessages from "./resources/snk-data-unit.msg.js";
2
2
  import snkFilterBarMessages from "./resources/snk-filter-bar.msg.js";
3
3
  import snkTaskbarMessages from "./resources/snk-taskbar.msg.js";
4
4
  import crudUtilsMessages from "./resources/crud-utils.msg.js";
5
+ import snkExporterMessages from "./resources/snk-exporter.msg.js";
5
6
  import { snkFormMessages, snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg.js";
6
7
  import { snkConfiguratorMessages } from "./resources/snk-configurator.msg.js";
7
8
  import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg.js";
@@ -19,7 +20,8 @@ export class SnkMessageBuilder {
19
20
  snkTabConfig: snkTabConfigMessages,
20
21
  crudUtils: crudUtilsMessages,
21
22
  snkGrid: snkGridMessages,
22
- snkGridConfig: snkGridConfigMessages
23
+ snkGridConfig: snkGridConfigMessages,
24
+ snkExporter: snkExporterMessages
23
25
  };
24
26
  this._currentOperation = OperationMap.CLEAN;
25
27
  this.loadAppMessages().then((msgs) => {
@@ -0,0 +1,21 @@
1
+ const snkExporterMessages = {
2
+ emailSenderTitle: "Enviar por email",
3
+ emailSenderBackButton: "Voltar",
4
+ emailSenderNextButton: "Avançar",
5
+ emailSenderCancelButton: "Cancelar",
6
+ emailSenderSendButton: "Enviar",
7
+ emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
8
+ emailSenderOptStep_lblFormat: "Formato:",
9
+ emailSenderOptStep_formatPDF: "PDF (.pdf)",
10
+ emailSenderOptStep_formatXLSX: "Planilha (.xlsx)",
11
+ emailSenderOptStep_export: "Exportar:",
12
+ emailSenderOptStep_allData: "Toda a grade",
13
+ emailSenderOptStep_currentPage: "Somente a página atual",
14
+ emailSenderOptStep_someRecords: "{{SELECTION_COUNT}} linhas selecionadas",
15
+ emailSenderOptStep_oneRecord: "Somente a linha selecionada",
16
+ emailSenderInfoStep_subtitle: "Informações de email",
17
+ emailSenderInfoStep_sendTo: "Enviar para",
18
+ emailSenderInfoStep_subject: "Assunto",
19
+ emailSenderInfoStep_message: "Mensagem"
20
+ };
21
+ export default snkExporterMessages;
@@ -12,6 +12,7 @@ const snkTaskbarMessages = {
12
12
  titleGridMode: "Modo Grade",
13
13
  titleFormMode: "Modo Formulário",
14
14
  titleConfigurator: "Configurações",
15
+ titleExportar: "Exportar",
15
16
  forbidden: "Permissão não liberada"
16
17
  };
17
18
  export default snkTaskbarMessages;
@@ -69,6 +69,7 @@ const snkTaskbarMessages = {
69
69
  titleGridMode: "Modo Grade",
70
70
  titleFormMode: "Modo Formulário",
71
71
  titleConfigurator: "Configurações",
72
+ titleExportar: "Exportar",
72
73
  forbidden: "Permissão não liberada"
73
74
  };
74
75
 
@@ -76,6 +77,27 @@ const crudUtilsMessages = {
76
77
  errorArray: "CrudUtils.find deve receber um array de fields, ou uma lista separada por virgula.",
77
78
  };
78
79
 
80
+ const snkExporterMessages = {
81
+ emailSenderTitle: "Enviar por email",
82
+ emailSenderBackButton: "Voltar",
83
+ emailSenderNextButton: "Avançar",
84
+ emailSenderCancelButton: "Cancelar",
85
+ emailSenderSendButton: "Enviar",
86
+ emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
87
+ emailSenderOptStep_lblFormat: "Formato:",
88
+ emailSenderOptStep_formatPDF: "PDF (.pdf)",
89
+ emailSenderOptStep_formatXLSX: "Planilha (.xlsx)",
90
+ emailSenderOptStep_export: "Exportar:",
91
+ emailSenderOptStep_allData: "Toda a grade",
92
+ emailSenderOptStep_currentPage: "Somente a página atual",
93
+ emailSenderOptStep_someRecords: "{{SELECTION_COUNT}} linhas selecionadas",
94
+ emailSenderOptStep_oneRecord: "Somente a linha selecionada",
95
+ emailSenderInfoStep_subtitle: "Informações de email",
96
+ emailSenderInfoStep_sendTo: "Enviar para",
97
+ emailSenderInfoStep_subject: "Assunto",
98
+ emailSenderInfoStep_message: "Mensagem"
99
+ };
100
+
79
101
  const snkFormMessages = {
80
102
  title: {
81
103
  clone: "Duplicar registro",
@@ -197,7 +219,8 @@ class SnkMessageBuilder {
197
219
  snkTabConfig: snkTabConfigMessages,
198
220
  crudUtils: crudUtilsMessages,
199
221
  snkGrid: snkGridMessages,
200
- snkGridConfig: snkGridConfigMessages
222
+ snkGridConfig: snkGridConfigMessages,
223
+ snkExporter: snkExporterMessages
201
224
  };
202
225
  this._currentOperation = OperationMap.CLEAN;
203
226
  this.loadAppMessages().then((msgs) => {
@@ -4,6 +4,7 @@ export { SnkConfigOptions as SnkConfigOptions } from '../types/components/snk-fo
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
6
  export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
7
+ export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
7
8
  export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/subcomponents/snk-field-config/snk-field-config';
8
9
  export { SnkFilterBar as SnkFilterBar } from '../types/components/snk-filter-bar/snk-filter-bar';
9
10
  export { SnkFilterBinarySelect as SnkFilterBinarySelect } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select';
@@ -4,6 +4,7 @@ export { SnkConfigOptions, defineCustomElement as defineCustomElementSnkConfigOp
4
4
  export { SnkConfigurator, defineCustomElement as defineCustomElementSnkConfigurator } from './snk-configurator.js';
5
5
  export { SnkCrud, defineCustomElement as defineCustomElementSnkCrud } from './snk-crud.js';
6
6
  export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
7
+ export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
7
8
  export { SnkFieldConfig, defineCustomElement as defineCustomElementSnkFieldConfig } from './snk-field-config.js';
8
9
  export { SnkFilterBar, defineCustomElement as defineCustomElementSnkFilterBar } from './snk-filter-bar.js';
9
10
  export { SnkFilterBinarySelect, defineCustomElement as defineCustomElementSnkFilterBinarySelect } from './snk-filter-binary-select.js';
@@ -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$g } from './snk-config-options2.js';
6
- import { d as defineCustomElement$f } from './snk-configurator2.js';
5
+ import { d as defineCustomElement$h } from './snk-config-options2.js';
6
+ import { d as defineCustomElement$g } from './snk-configurator2.js';
7
+ import { d as defineCustomElement$f } from './snk-exporter-email-sender2.js';
7
8
  import { d as defineCustomElement$e } from './snk-field-config2.js';
8
9
  import { d as defineCustomElement$d } from './snk-filter-bar2.js';
9
10
  import { d as defineCustomElement$c } from './snk-filter-detail2.js';
@@ -31,6 +32,10 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
31
32
  * Determina se pode haver mais de uma linha selecionada na grade.
32
33
  */
33
34
  this.multipleSelection = true;
35
+ /**
36
+ * Determina se haverá exportação de dados
37
+ */
38
+ this.enableDataExporter = false;
34
39
  }
35
40
  /**
36
41
  * Usado para alternar a visão entre GRID e FORM externamente.
@@ -109,7 +114,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
109
114
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
110
115
  }
111
116
  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), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { ref: (ref) => this._snkForm = ref, "data-element-id": "crud_form", configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
117
+ 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), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, enableDataExporter: this.enableDataExporter }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { ref: (ref) => this._snkForm = ref, "data-element-id": "crud_form", configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
113
118
  }
114
119
  get _element() { return this; }
115
120
  static get style() { return snkCrudCss; }
@@ -120,6 +125,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
120
125
  "recordsValidator": [16],
121
126
  "statusResolver": [16],
122
127
  "multipleSelection": [4, "multiple-selection"],
128
+ "enableDataExporter": [4, "enable-data-exporter"],
123
129
  "_dataUnit": [32],
124
130
  "_dataState": [32],
125
131
  "_viewMode": [32],
@@ -129,7 +135,7 @@ function defineCustomElement$1() {
129
135
  if (typeof customElements === "undefined") {
130
136
  return;
131
137
  }
132
- const components = ["snk-crud", "snk-config-options", "snk-configurator", "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"];
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"];
133
139
  components.forEach(tagName => { switch (tagName) {
134
140
  case "snk-crud":
135
141
  if (!customElements.get(tagName)) {
@@ -138,10 +144,15 @@ function defineCustomElement$1() {
138
144
  break;
139
145
  case "snk-config-options":
140
146
  if (!customElements.get(tagName)) {
141
- defineCustomElement$g();
147
+ defineCustomElement$h();
142
148
  }
143
149
  break;
144
150
  case "snk-configurator":
151
+ if (!customElements.get(tagName)) {
152
+ defineCustomElement$g();
153
+ }
154
+ break;
155
+ case "snk-exporter-email-sender":
145
156
  if (!customElements.get(tagName)) {
146
157
  defineCustomElement$f();
147
158
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkExporterEmailSender extends Components.SnkExporterEmailSender, HTMLElement {}
4
+ export const SnkExporterEmailSender: {
5
+ prototype: SnkExporterEmailSender;
6
+ new (): SnkExporterEmailSender;
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 SnkExporterEmailSender$1, d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
2
+
3
+ const SnkExporterEmailSender = SnkExporterEmailSender$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkExporterEmailSender, defineCustomElement };