@sankhyalabs/sankhyablocks 6.9.2 → 6.10.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-3aaa8a9f.js → ConfigStorage-da2bf3bf.js} +4 -4
- package/dist/cjs/{DataFetcher-093c47ae.js → DataFetcher-04c70ba9.js} +88 -24
- package/dist/cjs/{SnkFormConfigManager-ddad3cbb.js → SnkFormConfigManager-d7cc9118.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-e55c7afa.js → SnkMessageBuilder-a5a9b437.js} +2 -1
- package/dist/cjs/{dataunit-fetcher-2f67ac79.js → dataunit-fetcher-4102080d.js} +1 -1
- package/dist/cjs/{filter-bar-config-fetcher-81868495.js → filter-bar-config-fetcher-58cfc12e.js} +1 -1
- package/dist/cjs/{form-config-fetcher-affb0b28.js → form-config-fetcher-56442594.js} +2 -2
- package/dist/cjs/{pesquisa-fetcher-21c3afc9.js → pesquisa-fetcher-cab451b6.js} +1 -1
- package/dist/cjs/{resource-fetcher-e71a11b8.js → resource-fetcher-260e98a4.js} +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +8 -8
- package/dist/cjs/snk-attach.cjs.entry.js +2 -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-26cf970c.js → snk-data-unit-9d03800c.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-b0f98cf4.js → snk-guides-viewer-36766466.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 +15 -11
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-print-selector/snk-print-selector.css +9 -1
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +17 -14
- package/dist/collection/lib/message/resources/snk-print-selector.msg.js +2 -1
- package/dist/collection/lib/utils/PrintUtils.js +88 -24
- package/dist/components/DataFetcher.js +88 -24
- package/dist/components/SnkMessageBuilder.js +2 -1
- package/dist/components/snk-print-selector.js +14 -10
- package/dist/esm/{ConfigStorage-24b221ba.js → ConfigStorage-f1e805a0.js} +4 -4
- package/dist/esm/{DataFetcher-6153ff3e.js → DataFetcher-fddeb917.js} +88 -24
- package/dist/esm/{SnkFormConfigManager-fcbefc1a.js → SnkFormConfigManager-324f6dc7.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-96e66d9c.js → SnkMessageBuilder-76f62087.js} +2 -1
- package/dist/esm/{dataunit-fetcher-09586248.js → dataunit-fetcher-66f42154.js} +1 -1
- package/dist/esm/{filter-bar-config-fetcher-73ebc12f.js → filter-bar-config-fetcher-a358b8e0.js} +1 -1
- package/dist/esm/{form-config-fetcher-01e9985d.js → form-config-fetcher-533b895e.js} +2 -2
- package/dist/esm/{pesquisa-fetcher-829ec5a9.js → pesquisa-fetcher-4a702655.js} +1 -1
- package/dist/esm/{resource-fetcher-d053e214.js → resource-fetcher-0f20a072.js} +1 -1
- package/dist/esm/snk-actions-button.entry.js +2 -2
- package/dist/esm/snk-application.entry.js +8 -8
- package/dist/esm/snk-attach.entry.js +2 -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-0f2d3c74.js → snk-data-unit-0ff2d644.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-ab5c376c.js → snk-guides-viewer-e7209909.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 +15 -11
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-4ab8d0ee.entry.js → p-18b74675.entry.js} +1 -1
- package/dist/sankhyablocks/{p-85e6068d.entry.js → p-2ddf3e87.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7dd92fb8.entry.js → p-3251999f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-744d0fd2.js → p-432a73a8.js} +1 -1
- package/dist/sankhyablocks/{p-eb0c9f4c.js → p-4f3df9b6.js} +1 -1
- package/dist/sankhyablocks/p-4f550a1a.js +1 -0
- package/dist/sankhyablocks/{p-a4cd60bf.entry.js → p-522172e1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-16ad23d5.entry.js → p-5596a2dd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9a7aafe4.js → p-56378a3b.js} +1 -1
- package/dist/sankhyablocks/{p-13f0ed88.entry.js → p-6490021d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bfe8b96d.js → p-652b9081.js} +1 -1
- package/dist/sankhyablocks/{p-eaec700d.js → p-7a075ae6.js} +1 -1
- package/dist/sankhyablocks/p-7fd8a0ab.entry.js +1 -0
- package/dist/sankhyablocks/p-82800006.entry.js +1 -0
- package/dist/sankhyablocks/{p-1b596ea1.entry.js → p-8d583a79.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d20e2ce3.js → p-8f484733.js} +1 -1
- package/dist/sankhyablocks/{p-e665c93f.entry.js → p-8f6575c8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-814f9247.js → p-982107dc.js} +1 -1
- package/dist/sankhyablocks/{p-feb6963e.entry.js → p-9f34a127.entry.js} +1 -1
- package/dist/sankhyablocks/{p-07cb8a03.entry.js → p-a357d13c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3e8748b1.entry.js → p-af8ed6d5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bd1f8640.entry.js → p-bc19b890.entry.js} +1 -1
- package/dist/sankhyablocks/{p-354ce206.entry.js → p-bd840081.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e789eb2d.js → p-d4adf773.js} +1 -1
- package/dist/sankhyablocks/{p-89fb7531.js → p-d97eb781.js} +2 -2
- package/dist/sankhyablocks/p-eb30a52a.entry.js +1 -0
- package/dist/sankhyablocks/{p-05d82333.entry.js → p-ed9e1e52.entry.js} +1 -1
- package/dist/sankhyablocks/{p-432dd007.entry.js → p-eef26a01.entry.js} +1 -1
- package/dist/sankhyablocks/{p-60ad0dea.js → p-f034254e.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-print-selector/snk-print-selector.d.ts +7 -1
- package/dist/types/components.d.ts +3 -2
- package/dist/types/lib/utils/PrintUtils.d.ts +5 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-2b449454.js +0 -1
- package/dist/sankhyablocks/p-6f49f5d4.entry.js +0 -1
- package/dist/sankhyablocks/p-9404ad4d.entry.js +0 -1
- package/dist/sankhyablocks/p-ad4bb9d2.entry.js +0 -1
@@ -5,16 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-cfcd9af2.js');
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
8
|
+
const ConfigStorage = require('./ConfigStorage-da2bf3bf.js');
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
10
10
|
const IExpressionItem = require('./IExpressionItem-0e32ebb7.js');
|
11
11
|
const index$1 = require('./index-102ba62d.js');
|
12
12
|
require('./filter-item-type.enum-aa823a00.js');
|
13
|
-
require('./form-config-fetcher-
|
14
|
-
require('./DataFetcher-
|
13
|
+
require('./form-config-fetcher-56442594.js');
|
14
|
+
require('./DataFetcher-04c70ba9.js');
|
15
15
|
require('./_commonjsHelpers-537d719a.js');
|
16
|
-
require('./resource-fetcher-
|
17
|
-
require('./filter-bar-config-fetcher-
|
16
|
+
require('./resource-fetcher-260e98a4.js');
|
17
|
+
require('./filter-bar-config-fetcher-58cfc12e.js');
|
18
18
|
|
19
19
|
const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}";
|
20
20
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
|
-
const DataFetcher = require('./DataFetcher-
|
6
|
+
const DataFetcher = require('./DataFetcher-04c70ba9.js');
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
8
8
|
const core = require('@sankhyalabs/core');
|
9
9
|
const ModalButtonStatus = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status');
|
@@ -13,7 +13,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
13
13
|
|
14
14
|
const ModalButtonStatus__default = /*#__PURE__*/_interopDefaultLegacy(ModalButtonStatus);
|
15
15
|
|
16
|
-
const snkPrintSelectorCss = ".sc-snk-print-selector-h{max-height:100%}ez-modal-container.sc-snk-print-selector{--ez-modal-container-overflow-y:hidden}ez-list.sc-snk-print-selector{height:100%}.list-scroll.sc-snk-print-selector{
|
16
|
+
const snkPrintSelectorCss = ".sc-snk-print-selector-h{max-height:100%}ez-modal-container.sc-snk-print-selector{--ez-modal-container-overflow-y:hidden}ez-list.sc-snk-print-selector{height:100%}.list-scroll.sc-snk-print-selector{height:100%;overflow-y:auto;padding-right:var(--snk-grid-config__main--padding-right)}.with-header.sc-snk-print-selector{max-height:calc(100% - 125px)}.without-header.sc-snk-print-selector{max-height:calc(100% - 85px)}.list-scroll.sc-snk-print-selector::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.hidden.sc-snk-print-selector{display:none}";
|
17
17
|
|
18
18
|
const SnkPrintSelector = class {
|
19
19
|
constructor(hostRef) {
|
@@ -27,17 +27,18 @@ const SnkPrintSelector = class {
|
|
27
27
|
this._hasLocalPrinters = false;
|
28
28
|
this._localPrinters = [];
|
29
29
|
this._isSingleJob = false;
|
30
|
+
this._saveSubstitute = false;
|
30
31
|
this.buildIdTabSelector = () => {
|
31
32
|
const defaultTabs = [
|
32
33
|
{
|
33
|
-
label: this.
|
34
|
+
label: this.getMessage("snkPrintSelector.title.localPrintersTab"),
|
34
35
|
tabKey: this.LOCAL_PRINTERS_TAB,
|
35
36
|
index: Number(this.LOCAL_PRINTERS_TAB)
|
36
37
|
}
|
37
38
|
];
|
38
39
|
if (this._printServerActive) {
|
39
40
|
defaultTabs.unshift({
|
40
|
-
label: this.
|
41
|
+
label: this.getMessage("snkPrintSelector.title.remotePrintersTab"),
|
41
42
|
tabKey: this.REMOTE_PRINTERS_TAB,
|
42
43
|
index: Number(this.REMOTE_PRINTERS_TAB)
|
43
44
|
});
|
@@ -82,14 +83,14 @@ const SnkPrintSelector = class {
|
|
82
83
|
}
|
83
84
|
}
|
84
85
|
async handleCancel() {
|
85
|
-
const result = await utils.ApplicationUtils.confirm(this.
|
86
|
+
const result = await utils.ApplicationUtils.confirm(this.getMessage("snkPrintSelector.title.warning"), this.getMessage("snkPrintSelector.message.canceledPrint"));
|
86
87
|
if (result) {
|
87
88
|
this.closePrintSelector();
|
88
|
-
this._printerResolver(undefined);
|
89
|
+
this._printerResolver({ selectedPrinter: undefined, saveSubstitute: false });
|
89
90
|
}
|
90
91
|
}
|
91
92
|
handleApply() {
|
92
|
-
this._printerResolver(this._selectedPrinter);
|
93
|
+
this._printerResolver({ selectedPrinter: this._selectedPrinter, saveSubstitute: this._saveSubstitute });
|
93
94
|
this.closePrintSelector();
|
94
95
|
}
|
95
96
|
onChangeTab(evt) {
|
@@ -134,7 +135,7 @@ const SnkPrintSelector = class {
|
|
134
135
|
this._selectedPrinter = serverGroup === null || serverGroup === void 0 ? void 0 : serverGroup.printerList.find((item) => item.printerName === printer.label);
|
135
136
|
}
|
136
137
|
renderNoPrinters() {
|
137
|
-
return (index.h("div", { class: 'ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full' }, index.h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this.
|
138
|
+
return (index.h("div", { class: 'ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full' }, index.h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this.getMessage("snkPrintSelector.message.noPrinters"))));
|
138
139
|
}
|
139
140
|
buildPrinterIcon() {
|
140
141
|
return (index.h("ez-icon", { iconName: "print", style: { marginRight: 'var(--space--small)' } }));
|
@@ -144,6 +145,9 @@ const SnkPrintSelector = class {
|
|
144
145
|
[core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
|
145
146
|
};
|
146
147
|
}
|
148
|
+
getMessage(path) {
|
149
|
+
return this._application.messagesBuilder.getMessage(path, undefined);
|
150
|
+
}
|
147
151
|
componentWillLoad() {
|
148
152
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
149
153
|
}
|
@@ -153,9 +157,9 @@ const SnkPrintSelector = class {
|
|
153
157
|
core.ElementIDUtils.addIDInfo(this.element);
|
154
158
|
}
|
155
159
|
render() {
|
156
|
-
return (index.h(index.Host, null, index.h("ez-popup", Object.assign({ size: 'small', heightMode: 'full', useHeader: false, ref: (ref) => this._ezPopup = ref }, this.getElementID("snk-print-selector")), index.h("ez-modal-container", { modalTitle: this.
|
157
|
-
index.h("div", { class: 'ez-flex ez-margin-bottom--large' }, index.h("div", { class: 'ez-flex ez-margin-right--large' }, index.h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this.
|
158
|
-
index.h("div", { class:
|
160
|
+
return (index.h(index.Host, null, index.h("ez-popup", Object.assign({ size: 'small', heightMode: 'full', useHeader: false, ref: (ref) => this._ezPopup = ref }, this.getElementID("snk-print-selector")), index.h("ez-modal-container", { modalTitle: this.getMessage("snkPrintSelector.title.printerSelection"), okButtonLabel: this.getMessage("snkPrintSelector.button.print"), okButtonStatus: this._selectedPrinter ? ModalButtonStatus__default['default'].ENABLED : ModalButtonStatus__default['default'].DISABLED, cancelButtonLabel: this.getMessage("snkPrintSelector.button.cancel"), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, this._isSingleJob &&
|
161
|
+
index.h("div", { class: 'ez-flex ez-margin-bottom--large' }, index.h("div", { class: 'ez-flex ez-margin-right--large' }, index.h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this.getMessage("snkPrintSelector.subtitle.document")), index.h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].docTypeDescription)), index.h("div", { class: 'ez-flex ez-margin-right--large' }, index.h("span", { class: 'ez-text ez-text--bold ez-text--medium ez-padding-right--small' }, this.getMessage("snkPrintSelector.subtitle.jobs")), index.h("span", { class: 'ez-text ez-text--primary ez-text--medium' }, this._printJobData.pendingPrinters[0].printJobCount))), index.h("ez-tabselector", { tabs: this.buildIdTabSelector(), onEzChange: (evt) => this.onChangeTab(evt), selectedTab: this._printServerActive ? this.REMOTE_PRINTERS_TAB : this.LOCAL_PRINTERS_TAB }), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", { hidePolicy: 'hide' }, this._printServerActive &&
|
162
|
+
index.h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, index.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())), index.h("stack-item", { hidePolicy: 'hide' }, index.h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, index.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()))), index.h("ez-check", { label: this.getMessage("snkPrintSelector.message.savePrinter"), onEzChange: evt => this._saveSubstitute = evt.detail, compact: true })))));
|
159
163
|
}
|
160
164
|
get element() { return index.getElement(this); }
|
161
165
|
};
|
@@ -6,8 +6,8 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const constants$1 = require('./constants-d187e03e.js');
|
8
8
|
const taskbarElements = require('./taskbar-elements-b98dd6e9.js');
|
9
|
-
require('./DataFetcher-
|
10
|
-
require('./pesquisa-fetcher-
|
9
|
+
require('./DataFetcher-04c70ba9.js');
|
10
|
+
require('./pesquisa-fetcher-cab451b6.js');
|
11
11
|
const index$1 = require('./index-0e663819.js');
|
12
12
|
const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
|
13
13
|
const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -11,11 +11,19 @@ ez-list {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
.list-scroll {
|
14
|
-
|
14
|
+
height: 100%;
|
15
15
|
overflow-y: auto;
|
16
16
|
padding-right: var(--snk-grid-config__main--padding-right);
|
17
17
|
}
|
18
18
|
|
19
|
+
.with-header {
|
20
|
+
max-height: calc(100% - 125px);
|
21
|
+
}
|
22
|
+
|
23
|
+
.without-header {
|
24
|
+
max-height: calc(100% - 85px);
|
25
|
+
}
|
26
|
+
|
19
27
|
.list-scroll::-webkit-scrollbar {
|
20
28
|
width: var(--space--small);
|
21
29
|
min-width: var(--space--small);
|
@@ -14,17 +14,18 @@ export class SnkPrintSelector {
|
|
14
14
|
this._hasLocalPrinters = false;
|
15
15
|
this._localPrinters = [];
|
16
16
|
this._isSingleJob = false;
|
17
|
+
this._saveSubstitute = false;
|
17
18
|
this.buildIdTabSelector = () => {
|
18
19
|
const defaultTabs = [
|
19
20
|
{
|
20
|
-
label: this.
|
21
|
+
label: this.getMessage("snkPrintSelector.title.localPrintersTab"),
|
21
22
|
tabKey: this.LOCAL_PRINTERS_TAB,
|
22
23
|
index: Number(this.LOCAL_PRINTERS_TAB)
|
23
24
|
}
|
24
25
|
];
|
25
26
|
if (this._printServerActive) {
|
26
27
|
defaultTabs.unshift({
|
27
|
-
label: this.
|
28
|
+
label: this.getMessage("snkPrintSelector.title.remotePrintersTab"),
|
28
29
|
tabKey: this.REMOTE_PRINTERS_TAB,
|
29
30
|
index: Number(this.REMOTE_PRINTERS_TAB)
|
30
31
|
});
|
@@ -69,14 +70,14 @@ export class SnkPrintSelector {
|
|
69
70
|
}
|
70
71
|
}
|
71
72
|
async handleCancel() {
|
72
|
-
const result = await ApplicationUtils.confirm(this.
|
73
|
+
const result = await ApplicationUtils.confirm(this.getMessage("snkPrintSelector.title.warning"), this.getMessage("snkPrintSelector.message.canceledPrint"));
|
73
74
|
if (result) {
|
74
75
|
this.closePrintSelector();
|
75
|
-
this._printerResolver(undefined);
|
76
|
+
this._printerResolver({ selectedPrinter: undefined, saveSubstitute: false });
|
76
77
|
}
|
77
78
|
}
|
78
79
|
handleApply() {
|
79
|
-
this._printerResolver(this._selectedPrinter);
|
80
|
+
this._printerResolver({ selectedPrinter: this._selectedPrinter, saveSubstitute: this._saveSubstitute });
|
80
81
|
this.closePrintSelector();
|
81
82
|
}
|
82
83
|
onChangeTab(evt) {
|
@@ -121,7 +122,7 @@ export class SnkPrintSelector {
|
|
121
122
|
this._selectedPrinter = serverGroup === null || serverGroup === void 0 ? void 0 : serverGroup.printerList.find((item) => item.printerName === printer.label);
|
122
123
|
}
|
123
124
|
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.
|
125
|
+
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.getMessage("snkPrintSelector.message.noPrinters"))));
|
125
126
|
}
|
126
127
|
buildPrinterIcon() {
|
127
128
|
return (h("ez-icon", { iconName: "print", style: { marginRight: 'var(--space--small)' } }));
|
@@ -131,6 +132,9 @@ export class SnkPrintSelector {
|
|
131
132
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
132
133
|
};
|
133
134
|
}
|
135
|
+
getMessage(path) {
|
136
|
+
return this._application.messagesBuilder.getMessage(path, undefined);
|
137
|
+
}
|
134
138
|
componentWillLoad() {
|
135
139
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
136
140
|
}
|
@@ -140,9 +144,9 @@ export class SnkPrintSelector {
|
|
140
144
|
ElementIDUtils.addIDInfo(this.element);
|
141
145
|
}
|
142
146
|
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.
|
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.
|
145
|
-
h("div", { class:
|
147
|
+
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.getMessage("snkPrintSelector.title.printerSelection"), okButtonLabel: this.getMessage("snkPrintSelector.button.print"), okButtonStatus: this._selectedPrinter ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED, cancelButtonLabel: this.getMessage("snkPrintSelector.button.cancel"), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, this._isSingleJob &&
|
148
|
+
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.getMessage("snkPrintSelector.subtitle.document")), 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.getMessage("snkPrintSelector.subtitle.jobs")), 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 &&
|
149
|
+
h("div", { class: `list-scroll ez-size-height--full ${this._isSingleJob ? 'with-header' : 'without-header'}` }, 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 ${this._isSingleJob ? 'with-header' : 'without-header'}` }, 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()))), h("ez-check", { label: this.getMessage("snkPrintSelector.message.savePrinter"), onEzChange: evt => this._saveSubstitute = evt.detail, compact: true })))));
|
146
150
|
}
|
147
151
|
static get is() { return "snk-print-selector"; }
|
148
152
|
static get encapsulation() { return "scoped"; }
|
@@ -169,7 +173,7 @@ export class SnkPrintSelector {
|
|
169
173
|
return {
|
170
174
|
"openPrintSelector": {
|
171
175
|
"complexType": {
|
172
|
-
"signature": "(printJobData: PendingPrintJobData) => Promise<
|
176
|
+
"signature": "(printJobData: PendingPrintJobData) => Promise<PrintSelectorResponse>",
|
173
177
|
"parameters": [{
|
174
178
|
"tags": [],
|
175
179
|
"text": ""
|
@@ -178,16 +182,15 @@ export class SnkPrintSelector {
|
|
178
182
|
"Promise": {
|
179
183
|
"location": "global"
|
180
184
|
},
|
181
|
-
"
|
182
|
-
"location": "
|
183
|
-
"path": "../../lib/utils/PrintUtils"
|
185
|
+
"PrintSelectorResponse": {
|
186
|
+
"location": "local"
|
184
187
|
},
|
185
188
|
"PendingPrintJobData": {
|
186
189
|
"location": "import",
|
187
190
|
"path": "../../lib/utils/PrintUtils"
|
188
191
|
}
|
189
192
|
},
|
190
|
-
"return": "Promise<
|
193
|
+
"return": "Promise<PrintSelectorResponse>"
|
191
194
|
},
|
192
195
|
"docs": {
|
193
196
|
"text": "",
|
@@ -11,7 +11,8 @@ export const snkPrintSelectorMessages = {
|
|
11
11
|
},
|
12
12
|
message: {
|
13
13
|
canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
|
14
|
-
noPrinters: "Não há impressoras para seleção"
|
14
|
+
noPrinters: "Não há impressoras para seleção",
|
15
|
+
savePrinter: "Usar sempre esta seleção"
|
15
16
|
},
|
16
17
|
button: {
|
17
18
|
print: "Imprimir",
|
@@ -2,6 +2,7 @@ import { StringUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { DataFetcher } from "../http/data-fetcher/DataFetcher";
|
3
3
|
export class PrintUtils {
|
4
4
|
constructor() {
|
5
|
+
this.appletImpressao = new AppletImpressao();
|
5
6
|
}
|
6
7
|
static getInstance() {
|
7
8
|
if (!PrintUtils.instance) {
|
@@ -24,17 +25,15 @@ export class PrintUtils {
|
|
24
25
|
};
|
25
26
|
const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
|
26
27
|
const printJobData = this.parsePrintData(response);
|
27
|
-
this.
|
28
|
+
const pendingPrints = await this.processDirectPrint(printJobData);
|
29
|
+
if (!pendingPrints.length)
|
30
|
+
return;
|
31
|
+
this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
|
28
32
|
}
|
29
|
-
|
30
|
-
const
|
31
|
-
if (!appletImpressao)
|
32
|
-
return [];
|
33
|
-
const localPrinters = appletImpressao.getLocalPrinters();
|
34
|
-
if (!localPrinters)
|
35
|
-
return [];
|
33
|
+
getLocalPrinters() {
|
34
|
+
const localPrinters = this.appletImpressao.findLocalPrinters();
|
36
35
|
const printers = [];
|
37
|
-
for (const printerName of localPrinters
|
36
|
+
for (const printerName of localPrinters) {
|
38
37
|
printers.push({
|
39
38
|
nome: printerName,
|
40
39
|
printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
|
@@ -43,9 +42,6 @@ export class PrintUtils {
|
|
43
42
|
}
|
44
43
|
return printers;
|
45
44
|
}
|
46
|
-
getLocalPrinters() {
|
47
|
-
return this.findLocalPrinters();
|
48
|
-
}
|
49
45
|
parsePrintData(payload) {
|
50
46
|
const pendingPrintJobData = payload.pendindPrintJobData;
|
51
47
|
if (!pendingPrintJobData)
|
@@ -77,13 +73,7 @@ export class PrintUtils {
|
|
77
73
|
}
|
78
74
|
processLocalPrinting(localPrintings) {
|
79
75
|
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);
|
76
|
+
this.appletImpressao.doLocalPrinting(transactionIds.join());
|
87
77
|
}
|
88
78
|
async openSnkPrintSelector(printJobData) {
|
89
79
|
let printSelector = document.querySelector('snk-print-selector');
|
@@ -92,15 +82,22 @@ export class PrintUtils {
|
|
92
82
|
printSelector.setAttribute('id', StringUtils.generateUUID());
|
93
83
|
window.document.body.appendChild(printSelector);
|
94
84
|
}
|
95
|
-
const selectedPrinter = await printSelector.openPrintSelector(printJobData);
|
85
|
+
const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
|
96
86
|
if (!selectedPrinter)
|
97
87
|
return;
|
98
|
-
|
88
|
+
const params = {
|
89
|
+
transactionId: printJobData.transactionId,
|
90
|
+
pendingPrinters: printJobData.pendingPrinters,
|
91
|
+
printerUri: selectedPrinter.printerUri,
|
92
|
+
saveSubstitutePrinters: saveSubstitute
|
93
|
+
};
|
94
|
+
await this.saveSubstitutePrinter(params);
|
99
95
|
}
|
100
|
-
async saveSubstitutePrinter(
|
96
|
+
async saveSubstitutePrinter(params) {
|
97
|
+
const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
|
101
98
|
const parsedPendingPrinters = pendingPrinters.map((item) => ({
|
102
99
|
printerUri: {
|
103
|
-
$:
|
100
|
+
$: item.printerUri || printerUri
|
104
101
|
},
|
105
102
|
originalPrinterName: {
|
106
103
|
$: item.originalPrinterName
|
@@ -121,7 +118,7 @@ export class PrintUtils {
|
|
121
118
|
pendingPrinter: parsedPendingPrinters
|
122
119
|
},
|
123
120
|
saveSubstitutePrinters: {
|
124
|
-
$:
|
121
|
+
$: saveSubstitutePrinters.toString()
|
125
122
|
},
|
126
123
|
transactionId: {
|
127
124
|
$: transactionId
|
@@ -130,8 +127,75 @@ export class PrintUtils {
|
|
130
127
|
};
|
131
128
|
await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
|
132
129
|
}
|
130
|
+
async processDirectPrint(printJobData) {
|
131
|
+
const isWCRunning = this.appletImpressao.checkWebConnection();
|
132
|
+
if (!isWCRunning) {
|
133
|
+
return [];
|
134
|
+
}
|
135
|
+
const localPrinters = this.getLocalPrinters();
|
136
|
+
if (!localPrinters.length)
|
137
|
+
return [];
|
138
|
+
const directPendingPrints = [];
|
139
|
+
const pendingPrints = printJobData.pendingPrinters.filter(item => {
|
140
|
+
const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
|
141
|
+
const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
|
142
|
+
if (isDirectPrint) {
|
143
|
+
directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
|
144
|
+
return false;
|
145
|
+
}
|
146
|
+
return true;
|
147
|
+
});
|
148
|
+
if (!directPendingPrints.length)
|
149
|
+
return pendingPrints;
|
150
|
+
const params = {
|
151
|
+
transactionId: printJobData.transactionId,
|
152
|
+
pendingPrinters: directPendingPrints
|
153
|
+
};
|
154
|
+
await this.saveSubstitutePrinter(params);
|
155
|
+
return pendingPrints;
|
156
|
+
}
|
157
|
+
getDefaultPrinterName(printerName) {
|
158
|
+
const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
|
159
|
+
const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
|
160
|
+
return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
|
161
|
+
}
|
162
|
+
isPrinterNameAFile(printerName) {
|
163
|
+
const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
|
164
|
+
return regExp.test(printerName);
|
165
|
+
}
|
133
166
|
}
|
134
167
|
PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
|
135
168
|
PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
|
136
169
|
PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
|
137
170
|
PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
|
171
|
+
class AppletImpressao {
|
172
|
+
constructor() {
|
173
|
+
this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
174
|
+
}
|
175
|
+
checkWebConnection() {
|
176
|
+
if (!this.appletImpressao)
|
177
|
+
return false;
|
178
|
+
if (!this.appletImpressao.testRunningWC)
|
179
|
+
return false;
|
180
|
+
const isRunning = this.appletImpressao.testRunningWC();
|
181
|
+
return !!isRunning;
|
182
|
+
}
|
183
|
+
findLocalPrinters() {
|
184
|
+
if (!this.appletImpressao)
|
185
|
+
return [];
|
186
|
+
const localPrinters = this.appletImpressao.getLocalPrinters();
|
187
|
+
if (!localPrinters)
|
188
|
+
return [];
|
189
|
+
return localPrinters.split(",");
|
190
|
+
}
|
191
|
+
doLocalPrinting(transactionIds) {
|
192
|
+
if (!this.appletImpressao)
|
193
|
+
return;
|
194
|
+
this.appletImpressao.doLocalPrinting(transactionIds);
|
195
|
+
}
|
196
|
+
getDefaultPrinter() {
|
197
|
+
if (!this.appletImpressao)
|
198
|
+
return '';
|
199
|
+
return this.appletImpressao.getPrintDefault();
|
200
|
+
}
|
201
|
+
}
|
@@ -6466,6 +6466,7 @@ class GraphQLRecaller {
|
|
6466
6466
|
|
6467
6467
|
class PrintUtils {
|
6468
6468
|
constructor() {
|
6469
|
+
this.appletImpressao = new AppletImpressao();
|
6469
6470
|
}
|
6470
6471
|
static getInstance() {
|
6471
6472
|
if (!PrintUtils.instance) {
|
@@ -6488,17 +6489,15 @@ class PrintUtils {
|
|
6488
6489
|
};
|
6489
6490
|
const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
|
6490
6491
|
const printJobData = this.parsePrintData(response);
|
6491
|
-
this.
|
6492
|
+
const pendingPrints = await this.processDirectPrint(printJobData);
|
6493
|
+
if (!pendingPrints.length)
|
6494
|
+
return;
|
6495
|
+
this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
|
6492
6496
|
}
|
6493
|
-
|
6494
|
-
const
|
6495
|
-
if (!appletImpressao)
|
6496
|
-
return [];
|
6497
|
-
const localPrinters = appletImpressao.getLocalPrinters();
|
6498
|
-
if (!localPrinters)
|
6499
|
-
return [];
|
6497
|
+
getLocalPrinters() {
|
6498
|
+
const localPrinters = this.appletImpressao.findLocalPrinters();
|
6500
6499
|
const printers = [];
|
6501
|
-
for (const printerName of localPrinters
|
6500
|
+
for (const printerName of localPrinters) {
|
6502
6501
|
printers.push({
|
6503
6502
|
nome: printerName,
|
6504
6503
|
printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
|
@@ -6507,9 +6506,6 @@ class PrintUtils {
|
|
6507
6506
|
}
|
6508
6507
|
return printers;
|
6509
6508
|
}
|
6510
|
-
getLocalPrinters() {
|
6511
|
-
return this.findLocalPrinters();
|
6512
|
-
}
|
6513
6509
|
parsePrintData(payload) {
|
6514
6510
|
const pendingPrintJobData = payload.pendindPrintJobData;
|
6515
6511
|
if (!pendingPrintJobData)
|
@@ -6541,13 +6537,7 @@ class PrintUtils {
|
|
6541
6537
|
}
|
6542
6538
|
processLocalPrinting(localPrintings) {
|
6543
6539
|
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);
|
6540
|
+
this.appletImpressao.doLocalPrinting(transactionIds.join());
|
6551
6541
|
}
|
6552
6542
|
async openSnkPrintSelector(printJobData) {
|
6553
6543
|
let printSelector = document.querySelector('snk-print-selector');
|
@@ -6556,15 +6546,22 @@ class PrintUtils {
|
|
6556
6546
|
printSelector.setAttribute('id', StringUtils.generateUUID());
|
6557
6547
|
window.document.body.appendChild(printSelector);
|
6558
6548
|
}
|
6559
|
-
const selectedPrinter = await printSelector.openPrintSelector(printJobData);
|
6549
|
+
const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
|
6560
6550
|
if (!selectedPrinter)
|
6561
6551
|
return;
|
6562
|
-
|
6552
|
+
const params = {
|
6553
|
+
transactionId: printJobData.transactionId,
|
6554
|
+
pendingPrinters: printJobData.pendingPrinters,
|
6555
|
+
printerUri: selectedPrinter.printerUri,
|
6556
|
+
saveSubstitutePrinters: saveSubstitute
|
6557
|
+
};
|
6558
|
+
await this.saveSubstitutePrinter(params);
|
6563
6559
|
}
|
6564
|
-
async saveSubstitutePrinter(
|
6560
|
+
async saveSubstitutePrinter(params) {
|
6561
|
+
const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
|
6565
6562
|
const parsedPendingPrinters = pendingPrinters.map((item) => ({
|
6566
6563
|
printerUri: {
|
6567
|
-
$:
|
6564
|
+
$: item.printerUri || printerUri
|
6568
6565
|
},
|
6569
6566
|
originalPrinterName: {
|
6570
6567
|
$: item.originalPrinterName
|
@@ -6585,7 +6582,7 @@ class PrintUtils {
|
|
6585
6582
|
pendingPrinter: parsedPendingPrinters
|
6586
6583
|
},
|
6587
6584
|
saveSubstitutePrinters: {
|
6588
|
-
$:
|
6585
|
+
$: saveSubstitutePrinters.toString()
|
6589
6586
|
},
|
6590
6587
|
transactionId: {
|
6591
6588
|
$: transactionId
|
@@ -6594,11 +6591,78 @@ class PrintUtils {
|
|
6594
6591
|
};
|
6595
6592
|
await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
|
6596
6593
|
}
|
6594
|
+
async processDirectPrint(printJobData) {
|
6595
|
+
const isWCRunning = this.appletImpressao.checkWebConnection();
|
6596
|
+
if (!isWCRunning) {
|
6597
|
+
return [];
|
6598
|
+
}
|
6599
|
+
const localPrinters = this.getLocalPrinters();
|
6600
|
+
if (!localPrinters.length)
|
6601
|
+
return [];
|
6602
|
+
const directPendingPrints = [];
|
6603
|
+
const pendingPrints = printJobData.pendingPrinters.filter(item => {
|
6604
|
+
const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
|
6605
|
+
const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
|
6606
|
+
if (isDirectPrint) {
|
6607
|
+
directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
|
6608
|
+
return false;
|
6609
|
+
}
|
6610
|
+
return true;
|
6611
|
+
});
|
6612
|
+
if (!directPendingPrints.length)
|
6613
|
+
return pendingPrints;
|
6614
|
+
const params = {
|
6615
|
+
transactionId: printJobData.transactionId,
|
6616
|
+
pendingPrinters: directPendingPrints
|
6617
|
+
};
|
6618
|
+
await this.saveSubstitutePrinter(params);
|
6619
|
+
return pendingPrints;
|
6620
|
+
}
|
6621
|
+
getDefaultPrinterName(printerName) {
|
6622
|
+
const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
|
6623
|
+
const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
|
6624
|
+
return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
|
6625
|
+
}
|
6626
|
+
isPrinterNameAFile(printerName) {
|
6627
|
+
const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
|
6628
|
+
return regExp.test(printerName);
|
6629
|
+
}
|
6597
6630
|
}
|
6598
6631
|
PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
|
6599
6632
|
PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
|
6600
6633
|
PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
|
6601
6634
|
PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
|
6635
|
+
class AppletImpressao {
|
6636
|
+
constructor() {
|
6637
|
+
this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
|
6638
|
+
}
|
6639
|
+
checkWebConnection() {
|
6640
|
+
if (!this.appletImpressao)
|
6641
|
+
return false;
|
6642
|
+
if (!this.appletImpressao.testRunningWC)
|
6643
|
+
return false;
|
6644
|
+
const isRunning = this.appletImpressao.testRunningWC();
|
6645
|
+
return !!isRunning;
|
6646
|
+
}
|
6647
|
+
findLocalPrinters() {
|
6648
|
+
if (!this.appletImpressao)
|
6649
|
+
return [];
|
6650
|
+
const localPrinters = this.appletImpressao.getLocalPrinters();
|
6651
|
+
if (!localPrinters)
|
6652
|
+
return [];
|
6653
|
+
return localPrinters.split(",");
|
6654
|
+
}
|
6655
|
+
doLocalPrinting(transactionIds) {
|
6656
|
+
if (!this.appletImpressao)
|
6657
|
+
return;
|
6658
|
+
this.appletImpressao.doLocalPrinting(transactionIds);
|
6659
|
+
}
|
6660
|
+
getDefaultPrinter() {
|
6661
|
+
if (!this.appletImpressao)
|
6662
|
+
return '';
|
6663
|
+
return this.appletImpressao.getPrintDefault();
|
6664
|
+
}
|
6665
|
+
}
|
6602
6666
|
|
6603
6667
|
class DataFetcher {
|
6604
6668
|
constructor() {
|
@@ -452,7 +452,8 @@ const snkPrintSelectorMessages = {
|
|
452
452
|
},
|
453
453
|
message: {
|
454
454
|
canceledPrint: "A impressão será cancelada. Deseja mesmo continuar?",
|
455
|
-
noPrinters: "Não há impressoras para seleção"
|
455
|
+
noPrinters: "Não há impressoras para seleção",
|
456
|
+
savePrinter: "Usar sempre esta seleção"
|
456
457
|
},
|
457
458
|
button: {
|
458
459
|
print: "Imprimir",
|