@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-83517.0 → 0.0.0-bugfix-dev-KB-87855.1
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/{ClientSideExporterProvider-cc82b68a.js → ClientSideExporterProvider-a2753c93.js} +30 -28
- package/dist/cjs/{ConfigStorage-2235f35e.js → ConfigStorage-df09fb78.js} +2 -2
- package/dist/cjs/{DataFetcher-875371e9.js → DataFetcher-1afdb18e.js} +14 -2
- package/dist/cjs/{ISave-62fbb1dd.js → ISave-c76e2c51.js} +27 -3
- package/dist/cjs/{SnkFormConfigManager-6637cd6b.js → SnkFormConfigManager-45a8d7b7.js} +3 -3
- package/dist/cjs/{auth-fetcher-abad589f.js → auth-fetcher-1687ac0a.js} +1 -1
- package/dist/cjs/{constants-241934b3.js → constants-77c1b8bd.js} +1 -0
- package/dist/cjs/{dataunit-fetcher-b95768e8.js → dataunit-fetcher-a723f0dc.js} +12 -8
- package/dist/cjs/{form-config-fetcher-db332748.js → form-config-fetcher-40d3f752.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -5
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_7.cjs.entry.js +8 -6
- package/dist/cjs/snk-application.cjs.entry.js +133 -16
- package/dist/cjs/snk-attach.cjs.entry.js +6 -6
- package/dist/cjs/snk-config-options_3.cjs.entry.js +10 -8
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +27 -39
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-33937ffe.js → snk-data-unit-bab0b78a.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-search.cjs.entry.js +18 -5
- package/dist/cjs/snk-grid.cjs.entry.js +7 -7
- package/dist/cjs/{snk-guides-viewer-0e4f3b1a.js → snk-guides-viewer-b9a97db8.js} +6 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -11
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +5 -2
- package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-plus.js +107 -0
- package/dist/collection/components/snk-application/snk-application.js +86 -8
- package/dist/collection/components/snk-crud/snk-crud.js +22 -34
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +15 -19
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +18 -5
- package/dist/collection/components/snk-form-config/subcomponents/snk-config-options/snk-config-options.js +5 -3
- package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +2 -2
- package/dist/collection/components/snk-grid-config/snk-grid-config.js +2 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +6 -3
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +8 -2
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +14 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +5 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +6 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +26 -2
- package/dist/collection/lib/utils/constants.js +1 -0
- package/dist/components/ContinuousInsertUtils.js +25 -23
- package/dist/components/DataFetcher.js +14 -2
- package/dist/components/ISave.js +26 -2
- package/dist/components/constants.js +1 -0
- package/dist/components/dataunit-fetcher.js +11 -7
- package/dist/components/snk-application2.js +130 -10
- package/dist/components/snk-config-options2.js +5 -3
- package/dist/components/snk-crud.js +23 -35
- package/dist/components/snk-filter-search.js +18 -5
- package/dist/components/snk-grid-config2.js +2 -0
- package/dist/components/snk-simple-crud2.js +6 -3
- package/dist/esm/{ClientSideExporterProvider-8191676b.js → ClientSideExporterProvider-b3871edb.js} +30 -28
- package/dist/esm/{ConfigStorage-9bd805d6.js → ConfigStorage-71e6766f.js} +2 -2
- package/dist/esm/{DataFetcher-ecf5f903.js → DataFetcher-88e56266.js} +14 -2
- package/dist/esm/{ISave-7d546dce.js → ISave-5efafc97.js} +27 -3
- package/dist/esm/{SnkFormConfigManager-fbc6a9a8.js → SnkFormConfigManager-be490a33.js} +3 -3
- package/dist/esm/{auth-fetcher-07d33333.js → auth-fetcher-3510520e.js} +1 -1
- package/dist/esm/{constants-75abb876.js → constants-7db1128a.js} +1 -0
- package/dist/esm/{dataunit-fetcher-ed6e65ef.js → dataunit-fetcher-0e025732.js} +12 -8
- package/dist/esm/{form-config-fetcher-ac17cff4.js → form-config-fetcher-fa208a6c.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +5 -5
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_7.entry.js +8 -6
- package/dist/esm/snk-application.entry.js +134 -17
- package/dist/esm/snk-attach.entry.js +6 -6
- package/dist/esm/snk-config-options_3.entry.js +10 -8
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +28 -40
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-6258b8ae.js → snk-data-unit-0cb53554.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-filter-search.entry.js +18 -5
- package/dist/esm/snk-grid.entry.js +7 -7
- package/dist/esm/{snk-guides-viewer-80a8709c.js → snk-guides-viewer-83eecbd7.js} +6 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +5 -5
- package/dist/esm/snk-simple-crud.entry.js +14 -11
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/sankhyablocks/{p-13f17dab.js → p-03b68a74.js} +1 -1
- package/dist/sankhyablocks/{p-d1f04e2c.js → p-15784f66.js} +1 -1
- package/dist/sankhyablocks/p-15f67e59.entry.js +11 -0
- package/dist/sankhyablocks/{p-340e2447.entry.js → p-165cde3b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-abd9681c.js → p-18c460f2.js} +1 -1
- package/dist/sankhyablocks/{p-2746d606.entry.js → p-1bdc7355.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c7c6eab7.entry.js → p-33e99371.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2953c481.entry.js → p-3749dffb.entry.js} +1 -1
- package/dist/sankhyablocks/{p-950e3cbe.entry.js → p-475df998.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0bcd4757.entry.js → p-490b75b5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f467153c.entry.js → p-5ffa0493.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5fea0816.entry.js → p-60137b7a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-01512409.js → p-601b252b.js} +1 -1
- package/dist/sankhyablocks/p-6a0c8ce0.entry.js +1 -0
- package/dist/sankhyablocks/p-6dd38d7b.js +6 -0
- package/dist/sankhyablocks/{p-48729c8c.js → p-73285a8a.js} +1 -1
- package/dist/sankhyablocks/p-7993b2e3.js +60 -0
- package/dist/sankhyablocks/p-841d3c3e.entry.js +1 -0
- package/dist/sankhyablocks/p-885802c3.js +1 -0
- package/dist/sankhyablocks/{p-3a36d4b3.entry.js → p-90684a75.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1d19a5b0.js → p-9261d8a0.js} +1 -1
- package/dist/sankhyablocks/{p-dc617b0c.entry.js → p-9a7f7ca3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f861bfcb.entry.js → p-9b4c5dae.entry.js} +1 -1
- package/dist/sankhyablocks/p-b6200d32.entry.js +1 -0
- package/dist/sankhyablocks/{p-23cd6abf.entry.js → p-c0eb761b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-02c6dc9f.entry.js → p-d31a701e.entry.js} +1 -1
- package/dist/sankhyablocks/p-d4752c92.entry.js +1 -0
- package/dist/sankhyablocks/{p-d2065bb4.entry.js → p-dc6ad9a6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cb9d725a.js → p-ebdb9d89.js} +1 -1
- package/dist/sankhyablocks/p-edd2f941.entry.js +1 -0
- package/dist/sankhyablocks/{p-5a7e18f4.js → p-fbba7e3d.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/search-strategy/exec-prepared-search-plus.d.ts +5 -0
- package/dist/types/components/snk-application/snk-application.d.ts +7 -2
- package/dist/types/components/snk-crud/snk-crud.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +5 -3
- package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -1
- package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +1 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/dist/types/components.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +4 -1
- package/dist/types/lib/utils/constants.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-07afb345.entry.js +0 -1
- package/dist/sankhyablocks/p-108fee57.js +0 -6
- package/dist/sankhyablocks/p-35fcf37e.js +0 -1
- package/dist/sankhyablocks/p-513af002.entry.js +0 -1
- package/dist/sankhyablocks/p-7e0a0aae.js +0 -60
- package/dist/sankhyablocks/p-9907cf67.entry.js +0 -1
- package/dist/sankhyablocks/p-c5acb7ba.entry.js +0 -11
- package/dist/sankhyablocks/p-c8622597.entry.js +0 -1
- package/dist/sankhyablocks/p-e5d8891d.entry.js +0 -1
|
@@ -3,14 +3,20 @@ import { h } from '@stencil/core';
|
|
|
3
3
|
import FilterItemType from '../filter-item-type.enum';
|
|
4
4
|
export class SnkFilterSearch {
|
|
5
5
|
constructor() {
|
|
6
|
+
this._isSearchPlus = false;
|
|
6
7
|
this.config = undefined;
|
|
7
8
|
this.value = undefined;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Emitido quando acontece a alteração de valor do componente snk-filter-search
|
|
11
12
|
*/
|
|
12
|
-
ezChangeListener(_evt) {
|
|
13
|
-
this.
|
|
13
|
+
async ezChangeListener(_evt) {
|
|
14
|
+
if (this._isSearchPlus) {
|
|
15
|
+
this.value = await this._searchInput.getValueAsync();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.value = this._searchInput.value;
|
|
19
|
+
}
|
|
14
20
|
this.valueChanged.emit(this.value);
|
|
15
21
|
}
|
|
16
22
|
componentDidLoad() {
|
|
@@ -18,10 +24,11 @@ export class SnkFilterSearch {
|
|
|
18
24
|
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
|
-
doSearch(mode, argument) {
|
|
27
|
+
doSearch(mode, argument, isSearchPlus = false) {
|
|
22
28
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
29
|
+
const loader = isSearchPlus ? application.executePreparedSearchPlus : application.executePreparedSearch;
|
|
23
30
|
return new Promise((resolve, reject) => {
|
|
24
|
-
|
|
31
|
+
loader.bind(application)(mode, argument, this.config.props.searchContext)
|
|
25
32
|
.then(result => {
|
|
26
33
|
resolve(result);
|
|
27
34
|
}).catch(reason => {
|
|
@@ -35,11 +42,17 @@ export class SnkFilterSearch {
|
|
|
35
42
|
async show() {
|
|
36
43
|
this._searchInput.setFocus();
|
|
37
44
|
}
|
|
45
|
+
getInputItem() {
|
|
46
|
+
var _a;
|
|
47
|
+
this._isSearchPlus = ((_a = this.config.props) === null || _a === void 0 ? void 0 : _a["useSearchPlus"]) == true;
|
|
48
|
+
const TagName = this._isSearchPlus ? "ez-search-plus" : "ez-search";
|
|
49
|
+
return (h(TagName, { id: this.config.id, suppressEmptyOption: true, value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, this._isSearchPlus) }));
|
|
50
|
+
}
|
|
38
51
|
render() {
|
|
39
52
|
if (!this.config || this.config.type !== FilterItemType.SEARCH) {
|
|
40
53
|
return undefined;
|
|
41
54
|
}
|
|
42
|
-
return
|
|
55
|
+
return this.getInputItem();
|
|
43
56
|
}
|
|
44
57
|
static get is() { return "snk-filter-search"; }
|
|
45
58
|
static get properties() {
|
|
@@ -136,11 +136,13 @@ export class SnkConfigOptions {
|
|
|
136
136
|
return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
|
|
137
137
|
}
|
|
138
138
|
getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
|
|
139
|
+
const useSearchPlus = userInterface == UserInterface.SEARCHPLUS;
|
|
139
140
|
switch (userInterface) {
|
|
140
141
|
case UserInterface.SEARCH:
|
|
142
|
+
case UserInterface.SEARCHPLUS:
|
|
141
143
|
return {
|
|
142
144
|
suppressEmptyOption: required,
|
|
143
|
-
optionLoader: (searchArgument) => this.onSearch(searchArgument)
|
|
145
|
+
optionLoader: (searchArgument) => this.onSearch(searchArgument, { useSearchPlus })
|
|
144
146
|
};
|
|
145
147
|
case UserInterface.OPTIONSELECTOR:
|
|
146
148
|
return {
|
|
@@ -173,9 +175,9 @@ export class SnkConfigOptions {
|
|
|
173
175
|
this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
|
|
174
176
|
this.configOptionsChanged.emit(this.fieldConfig);
|
|
175
177
|
}
|
|
176
|
-
onSearch(searchArgument) {
|
|
178
|
+
onSearch(searchArgument, ctxOptions) {
|
|
177
179
|
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
178
|
-
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
180
|
+
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit, ctxOptions);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
buildField(descriptor, config) {
|
|
@@ -15,11 +15,11 @@ export default class SnkMultiSelectionListDataSource {
|
|
|
15
15
|
}
|
|
16
16
|
return String(this._dataUnit.getFormattedValue(fieldName, value));
|
|
17
17
|
}
|
|
18
|
-
async getStaticOptions(fieldName) {
|
|
18
|
+
async getStaticOptions(fieldName, options) {
|
|
19
19
|
if (fieldName == undefined) {
|
|
20
20
|
return Promise.resolve(undefined);
|
|
21
21
|
}
|
|
22
|
-
return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
|
|
22
|
+
return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
|
|
23
23
|
}
|
|
24
24
|
fetchData(filterTerm, fieldName) {
|
|
25
25
|
return new Promise(resolve => {
|
|
@@ -258,6 +258,7 @@ export class SnkGridConfig {
|
|
|
258
258
|
delete _newColumnConfig.ascending;
|
|
259
259
|
_newColumnConfig.orderIndex = 0;
|
|
260
260
|
}
|
|
261
|
+
_newColumnConfig.configVersion = SnkGridConfig.CURRENT_CONFIG_VERSION;
|
|
261
262
|
_newColumnConfigList.push(_newColumnConfig);
|
|
262
263
|
}
|
|
263
264
|
});
|
|
@@ -639,3 +640,4 @@ export class SnkGridConfig {
|
|
|
639
640
|
}
|
|
640
641
|
static get elementRef() { return "_element"; }
|
|
641
642
|
}
|
|
643
|
+
SnkGridConfig.CURRENT_CONFIG_VERSION = 1;
|
|
@@ -639,7 +639,9 @@ export class SnkSimpleCrud {
|
|
|
639
639
|
window.addEventListener("keydown", this._keyDownHandler, { capture: true });
|
|
640
640
|
}
|
|
641
641
|
disconnectedCallback() {
|
|
642
|
+
var _a;
|
|
642
643
|
window.removeEventListener("keydown", this._keyDownHandler);
|
|
644
|
+
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
|
643
645
|
}
|
|
644
646
|
gridConfigChangeHandler(evt) {
|
|
645
647
|
evt.stopPropagation();
|
|
@@ -721,12 +723,12 @@ export class SnkSimpleCrud {
|
|
|
721
723
|
}
|
|
722
724
|
async initKeyboardManager() {
|
|
723
725
|
var _a;
|
|
724
|
-
|
|
726
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
725
727
|
const dataUnit = this.dataUnit || await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
|
726
728
|
if (dataUnit == undefined) {
|
|
727
729
|
return;
|
|
728
730
|
}
|
|
729
|
-
|
|
731
|
+
this._keyboardManager
|
|
730
732
|
.bind("F7", () => dataUnit.saveData(), { description: "Salva os dados.", element: this._element })
|
|
731
733
|
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
|
|
732
734
|
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
|
@@ -736,7 +738,8 @@ export class SnkSimpleCrud {
|
|
|
736
738
|
}
|
|
737
739
|
}, {
|
|
738
740
|
debounceTime: 1000,
|
|
739
|
-
description: "Cancela uma ação.",
|
|
741
|
+
description: "Cancela uma ação.",
|
|
742
|
+
element: this._element
|
|
740
743
|
});
|
|
741
744
|
}
|
|
742
745
|
async handleFormConfigSaved() {
|
|
@@ -24,9 +24,15 @@ export default class RmPrecisionCustomValueFormatter {
|
|
|
24
24
|
if (rmPrecision || rmPrecision === 0) {
|
|
25
25
|
return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const columnProps = column === null || column === void 0 ? void 0 : column.props;
|
|
28
|
+
if (columnProps) {
|
|
29
|
+
const precision = column === null || column === void 0 ? void 0 : column.props.get('precision');
|
|
30
|
+
const prettyPrecision = column === null || column === void 0 ? void 0 : column.props.get('prettyPrecision');
|
|
31
|
+
if (precision !== undefined && prettyPrecision !== undefined) {
|
|
32
|
+
return NumberUtils.format(currentValue, precision, prettyPrecision);
|
|
33
|
+
}
|
|
29
34
|
}
|
|
35
|
+
return currentValue;
|
|
30
36
|
}
|
|
31
37
|
refreshSelectedRows() {
|
|
32
38
|
var _a;
|
|
@@ -61,7 +61,13 @@ export class DataFetcher {
|
|
|
61
61
|
if (error.length > 0) { //As informações do erro vem no primeiro indice de um array
|
|
62
62
|
const errorInfo = error[POSITION_ERROR_INFO];
|
|
63
63
|
const errorMessage = (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message) ? errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message : "Não há mensagem de erro";
|
|
64
|
-
|
|
64
|
+
/*
|
|
65
|
+
No HTML5, todos os erros de Troubleshooting são considerados alerta,
|
|
66
|
+
pois a comparação errorLevel == ServiceProxyConstants.LEVEL.ERROR sempre é falsa
|
|
67
|
+
Motivo: - errorLevel é uma string "ERROR" por exemplo
|
|
68
|
+
- ServiceProxyConstants.LEVEL.ERROR é um numero 1, por exemplo
|
|
69
|
+
*/
|
|
70
|
+
const errorLevel = ((_a = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _a === void 0 ? void 0 : _a.level) ? "WARNING" : "ERROR";
|
|
65
71
|
const errorCode = ((_b = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _b === void 0 ? void 0 : _b.code) ? errorInfo.extensions.code : "";
|
|
66
72
|
switch (errorLevel) {
|
|
67
73
|
case "WARNING":
|
|
@@ -83,7 +89,13 @@ export class DataFetcher {
|
|
|
83
89
|
let tsErrorCode, tsErrorLevel;
|
|
84
90
|
if (tsError) {
|
|
85
91
|
tsErrorCode = tsError.tsErrorCode;
|
|
86
|
-
|
|
92
|
+
/*
|
|
93
|
+
No HTML5, todos os erros de Troubleshooting são considerados alerta,
|
|
94
|
+
pois a comparação errorLevel == ServiceProxyConstants.LEVEL.ERROR sempre é falsa
|
|
95
|
+
Motivo: - errorLevel é uma string "ERROR" por exemplo
|
|
96
|
+
- ServiceProxyConstants.LEVEL.ERROR é um numero 1, por exemplo
|
|
97
|
+
*/
|
|
98
|
+
tsErrorLevel = "WARNING";
|
|
87
99
|
}
|
|
88
100
|
if (tsErrorLevel === "WARNING") {
|
|
89
101
|
return new WarningException(title, statusMessage, tsErrorCode);
|
|
@@ -23,7 +23,7 @@ export default class PreloadManager {
|
|
|
23
23
|
static getSortingFunction(dataUnit, sorting) {
|
|
24
24
|
return SortingUtils.getSortingFunction(dataUnit, sorting);
|
|
25
25
|
}
|
|
26
|
-
static async getDistinct(dataUnit, fieldName) {
|
|
26
|
+
static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
|
|
27
27
|
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
|
28
28
|
return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
|
|
29
29
|
}
|
|
@@ -42,7 +42,10 @@ export default class PreloadManager {
|
|
|
42
42
|
if (fieldValue == undefined) {
|
|
43
43
|
return { key: null, value: null };
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
46
|
+
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
47
|
+
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
48
|
+
}
|
|
46
49
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
47
50
|
})
|
|
48
51
|
.then(result => {
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
|
@@ -227,11 +227,12 @@ export class DatasetStrategy {
|
|
|
227
227
|
return InMemoryLoader.getConvertedValue(descriptor, strValue);
|
|
228
228
|
}
|
|
229
229
|
getSearchDescriptionField(descriptor) {
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
if (![UserInterface.SEARCH, UserInterface.SEARCHPLUS].includes(descriptor.userInterface)) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
|
|
234
|
+
if (!StringUtils.isEmpty(DESCRIPTIONFIELD)) {
|
|
235
|
+
return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;
|
|
235
236
|
}
|
|
236
237
|
return undefined;
|
|
237
238
|
}
|
|
@@ -50,7 +50,20 @@ export class PesquisaFetcher {
|
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
buildDescriptionCacheKey(entityName, codeValue) {
|
|
54
|
+
return `${entityName}__${codeValue}`;
|
|
55
|
+
}
|
|
56
|
+
async loadByCode(entityName, codeValue, criteria, searchOptions) {
|
|
57
|
+
const cacheKey = this.buildDescriptionCacheKey(entityName, codeValue);
|
|
58
|
+
const cachedValue = PesquisaFetcher.DESCRIPTIONS_BY_CODE[cacheKey];
|
|
59
|
+
if (cachedValue) {
|
|
60
|
+
return Promise.resolve(cachedValue);
|
|
61
|
+
}
|
|
62
|
+
const result = await this.loadAdvancedSearch(entityName, undefined, criteria, searchOptions, codeValue);
|
|
63
|
+
PesquisaFetcher.DESCRIPTIONS_BY_CODE[cacheKey] = result;
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
loadAdvancedSearch(entityName, argument, criteria, searchOptions, codeValue) {
|
|
54
67
|
var _a, _b, _c, _d, _e;
|
|
55
68
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
56
69
|
const values = {
|
|
@@ -94,12 +107,22 @@ export class PesquisaFetcher {
|
|
|
94
107
|
const reqBody = {
|
|
95
108
|
"serviceName": serviceName,
|
|
96
109
|
"requestBody": {
|
|
97
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "
|
|
110
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
|
|
98
111
|
"clientEventList": {
|
|
99
112
|
"clientEvent": []
|
|
100
113
|
}
|
|
101
114
|
}
|
|
102
115
|
};
|
|
116
|
+
if (codeValue == undefined) {
|
|
117
|
+
reqBody.requestBody.criteria.query = {
|
|
118
|
+
"$": argument
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
reqBody.requestBody.criteria.pk = {
|
|
123
|
+
"$": codeValue
|
|
124
|
+
};
|
|
125
|
+
}
|
|
103
126
|
const urlOptions = {
|
|
104
127
|
urlParams: {
|
|
105
128
|
"quietMode": true
|
|
@@ -209,6 +232,7 @@ export class PesquisaFetcher {
|
|
|
209
232
|
return params;
|
|
210
233
|
}
|
|
211
234
|
}
|
|
235
|
+
PesquisaFetcher.DESCRIPTIONS_BY_CODE = {};
|
|
212
236
|
function buildLoadGridConfigPayload(entityName) {
|
|
213
237
|
return {
|
|
214
238
|
'gridConfig': {
|
|
@@ -168,11 +168,11 @@ class SnkMultiSelectionListDataSource {
|
|
|
168
168
|
}
|
|
169
169
|
return String(this._dataUnit.getFormattedValue(fieldName, value));
|
|
170
170
|
}
|
|
171
|
-
async getStaticOptions(fieldName) {
|
|
171
|
+
async getStaticOptions(fieldName, options) {
|
|
172
172
|
if (fieldName == undefined) {
|
|
173
173
|
return Promise.resolve(undefined);
|
|
174
174
|
}
|
|
175
|
-
return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName));
|
|
175
|
+
return Promise.resolve(await PreloadManager.getDistinct(this._dataUnit, fieldName, options === null || options === void 0 ? void 0 : options.onlyLabel));
|
|
176
176
|
}
|
|
177
177
|
fetchData(filterTerm, fieldName) {
|
|
178
178
|
return new Promise(resolve => {
|
|
@@ -248,9 +248,15 @@ class RmPrecisionCustomValueFormatter {
|
|
|
248
248
|
if (rmPrecision || rmPrecision === 0) {
|
|
249
249
|
return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
const columnProps = column === null || column === void 0 ? void 0 : column.props;
|
|
252
|
+
if (columnProps) {
|
|
253
|
+
const precision = column === null || column === void 0 ? void 0 : column.props.get('precision');
|
|
254
|
+
const prettyPrecision = column === null || column === void 0 ? void 0 : column.props.get('prettyPrecision');
|
|
255
|
+
if (precision !== undefined && prettyPrecision !== undefined) {
|
|
256
|
+
return NumberUtils.format(currentValue, precision, prettyPrecision);
|
|
257
|
+
}
|
|
253
258
|
}
|
|
259
|
+
return currentValue;
|
|
254
260
|
}
|
|
255
261
|
refreshSelectedRows() {
|
|
256
262
|
var _a;
|
|
@@ -298,25 +304,21 @@ class CommonsExporter {
|
|
|
298
304
|
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
|
299
305
|
customFormatter
|
|
300
306
|
};
|
|
301
|
-
if (isUserInterfaceSEARCH) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const newWidth = this.getWidthByMetaData(column === null || column === void 0 ? void 0 : column.width, columnData === null || columnData === void 0 ? void 0 : columnData.width, descriptionColumn === null || descriptionColumn === void 0 ? void 0 : descriptionColumn.width);
|
|
317
|
-
columnData = Object.assign(Object.assign({}, columnData), { width: newWidth === null || newWidth === void 0 ? void 0 : newWidth.codWidth });
|
|
318
|
-
descriptionColumn = Object.assign(Object.assign({}, descriptionColumn), { width: newWidth === null || newWidth === void 0 ? void 0 : newWidth.descWidth, label: (descriptionColumn === null || descriptionColumn === void 0 ? void 0 : descriptionColumn.label) || (column === null || column === void 0 ? void 0 : column.label) });
|
|
319
|
-
}
|
|
307
|
+
if (isUserInterfaceSEARCH && ((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
|
308
|
+
const labelDescription = (_c = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _c === void 0 ? void 0 : _c.DESCRIPTIONENTITY;
|
|
309
|
+
const mergedFrom = fieldData.properties.mergedFrom;
|
|
310
|
+
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
|
311
|
+
descriptionColumn = {
|
|
312
|
+
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
|
313
|
+
label: labelDescription,
|
|
314
|
+
width: isUserInterfaceSEARCH && labelDescription ? (labelDescription.length * this.DEFAULT_FONT_SIZE - widthColumnDefault) : column.width,
|
|
315
|
+
type: DataType.TEXT,
|
|
316
|
+
userInterface: UserInterface$1.LONGTEXT,
|
|
317
|
+
descriptionFrom: fieldData.name
|
|
318
|
+
};
|
|
319
|
+
const newWidth = this.getWidthByMetaData(column === null || column === void 0 ? void 0 : column.width, columnData === null || columnData === void 0 ? void 0 : columnData.width, descriptionColumn === null || descriptionColumn === void 0 ? void 0 : descriptionColumn.width);
|
|
320
|
+
columnData = Object.assign(Object.assign({}, columnData), { width: newWidth === null || newWidth === void 0 ? void 0 : newWidth.codWidth });
|
|
321
|
+
descriptionColumn = Object.assign(Object.assign({}, descriptionColumn), { width: newWidth === null || newWidth === void 0 ? void 0 : newWidth.descWidth, label: (descriptionColumn === null || descriptionColumn === void 0 ? void 0 : descriptionColumn.label) || (column === null || column === void 0 ? void 0 : column.label) });
|
|
320
322
|
}
|
|
321
323
|
columnsMetadata.push(columnData);
|
|
322
324
|
if (descriptionColumn)
|
|
@@ -6716,7 +6716,13 @@ class DataFetcher {
|
|
|
6716
6716
|
if (error.length > 0) { //As informações do erro vem no primeiro indice de um array
|
|
6717
6717
|
const errorInfo = error[POSITION_ERROR_INFO];
|
|
6718
6718
|
const errorMessage = (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message) ? errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.message : "Não há mensagem de erro";
|
|
6719
|
-
|
|
6719
|
+
/*
|
|
6720
|
+
No HTML5, todos os erros de Troubleshooting são considerados alerta,
|
|
6721
|
+
pois a comparação errorLevel == ServiceProxyConstants.LEVEL.ERROR sempre é falsa
|
|
6722
|
+
Motivo: - errorLevel é uma string "ERROR" por exemplo
|
|
6723
|
+
- ServiceProxyConstants.LEVEL.ERROR é um numero 1, por exemplo
|
|
6724
|
+
*/
|
|
6725
|
+
const errorLevel = ((_a = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _a === void 0 ? void 0 : _a.level) ? "WARNING" : "ERROR";
|
|
6720
6726
|
const errorCode = ((_b = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.extensions) === null || _b === void 0 ? void 0 : _b.code) ? errorInfo.extensions.code : "";
|
|
6721
6727
|
switch (errorLevel) {
|
|
6722
6728
|
case "WARNING":
|
|
@@ -6738,7 +6744,13 @@ class DataFetcher {
|
|
|
6738
6744
|
let tsErrorCode, tsErrorLevel;
|
|
6739
6745
|
if (tsError) {
|
|
6740
6746
|
tsErrorCode = tsError.tsErrorCode;
|
|
6741
|
-
|
|
6747
|
+
/*
|
|
6748
|
+
No HTML5, todos os erros de Troubleshooting são considerados alerta,
|
|
6749
|
+
pois a comparação errorLevel == ServiceProxyConstants.LEVEL.ERROR sempre é falsa
|
|
6750
|
+
Motivo: - errorLevel é uma string "ERROR" por exemplo
|
|
6751
|
+
- ServiceProxyConstants.LEVEL.ERROR é um numero 1, por exemplo
|
|
6752
|
+
*/
|
|
6753
|
+
tsErrorLevel = "WARNING";
|
|
6742
6754
|
}
|
|
6743
6755
|
if (tsErrorLevel === "WARNING") {
|
|
6744
6756
|
return new WarningException(title, statusMessage, tsErrorCode);
|
package/dist/components/ISave.js
CHANGED
|
@@ -148,7 +148,20 @@ class PesquisaFetcher {
|
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
buildDescriptionCacheKey(entityName, codeValue) {
|
|
152
|
+
return `${entityName}__${codeValue}`;
|
|
153
|
+
}
|
|
154
|
+
async loadByCode(entityName, codeValue, criteria, searchOptions) {
|
|
155
|
+
const cacheKey = this.buildDescriptionCacheKey(entityName, codeValue);
|
|
156
|
+
const cachedValue = PesquisaFetcher.DESCRIPTIONS_BY_CODE[cacheKey];
|
|
157
|
+
if (cachedValue) {
|
|
158
|
+
return Promise.resolve(cachedValue);
|
|
159
|
+
}
|
|
160
|
+
const result = await this.loadAdvancedSearch(entityName, undefined, criteria, searchOptions, codeValue);
|
|
161
|
+
PesquisaFetcher.DESCRIPTIONS_BY_CODE[cacheKey] = result;
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
loadAdvancedSearch(entityName, argument, criteria, searchOptions, codeValue) {
|
|
152
165
|
var _a, _b, _c, _d, _e;
|
|
153
166
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
154
167
|
const values = {
|
|
@@ -192,12 +205,22 @@ class PesquisaFetcher {
|
|
|
192
205
|
const reqBody = {
|
|
193
206
|
"serviceName": serviceName,
|
|
194
207
|
"requestBody": {
|
|
195
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "
|
|
208
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
|
|
196
209
|
"clientEventList": {
|
|
197
210
|
"clientEvent": []
|
|
198
211
|
}
|
|
199
212
|
}
|
|
200
213
|
};
|
|
214
|
+
if (codeValue == undefined) {
|
|
215
|
+
reqBody.requestBody.criteria.query = {
|
|
216
|
+
"$": argument
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
reqBody.requestBody.criteria.pk = {
|
|
221
|
+
"$": codeValue
|
|
222
|
+
};
|
|
223
|
+
}
|
|
201
224
|
const urlOptions = {
|
|
202
225
|
urlParams: {
|
|
203
226
|
"quietMode": true
|
|
@@ -307,6 +330,7 @@ class PesquisaFetcher {
|
|
|
307
330
|
return params;
|
|
308
331
|
}
|
|
309
332
|
}
|
|
333
|
+
PesquisaFetcher.DESCRIPTIONS_BY_CODE = {};
|
|
310
334
|
function buildLoadGridConfigPayload(entityName) {
|
|
311
335
|
return {
|
|
312
336
|
'gridConfig': {
|
|
@@ -153,7 +153,7 @@ class PreloadManager {
|
|
|
153
153
|
static getSortingFunction(dataUnit, sorting) {
|
|
154
154
|
return SortingUtils.getSortingFunction(dataUnit, sorting);
|
|
155
155
|
}
|
|
156
|
-
static async getDistinct(dataUnit, fieldName) {
|
|
156
|
+
static async getDistinct(dataUnit, fieldName, onlyLabel = false) {
|
|
157
157
|
if (!PreloadManager.isCacheEnabled(dataUnit)) {
|
|
158
158
|
return Promise.resolve(ColumnFilterManager.compileDistinct(fieldName, dataUnit));
|
|
159
159
|
}
|
|
@@ -172,7 +172,10 @@ class PreloadManager {
|
|
|
172
172
|
if (fieldValue == undefined) {
|
|
173
173
|
return { key: null, value: null };
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
176
|
+
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
177
|
+
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
178
|
+
}
|
|
176
179
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
177
180
|
})
|
|
178
181
|
.then(result => {
|
|
@@ -495,11 +498,12 @@ class DatasetStrategy {
|
|
|
495
498
|
return InMemoryLoader.getConvertedValue(descriptor, strValue);
|
|
496
499
|
}
|
|
497
500
|
getSearchDescriptionField(descriptor) {
|
|
498
|
-
if (
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
501
|
+
if (![UserInterface.SEARCH, UserInterface.SEARCHPLUS].includes(descriptor.userInterface)) {
|
|
502
|
+
return undefined;
|
|
503
|
+
}
|
|
504
|
+
const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
|
|
505
|
+
if (!StringUtils.isEmpty(DESCRIPTIONFIELD)) {
|
|
506
|
+
return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;
|
|
503
507
|
}
|
|
504
508
|
return undefined;
|
|
505
509
|
}
|