@sankhyalabs/sankhyablocks 6.7.0 → 6.9.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.
- package/dist/cjs/{ConfigStorage-86ffc4ab.js → ConfigStorage-3aaa8a9f.js} +4 -4
- package/dist/cjs/{DataFetcher-35849b28.js → DataFetcher-093c47ae.js} +146 -0
- package/dist/cjs/{SnkFormConfigManager-3b8e7c8a.js → SnkFormConfigManager-ddad3cbb.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-ba6d4ade.js → SnkMessageBuilder-e55c7afa.js} +25 -1
- package/dist/cjs/{dataunit-fetcher-e46b3c0f.js → dataunit-fetcher-2f67ac79.js} +7 -2
- package/dist/cjs/{filter-bar-config-fetcher-2c62fb37.js → filter-bar-config-fetcher-81868495.js} +1 -1
- package/dist/cjs/{form-config-fetcher-f137bca0.js → form-config-fetcher-affb0b28.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-d53d9d40.js → pesquisa-fetcher-21c3afc9.js} +1 -1
- package/dist/cjs/{resource-fetcher-28fb554b.js → resource-fetcher-e71a11b8.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +9 -8
- package/dist/cjs/snk-attach.cjs.entry.js +3 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-60e7965f.js → snk-data-unit-26cf970c.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
- package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -5
- package/dist/cjs/snk-filter-detail.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -5
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-form.cjs.entry.js +6 -6
- package/dist/cjs/snk-grid-config.cjs.entry.js +5 -5
- package/dist/cjs/snk-grid.cjs.entry.js +5 -5
- package/dist/cjs/{snk-guides-viewer-40808d6c.js → snk-guides-viewer-b0f98cf4.js} +3 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +5 -5
- package/dist/cjs/snk-print-selector.cjs.entry.js +164 -0
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-print-selector/snk-print-selector.css +27 -0
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +200 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +10 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +6 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-print-selector.msg.js +22 -0
- package/dist/collection/lib/utils/PrintUtils.js +137 -0
- package/dist/components/DataFetcher.js +147 -2
- package/dist/components/SnkMessageBuilder.js +25 -1
- package/dist/components/dataunit-fetcher.js +6 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-print-selector.d.ts +11 -0
- package/dist/components/snk-print-selector.js +179 -0
- package/dist/esm/{ConfigStorage-a4e8c4ab.js → ConfigStorage-24b221ba.js} +4 -4
- package/dist/esm/{DataFetcher-74c98125.js → DataFetcher-6153ff3e.js} +147 -2
- package/dist/esm/{SnkFormConfigManager-cc85f865.js → SnkFormConfigManager-fcbefc1a.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-9d2becfb.js → SnkMessageBuilder-96e66d9c.js} +25 -1
- package/dist/esm/{dataunit-fetcher-aa43793c.js → dataunit-fetcher-09586248.js} +7 -2
- package/dist/esm/{filter-bar-config-fetcher-34892dca.js → filter-bar-config-fetcher-73ebc12f.js} +1 -1
- package/dist/esm/{form-config-fetcher-055ecbac.js → form-config-fetcher-01e9985d.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-f03c9cd5.js → pesquisa-fetcher-829ec5a9.js} +1 -1
- package/dist/esm/{resource-fetcher-c1210690.js → resource-fetcher-d053e214.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +2 -2
- package/dist/esm/snk-application.entry.js +9 -8
- package/dist/esm/snk-attach.entry.js +3 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-5e4fe819.js → snk-data-unit-0f2d3c74.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-filter-bar.entry.js +5 -5
- package/dist/esm/snk-filter-detail.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +5 -5
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +6 -6
- package/dist/esm/snk-grid-config.entry.js +5 -5
- package/dist/esm/snk-grid.entry.js +5 -5
- package/dist/esm/{snk-guides-viewer-9e9b5290.js → snk-guides-viewer-ab5c376c.js} +3 -3
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +5 -5
- package/dist/esm/snk-print-selector.entry.js +156 -0
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-c2cb015f.entry.js → p-05d82333.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cfcd8f5b.entry.js → p-07cb8a03.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4acd4b0c.entry.js → p-13f0ed88.entry.js} +1 -1
- package/dist/sankhyablocks/p-16ad23d5.entry.js +1 -0
- package/dist/sankhyablocks/{p-0a0985c9.entry.js → p-1b596ea1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-77fe6eae.entry.js → p-1cf9d5a6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6871a878.js → p-2b449454.js} +1 -1
- package/dist/sankhyablocks/{p-f8499a4e.entry.js → p-3e8748b1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cad72c62.entry.js → p-432dd007.entry.js} +1 -1
- package/dist/sankhyablocks/p-43e18073.entry.js +11 -0
- package/dist/sankhyablocks/{p-c7be0415.entry.js → p-4ab8d0ee.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3d8120ef.js → p-60ad0dea.js} +1 -1
- package/dist/sankhyablocks/p-6f49f5d4.entry.js +1 -0
- package/dist/sankhyablocks/{p-3ab6b96d.js → p-744d0fd2.js} +1 -1
- package/dist/sankhyablocks/{p-187b54d0.entry.js → p-7dd92fb8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-79e24321.js → p-814f9247.js} +1 -1
- package/dist/sankhyablocks/{p-00f584c7.entry.js → p-85e6068d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-548af336.js → p-89fb7531.js} +2 -2
- package/dist/sankhyablocks/p-9404ad4d.entry.js +1 -0
- package/dist/sankhyablocks/{p-93935922.js → p-9a7aafe4.js} +1 -1
- package/dist/sankhyablocks/p-ad4bb9d2.entry.js +1 -0
- package/dist/sankhyablocks/{p-d15777d0.entry.js → p-bd1f8640.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a1b76ddf.js → p-bfe8b96d.js} +1 -1
- package/dist/sankhyablocks/{p-58334b3b.js → p-d20e2ce3.js} +2 -2
- package/dist/sankhyablocks/{p-c0be90a3.entry.js → p-e665c93f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-59e539a4.js → p-e789eb2d.js} +1 -1
- package/dist/sankhyablocks/{p-425addc3.js → p-eaec700d.js} +1 -1
- package/dist/sankhyablocks/{p-01070d6d.js → p-eb0c9f4c.js} +1 -1
- package/dist/sankhyablocks/{p-e6dc5f63.entry.js → p-feb6963e.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-print-selector/snk-print-selector.d.ts +40 -0
- package/dist/types/components.d.ts +15 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-print-selector.msg.d.ts +1 -0
- package/dist/types/lib/utils/PrintUtils.d.ts +51 -0
- package/package.json +2 -2
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-18056610.entry.js +0 -1
- package/dist/sankhyablocks/p-1a2d8996.entry.js +0 -1
- package/dist/sankhyablocks/p-47f8fef4.entry.js +0 -1
- package/dist/sankhyablocks/p-8265d50d.entry.js +0 -11
@@ -0,0 +1,200 @@
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
2
|
+
import { PrintUtils } from "../../lib/utils/PrintUtils";
|
3
|
+
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
4
|
+
import { ApplicationContext, ElementIDUtils } from "@sankhyalabs/core";
|
5
|
+
import ModalButtonStatus from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status";
|
6
|
+
export class SnkPrintSelector {
|
7
|
+
constructor() {
|
8
|
+
this.APPLY = "OK";
|
9
|
+
this.CANCEL = "CANCEL";
|
10
|
+
this.CLOSE = "CLOSE";
|
11
|
+
this.REMOTE_PRINTERS_TAB = '0';
|
12
|
+
this.LOCAL_PRINTERS_TAB = '1';
|
13
|
+
this._hasRemotePrinters = false;
|
14
|
+
this._hasLocalPrinters = false;
|
15
|
+
this._localPrinters = [];
|
16
|
+
this._isSingleJob = false;
|
17
|
+
this.buildIdTabSelector = () => {
|
18
|
+
const defaultTabs = [
|
19
|
+
{
|
20
|
+
label: this._application.messagesBuilder.getMessage("snkPrintSelector.title.localPrintersTab", undefined),
|
21
|
+
tabKey: this.LOCAL_PRINTERS_TAB,
|
22
|
+
index: Number(this.LOCAL_PRINTERS_TAB)
|
23
|
+
}
|
24
|
+
];
|
25
|
+
if (this._printServerActive) {
|
26
|
+
defaultTabs.unshift({
|
27
|
+
label: this._application.messagesBuilder.getMessage("snkPrintSelector.title.remotePrintersTab", undefined),
|
28
|
+
tabKey: this.REMOTE_PRINTERS_TAB,
|
29
|
+
index: Number(this.REMOTE_PRINTERS_TAB)
|
30
|
+
});
|
31
|
+
}
|
32
|
+
return [...defaultTabs];
|
33
|
+
};
|
34
|
+
this._printServerActive = false;
|
35
|
+
this._selectedPrinter = undefined;
|
36
|
+
this._remotePrintersDataSource = [];
|
37
|
+
this._localPrintersDataSource = [];
|
38
|
+
this._printJobData = undefined;
|
39
|
+
}
|
40
|
+
async openPrintSelector(printJobData) {
|
41
|
+
return new Promise((resolve) => {
|
42
|
+
this._printJobData = printJobData;
|
43
|
+
this._isSingleJob = this._printJobData.pendingPrinters.length === 1;
|
44
|
+
this._printServerActive = this._printJobData.printServerActive;
|
45
|
+
if (this._printServerActive) {
|
46
|
+
this.buildRemotePrinters();
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
this.buildLocalPrinters();
|
50
|
+
this._viewStack.show(+this.LOCAL_PRINTERS_TAB);
|
51
|
+
}
|
52
|
+
this._ezPopup.opened = true;
|
53
|
+
this._printerResolver = resolve;
|
54
|
+
});
|
55
|
+
}
|
56
|
+
closePrintSelector() {
|
57
|
+
this._ezPopup.opened = false;
|
58
|
+
this.element.remove();
|
59
|
+
}
|
60
|
+
handleModalAction(evt) {
|
61
|
+
switch (evt) {
|
62
|
+
case this.APPLY:
|
63
|
+
this.handleApply();
|
64
|
+
break;
|
65
|
+
case this.CANCEL:
|
66
|
+
case this.CLOSE:
|
67
|
+
this.handleCancel();
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
async handleCancel() {
|
72
|
+
const result = await ApplicationUtils.confirm(this._application.messagesBuilder.getMessage("snkPrintSelector.title.warning", undefined), this._application.messagesBuilder.getMessage("snkPrintSelector.message.canceledPrint", undefined));
|
73
|
+
if (result) {
|
74
|
+
this.closePrintSelector();
|
75
|
+
this._printerResolver(undefined);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
handleApply() {
|
79
|
+
this._printerResolver(this._selectedPrinter);
|
80
|
+
this.closePrintSelector();
|
81
|
+
}
|
82
|
+
onChangeTab(evt) {
|
83
|
+
if (evt.detail.tabKey === this.LOCAL_PRINTERS_TAB) {
|
84
|
+
this.buildLocalPrinters();
|
85
|
+
}
|
86
|
+
this._viewStack.show(+evt.detail.tabKey);
|
87
|
+
}
|
88
|
+
buildRemotePrinters() {
|
89
|
+
const dataSource = [];
|
90
|
+
this._printJobData.printServers.forEach((printServer) => {
|
91
|
+
dataSource.push({
|
92
|
+
group: printServer.printServerUri,
|
93
|
+
items: printServer.printerList.map((printer) => ({
|
94
|
+
label: printer.printerName,
|
95
|
+
group: printServer.printServerUri
|
96
|
+
}))
|
97
|
+
});
|
98
|
+
});
|
99
|
+
this._remotePrintersDataSource = dataSource;
|
100
|
+
this._hasRemotePrinters = this._remotePrintersDataSource.length > 0;
|
101
|
+
}
|
102
|
+
buildLocalPrinters() {
|
103
|
+
if (this._localPrintersDataSource.length > 0)
|
104
|
+
return;
|
105
|
+
this._localPrinters = PrintUtils.getInstance().getLocalPrinters();
|
106
|
+
this._localPrintersDataSource = this._localPrinters.map((printer) => ({
|
107
|
+
label: printer.nome
|
108
|
+
}));
|
109
|
+
this._hasLocalPrinters = this._localPrintersDataSource.length > 0;
|
110
|
+
}
|
111
|
+
onSelectPrinter(printer, isLocal) {
|
112
|
+
if (isLocal) {
|
113
|
+
if (this._hasRemotePrinters)
|
114
|
+
this._remotePrintersList.removeSelection();
|
115
|
+
this._selectedPrinter = this._localPrinters.find((item) => item.nome === printer.label);
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
if (this._hasLocalPrinters)
|
119
|
+
this._localPrintersList.removeSelection();
|
120
|
+
const serverGroup = this._printJobData.printServers.find((item) => item.printServerUri === printer.group);
|
121
|
+
this._selectedPrinter = serverGroup === null || serverGroup === void 0 ? void 0 : serverGroup.printerList.find((item) => item.printerName === printer.label);
|
122
|
+
}
|
123
|
+
renderNoPrinters() {
|
124
|
+
return (h("div", { class: 'ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full' }, h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._application.messagesBuilder.getMessage("snkPrintSelector.message.noPrinters", undefined))));
|
125
|
+
}
|
126
|
+
buildPrinterIcon() {
|
127
|
+
return (h("ez-icon", { iconName: "print", style: { marginRight: 'var(--space--small)' } }));
|
128
|
+
}
|
129
|
+
getElementID(sufix) {
|
130
|
+
return {
|
131
|
+
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
132
|
+
};
|
133
|
+
}
|
134
|
+
componentWillLoad() {
|
135
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
136
|
+
}
|
137
|
+
componentDidLoad() {
|
138
|
+
if (!this.element)
|
139
|
+
return;
|
140
|
+
ElementIDUtils.addIDInfo(this.element);
|
141
|
+
}
|
142
|
+
render() {
|
143
|
+
return (h(Host, null, h("ez-popup", Object.assign({ size: 'small', heightMode: 'full', useHeader: false, ref: (ref) => this._ezPopup = ref }, this.getElementID("snk-print-selector")), h("ez-modal-container", { modalTitle: this._application.messagesBuilder.getMessage("snkPrintSelector.title.printerSelection", undefined), okButtonLabel: this._application.messagesBuilder.getMessage("snkPrintSelector.button.print", undefined), okButtonStatus: this._selectedPrinter ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED, cancelButtonLabel: this._application.messagesBuilder.getMessage("snkPrintSelector.button.cancel", undefined), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, this._isSingleJob &&
|
144
|
+
h("div", { class: 'ez-flex ez-margin-bottom--large' }, h("div", { class: 'ez-flex ez-margin-right--large' }, h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this._application.messagesBuilder.getMessage("snkPrintSelector.subtitle.document", undefined)), h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].docTypeDescription)), h("div", { class: 'ez-flex ez-margin-right--large' }, h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this._application.messagesBuilder.getMessage("snkPrintSelector.subtitle.jobs", undefined)), h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].printJobCount))), h("ez-tabselector", { tabs: this.buildIdTabSelector(), onEzChange: (evt) => this.onChangeTab(evt), selectedTab: this._printServerActive ? this.REMOTE_PRINTERS_TAB : this.LOCAL_PRINTERS_TAB }), h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", { hidePolicy: 'hide' }, this._printServerActive &&
|
145
|
+
h("div", { class: "list-scroll ez-size-height--full" }, h("ez-list", { ref: (ref) => this._remotePrintersList = ref, class: `ez-padding-top--medium ${this._hasRemotePrinters ? '' : 'hidden'}`, dataSource: this._remotePrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, false), itemLeftSlotBuilder: this.buildPrinterIcon, useGroups: true, ezSelectable: true, hoverFeedback: true, "data-element-id": 'remotePrintersList' }), !this._hasRemotePrinters && this.renderNoPrinters())), h("stack-item", { hidePolicy: 'hide' }, h("div", { class: "list-scroll ez-size-height--full" }, h("ez-list", { ref: (ref) => this._localPrintersList = ref, class: `ez-padding-top--medium ${this._hasLocalPrinters ? '' : 'hidden'}`, dataSource: this._localPrintersDataSource, onEzSelectItem: (evt) => this.onSelectPrinter(evt.detail, true), itemLeftSlotBuilder: this.buildPrinterIcon, ezSelectable: true, hoverFeedback: true }), !this._hasLocalPrinters && this.renderNoPrinters())))))));
|
146
|
+
}
|
147
|
+
static get is() { return "snk-print-selector"; }
|
148
|
+
static get encapsulation() { return "scoped"; }
|
149
|
+
static get originalStyleUrls() {
|
150
|
+
return {
|
151
|
+
"$": ["snk-print-selector.css"]
|
152
|
+
};
|
153
|
+
}
|
154
|
+
static get styleUrls() {
|
155
|
+
return {
|
156
|
+
"$": ["snk-print-selector.css"]
|
157
|
+
};
|
158
|
+
}
|
159
|
+
static get states() {
|
160
|
+
return {
|
161
|
+
"_printServerActive": {},
|
162
|
+
"_selectedPrinter": {},
|
163
|
+
"_remotePrintersDataSource": {},
|
164
|
+
"_localPrintersDataSource": {},
|
165
|
+
"_printJobData": {}
|
166
|
+
};
|
167
|
+
}
|
168
|
+
static get methods() {
|
169
|
+
return {
|
170
|
+
"openPrintSelector": {
|
171
|
+
"complexType": {
|
172
|
+
"signature": "(printJobData: PendingPrintJobData) => Promise<DataPrinter | undefined>",
|
173
|
+
"parameters": [{
|
174
|
+
"tags": [],
|
175
|
+
"text": ""
|
176
|
+
}],
|
177
|
+
"references": {
|
178
|
+
"Promise": {
|
179
|
+
"location": "global"
|
180
|
+
},
|
181
|
+
"DataPrinter": {
|
182
|
+
"location": "import",
|
183
|
+
"path": "../../lib/utils/PrintUtils"
|
184
|
+
},
|
185
|
+
"PendingPrintJobData": {
|
186
|
+
"location": "import",
|
187
|
+
"path": "../../lib/utils/PrintUtils"
|
188
|
+
}
|
189
|
+
},
|
190
|
+
"return": "Promise<DataPrinter>"
|
191
|
+
},
|
192
|
+
"docs": {
|
193
|
+
"text": "",
|
194
|
+
"tags": []
|
195
|
+
}
|
196
|
+
}
|
197
|
+
};
|
198
|
+
}
|
199
|
+
static get elementRef() { return "element"; }
|
200
|
+
}
|
@@ -4,6 +4,7 @@ import UrlUtils from "../../../lib/utils/urlutils";
|
|
4
4
|
import { StringUtils } from '@sankhyalabs/core';
|
5
5
|
import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
|
6
6
|
import { GraphQLRecaller } from './recaller/GraphQLRecaller';
|
7
|
+
import { PrintUtils } from '../../utils/PrintUtils';
|
7
8
|
export class DataFetcher {
|
8
9
|
constructor() {
|
9
10
|
this.GRAPHQL_PATH = "/mgefin-bff/graphql";
|
@@ -146,6 +147,14 @@ export class DataFetcher {
|
|
146
147
|
}
|
147
148
|
});
|
148
149
|
}
|
150
|
+
processPrinting(payload) {
|
151
|
+
if ((payload === null || payload === void 0 ? void 0 : payload.pendingPrinting) === 'true') {
|
152
|
+
PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
|
153
|
+
}
|
154
|
+
if ('localPrintings' in payload) {
|
155
|
+
PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
|
156
|
+
}
|
157
|
+
}
|
149
158
|
getContext(module) {
|
150
159
|
var _a;
|
151
160
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
@@ -205,6 +214,7 @@ export class DataFetcher {
|
|
205
214
|
}
|
206
215
|
}
|
207
216
|
this.proccessServiceBorkerClientEvents(jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject);
|
217
|
+
this.processPrinting(jsonResp);
|
208
218
|
}
|
209
219
|
catch (err) {
|
210
220
|
console.warn(`Erro ao executar serviço: ${err}`);
|
@@ -14,6 +14,7 @@ import { ChangeOperation, DataType, DataUnit, StringUtils, DataUnitStorage } fro
|
|
14
14
|
import { gql } from "graphql-request";
|
15
15
|
import { DataFetcher } from "../DataFetcher";
|
16
16
|
import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
|
17
|
+
import { DataUnitTransient } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
|
17
18
|
export default class DataUnitFetcher {
|
18
19
|
constructor() {
|
19
20
|
this.templateByQuery = new Map();
|
@@ -300,9 +301,13 @@ export default class DataUnitFetcher {
|
|
300
301
|
});
|
301
302
|
});
|
302
303
|
}
|
304
|
+
getTransientInfo(dataUnit, recordID) {
|
305
|
+
const { records } = dataUnit.getSelectionInfo();
|
306
|
+
return Object.entries(records.filter(record => record.__record__id__ == recordID)[0]).filter(([key]) => key.startsWith(DataUnitTransient.DATA_UNIT_TRANSIENT_PREFIX_NAME)).map(([name, value]) => ({ fieldName: name, value, dataType: DataType.TEXT }));
|
307
|
+
}
|
303
308
|
removeRecords(dataUnit, recordIds) {
|
304
309
|
const changes = recordIds.map((recordId) => {
|
305
|
-
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
|
310
|
+
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId, fields: this.getTransientInfo(dataUnit, recordId) };
|
306
311
|
});
|
307
312
|
return new Promise((resolve, reject) => {
|
308
313
|
DataFetcher.get()
|
@@ -16,6 +16,7 @@ import { snkAttachMessages } from "./resources/snk-attach.msg";
|
|
16
16
|
import { snkPersonalizedFilterMessages } from "./resources/snk-personalized-filter.msg.js";
|
17
17
|
import { snkEntityListMessages } from "./resources/snk-entity-list.msg.js";
|
18
18
|
import { snkActionsButtonMessages } from "./resources/snk-actions-button.msg.js";
|
19
|
+
import { snkPrintSelectorMessages } from "./resources/snk-print-selector.msg.js";
|
19
20
|
import { ApplicationContext } from "@sankhyalabs/core";
|
20
21
|
export class SnkMessageBuilder {
|
21
22
|
constructor(domainName) {
|
@@ -41,7 +42,8 @@ export class SnkMessageBuilder {
|
|
41
42
|
snkAttach: snkAttachMessages,
|
42
43
|
snkPersonalizedFilter: snkPersonalizedFilterMessages,
|
43
44
|
snkEntityList: snkEntityListMessages,
|
44
|
-
snkActionsButton: snkActionsButtonMessages
|
45
|
+
snkActionsButton: snkActionsButtonMessages,
|
46
|
+
snkPrintSelector: snkPrintSelectorMessages
|
45
47
|
};
|
46
48
|
this._currentOperation = OperationMap.CLEAN;
|
47
49
|
this._domainName = domainName;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export const snkPrintSelectorMessages = {
|
2
|
+
title: {
|
3
|
+
warning: "Aviso",
|
4
|
+
printerSelection: "Seleção de impressora",
|
5
|
+
remotePrintersTab: "Impressoras remotas",
|
6
|
+
localPrintersTab: "Impressoras locais"
|
7
|
+
},
|
8
|
+
subtitle: {
|
9
|
+
document: "Documento:",
|
10
|
+
jobs: "Trabalhos:"
|
11
|
+
},
|
12
|
+
message: {
|
13
|
+
canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
|
14
|
+
noPrinters: "Não há impressoras para seleção"
|
15
|
+
},
|
16
|
+
button: {
|
17
|
+
print: "Imprimir",
|
18
|
+
cancel: "Cancelar",
|
19
|
+
yes: "Sim",
|
20
|
+
no: "Não"
|
21
|
+
}
|
22
|
+
};
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import { StringUtils } from "@sankhyalabs/core";
|
2
|
+
import { DataFetcher } from "../http/data-fetcher/DataFetcher";
|
3
|
+
export class PrintUtils {
|
4
|
+
constructor() {
|
5
|
+
}
|
6
|
+
static getInstance() {
|
7
|
+
if (!PrintUtils.instance) {
|
8
|
+
PrintUtils.instance = new PrintUtils();
|
9
|
+
}
|
10
|
+
return PrintUtils.instance;
|
11
|
+
}
|
12
|
+
async processPendingPrinting(transactionId) {
|
13
|
+
await this.findPendingPrints(transactionId);
|
14
|
+
}
|
15
|
+
async findPendingPrints(transactionId) {
|
16
|
+
const requestBody = {
|
17
|
+
transactionIds: [
|
18
|
+
{
|
19
|
+
transactionId: {
|
20
|
+
$: transactionId
|
21
|
+
}
|
22
|
+
}
|
23
|
+
]
|
24
|
+
};
|
25
|
+
const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
|
26
|
+
const printJobData = this.parsePrintData(response);
|
27
|
+
this.openSnkPrintSelector(printJobData);
|
28
|
+
}
|
29
|
+
findLocalPrinters() {
|
30
|
+
const appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
31
|
+
if (!appletImpressao)
|
32
|
+
return [];
|
33
|
+
const localPrinters = appletImpressao.getLocalPrinters();
|
34
|
+
if (!localPrinters)
|
35
|
+
return [];
|
36
|
+
const printers = [];
|
37
|
+
for (const printerName of localPrinters.split(',')) {
|
38
|
+
printers.push({
|
39
|
+
nome: printerName,
|
40
|
+
printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
|
41
|
+
isLocal: true
|
42
|
+
});
|
43
|
+
}
|
44
|
+
return printers;
|
45
|
+
}
|
46
|
+
getLocalPrinters() {
|
47
|
+
return this.findLocalPrinters();
|
48
|
+
}
|
49
|
+
parsePrintData(payload) {
|
50
|
+
const pendingPrintJobData = payload.pendindPrintJobData;
|
51
|
+
if (!pendingPrintJobData)
|
52
|
+
return undefined;
|
53
|
+
let { printServers: { printServer }, pendingPrinters: { pendingPrinter } } = pendingPrintJobData;
|
54
|
+
printServer = printServer ? (Array.isArray(printServer) ? printServer : [printServer]) : [];
|
55
|
+
pendingPrinter = pendingPrinter ? (Array.isArray(pendingPrinter) ? pendingPrinter : [pendingPrinter]) : [];
|
56
|
+
const normalizedPrintServer = printServer.map(item => {
|
57
|
+
const printerList = Array.isArray(item.printerLocation) ? item.printerLocation : [item.printerLocation];
|
58
|
+
return {
|
59
|
+
printServerUri: item.printServerUri,
|
60
|
+
printerList: printerList.map(this.normalize)
|
61
|
+
};
|
62
|
+
});
|
63
|
+
const normalizedPendingPrinter = pendingPrinter.map(this.normalize);
|
64
|
+
return {
|
65
|
+
transactionId: pendingPrintJobData.transactionId.$,
|
66
|
+
printServers: normalizedPrintServer,
|
67
|
+
pendingPrinters: normalizedPendingPrinter,
|
68
|
+
printServerActive: pendingPrintJobData.printServers.printServerActive === 'true'
|
69
|
+
};
|
70
|
+
}
|
71
|
+
normalize(object) {
|
72
|
+
const normalizedObject = {};
|
73
|
+
Object.keys(object).forEach((key) => {
|
74
|
+
normalizedObject[key] = PrintUtils.ENCODED_PROPERTIES.includes(key) ? window.atob(object[key].$) : object[key].$;
|
75
|
+
});
|
76
|
+
return normalizedObject;
|
77
|
+
}
|
78
|
+
processLocalPrinting(localPrintings) {
|
79
|
+
const transactionIds = localPrintings.map((item) => item.transactionId);
|
80
|
+
this.doLocalPrinting(transactionIds.join());
|
81
|
+
}
|
82
|
+
doLocalPrinting(transactionIds) {
|
83
|
+
const appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
84
|
+
if (!appletImpressao)
|
85
|
+
return;
|
86
|
+
appletImpressao.doLocalPrinting(transactionIds);
|
87
|
+
}
|
88
|
+
async openSnkPrintSelector(printJobData) {
|
89
|
+
let printSelector = document.querySelector('snk-print-selector');
|
90
|
+
if (!printSelector) {
|
91
|
+
printSelector = document.createElement('snk-print-selector');
|
92
|
+
printSelector.setAttribute('id', StringUtils.generateUUID());
|
93
|
+
window.document.body.appendChild(printSelector);
|
94
|
+
}
|
95
|
+
const selectedPrinter = await printSelector.openPrintSelector(printJobData);
|
96
|
+
if (!selectedPrinter)
|
97
|
+
return;
|
98
|
+
await this.saveSubstitutePrinter(printJobData.transactionId, printJobData.pendingPrinters, selectedPrinter);
|
99
|
+
}
|
100
|
+
async saveSubstitutePrinter(transactionId, pendingPrinters, printer) {
|
101
|
+
const parsedPendingPrinters = pendingPrinters.map((item) => ({
|
102
|
+
printerUri: {
|
103
|
+
$: printer.printerUri
|
104
|
+
},
|
105
|
+
originalPrinterName: {
|
106
|
+
$: item.originalPrinterName
|
107
|
+
},
|
108
|
+
printJobCount: {
|
109
|
+
$: item.printJobCount
|
110
|
+
},
|
111
|
+
docType: {
|
112
|
+
$: item.docType
|
113
|
+
},
|
114
|
+
docTypeDescription: {
|
115
|
+
$: item.docTypeDescription
|
116
|
+
}
|
117
|
+
}));
|
118
|
+
const requestBody = {
|
119
|
+
substitutePrintersRequest: {
|
120
|
+
substitutePrinters: {
|
121
|
+
pendingPrinter: parsedPendingPrinters
|
122
|
+
},
|
123
|
+
saveSubstitutePrinters: {
|
124
|
+
$: 'false'
|
125
|
+
},
|
126
|
+
transactionId: {
|
127
|
+
$: transactionId
|
128
|
+
}
|
129
|
+
}
|
130
|
+
};
|
131
|
+
await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
|
135
|
+
PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
|
136
|
+
PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
|
137
|
+
PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApplicationContext, ErrorException, WarningException, ObjectUtils
|
1
|
+
import { StringUtils, ApplicationContext, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
2
2
|
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers.js';
|
3
3
|
|
4
4
|
var browserPonyfill = createCommonjsModule(function (module, exports) {
|
@@ -6464,6 +6464,142 @@ class GraphQLRecaller {
|
|
6464
6464
|
}
|
6465
6465
|
}
|
6466
6466
|
|
6467
|
+
class PrintUtils {
|
6468
|
+
constructor() {
|
6469
|
+
}
|
6470
|
+
static getInstance() {
|
6471
|
+
if (!PrintUtils.instance) {
|
6472
|
+
PrintUtils.instance = new PrintUtils();
|
6473
|
+
}
|
6474
|
+
return PrintUtils.instance;
|
6475
|
+
}
|
6476
|
+
async processPendingPrinting(transactionId) {
|
6477
|
+
await this.findPendingPrints(transactionId);
|
6478
|
+
}
|
6479
|
+
async findPendingPrints(transactionId) {
|
6480
|
+
const requestBody = {
|
6481
|
+
transactionIds: [
|
6482
|
+
{
|
6483
|
+
transactionId: {
|
6484
|
+
$: transactionId
|
6485
|
+
}
|
6486
|
+
}
|
6487
|
+
]
|
6488
|
+
};
|
6489
|
+
const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
|
6490
|
+
const printJobData = this.parsePrintData(response);
|
6491
|
+
this.openSnkPrintSelector(printJobData);
|
6492
|
+
}
|
6493
|
+
findLocalPrinters() {
|
6494
|
+
const appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
6495
|
+
if (!appletImpressao)
|
6496
|
+
return [];
|
6497
|
+
const localPrinters = appletImpressao.getLocalPrinters();
|
6498
|
+
if (!localPrinters)
|
6499
|
+
return [];
|
6500
|
+
const printers = [];
|
6501
|
+
for (const printerName of localPrinters.split(',')) {
|
6502
|
+
printers.push({
|
6503
|
+
nome: printerName,
|
6504
|
+
printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
|
6505
|
+
isLocal: true
|
6506
|
+
});
|
6507
|
+
}
|
6508
|
+
return printers;
|
6509
|
+
}
|
6510
|
+
getLocalPrinters() {
|
6511
|
+
return this.findLocalPrinters();
|
6512
|
+
}
|
6513
|
+
parsePrintData(payload) {
|
6514
|
+
const pendingPrintJobData = payload.pendindPrintJobData;
|
6515
|
+
if (!pendingPrintJobData)
|
6516
|
+
return undefined;
|
6517
|
+
let { printServers: { printServer }, pendingPrinters: { pendingPrinter } } = pendingPrintJobData;
|
6518
|
+
printServer = printServer ? (Array.isArray(printServer) ? printServer : [printServer]) : [];
|
6519
|
+
pendingPrinter = pendingPrinter ? (Array.isArray(pendingPrinter) ? pendingPrinter : [pendingPrinter]) : [];
|
6520
|
+
const normalizedPrintServer = printServer.map(item => {
|
6521
|
+
const printerList = Array.isArray(item.printerLocation) ? item.printerLocation : [item.printerLocation];
|
6522
|
+
return {
|
6523
|
+
printServerUri: item.printServerUri,
|
6524
|
+
printerList: printerList.map(this.normalize)
|
6525
|
+
};
|
6526
|
+
});
|
6527
|
+
const normalizedPendingPrinter = pendingPrinter.map(this.normalize);
|
6528
|
+
return {
|
6529
|
+
transactionId: pendingPrintJobData.transactionId.$,
|
6530
|
+
printServers: normalizedPrintServer,
|
6531
|
+
pendingPrinters: normalizedPendingPrinter,
|
6532
|
+
printServerActive: pendingPrintJobData.printServers.printServerActive === 'true'
|
6533
|
+
};
|
6534
|
+
}
|
6535
|
+
normalize(object) {
|
6536
|
+
const normalizedObject = {};
|
6537
|
+
Object.keys(object).forEach((key) => {
|
6538
|
+
normalizedObject[key] = PrintUtils.ENCODED_PROPERTIES.includes(key) ? window.atob(object[key].$) : object[key].$;
|
6539
|
+
});
|
6540
|
+
return normalizedObject;
|
6541
|
+
}
|
6542
|
+
processLocalPrinting(localPrintings) {
|
6543
|
+
const transactionIds = localPrintings.map((item) => item.transactionId);
|
6544
|
+
this.doLocalPrinting(transactionIds.join());
|
6545
|
+
}
|
6546
|
+
doLocalPrinting(transactionIds) {
|
6547
|
+
const appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
6548
|
+
if (!appletImpressao)
|
6549
|
+
return;
|
6550
|
+
appletImpressao.doLocalPrinting(transactionIds);
|
6551
|
+
}
|
6552
|
+
async openSnkPrintSelector(printJobData) {
|
6553
|
+
let printSelector = document.querySelector('snk-print-selector');
|
6554
|
+
if (!printSelector) {
|
6555
|
+
printSelector = document.createElement('snk-print-selector');
|
6556
|
+
printSelector.setAttribute('id', StringUtils.generateUUID());
|
6557
|
+
window.document.body.appendChild(printSelector);
|
6558
|
+
}
|
6559
|
+
const selectedPrinter = await printSelector.openPrintSelector(printJobData);
|
6560
|
+
if (!selectedPrinter)
|
6561
|
+
return;
|
6562
|
+
await this.saveSubstitutePrinter(printJobData.transactionId, printJobData.pendingPrinters, selectedPrinter);
|
6563
|
+
}
|
6564
|
+
async saveSubstitutePrinter(transactionId, pendingPrinters, printer) {
|
6565
|
+
const parsedPendingPrinters = pendingPrinters.map((item) => ({
|
6566
|
+
printerUri: {
|
6567
|
+
$: printer.printerUri
|
6568
|
+
},
|
6569
|
+
originalPrinterName: {
|
6570
|
+
$: item.originalPrinterName
|
6571
|
+
},
|
6572
|
+
printJobCount: {
|
6573
|
+
$: item.printJobCount
|
6574
|
+
},
|
6575
|
+
docType: {
|
6576
|
+
$: item.docType
|
6577
|
+
},
|
6578
|
+
docTypeDescription: {
|
6579
|
+
$: item.docTypeDescription
|
6580
|
+
}
|
6581
|
+
}));
|
6582
|
+
const requestBody = {
|
6583
|
+
substitutePrintersRequest: {
|
6584
|
+
substitutePrinters: {
|
6585
|
+
pendingPrinter: parsedPendingPrinters
|
6586
|
+
},
|
6587
|
+
saveSubstitutePrinters: {
|
6588
|
+
$: 'false'
|
6589
|
+
},
|
6590
|
+
transactionId: {
|
6591
|
+
$: transactionId
|
6592
|
+
}
|
6593
|
+
}
|
6594
|
+
};
|
6595
|
+
await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
|
6596
|
+
}
|
6597
|
+
}
|
6598
|
+
PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
|
6599
|
+
PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
|
6600
|
+
PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
|
6601
|
+
PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
|
6602
|
+
|
6467
6603
|
class DataFetcher {
|
6468
6604
|
constructor() {
|
6469
6605
|
this.GRAPHQL_PATH = "/mgefin-bff/graphql";
|
@@ -6606,6 +6742,14 @@ class DataFetcher {
|
|
6606
6742
|
}
|
6607
6743
|
});
|
6608
6744
|
}
|
6745
|
+
processPrinting(payload) {
|
6746
|
+
if ((payload === null || payload === void 0 ? void 0 : payload.pendingPrinting) === 'true') {
|
6747
|
+
PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
|
6748
|
+
}
|
6749
|
+
if ('localPrintings' in payload) {
|
6750
|
+
PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
|
6751
|
+
}
|
6752
|
+
}
|
6609
6753
|
getContext(module) {
|
6610
6754
|
var _a;
|
6611
6755
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
@@ -6665,6 +6809,7 @@ class DataFetcher {
|
|
6665
6809
|
}
|
6666
6810
|
}
|
6667
6811
|
this.proccessServiceBorkerClientEvents(jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject);
|
6812
|
+
this.processPrinting(jsonResp);
|
6668
6813
|
}
|
6669
6814
|
catch (err) {
|
6670
6815
|
console.warn(`Erro ao executar serviço: ${err}`);
|
@@ -6843,4 +6988,4 @@ class WaitingRequest {
|
|
6843
6988
|
}
|
6844
6989
|
}
|
6845
6990
|
|
6846
|
-
export { DataFetcher as D, UrlUtils as U, dist as d };
|
6991
|
+
export { DataFetcher as D, PrintUtils as P, UrlUtils as U, dist as d };
|
@@ -439,6 +439,29 @@ const snkActionsButtonMessages = {
|
|
439
439
|
}
|
440
440
|
};
|
441
441
|
|
442
|
+
const snkPrintSelectorMessages = {
|
443
|
+
title: {
|
444
|
+
warning: "Aviso",
|
445
|
+
printerSelection: "Seleção de impressora",
|
446
|
+
remotePrintersTab: "Impressoras remotas",
|
447
|
+
localPrintersTab: "Impressoras locais"
|
448
|
+
},
|
449
|
+
subtitle: {
|
450
|
+
document: "Documento:",
|
451
|
+
jobs: "Trabalhos:"
|
452
|
+
},
|
453
|
+
message: {
|
454
|
+
canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
|
455
|
+
noPrinters: "Não há impressoras para seleção"
|
456
|
+
},
|
457
|
+
button: {
|
458
|
+
print: "Imprimir",
|
459
|
+
cancel: "Cancelar",
|
460
|
+
yes: "Sim",
|
461
|
+
no: "Não"
|
462
|
+
}
|
463
|
+
};
|
464
|
+
|
442
465
|
class SnkMessageBuilder {
|
443
466
|
constructor(domainName) {
|
444
467
|
this._defaults = {
|
@@ -463,7 +486,8 @@ class SnkMessageBuilder {
|
|
463
486
|
snkAttach: snkAttachMessages,
|
464
487
|
snkPersonalizedFilter: snkPersonalizedFilterMessages,
|
465
488
|
snkEntityList: snkEntityListMessages,
|
466
|
-
snkActionsButton: snkActionsButtonMessages
|
489
|
+
snkActionsButton: snkActionsButtonMessages,
|
490
|
+
snkPrintSelector: snkPrintSelectorMessages
|
467
491
|
};
|
468
492
|
this._currentOperation = OperationMap.CLEAN;
|
469
493
|
this._domainName = domainName;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { DataUnit, StringUtils, DataType, DataUnitStorage, ChangeOperation } from '@sankhyalabs/core';
|
2
2
|
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
4
|
+
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
5
|
|
5
6
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
6
7
|
var t = {};
|
@@ -299,9 +300,13 @@ class DataUnitFetcher {
|
|
299
300
|
});
|
300
301
|
});
|
301
302
|
}
|
303
|
+
getTransientInfo(dataUnit, recordID) {
|
304
|
+
const { records } = dataUnit.getSelectionInfo();
|
305
|
+
return Object.entries(records.filter(record => record.__record__id__ == recordID)[0]).filter(([key]) => key.startsWith(DataUnitTransient.DATA_UNIT_TRANSIENT_PREFIX_NAME)).map(([name, value]) => ({ fieldName: name, value, dataType: DataType.TEXT }));
|
306
|
+
}
|
302
307
|
removeRecords(dataUnit, recordIds) {
|
303
308
|
const changes = recordIds.map((recordId) => {
|
304
|
-
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
|
309
|
+
return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId, fields: this.getTransientInfo(dataUnit, recordId) };
|
305
310
|
});
|
306
311
|
return new Promise((resolve, reject) => {
|
307
312
|
DataFetcher.get()
|
@@ -39,6 +39,7 @@ export { SnkGuidesViewer as SnkGuidesViewer } from '../types/components/snk-crud
|
|
39
39
|
export { SnkPersonalizedFilter as SnkPersonalizedFilter } from '../types/components/snk-personalized-filter/snk-personalized-filter';
|
40
40
|
export { SnkFilterPersonalized as SnkPersonalizedFilterEditor } from '../types/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor';
|
41
41
|
export { SnkPesquisa as SnkPesquisa } from '../types/components/snk-pesquisa/snk-pesquisa';
|
42
|
+
export { SnkPrintSelector as SnkPrintSelector } from '../types/components/snk-print-selector/snk-print-selector';
|
42
43
|
export { SelectBox as SnkSelectBox } from '../types/components/snk-grid/subcomponents/snk-select-box/snk-select-box';
|
43
44
|
export { SnkSimpleBar as SnkSimpleBar } from '../types/components/snk-simple-bar/snk-simple-bar';
|
44
45
|
export { SnkSimpleCrud as SnkSimpleCrud } from '../types/components/snk-simple-crud/snk-simple-crud';
|