@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
@@ -1,16 +1,18 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
|
-
import { StringUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
2
|
+
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { F as FilterGroupCondition, P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
4
4
|
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { s as store } from './index3.js';
|
7
|
-
import { d as defineCustomElement$
|
8
|
-
import { d as defineCustomElement$
|
7
|
+
import { d as defineCustomElement$7 } from './snk-expression-group2.js';
|
8
|
+
import { d as defineCustomElement$6 } from './snk-expression-item2.js';
|
9
|
+
import { d as defineCustomElement$5 } from './snk-filter-advanced-mode2.js';
|
10
|
+
import { d as defineCustomElement$4 } from './snk-filter-assistent-mode2.js';
|
9
11
|
import { d as defineCustomElement$3 } from './snk-filter-field-search2.js';
|
10
12
|
import { d as defineCustomElement$2 } from './snk-filter-param-config2.js';
|
11
13
|
import { d as defineCustomElement$1 } from './snk-simple-bar2.js';
|
12
14
|
|
13
|
-
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%}";
|
15
|
+
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%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
|
14
16
|
|
15
17
|
const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
16
18
|
constructor() {
|
@@ -99,6 +101,13 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
99
101
|
}
|
100
102
|
this.loadFilter(this.filterId, undefined);
|
101
103
|
}
|
104
|
+
componentDidRender() {
|
105
|
+
var _a;
|
106
|
+
(_a = this._viewStackRef) === null || _a === void 0 ? void 0 : _a.show(this._filterAssistentMode ? 0 : 1);
|
107
|
+
if (this._elButtonMode) {
|
108
|
+
this._elButtonMode.setAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME, ElementIDUtils.getInternalIDInfo(`${this._filterAssistentMode ? "advancedMode_ezButton" : "assistentMode_ezButton"}`));
|
109
|
+
}
|
110
|
+
}
|
102
111
|
getMessage(key, params) {
|
103
112
|
return this._application.messagesBuilder.getMessage(key, params);
|
104
113
|
}
|
@@ -116,26 +125,55 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
116
125
|
removeFilter() {
|
117
126
|
ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
|
118
127
|
}
|
119
|
-
async handleFilterGroupChange() {
|
120
|
-
const assistent = await this._mainExpressionGroup.getExpressionGroup();
|
121
|
-
this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { assistent });
|
122
|
-
this._filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
123
|
-
this._elTextAreaExpression.value = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent, true);
|
124
|
-
this._elButtonSave.enabled = !this.hasChangesToSave();
|
125
|
-
}
|
126
128
|
hasChangesToSave() {
|
127
129
|
return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
|
128
130
|
}
|
129
|
-
handleSave() {
|
131
|
+
async handleSave() {
|
132
|
+
if (this._filterAssistentMode) {
|
133
|
+
const isValid = PersonalizedFilterUtils.validateFields(this._filterAssistent.assistent);
|
134
|
+
if (!isValid || !this._filterAssistent.name)
|
135
|
+
return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
|
136
|
+
this.saveAssistentMode();
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
if (!this._filterAssistent.expression || !this._filterAssistent.name)
|
140
|
+
return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
|
141
|
+
const isValidExpressionForAdvancedMode = await this.validateExpressionBeforeSaving();
|
142
|
+
if (!isValidExpressionForAdvancedMode)
|
143
|
+
return;
|
144
|
+
this.saveAdvancedMode();
|
145
|
+
}
|
146
|
+
}
|
147
|
+
saveAssistentMode() {
|
130
148
|
const { assistent, expression } = this._filterAssistent;
|
131
|
-
const isValid = PersonalizedFilterUtils.validateFields(assistent);
|
132
|
-
if (!isValid || !this._filterAssistent.name)
|
133
|
-
return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
|
134
149
|
const expressionQuery = !!assistent ? PersonalizedFilterUtils.buildGroupExpression(assistent) : expression;
|
135
150
|
this._filterAssistent.expression = expressionQuery;
|
136
151
|
this.ezSave.emit(expressionQuery);
|
137
152
|
this.saveFilter();
|
138
153
|
}
|
154
|
+
saveAdvancedMode() {
|
155
|
+
if (this._filterAssistent.assistent) {
|
156
|
+
ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description"))
|
157
|
+
.then((confirm) => {
|
158
|
+
if (!confirm)
|
159
|
+
return;
|
160
|
+
this.saveAndTransformToAdvancedMode();
|
161
|
+
});
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
this.saveAndTransformToAdvancedMode();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
saveAndTransformToAdvancedMode() {
|
168
|
+
this._filterAssistent.assistent = undefined;
|
169
|
+
this.ezSave.emit(this._filterAssistent.expression);
|
170
|
+
this.saveFilter();
|
171
|
+
}
|
172
|
+
async validateExpressionBeforeSaving() {
|
173
|
+
const { valid, message } = await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri, this._filterAssistent.expression);
|
174
|
+
valid || this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), message);
|
175
|
+
return valid;
|
176
|
+
}
|
139
177
|
handleCancel() {
|
140
178
|
if (this.hasChangesToSave()) {
|
141
179
|
return this.ezCancel.emit();
|
@@ -169,32 +207,87 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
169
207
|
}
|
170
208
|
return resp;
|
171
209
|
}
|
172
|
-
|
210
|
+
handleExpressionChangeAdvancedMode(expression) {
|
173
211
|
this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
|
174
212
|
this._elButtonSave.enabled = !this.hasChangesToSave();
|
175
213
|
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
214
|
+
handleChangeFilterAssistentMode(filterAssistent) {
|
215
|
+
this._elButtonSave.enabled = !this.hasChangesToSave();
|
216
|
+
this._filterAssistent = Object.assign({}, filterAssistent);
|
217
|
+
}
|
218
|
+
selectField(fieldName) {
|
219
|
+
if (!('name' in fieldName))
|
220
|
+
return;
|
221
|
+
const fieldExpression = this.buildExpression(fieldName.entityName, fieldName.name, fieldName.entityPath);
|
222
|
+
const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
|
223
|
+
textAreaElement.appendTextToSelection(fieldExpression);
|
224
|
+
}
|
225
|
+
buildExpression(entityName, fieldName, entityPath) {
|
226
|
+
if (entityPath.length > 0) {
|
227
|
+
entityPath.shift();
|
180
228
|
}
|
181
|
-
return
|
229
|
+
return entityPath.length > 0 ? `${entityPath.join("->")}->${fieldName}` : `${entityName}.${fieldName}`;
|
230
|
+
}
|
231
|
+
onAddField(target) {
|
232
|
+
const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
|
233
|
+
const options = { horizontalGap: 0, verticalGap: 12, fromRight: true };
|
234
|
+
textAreaElement.setFocus();
|
235
|
+
target.setBlur();
|
236
|
+
if (this._elFilterFieldSearch)
|
237
|
+
this._elFilterFieldSearch.show(target, options);
|
238
|
+
}
|
239
|
+
renderButtonAddField() {
|
240
|
+
if (this._filterAssistentMode)
|
241
|
+
return;
|
242
|
+
return (h(Fragment, null, h("ez-button", { class: "snk-personalized-filter__button-mode", label: this.getMessage("snkPersonalizedFilter.info.addField"), enabled: true, onClick: (evt) => this.onAddField(evt.target) }, h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: "plus" })), h("snk-filter-field-search", { class: "ez-padding-left--medium", ref: ref => this._elFilterFieldSearch = ref, onEzSelectFilterItem: (evt) => this.selectField(evt.detail), fieldsDataSource: this._dataSourceFetcher })));
|
182
243
|
}
|
183
244
|
buildContainerPersonalizedFilter() {
|
184
|
-
|
245
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStackRef = ref }, h("stack-item", null, this._filterAssistentMode &&
|
246
|
+
h("snk-filter-assistent-mode", { filterAssistent: this._filterAssistent, messagesBuilder: this.messagesBuilder, filterId: this.filterId, entityUri: this.entityUri, application: this._application, onEzChangeFilter: (ev) => this.handleChangeFilterAssistentMode(ev.detail) })), h("stack-item", null, h("snk-filter-advanced-mode", { ref: (ref) => this._elAdvancedMode = ref, filterAssistent: this._filterAssistent, application: this._application, onEzExpressionChange: (ev) => this.handleExpressionChangeAdvancedMode(ev.detail) }))));
|
247
|
+
}
|
248
|
+
handleModeChange() {
|
249
|
+
var _a, _b;
|
185
250
|
if (this._filterAssistentMode) {
|
186
|
-
|
251
|
+
ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description"))
|
252
|
+
.then((canCancel) => {
|
253
|
+
if (!canCancel)
|
254
|
+
return;
|
255
|
+
this._filterAssistentMode = !this._filterAssistentMode;
|
256
|
+
if (!this.hasChangesToSave()) {
|
257
|
+
const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
|
258
|
+
this._filterAssistent.expression = expression;
|
259
|
+
this._elButtonSave.enabled = !this.hasChangesToSave();
|
260
|
+
}
|
261
|
+
});
|
187
262
|
}
|
188
263
|
else {
|
189
|
-
|
264
|
+
if (((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.expression) === ((_b = this._originalFilterAssistent) === null || _b === void 0 ? void 0 : _b.expression)) {
|
265
|
+
this._filterAssistentMode = !this._filterAssistentMode;
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
const expressionBefore = this._filterAssistent.expression;
|
269
|
+
const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
|
270
|
+
if (expressionBefore !== expression) {
|
271
|
+
ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description"))
|
272
|
+
.then((canCancel) => {
|
273
|
+
if (!canCancel)
|
274
|
+
return;
|
275
|
+
this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
|
276
|
+
this._filterAssistentMode = !this._filterAssistentMode;
|
277
|
+
});
|
278
|
+
}
|
279
|
+
else {
|
280
|
+
this._filterAssistentMode = !this._filterAssistentMode;
|
281
|
+
}
|
282
|
+
}
|
190
283
|
}
|
191
284
|
}
|
192
285
|
render() {
|
193
|
-
var _a, _b;
|
286
|
+
var _a, _b, _c, _d;
|
194
287
|
if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
|
195
288
|
return;
|
196
289
|
}
|
197
|
-
return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this.buildContainerPersonalizedFilter()))))));
|
290
|
+
return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) }), this.renderButtonAddField(), h("ez-button", { ref: (el) => this._elButtonMode = el, class: "snk-personalized-filter__button-mode", label: this._filterAssistentMode ? this.getMessage("snkPersonalizedFilter.info.activeModeAdvanced") : this.getMessage("snkPersonalizedFilter.info.activeModeAssistent"), onClick: () => this.handleModeChange(), "data-tooltip": !(this._filterAssistentMode || ((_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent)) ? this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode") : undefined, "data-flow": "bottom", enabled: (!this._filterAssistent.name || Boolean(this._filterAssistentMode || ((_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.assistent))) })), this.buildContainerPersonalizedFilter()))))));
|
198
291
|
}
|
199
292
|
static get watchers() { return {
|
200
293
|
"filterId": ["loadFilter"]
|
@@ -213,7 +306,7 @@ function defineCustomElement() {
|
|
213
306
|
if (typeof customElements === "undefined") {
|
214
307
|
return;
|
215
308
|
}
|
216
|
-
const components = ["snk-personalized-filter", "snk-expression-group", "snk-expression-item", "snk-filter-field-search", "snk-filter-param-config", "snk-simple-bar"];
|
309
|
+
const components = ["snk-personalized-filter", "snk-expression-group", "snk-expression-item", "snk-filter-advanced-mode", "snk-filter-assistent-mode", "snk-filter-field-search", "snk-filter-param-config", "snk-simple-bar"];
|
217
310
|
components.forEach(tagName => { switch (tagName) {
|
218
311
|
case "snk-personalized-filter":
|
219
312
|
if (!customElements.get(tagName)) {
|
@@ -222,10 +315,20 @@ function defineCustomElement() {
|
|
222
315
|
break;
|
223
316
|
case "snk-expression-group":
|
224
317
|
if (!customElements.get(tagName)) {
|
225
|
-
defineCustomElement$
|
318
|
+
defineCustomElement$7();
|
226
319
|
}
|
227
320
|
break;
|
228
321
|
case "snk-expression-item":
|
322
|
+
if (!customElements.get(tagName)) {
|
323
|
+
defineCustomElement$6();
|
324
|
+
}
|
325
|
+
break;
|
326
|
+
case "snk-filter-advanced-mode":
|
327
|
+
if (!customElements.get(tagName)) {
|
328
|
+
defineCustomElement$5();
|
329
|
+
}
|
330
|
+
break;
|
331
|
+
case "snk-filter-assistent-mode":
|
229
332
|
if (!customElements.get(tagName)) {
|
230
333
|
defineCustomElement$4();
|
231
334
|
}
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
5
5
|
import ModalButtonStatus from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status';
|
6
6
|
|
7
|
-
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{
|
7
|
+
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}";
|
8
8
|
|
9
9
|
const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
10
10
|
constructor() {
|
@@ -19,17 +19,18 @@ const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
19
19
|
this._hasLocalPrinters = false;
|
20
20
|
this._localPrinters = [];
|
21
21
|
this._isSingleJob = false;
|
22
|
+
this._saveSubstitute = false;
|
22
23
|
this.buildIdTabSelector = () => {
|
23
24
|
const defaultTabs = [
|
24
25
|
{
|
25
|
-
label: this.
|
26
|
+
label: this.getMessage("snkPrintSelector.title.localPrintersTab"),
|
26
27
|
tabKey: this.LOCAL_PRINTERS_TAB,
|
27
28
|
index: Number(this.LOCAL_PRINTERS_TAB)
|
28
29
|
}
|
29
30
|
];
|
30
31
|
if (this._printServerActive) {
|
31
32
|
defaultTabs.unshift({
|
32
|
-
label: this.
|
33
|
+
label: this.getMessage("snkPrintSelector.title.remotePrintersTab"),
|
33
34
|
tabKey: this.REMOTE_PRINTERS_TAB,
|
34
35
|
index: Number(this.REMOTE_PRINTERS_TAB)
|
35
36
|
});
|
@@ -74,14 +75,14 @@ const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
74
75
|
}
|
75
76
|
}
|
76
77
|
async handleCancel() {
|
77
|
-
const result = await ApplicationUtils.confirm(this.
|
78
|
+
const result = await ApplicationUtils.confirm(this.getMessage("snkPrintSelector.title.warning"), this.getMessage("snkPrintSelector.message.canceledPrint"));
|
78
79
|
if (result) {
|
79
80
|
this.closePrintSelector();
|
80
|
-
this._printerResolver(undefined);
|
81
|
+
this._printerResolver({ selectedPrinter: undefined, saveSubstitute: false });
|
81
82
|
}
|
82
83
|
}
|
83
84
|
handleApply() {
|
84
|
-
this._printerResolver(this._selectedPrinter);
|
85
|
+
this._printerResolver({ selectedPrinter: this._selectedPrinter, saveSubstitute: this._saveSubstitute });
|
85
86
|
this.closePrintSelector();
|
86
87
|
}
|
87
88
|
onChangeTab(evt) {
|
@@ -126,7 +127,7 @@ const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
126
127
|
this._selectedPrinter = serverGroup === null || serverGroup === void 0 ? void 0 : serverGroup.printerList.find((item) => item.printerName === printer.label);
|
127
128
|
}
|
128
129
|
renderNoPrinters() {
|
129
|
-
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.
|
130
|
+
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"))));
|
130
131
|
}
|
131
132
|
buildPrinterIcon() {
|
132
133
|
return (h("ez-icon", { iconName: "print", style: { marginRight: 'var(--space--small)' } }));
|
@@ -136,6 +137,9 @@ const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
136
137
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
137
138
|
};
|
138
139
|
}
|
140
|
+
getMessage(path) {
|
141
|
+
return this._application.messagesBuilder.getMessage(path, undefined);
|
142
|
+
}
|
139
143
|
componentWillLoad() {
|
140
144
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
141
145
|
}
|
@@ -145,9 +149,9 @@ const SnkPrintSelector$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
145
149
|
ElementIDUtils.addIDInfo(this.element);
|
146
150
|
}
|
147
151
|
render() {
|
148
|
-
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.
|
149
|
-
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.
|
150
|
-
h("div", { class:
|
152
|
+
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 &&
|
153
|
+
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 &&
|
154
|
+
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 })))));
|
151
155
|
}
|
152
156
|
get element() { return this; }
|
153
157
|
static get style() { return snkPrintSelectorCss; }
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { ApplicationContext } from '@sankhyalabs/core';
|
2
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
3
|
-
import { R as ResourceFetcher } from './resource-fetcher-
|
4
|
-
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-
|
5
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
2
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-533b895e.js';
|
3
|
+
import { R as ResourceFetcher } from './resource-fetcher-0f20a072.js';
|
4
|
+
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-790283d8.js';
|
5
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-fddeb917.js';
|
6
6
|
|
7
7
|
class GridConfigFetcher extends ResourceFetcher {
|
8
8
|
constructor() {
|
@@ -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}`;
|
@@ -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() {
|