@sankhyalabs/sankhyablocks 6.9.2 → 7.0.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-97468a0f.js} +31 -25
- package/dist/cjs/{DataFetcher-093c47ae.js → DataFetcher-04c70ba9.js} +88 -24
- package/dist/cjs/{PersonalizedFilterUtils-cfcd9af2.js → PersonalizedFilterUtils-9848e09b.js} +18 -64
- package/dist/cjs/{SnkFormConfigManager-ddad3cbb.js → SnkFormConfigManager-bef6e022.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-e55c7afa.js → SnkMessageBuilder-f40df6d4.js} +20 -3
- 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-a7747f69.js} +23 -6
- package/dist/cjs/{form-config-fetcher-affb0b28.js → form-config-fetcher-56442594.js} +2 -2
- package/dist/cjs/index-8d94b7e0.js +7 -0
- package/dist/cjs/index-c5771aba.js +44 -0
- package/dist/cjs/loader.cjs.js +1 -1
- 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/sankhyablocks.cjs.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-b0cc2d42.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-expression-group_2.cjs.entry.js +542 -0
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +66 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -17
- package/dist/cjs/snk-filter-detail.cjs.entry.js +5 -5
- package/dist/cjs/{snk-expression-item_3.cjs.entry.js → snk-filter-field-search_2.cjs.entry.js} +23 -315
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -5
- package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -2
- 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-897368ea.js} +3 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +125 -34
- 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/collection-manifest.json +2 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +5 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +114 -23
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +4 -6
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +2 -1
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.css +10 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.js +95 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.css +66 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +158 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +8 -2
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +14 -23
- 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/configs/ConfigStorage.js +5 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +22 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +22 -18
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +18 -2
- 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/ConfigStorage.js +27 -21
- package/dist/components/DataFetcher.js +88 -24
- package/dist/components/PersonalizedFilterUtils.js +14 -23
- package/dist/components/SnkMessageBuilder.js +20 -3
- package/dist/components/filter-bar-config-fetcher.js +22 -5
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/snk-crud.js +34 -22
- package/dist/components/snk-detail-view2.js +49 -27
- package/dist/components/snk-expression-group2.js +4 -6
- package/dist/components/snk-expression-item2.js +2 -1
- package/dist/components/snk-filter-advanced-mode.d.ts +11 -0
- package/dist/components/snk-filter-advanced-mode.js +6 -0
- package/dist/components/snk-filter-advanced-mode2.js +46 -0
- package/dist/components/snk-filter-assistent-mode.d.ts +11 -0
- package/dist/components/snk-filter-assistent-mode.js +6 -0
- package/dist/components/snk-filter-assistent-mode2.js +77 -0
- package/dist/components/snk-filter-bar2.js +17 -5
- package/dist/components/snk-filter-param-config2.js +6 -0
- package/dist/components/snk-grid2.js +22 -10
- package/dist/components/snk-personalized-filter2.js +131 -28
- package/dist/components/snk-print-selector.js +14 -10
- package/dist/esm/{ConfigStorage-24b221ba.js → ConfigStorage-02f17a26.js} +31 -25
- package/dist/esm/{DataFetcher-6153ff3e.js → DataFetcher-fddeb917.js} +88 -24
- package/dist/esm/{PersonalizedFilterUtils-1a167d89.js → PersonalizedFilterUtils-731cae01.js} +16 -62
- package/dist/esm/{SnkFormConfigManager-fcbefc1a.js → SnkFormConfigManager-cd9e6cab.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-96e66d9c.js → SnkMessageBuilder-5be56185.js} +20 -3
- 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-790283d8.js} +23 -6
- package/dist/esm/{form-config-fetcher-01e9985d.js → form-config-fetcher-533b895e.js} +2 -2
- package/dist/esm/index-620ac460.js +7 -0
- package/dist/esm/index-ae591a44.js +44 -0
- package/dist/esm/loader.js +1 -1
- 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/sankhyablocks.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-b9b4bb5f.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-expression-group_2.entry.js +537 -0
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +61 -0
- package/dist/esm/snk-filter-bar.entry.js +8 -8
- package/dist/esm/snk-filter-detail.entry.js +5 -5
- package/dist/esm/{snk-expression-item_3.entry.js → snk-filter-field-search_2.entry.js} +12 -303
- package/dist/esm/snk-filter-modal-item.entry.js +5 -5
- package/dist/esm/snk-filter-modal.entry.js +2 -2
- 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-579c70cc.js} +3 -3
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +122 -31
- package/dist/esm/snk-print-selector.entry.js +15 -11
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-e665c93f.entry.js → p-19fdcf88.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4ab8d0ee.entry.js → p-1fe2976e.entry.js} +1 -1
- package/dist/sankhyablocks/p-2227bb94.js +1 -0
- package/dist/sankhyablocks/{p-85e6068d.entry.js → p-2ddf3e87.entry.js} +1 -1
- package/dist/sankhyablocks/p-386102a7.entry.js +1 -0
- package/dist/sankhyablocks/{p-eaec700d.js → p-3b059f4e.js} +1 -1
- package/dist/sankhyablocks/p-4af6cbef.entry.js +1 -0
- package/dist/sankhyablocks/p-4bbc7aac.entry.js +1 -0
- package/dist/sankhyablocks/p-4f550a1a.js +1 -0
- package/dist/sankhyablocks/{p-7dd92fb8.entry.js → p-4f687570.entry.js} +1 -1
- package/dist/sankhyablocks/p-5098f618.js +1 -0
- package/dist/sankhyablocks/{p-16ad23d5.entry.js → p-5596a2dd.entry.js} +1 -1
- package/dist/sankhyablocks/p-7e636457.entry.js +1 -0
- package/dist/sankhyablocks/p-7f1c4687.js +56 -0
- package/dist/sankhyablocks/p-82800006.entry.js +1 -0
- package/dist/sankhyablocks/{p-05d82333.entry.js → p-88f4ef73.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d20e2ce3.js → p-8f484733.js} +1 -1
- package/dist/sankhyablocks/{p-eb0c9f4c.js → p-90a926c7.js} +1 -1
- package/dist/sankhyablocks/{p-432dd007.entry.js → p-90e7c3a2.entry.js} +1 -1
- package/dist/sankhyablocks/p-933c0c0b.js +1 -0
- package/dist/sankhyablocks/p-9666c0d0.entry.js +1 -0
- package/dist/sankhyablocks/p-97720467.entry.js +1 -0
- package/dist/sankhyablocks/{p-a4cd60bf.entry.js → p-97c586ab.entry.js} +1 -1
- package/dist/sankhyablocks/{p-814f9247.js → p-982107dc.js} +1 -1
- package/dist/sankhyablocks/{p-354ce206.entry.js → p-9fa9331b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-07cb8a03.entry.js → p-a357d13c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bfe8b96d.js → p-acd8b97b.js} +1 -1
- package/dist/sankhyablocks/{p-40a5d35e.entry.js → p-ad6673fb.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-bd86c9d3.entry.js +1 -0
- package/dist/sankhyablocks/{p-1b596ea1.entry.js → p-cdbdcf13.entry.js} +1 -1
- package/dist/sankhyablocks/{p-89fb7531.js → p-d97eb781.js} +2 -2
- package/dist/sankhyablocks/{p-60ad0dea.js → p-f034254e.js} +1 -1
- package/dist/sankhyablocks/p-f4184ce7.js +1 -0
- package/dist/sankhyablocks/{p-9a7aafe4.js → p-fb1e5b6d.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-personalized-filter/interfaces/IPersonalizedFilter.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +17 -6
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +2 -2
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.d.ts +20 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +31 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +6 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
- package/dist/types/components/snk-print-selector/snk-print-selector.d.ts +7 -1
- package/dist/types/components.d.ts +106 -4
- package/dist/types/lib/configs/ConfigStorage.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
- package/dist/types/lib/utils/PrintUtils.d.ts +5 -2
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/IExpressionItem-0e32ebb7.js +0 -7
- package/dist/cjs/snk-expression-group.cjs.entry.js +0 -250
- package/dist/esm/IExpressionItem-21f225bf.js +0 -7
- package/dist/esm/snk-expression-group.entry.js +0 -246
- package/dist/sankhyablocks/p-13f0ed88.entry.js +0 -1
- package/dist/sankhyablocks/p-2b449454.js +0 -1
- package/dist/sankhyablocks/p-63bff2a8.js +0 -1
- package/dist/sankhyablocks/p-6f49f5d4.entry.js +0 -1
- package/dist/sankhyablocks/p-744d0fd2.js +0 -1
- package/dist/sankhyablocks/p-7d68a43a.js +0 -1
- package/dist/sankhyablocks/p-9404ad4d.entry.js +0 -1
- package/dist/sankhyablocks/p-ad4bb9d2.entry.js +0 -1
- package/dist/sankhyablocks/p-d9586ead.entry.js +0 -1
- package/dist/sankhyablocks/p-e789eb2d.js +0 -68
- package/dist/sankhyablocks/p-f8ce17d3.entry.js +0 -1
- package/dist/sankhyablocks/p-feb6963e.entry.js +0 -1
@@ -7,14 +7,12 @@ export class PersonalizedFilterUtils {
|
|
7
7
|
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
8
8
|
* @returns Retorna a expressão de filtro.
|
9
9
|
*/
|
10
|
-
static buildFilterExpression(expressionItem
|
10
|
+
static buildFilterExpression(expressionItem) {
|
11
|
+
var _a;
|
11
12
|
if (expressionItem == undefined) {
|
12
13
|
return;
|
13
14
|
}
|
14
|
-
|
15
|
-
return "";
|
16
|
-
}
|
17
|
-
let value = this.buildVariableParameterValue(expressionItem);
|
15
|
+
let value = (_a = this.buildVariableParameterValue(expressionItem)) !== null && _a !== void 0 ? _a : undefined;
|
18
16
|
let expression = expressionItem.expression || "";
|
19
17
|
let commas = "'";
|
20
18
|
if (expressionItem.paramVariable) {
|
@@ -38,8 +36,13 @@ export class PersonalizedFilterUtils {
|
|
38
36
|
expression += ` LIKE '%${value}'`;
|
39
37
|
break;
|
40
38
|
default:
|
41
|
-
|
42
|
-
|
39
|
+
if (expressionItem.operand) {
|
40
|
+
expression += ` ${FilterOperand[expressionItem.operand]}`;
|
41
|
+
}
|
42
|
+
if (value) {
|
43
|
+
value = isNaN(value) ? `${commas}${value}${commas}` : value;
|
44
|
+
expression += ` ${value}`;
|
45
|
+
}
|
43
46
|
}
|
44
47
|
return expression;
|
45
48
|
}
|
@@ -63,7 +66,7 @@ export class PersonalizedFilterUtils {
|
|
63
66
|
pois para filtros herdados do HTML5 não temos o tipo OBJECT, fazendo com que a expressão
|
64
67
|
fique inválida para campos do tipo pesquisa.
|
65
68
|
*/
|
66
|
-
if (UserInterface.SEARCH === expressionItem.userInterface || DataType.OBJECT == type) {
|
69
|
+
if (UserInterface.SEARCH === expressionItem.userInterface || expressionItem.userInterface === UserInterface.OPTIONSELECTOR || DataType.OBJECT == type) {
|
67
70
|
value = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
|
68
71
|
}
|
69
72
|
if (DataType.NUMBER == type && value != undefined) {
|
@@ -105,11 +108,11 @@ export class PersonalizedFilterUtils {
|
|
105
108
|
/*
|
106
109
|
* Cria uma expressão de filtro para um grupo de itens.
|
107
110
|
*/
|
108
|
-
static buildGroupExpression(expressionGroup
|
111
|
+
static buildGroupExpression(expressionGroup) {
|
109
112
|
var _a, _b;
|
110
113
|
if (!((_a = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.items) === null || _a === void 0 ? void 0 : _a.length))
|
111
114
|
return "";
|
112
|
-
const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item
|
115
|
+
const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item)).join(` ${expressionGroup.operand} `);
|
113
116
|
if (((_b = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.childrenGroups) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
114
117
|
const childGroupExpressions = expressionGroup.childrenGroups.map((children) => this.buildGroupExpression(children)).join(` ${expressionGroup.operand} `);
|
115
118
|
return `(${itemExpressions} ${expressionGroup.operand} (${childGroupExpressions}))`;
|
@@ -196,7 +199,6 @@ export class PersonalizedFilterUtils {
|
|
196
199
|
* do tipo variavel;
|
197
200
|
*/
|
198
201
|
static buildVariableParameters(expressionGroup) {
|
199
|
-
var _a, _b, _c, _d;
|
200
202
|
const allItems = this.buildPlainExpressionItems(expressionGroup);
|
201
203
|
const allParams = [];
|
202
204
|
for (const item of allItems) {
|
@@ -205,18 +207,7 @@ export class PersonalizedFilterUtils {
|
|
205
207
|
}
|
206
208
|
allParams.push({
|
207
209
|
entityName: item.entityName,
|
208
|
-
fieldName: item.fieldName
|
209
|
-
dataType: item.type,
|
210
|
-
description: item.description,
|
211
|
-
userInterface: item.userInterface,
|
212
|
-
label: item.fieldLabel,
|
213
|
-
searchContext: {
|
214
|
-
entity: (_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.find(prop => prop.name == "ENTITYNAME")) === null || _b === void 0 ? void 0 : _b.value,
|
215
|
-
entityDescription: (_d = (_c = item.props) === null || _c === void 0 ? void 0 : _c.find(prop => prop.name == "DESCRIPTIONENTITY")) === null || _d === void 0 ? void 0 : _d.value,
|
216
|
-
searchOptions: {
|
217
|
-
showInactives: false
|
218
|
-
}
|
219
|
-
}
|
210
|
+
fieldName: item.fieldName
|
220
211
|
});
|
221
212
|
}
|
222
213
|
return allParams;
|
@@ -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": "",
|
@@ -17,17 +17,16 @@ export class ConfigStorage {
|
|
17
17
|
const resourceID = await application.getResourceID();
|
18
18
|
ConfigStorage.instance = new ConfigStorage();
|
19
19
|
ConfigStorage.resourceID = resourceID;
|
20
|
-
ConfigStorage.instance.loadFilterBarConfig(configName);
|
21
20
|
ConfigStorage.instance.loadFormConfig(configName);
|
22
21
|
ConfigStorage.instance.loadGridConfig(configName);
|
23
22
|
}
|
24
23
|
}
|
25
24
|
return this.instance;
|
26
25
|
}
|
27
|
-
async loadFilterBarConfig(name) {
|
26
|
+
async loadFilterBarConfig(name, urlParams) {
|
28
27
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
29
28
|
if (!ConfigStorage.configById.has(cacheID)) {
|
30
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
|
29
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
|
31
30
|
}
|
32
31
|
return ConfigStorage.configById.get(cacheID);
|
33
32
|
}
|
@@ -79,6 +78,9 @@ export class ConfigStorage {
|
|
79
78
|
static async removePersonalizedFilter(personalizedFilter, configName) {
|
80
79
|
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
81
80
|
}
|
81
|
+
static async validatePersonalizedFilter(dataUnitName, expression) {
|
82
|
+
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
83
|
+
}
|
82
84
|
static buildCacheID(name, source) {
|
83
85
|
if (name == undefined) {
|
84
86
|
return `req_${source}_${this.resourceID}`;
|
@@ -75,9 +75,9 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
|
|
75
75
|
saveConfig(items, resourceID, configName) {
|
76
76
|
return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
|
77
77
|
}
|
78
|
-
getConfig(resourceID, configName) {
|
78
|
+
getConfig(resourceID, configName, urlParams) {
|
79
79
|
return new Promise((accept, reject) => {
|
80
|
-
this.loadResource(this.getPath(resourceID, configName))
|
80
|
+
this.loadResource(this.getPath(resourceID, configName, urlParams))
|
81
81
|
.then((configAsString) => {
|
82
82
|
let fieldsList;
|
83
83
|
if (configAsString) {
|
@@ -125,10 +125,27 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
|
|
125
125
|
return item;
|
126
126
|
});
|
127
127
|
}
|
128
|
-
getPath(resourceID, name) {
|
128
|
+
getPath(resourceID, name, urlParams) {
|
129
|
+
let path = `cfg://filter/FilterBarState:${resourceID}`;
|
129
130
|
if (name) {
|
130
|
-
|
131
|
+
path += `.${name}`;
|
131
132
|
}
|
132
|
-
|
133
|
+
if (urlParams) {
|
134
|
+
path += this.buildQueryString(urlParams);
|
135
|
+
}
|
136
|
+
return path;
|
137
|
+
}
|
138
|
+
buildQueryString(urlParams) {
|
139
|
+
let queryString = '?';
|
140
|
+
for (let key in urlParams) {
|
141
|
+
if (!urlParams.hasOwnProperty(key)) {
|
142
|
+
continue;
|
143
|
+
}
|
144
|
+
if (queryString.length > 1) {
|
145
|
+
queryString += '&';
|
146
|
+
}
|
147
|
+
queryString += key + '=' + urlParams[key];
|
148
|
+
}
|
149
|
+
return queryString;
|
133
150
|
}
|
134
151
|
}
|
@@ -49,24 +49,6 @@ export default class PersonalizedFilterFetcher {
|
|
49
49
|
active
|
50
50
|
expression
|
51
51
|
warningMessage
|
52
|
-
parameters {
|
53
|
-
entityName
|
54
|
-
fieldName
|
55
|
-
dataType
|
56
|
-
description
|
57
|
-
userInterface
|
58
|
-
label
|
59
|
-
searchContext {
|
60
|
-
entity
|
61
|
-
entityDescription
|
62
|
-
searchOptions {
|
63
|
-
rootEntity
|
64
|
-
descriptionFieldName
|
65
|
-
codeFieldName
|
66
|
-
showInactives
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
52
|
assistent
|
71
53
|
}
|
72
54
|
}`);
|
@@ -84,6 +66,13 @@ export default class PersonalizedFilterFetcher {
|
|
84
66
|
name
|
85
67
|
}
|
86
68
|
}`);
|
69
|
+
this.templateByQuery.set("validateExpression", gql `
|
70
|
+
query($dataUnitName: String!, $expression: String!) {
|
71
|
+
$queryAlias$: validateExpression(dataUnitName: $dataUnitName, expression: $expression) {
|
72
|
+
valid
|
73
|
+
message
|
74
|
+
}
|
75
|
+
}`);
|
87
76
|
}
|
88
77
|
async loadPersonalizedFilter(resourceID, filterID, configName) {
|
89
78
|
return new Promise((resolve, reject) => {
|
@@ -133,6 +122,21 @@ export default class PersonalizedFilterFetcher {
|
|
133
122
|
});
|
134
123
|
});
|
135
124
|
}
|
125
|
+
async validatePersonalizedFilter(dataUnitName, expression) {
|
126
|
+
return new Promise((resolve, reject) => {
|
127
|
+
DataFetcher.get()
|
128
|
+
.callGraphQL({
|
129
|
+
values: { dataUnitName: dataUnitName, expression: expression },
|
130
|
+
query: this.templateByQuery.get("validateExpression"),
|
131
|
+
})
|
132
|
+
.then((resp) => {
|
133
|
+
resolve(resp);
|
134
|
+
})
|
135
|
+
.catch((error) => {
|
136
|
+
reject(error);
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
136
140
|
loadFields(uri) {
|
137
141
|
return new Promise((resolve, reject) => {
|
138
142
|
DataFetcher.get()
|
@@ -15,12 +15,16 @@ export const snkPersonalizedFilterMessages = {
|
|
15
15
|
labelCancel: "Cancelar",
|
16
16
|
labelSave: "Salvar",
|
17
17
|
labelNameFilter: "Nome do filtro",
|
18
|
-
labelExpression: "Expressão
|
18
|
+
labelExpression: "Expressão",
|
19
19
|
badgeVariable: "variável",
|
20
20
|
noDataFound: "Nenhum filtro encontrado",
|
21
21
|
condition: "Condição",
|
22
22
|
addGroup: "Adicionar grupo",
|
23
|
-
|
23
|
+
addField: "Adicionar campo",
|
24
|
+
applyExpression: "Expressão a ser aplicada:",
|
25
|
+
tooltipDisabledAssistentMode: "Expressão não suportada pelo assistente.",
|
26
|
+
activeModeAdvanced: "Ativar modo avançado",
|
27
|
+
activeModeAssistent: "Ativar modo assistente"
|
24
28
|
},
|
25
29
|
confirmExpression: {
|
26
30
|
title: "Aviso",
|
@@ -34,6 +38,18 @@ export const snkPersonalizedFilterMessages = {
|
|
34
38
|
title: "Aviso",
|
35
39
|
description: `As alterações realizadas serão descartadas.</br></br><b>Gostaria de continuar?</b>`
|
36
40
|
},
|
41
|
+
confirmChangeModeAssistent: {
|
42
|
+
title: "Aviso",
|
43
|
+
description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
|
44
|
+
},
|
45
|
+
confirmChangeModeAdvanced: {
|
46
|
+
title: "Aviso",
|
47
|
+
description: `Ao retornar ao modo assistente suas alterações serão perdidas.</br></br><b>Gostaria de continuar?</b>`
|
48
|
+
},
|
49
|
+
confirmSaveModeAdvanced: {
|
50
|
+
title: "Aviso",
|
51
|
+
description: `Ao modificar a expressão, o modo assistente será desabilitado.</br></br><b>Gostaria de continuar?</b>`
|
52
|
+
},
|
37
53
|
operador: {
|
38
54
|
firstLevel: "A seleção será habilitada a partir da adição da segunda linha de regras.",
|
39
55
|
and: "Será verdadeiro se todas as condições forem obedecidas.",
|
@@ -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
|
+
}
|
@@ -93,24 +93,6 @@ class PersonalizedFilterFetcher {
|
|
93
93
|
active
|
94
94
|
expression
|
95
95
|
warningMessage
|
96
|
-
parameters {
|
97
|
-
entityName
|
98
|
-
fieldName
|
99
|
-
dataType
|
100
|
-
description
|
101
|
-
userInterface
|
102
|
-
label
|
103
|
-
searchContext {
|
104
|
-
entity
|
105
|
-
entityDescription
|
106
|
-
searchOptions {
|
107
|
-
rootEntity
|
108
|
-
descriptionFieldName
|
109
|
-
codeFieldName
|
110
|
-
showInactives
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
96
|
assistent
|
115
97
|
}
|
116
98
|
}`);
|
@@ -128,6 +110,13 @@ class PersonalizedFilterFetcher {
|
|
128
110
|
name
|
129
111
|
}
|
130
112
|
}`);
|
113
|
+
this.templateByQuery.set("validateExpression", dist.gql `
|
114
|
+
query($dataUnitName: String!, $expression: String!) {
|
115
|
+
$queryAlias$: validateExpression(dataUnitName: $dataUnitName, expression: $expression) {
|
116
|
+
valid
|
117
|
+
message
|
118
|
+
}
|
119
|
+
}`);
|
131
120
|
}
|
132
121
|
async loadPersonalizedFilter(resourceID, filterID, configName) {
|
133
122
|
return new Promise((resolve, reject) => {
|
@@ -177,6 +166,21 @@ class PersonalizedFilterFetcher {
|
|
177
166
|
});
|
178
167
|
});
|
179
168
|
}
|
169
|
+
async validatePersonalizedFilter(dataUnitName, expression) {
|
170
|
+
return new Promise((resolve, reject) => {
|
171
|
+
DataFetcher.get()
|
172
|
+
.callGraphQL({
|
173
|
+
values: { dataUnitName: dataUnitName, expression: expression },
|
174
|
+
query: this.templateByQuery.get("validateExpression"),
|
175
|
+
})
|
176
|
+
.then((resp) => {
|
177
|
+
resolve(resp);
|
178
|
+
})
|
179
|
+
.catch((error) => {
|
180
|
+
reject(error);
|
181
|
+
});
|
182
|
+
});
|
183
|
+
}
|
180
184
|
loadFields(uri) {
|
181
185
|
return new Promise((resolve, reject) => {
|
182
186
|
DataFetcher.get()
|
@@ -222,17 +226,16 @@ class ConfigStorage {
|
|
222
226
|
const resourceID = await application.getResourceID();
|
223
227
|
ConfigStorage.instance = new ConfigStorage();
|
224
228
|
ConfigStorage.resourceID = resourceID;
|
225
|
-
ConfigStorage.instance.loadFilterBarConfig(configName);
|
226
229
|
ConfigStorage.instance.loadFormConfig(configName);
|
227
230
|
ConfigStorage.instance.loadGridConfig(configName);
|
228
231
|
}
|
229
232
|
}
|
230
233
|
return this.instance;
|
231
234
|
}
|
232
|
-
async loadFilterBarConfig(name) {
|
235
|
+
async loadFilterBarConfig(name, urlParams) {
|
233
236
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
234
237
|
if (!ConfigStorage.configById.has(cacheID)) {
|
235
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
|
238
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
|
236
239
|
}
|
237
240
|
return ConfigStorage.configById.get(cacheID);
|
238
241
|
}
|
@@ -284,6 +287,9 @@ class ConfigStorage {
|
|
284
287
|
static async removePersonalizedFilter(personalizedFilter, configName) {
|
285
288
|
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
286
289
|
}
|
290
|
+
static async validatePersonalizedFilter(dataUnitName, expression) {
|
291
|
+
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
292
|
+
}
|
287
293
|
static buildCacheID(name, source) {
|
288
294
|
if (name == undefined) {
|
289
295
|
return `req_${source}_${this.resourceID}`;
|