@sankhyalabs/sankhyablocks 8.8.6 → 8.8.8
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/{PersonalizedFilterUtils-1aeb625d.js → PersonalizedFilterUtils-2f7823fc.js} +11 -4
- package/dist/cjs/snk-application.cjs.entry.js +26 -14
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +26 -14
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +13 -4
- package/dist/components/PersonalizedFilterUtils.js +10 -3
- package/dist/components/snk-application2.js +26 -14
- package/dist/esm/{PersonalizedFilterUtils-75fb0106.js → PersonalizedFilterUtils-49a5dcb7.js} +11 -4
- package/dist/esm/snk-application.entry.js +26 -14
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
- package/dist/esm/snk-filter-bar.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- package/dist/esm/snk-filter-field-search_2.entry.js +1 -1
- package/dist/esm/snk-filter-modal.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/sankhyablocks/{p-4efe1a8a.entry.js → p-3532eb1c.entry.js} +3 -3
- package/dist/sankhyablocks/{p-5c1aacc7.js → p-43b2aad5.js} +1 -1
- package/dist/sankhyablocks/{p-70150991.entry.js → p-6d765e32.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0885ed3c.entry.js → p-c0931902.entry.js} +1 -1
- package/dist/sankhyablocks/{p-989937ee.entry.js → p-c606c748.entry.js} +1 -1
- package/dist/sankhyablocks/{p-25c5428f.entry.js → p-c78a80ae.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5d04ae42.entry.js → p-e11c5038.entry.js} +1 -1
- package/dist/sankhyablocks/{p-767db365.entry.js → p-e60325bc.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +2 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/{PersonalizedFilterUtils-1aeb625d.js → PersonalizedFilterUtils-2f7823fc.js}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
const core = require('@sankhyalabs/core');
|
4
|
-
const index = require('./index-c5771aba.js');
|
5
4
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
5
|
+
const index = require('./index-c5771aba.js');
|
6
6
|
|
7
7
|
class PersonalizedFilterUtils {
|
8
8
|
/**
|
@@ -188,9 +188,16 @@ class PersonalizedFilterUtils {
|
|
188
188
|
const activeFilters = (config.groupedItems || []).filter(item => item.visible);
|
189
189
|
const allFilterWithVariableParams = activeFilters.filter(activeFilter => { var _a, _b, _c; return !!((_c = (_b = (_a = activeFilter.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) === null || _c === void 0 ? void 0 : _c.length); });
|
190
190
|
const allParamsWithValues = allFilterWithVariableParams.flatMap(filter => { var _a; return (_a = filter.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters; });
|
191
|
-
const valuesFromParams = allFilterWithVariableParams.flatMap(filter => {
|
192
|
-
|
193
|
-
|
191
|
+
const valuesFromParams = allFilterWithVariableParams.flatMap((filter) => {
|
192
|
+
return filter.props.personalizedFilter.parameters.flatMap((param, index) => {
|
193
|
+
if (!filter.value) {
|
194
|
+
return null;
|
195
|
+
}
|
196
|
+
if (filter.value[index] === undefined && param.dataType === core.DataType.BOOLEAN) {
|
197
|
+
return false;
|
198
|
+
}
|
199
|
+
return filter.value[index];
|
200
|
+
});
|
194
201
|
});
|
195
202
|
valuesArray = this.getNormalizedValue(allParamsWithValues, valuesArray);
|
196
203
|
isValid = allParamsWithValues.length === valuesFromParams.length && valuesFromParams.every(value => value != null);
|
@@ -930,9 +930,7 @@ const SnkApplication = class {
|
|
930
930
|
this._currentPkParameter = pkHash;
|
931
931
|
return;
|
932
932
|
}
|
933
|
-
|
934
|
-
this._currentPkParameter = pkHash;
|
935
|
-
}
|
933
|
+
this.defaultLoadByPK(pkParam, pkHash);
|
936
934
|
}
|
937
935
|
getResourceIdFromToken() {
|
938
936
|
if ((top.window.location.pathname).indexOf("tabContent.jsp") > -1) {
|
@@ -940,24 +938,32 @@ const SnkApplication = class {
|
|
940
938
|
}
|
941
939
|
return DataFetcher.UrlUtils.getResourceIdFromUrlToken(top.window.location.hash);
|
942
940
|
}
|
943
|
-
defaultLoadByPK(pkObject) {
|
941
|
+
defaultLoadByPK(pkObject, pkHash) {
|
944
942
|
if (!(pkObject === null || pkObject === void 0 ? void 0 : pkObject.pk))
|
945
943
|
return;
|
946
|
-
const
|
944
|
+
const snkDataUnit = this.getFirstDataUnitFromDOM();
|
945
|
+
const dataUnit = snkDataUnit.dataUnit;
|
947
946
|
if (!dataUnit) {
|
948
947
|
console.warn("Dataunit não inicializado");
|
948
|
+
snkDataUnit.addEventListener("dataUnitReady", (event) => {
|
949
|
+
this.loadDataWithPKFilter(pkObject, event.detail);
|
950
|
+
this._currentPkParameter = pkHash;
|
951
|
+
});
|
949
952
|
return;
|
950
953
|
}
|
954
|
+
this.loadDataWithPKFilter(pkObject, dataUnit);
|
955
|
+
this._currentPkParameter = pkHash;
|
956
|
+
}
|
957
|
+
loadDataWithPKFilter(pkObject, dataUnit) {
|
951
958
|
const quickFilter = {
|
952
|
-
term:
|
959
|
+
term: '',
|
953
960
|
filter: {
|
954
|
-
name:
|
961
|
+
name: 'LOAD_BY_PK_FILTER',
|
955
962
|
expression: this.buildFilterExpressionByPkObject(pkObject),
|
956
|
-
params: this.getFilterParamsFromPkObject(pkObject, dataUnit)
|
957
|
-
}
|
963
|
+
params: this.getFilterParamsFromPkObject(pkObject, dataUnit),
|
964
|
+
},
|
958
965
|
};
|
959
966
|
dataUnit.loadData(quickFilter);
|
960
|
-
return true;
|
961
967
|
}
|
962
968
|
getFirstDataUnitFromDOM() {
|
963
969
|
//Primeiro tentamos obeter o dataunit para fazer o loadByPK
|
@@ -966,7 +972,7 @@ const SnkApplication = class {
|
|
966
972
|
snkDataUnit = this._element.querySelector("snk-data-unit");
|
967
973
|
}
|
968
974
|
if (snkDataUnit) {
|
969
|
-
return snkDataUnit
|
975
|
+
return snkDataUnit;
|
970
976
|
}
|
971
977
|
return undefined;
|
972
978
|
}
|
@@ -1052,6 +1058,14 @@ const SnkApplication = class {
|
|
1052
1058
|
const firstLoadConv = urlParams.get("firstLoadConv");
|
1053
1059
|
return firstLoadConv && firstLoadConv === "S";
|
1054
1060
|
}
|
1061
|
+
registerPkChangeListener() {
|
1062
|
+
if (window.hasOwnProperty("onhashchange")) {
|
1063
|
+
window.onhashchange = this.pkChangeListener.bind(this);
|
1064
|
+
}
|
1065
|
+
else {
|
1066
|
+
setInterval(this.pkChangeListener.bind(this), 100);
|
1067
|
+
}
|
1068
|
+
}
|
1055
1069
|
componentWillLoad() {
|
1056
1070
|
core.ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
|
1057
1071
|
this._errorHandler = new SnkErrorHandler(this);
|
@@ -1061,9 +1075,7 @@ const SnkApplication = class {
|
|
1061
1075
|
return this.executeSearch(searchArgument, fieldName, dataUnit);
|
1062
1076
|
});
|
1063
1077
|
core.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
1064
|
-
|
1065
|
-
this.pkChangeListener();
|
1066
|
-
}, 100);
|
1078
|
+
this.registerPkChangeListener();
|
1067
1079
|
core.ErrorTracking.init();
|
1068
1080
|
ConfigStorage.ConfigStorage.preload(this.applicationResourceID, this.configName);
|
1069
1081
|
document.addEventListener("click", () => Workspace.applicationClick());
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
6
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
|
-
require('./index-c5771aba.js');
|
9
8
|
require('./filter-item-type.enum-aa823a00.js');
|
9
|
+
require('./index-c5771aba.js');
|
10
10
|
|
11
11
|
const snkFilterAdvancedModeCss = ".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";
|
12
12
|
|
@@ -10,7 +10,7 @@ const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
10
10
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
11
11
|
const index = require('./index-c5771aba.js');
|
12
12
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
13
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
13
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
14
14
|
require('./form-config-fetcher-17775a75.js');
|
15
15
|
require('./DataFetcher-713f0749.js');
|
16
16
|
require('./_commonjsHelpers-537d719a.js');
|
@@ -7,7 +7,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
7
7
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
8
|
const core = require('@sankhyalabs/core');
|
9
9
|
const presentationMode = require('./presentationMode-52ec3bdd.js');
|
10
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
10
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
11
11
|
require('./index-c5771aba.js');
|
12
12
|
|
13
13
|
const SnkFilterDetail = class {
|
@@ -7,7 +7,7 @@ const index$1 = require('./index-8d94b7e0.js');
|
|
7
7
|
const core = require('@sankhyalabs/core');
|
8
8
|
const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
|
9
9
|
const index$2 = require('./index-c5771aba.js');
|
10
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
10
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
11
11
|
require('./filter-item-type.enum-aa823a00.js');
|
12
12
|
|
13
13
|
const ICON_MODES = {
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const filterType_enum = require('./filter-type.enum-b14ce507.js');
|
9
9
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
10
10
|
const core = require('@sankhyalabs/core');
|
11
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
11
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
12
12
|
require('./index-c5771aba.js');
|
13
13
|
|
14
14
|
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
7
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-2f7823fc.js');
|
8
8
|
const ConfigStorage = require('./ConfigStorage-c15716fd.js');
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
10
10
|
const index$1 = require('./index-c5771aba.js');
|
@@ -694,9 +694,7 @@ export class SnkApplication {
|
|
694
694
|
this._currentPkParameter = pkHash;
|
695
695
|
return;
|
696
696
|
}
|
697
|
-
|
698
|
-
this._currentPkParameter = pkHash;
|
699
|
-
}
|
697
|
+
this.defaultLoadByPK(pkParam, pkHash);
|
700
698
|
}
|
701
699
|
getResourceIdFromToken() {
|
702
700
|
if ((top.window.location.pathname).indexOf("tabContent.jsp") > -1) {
|
@@ -704,24 +702,32 @@ export class SnkApplication {
|
|
704
702
|
}
|
705
703
|
return UrlUtils.getResourceIdFromUrlToken(top.window.location.hash);
|
706
704
|
}
|
707
|
-
defaultLoadByPK(pkObject) {
|
705
|
+
defaultLoadByPK(pkObject, pkHash) {
|
708
706
|
if (!(pkObject === null || pkObject === void 0 ? void 0 : pkObject.pk))
|
709
707
|
return;
|
710
|
-
const
|
708
|
+
const snkDataUnit = this.getFirstDataUnitFromDOM();
|
709
|
+
const dataUnit = snkDataUnit.dataUnit;
|
711
710
|
if (!dataUnit) {
|
712
711
|
console.warn("Dataunit não inicializado");
|
712
|
+
snkDataUnit.addEventListener("dataUnitReady", (event) => {
|
713
|
+
this.loadDataWithPKFilter(pkObject, event.detail);
|
714
|
+
this._currentPkParameter = pkHash;
|
715
|
+
});
|
713
716
|
return;
|
714
717
|
}
|
718
|
+
this.loadDataWithPKFilter(pkObject, dataUnit);
|
719
|
+
this._currentPkParameter = pkHash;
|
720
|
+
}
|
721
|
+
loadDataWithPKFilter(pkObject, dataUnit) {
|
715
722
|
const quickFilter = {
|
716
|
-
term:
|
723
|
+
term: '',
|
717
724
|
filter: {
|
718
|
-
name:
|
725
|
+
name: 'LOAD_BY_PK_FILTER',
|
719
726
|
expression: this.buildFilterExpressionByPkObject(pkObject),
|
720
|
-
params: this.getFilterParamsFromPkObject(pkObject, dataUnit)
|
721
|
-
}
|
727
|
+
params: this.getFilterParamsFromPkObject(pkObject, dataUnit),
|
728
|
+
},
|
722
729
|
};
|
723
730
|
dataUnit.loadData(quickFilter);
|
724
|
-
return true;
|
725
731
|
}
|
726
732
|
getFirstDataUnitFromDOM() {
|
727
733
|
//Primeiro tentamos obeter o dataunit para fazer o loadByPK
|
@@ -730,7 +736,7 @@ export class SnkApplication {
|
|
730
736
|
snkDataUnit = this._element.querySelector("snk-data-unit");
|
731
737
|
}
|
732
738
|
if (snkDataUnit) {
|
733
|
-
return snkDataUnit
|
739
|
+
return snkDataUnit;
|
734
740
|
}
|
735
741
|
return undefined;
|
736
742
|
}
|
@@ -816,6 +822,14 @@ export class SnkApplication {
|
|
816
822
|
const firstLoadConv = urlParams.get("firstLoadConv");
|
817
823
|
return firstLoadConv && firstLoadConv === "S";
|
818
824
|
}
|
825
|
+
registerPkChangeListener() {
|
826
|
+
if (window.hasOwnProperty("onhashchange")) {
|
827
|
+
window.onhashchange = this.pkChangeListener.bind(this);
|
828
|
+
}
|
829
|
+
else {
|
830
|
+
setInterval(this.pkChangeListener.bind(this), 100);
|
831
|
+
}
|
832
|
+
}
|
819
833
|
componentWillLoad() {
|
820
834
|
ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
|
821
835
|
this._errorHandler = new SnkErrorHandler(this);
|
@@ -825,9 +839,7 @@ export class SnkApplication {
|
|
825
839
|
return this.executeSearch(searchArgument, fieldName, dataUnit);
|
826
840
|
});
|
827
841
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
828
|
-
|
829
|
-
this.pkChangeListener();
|
830
|
-
}, 100);
|
842
|
+
this.registerPkChangeListener();
|
831
843
|
ErrorTracking.init();
|
832
844
|
ConfigStorage.preload(this.applicationResourceID, this.configName);
|
833
845
|
document.addEventListener("click", () => Workspace.applicationClick());
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DataType, DateUtils, NumberUtils, UserInterface } from "@sankhyalabs/core";
|
2
|
-
import { FilterOperand } from "../../../interfaces/index";
|
3
2
|
import FilterItemType from "../../../../snk-filter-bar/filter-item/filter-item-type.enum";
|
3
|
+
import { FilterOperand } from "../../../interfaces/index";
|
4
4
|
export class PersonalizedFilterUtils {
|
5
5
|
/**
|
6
6
|
* Cria uma expressão de filtro a partir de um IExpressionItem.
|
@@ -185,9 +185,18 @@ export class PersonalizedFilterUtils {
|
|
185
185
|
const activeFilters = (config.groupedItems || []).filter(item => item.visible);
|
186
186
|
const allFilterWithVariableParams = activeFilters.filter(activeFilter => { var _a, _b, _c; return !!((_c = (_b = (_a = activeFilter.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) === null || _c === void 0 ? void 0 : _c.length); });
|
187
187
|
const allParamsWithValues = allFilterWithVariableParams.flatMap(filter => { var _a; return (_a = filter.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters; });
|
188
|
-
const valuesFromParams = allFilterWithVariableParams.flatMap(filter => {
|
189
|
-
|
190
|
-
|
188
|
+
const valuesFromParams = allFilterWithVariableParams.flatMap((filter) => {
|
189
|
+
return filter.props.personalizedFilter.parameters.flatMap((param, index) => {
|
190
|
+
if (!filter.value) {
|
191
|
+
return null;
|
192
|
+
}
|
193
|
+
;
|
194
|
+
if (filter.value[index] === undefined && param.dataType === DataType.BOOLEAN) {
|
195
|
+
return false;
|
196
|
+
}
|
197
|
+
;
|
198
|
+
return filter.value[index];
|
199
|
+
});
|
191
200
|
});
|
192
201
|
valuesArray = this.getNormalizedValue(allParamsWithValues, valuesArray);
|
193
202
|
isValid = allParamsWithValues.length === valuesFromParams.length && valuesFromParams.every(value => value != null);
|
@@ -228,9 +228,16 @@ class PersonalizedFilterUtils {
|
|
228
228
|
const activeFilters = (config.groupedItems || []).filter(item => item.visible);
|
229
229
|
const allFilterWithVariableParams = activeFilters.filter(activeFilter => { var _a, _b, _c; return !!((_c = (_b = (_a = activeFilter.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) === null || _c === void 0 ? void 0 : _c.length); });
|
230
230
|
const allParamsWithValues = allFilterWithVariableParams.flatMap(filter => { var _a; return (_a = filter.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters; });
|
231
|
-
const valuesFromParams = allFilterWithVariableParams.flatMap(filter => {
|
232
|
-
|
233
|
-
|
231
|
+
const valuesFromParams = allFilterWithVariableParams.flatMap((filter) => {
|
232
|
+
return filter.props.personalizedFilter.parameters.flatMap((param, index) => {
|
233
|
+
if (!filter.value) {
|
234
|
+
return null;
|
235
|
+
}
|
236
|
+
if (filter.value[index] === undefined && param.dataType === DataType.BOOLEAN) {
|
237
|
+
return false;
|
238
|
+
}
|
239
|
+
return filter.value[index];
|
240
|
+
});
|
234
241
|
});
|
235
242
|
valuesArray = this.getNormalizedValue(allParamsWithValues, valuesArray);
|
236
243
|
isValid = allParamsWithValues.length === valuesFromParams.length && valuesFromParams.every(value => value != null);
|
@@ -918,9 +918,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
918
918
|
this._currentPkParameter = pkHash;
|
919
919
|
return;
|
920
920
|
}
|
921
|
-
|
922
|
-
this._currentPkParameter = pkHash;
|
923
|
-
}
|
921
|
+
this.defaultLoadByPK(pkParam, pkHash);
|
924
922
|
}
|
925
923
|
getResourceIdFromToken() {
|
926
924
|
if ((top.window.location.pathname).indexOf("tabContent.jsp") > -1) {
|
@@ -928,24 +926,32 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
928
926
|
}
|
929
927
|
return UrlUtils.getResourceIdFromUrlToken(top.window.location.hash);
|
930
928
|
}
|
931
|
-
defaultLoadByPK(pkObject) {
|
929
|
+
defaultLoadByPK(pkObject, pkHash) {
|
932
930
|
if (!(pkObject === null || pkObject === void 0 ? void 0 : pkObject.pk))
|
933
931
|
return;
|
934
|
-
const
|
932
|
+
const snkDataUnit = this.getFirstDataUnitFromDOM();
|
933
|
+
const dataUnit = snkDataUnit.dataUnit;
|
935
934
|
if (!dataUnit) {
|
936
935
|
console.warn("Dataunit não inicializado");
|
936
|
+
snkDataUnit.addEventListener("dataUnitReady", (event) => {
|
937
|
+
this.loadDataWithPKFilter(pkObject, event.detail);
|
938
|
+
this._currentPkParameter = pkHash;
|
939
|
+
});
|
937
940
|
return;
|
938
941
|
}
|
942
|
+
this.loadDataWithPKFilter(pkObject, dataUnit);
|
943
|
+
this._currentPkParameter = pkHash;
|
944
|
+
}
|
945
|
+
loadDataWithPKFilter(pkObject, dataUnit) {
|
939
946
|
const quickFilter = {
|
940
|
-
term:
|
947
|
+
term: '',
|
941
948
|
filter: {
|
942
|
-
name:
|
949
|
+
name: 'LOAD_BY_PK_FILTER',
|
943
950
|
expression: this.buildFilterExpressionByPkObject(pkObject),
|
944
|
-
params: this.getFilterParamsFromPkObject(pkObject, dataUnit)
|
945
|
-
}
|
951
|
+
params: this.getFilterParamsFromPkObject(pkObject, dataUnit),
|
952
|
+
},
|
946
953
|
};
|
947
954
|
dataUnit.loadData(quickFilter);
|
948
|
-
return true;
|
949
955
|
}
|
950
956
|
getFirstDataUnitFromDOM() {
|
951
957
|
//Primeiro tentamos obeter o dataunit para fazer o loadByPK
|
@@ -954,7 +960,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
954
960
|
snkDataUnit = this._element.querySelector("snk-data-unit");
|
955
961
|
}
|
956
962
|
if (snkDataUnit) {
|
957
|
-
return snkDataUnit
|
963
|
+
return snkDataUnit;
|
958
964
|
}
|
959
965
|
return undefined;
|
960
966
|
}
|
@@ -1040,6 +1046,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1040
1046
|
const firstLoadConv = urlParams.get("firstLoadConv");
|
1041
1047
|
return firstLoadConv && firstLoadConv === "S";
|
1042
1048
|
}
|
1049
|
+
registerPkChangeListener() {
|
1050
|
+
if (window.hasOwnProperty("onhashchange")) {
|
1051
|
+
window.onhashchange = this.pkChangeListener.bind(this);
|
1052
|
+
}
|
1053
|
+
else {
|
1054
|
+
setInterval(this.pkChangeListener.bind(this), 100);
|
1055
|
+
}
|
1056
|
+
}
|
1043
1057
|
componentWillLoad() {
|
1044
1058
|
ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
|
1045
1059
|
this._errorHandler = new SnkErrorHandler(this);
|
@@ -1049,9 +1063,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1049
1063
|
return this.executeSearch(searchArgument, fieldName, dataUnit);
|
1050
1064
|
});
|
1051
1065
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
1052
|
-
|
1053
|
-
this.pkChangeListener();
|
1054
|
-
}, 100);
|
1066
|
+
this.registerPkChangeListener();
|
1055
1067
|
ErrorTracking.init();
|
1056
1068
|
ConfigStorage.preload(this.applicationResourceID, this.configName);
|
1057
1069
|
document.addEventListener("click", () => Workspace.applicationClick());
|
package/dist/esm/{PersonalizedFilterUtils-75fb0106.js → PersonalizedFilterUtils-49a5dcb7.js}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DataType, NumberUtils, DateUtils, UserInterface } from '@sankhyalabs/core';
|
2
|
-
import { F as FilterOperand } from './index-ae591a44.js';
|
3
2
|
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
3
|
+
import { F as FilterOperand } from './index-ae591a44.js';
|
4
4
|
|
5
5
|
class PersonalizedFilterUtils {
|
6
6
|
/**
|
@@ -186,9 +186,16 @@ class PersonalizedFilterUtils {
|
|
186
186
|
const activeFilters = (config.groupedItems || []).filter(item => item.visible);
|
187
187
|
const allFilterWithVariableParams = activeFilters.filter(activeFilter => { var _a, _b, _c; return !!((_c = (_b = (_a = activeFilter.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) === null || _c === void 0 ? void 0 : _c.length); });
|
188
188
|
const allParamsWithValues = allFilterWithVariableParams.flatMap(filter => { var _a; return (_a = filter.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters; });
|
189
|
-
const valuesFromParams = allFilterWithVariableParams.flatMap(filter => {
|
190
|
-
|
191
|
-
|
189
|
+
const valuesFromParams = allFilterWithVariableParams.flatMap((filter) => {
|
190
|
+
return filter.props.personalizedFilter.parameters.flatMap((param, index) => {
|
191
|
+
if (!filter.value) {
|
192
|
+
return null;
|
193
|
+
}
|
194
|
+
if (filter.value[index] === undefined && param.dataType === DataType.BOOLEAN) {
|
195
|
+
return false;
|
196
|
+
}
|
197
|
+
return filter.value[index];
|
198
|
+
});
|
192
199
|
});
|
193
200
|
valuesArray = this.getNormalizedValue(allParamsWithValues, valuesArray);
|
194
201
|
isValid = allParamsWithValues.length === valuesFromParams.length && valuesFromParams.every(value => value != null);
|
@@ -926,9 +926,7 @@ const SnkApplication = class {
|
|
926
926
|
this._currentPkParameter = pkHash;
|
927
927
|
return;
|
928
928
|
}
|
929
|
-
|
930
|
-
this._currentPkParameter = pkHash;
|
931
|
-
}
|
929
|
+
this.defaultLoadByPK(pkParam, pkHash);
|
932
930
|
}
|
933
931
|
getResourceIdFromToken() {
|
934
932
|
if ((top.window.location.pathname).indexOf("tabContent.jsp") > -1) {
|
@@ -936,24 +934,32 @@ const SnkApplication = class {
|
|
936
934
|
}
|
937
935
|
return UrlUtils.getResourceIdFromUrlToken(top.window.location.hash);
|
938
936
|
}
|
939
|
-
defaultLoadByPK(pkObject) {
|
937
|
+
defaultLoadByPK(pkObject, pkHash) {
|
940
938
|
if (!(pkObject === null || pkObject === void 0 ? void 0 : pkObject.pk))
|
941
939
|
return;
|
942
|
-
const
|
940
|
+
const snkDataUnit = this.getFirstDataUnitFromDOM();
|
941
|
+
const dataUnit = snkDataUnit.dataUnit;
|
943
942
|
if (!dataUnit) {
|
944
943
|
console.warn("Dataunit não inicializado");
|
944
|
+
snkDataUnit.addEventListener("dataUnitReady", (event) => {
|
945
|
+
this.loadDataWithPKFilter(pkObject, event.detail);
|
946
|
+
this._currentPkParameter = pkHash;
|
947
|
+
});
|
945
948
|
return;
|
946
949
|
}
|
950
|
+
this.loadDataWithPKFilter(pkObject, dataUnit);
|
951
|
+
this._currentPkParameter = pkHash;
|
952
|
+
}
|
953
|
+
loadDataWithPKFilter(pkObject, dataUnit) {
|
947
954
|
const quickFilter = {
|
948
|
-
term:
|
955
|
+
term: '',
|
949
956
|
filter: {
|
950
|
-
name:
|
957
|
+
name: 'LOAD_BY_PK_FILTER',
|
951
958
|
expression: this.buildFilterExpressionByPkObject(pkObject),
|
952
|
-
params: this.getFilterParamsFromPkObject(pkObject, dataUnit)
|
953
|
-
}
|
959
|
+
params: this.getFilterParamsFromPkObject(pkObject, dataUnit),
|
960
|
+
},
|
954
961
|
};
|
955
962
|
dataUnit.loadData(quickFilter);
|
956
|
-
return true;
|
957
963
|
}
|
958
964
|
getFirstDataUnitFromDOM() {
|
959
965
|
//Primeiro tentamos obeter o dataunit para fazer o loadByPK
|
@@ -962,7 +968,7 @@ const SnkApplication = class {
|
|
962
968
|
snkDataUnit = this._element.querySelector("snk-data-unit");
|
963
969
|
}
|
964
970
|
if (snkDataUnit) {
|
965
|
-
return snkDataUnit
|
971
|
+
return snkDataUnit;
|
966
972
|
}
|
967
973
|
return undefined;
|
968
974
|
}
|
@@ -1048,6 +1054,14 @@ const SnkApplication = class {
|
|
1048
1054
|
const firstLoadConv = urlParams.get("firstLoadConv");
|
1049
1055
|
return firstLoadConv && firstLoadConv === "S";
|
1050
1056
|
}
|
1057
|
+
registerPkChangeListener() {
|
1058
|
+
if (window.hasOwnProperty("onhashchange")) {
|
1059
|
+
window.onhashchange = this.pkChangeListener.bind(this);
|
1060
|
+
}
|
1061
|
+
else {
|
1062
|
+
setInterval(this.pkChangeListener.bind(this), 100);
|
1063
|
+
}
|
1064
|
+
}
|
1051
1065
|
componentWillLoad() {
|
1052
1066
|
ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
|
1053
1067
|
this._errorHandler = new SnkErrorHandler(this);
|
@@ -1057,9 +1071,7 @@ const SnkApplication = class {
|
|
1057
1071
|
return this.executeSearch(searchArgument, fieldName, dataUnit);
|
1058
1072
|
});
|
1059
1073
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
1060
|
-
|
1061
|
-
this.pkChangeListener();
|
1062
|
-
}, 100);
|
1074
|
+
this.registerPkChangeListener();
|
1063
1075
|
ErrorTracking.init();
|
1064
1076
|
ConfigStorage.preload(this.applicationResourceID, this.configName);
|
1065
1077
|
document.addEventListener("click", () => Workspace.applicationClick());
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-a7d3d3f1.js';
|
2
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
2
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
|
-
import './index-ae591a44.js';
|
5
4
|
import './filter-item-type.enum-5028ed3f.js';
|
5
|
+
import './index-ae591a44.js';
|
6
6
|
|
7
7
|
const snkFilterAdvancedModeCss = ".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";
|
8
8
|
|
@@ -6,7 +6,7 @@ import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
6
6
|
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
7
7
|
import { F as FilterOperand } from './index-ae591a44.js';
|
8
8
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
9
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
9
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
10
10
|
import './form-config-fetcher-e1603e66.js';
|
11
11
|
import './DataFetcher-79f78222.js';
|
12
12
|
import './_commonjsHelpers-9943807e.js';
|
@@ -3,7 +3,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
4
4
|
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
5
5
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
6
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
6
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
7
7
|
import './index-ae591a44.js';
|
8
8
|
|
9
9
|
const SnkFilterDetail = class {
|
@@ -3,7 +3,7 @@ import { S as SelectedItemType } from './index-620ac460.js';
|
|
3
3
|
import { UserInterface, JSUtils, ElementIDUtils, ApplicationContext, StringUtils, DataType } from '@sankhyalabs/core';
|
4
4
|
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
5
5
|
import { b as FilterConfigType, c as FilterEntities, d as FilterUserConfigTypes } from './index-ae591a44.js';
|
6
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
6
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
7
7
|
import './filter-item-type.enum-5028ed3f.js';
|
8
8
|
|
9
9
|
const ICON_MODES = {
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
|
5
5
|
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
6
6
|
import { ObjectUtils } from '@sankhyalabs/core';
|
7
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
7
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
8
8
|
import './index-ae591a44.js';
|
9
9
|
|
10
10
|
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
|
2
2
|
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
3
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-49a5dcb7.js';
|
4
4
|
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-79c81f36.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { a as FilterGroupCondition } from './index-ae591a44.js';
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{DateUtils as n,StringUtils as r,ObjectUtils as a,WaitingChangeException as o,WarningException as c,ErrorException as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,DataType as d,ApplicationContext as m,ErrorTracking as w}from"@sankhyalabs/core";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{C as y}from"./p-29176742.js";import{d as P,D as
|
1
|
+
import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{DateUtils as n,StringUtils as r,ObjectUtils as a,WaitingChangeException as o,WarningException as c,ErrorException as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,DataType as d,ApplicationContext as m,ErrorTracking as w}from"@sankhyalabs/core";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{C as y}from"./p-29176742.js";import{d as P,D as g,U as v}from"./p-c9399ce6.js";import{A as I,a as A}from"./p-d0b36421.js";import{D as _}from"./p-73407f35.js";import{P as S}from"./p-41d156dd.js";import{S as C}from"./p-f1f7b545.js";import"./p-4651b43f.js";import"./p-584d7212.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-c22c1d8e.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"./p-688dcb4c.js";class D{static webConnectionCaller(t,s,e){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,s,e)}}const E=N;function N(t,s){const e=b();return(N=function(t){return e[t-=378]})(t,s)}function b(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(b=function(){return t})()}!function(){const t=N,s=b();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class k{[E(397)](t){const s=E;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new L("S"===t[s(402)]||!0===t[s(402)]);return Array[s(394)](t[s(391)])&&t[s(391)][s(385)]((t=>e.putAccess(t[s(382)],String(t.status)==s(398)))),e}}class L{constructor(t){const s=E;this.isSup=t,this[s(384)]={}}[E(378)](t,s){this[E(384)][t]=s}[E(393)](t){const s=E;if(this[s(402)])return!0;let e=!0;return this[s(384)][s(380)](t)&&(e=this.actions[t]),e}isUserSup(){return this.isSup}}class T{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",P.gql`query($name: String!) {
|
2
2
|
$queryAlias$: fetchResource(name: $name){
|
3
3
|
name
|
4
4
|
resource
|
5
5
|
}
|
6
|
-
}`)}async getParam(t){const s=`param://application?params=${t}`;return
|
6
|
+
}`)}async getParam(t){const s=`param://application?params=${t}`;return g.get().callGraphQL({values:{name:s},query:this.templateByQuery.get("fetchParam")})}async asString(t){const s=await this.getParam(t);return this.getValue(s)}async asInteger(t){const s=await this.getParam(t);return parseInt(this.getValue(s))}async asFloat(t){const s=await this.getParam(t);return parseFloat(this.getValue(s))}async asBoolean(t){const s=await this.getParam(t);return"S"===this.getValue(s)}async asDate(t){const s=await this.getParam(t);return n.strToDate(this.getValue(s))}async getBatchParams(t){const s=await this.getParam(t.join(",")),e={};return s.forEach((t=>e[t.name]=t.resource)),e}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),r.isEmpty(t.resource))return"";try{const s=a.stringToObject(t.resource),[e]=Object.keys(s);return s[e]}catch(t){console.warn("Erro ao converter string JSON.")}}}class O{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",P.gql`query($filters: [InputFilter!] $name: String!) {
|
7
7
|
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
8
8
|
name
|
9
9
|
value
|
10
10
|
}
|
11
|
-
}`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,n)=>{v.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}function j(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(j=function(){return t})()}const U=$;function $(t,s){const e=j();return($=function(t){return e[t-=392]})(t,s)}!function(){const t=$,s=j();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const M=U(396);var R;class F{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}static setScreenToUseV3Layout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseV3Layout()}static setScreenToUseOldLayout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseOldLayout()}static applicationClick(){var t,s;(null===(t=window.workspace)||void 0===t?void 0:t.applicationClick)&&(null===(s=window.workspace)||void 0===s||s.applicationClick())}}F.resourceID=null===(R=window.workspace)||void 0===R?void 0:R.resourceID;class z{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof o||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof o||t instanceof c?this._app.alert(t.title,t.message):t instanceof h?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${a.objectToString(t)}"`;this._app.error(s,e)}}))}}const q=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this.NEW_VERSION_POPUP_LOCKER="NEW_VERSION_POPUP_LOCKER",this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new x,this._pendingActions=new Map,this._isLoadedByPk=!1,this.messagesBuilder=void 0,this.configName=void 0,this.loadByPK=void 0}async processPendingActions(t){const s=this._pendingActions.get(t);s&&s.length&&(s.forEach((t=>t())),this._pendingActions.set(t,[]))}get parameters(){return this._parameters||(this._parameters=new L),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((s,e)=>{this.authFetcher.getData(t).then((t=>{s(t)})).catch((t=>{e(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new B(t,s)),e||this.authFetcher.getData(this.applicationResourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,s)=>{this.getAuth().then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async addPendingAction(t,s){var e;const i=null!==(e=this._pendingActions.get(t))&&void 0!==e?e:[];this._pendingActions.set(t,[...i,s])}async callServiceBroker(t,s,e){return v.get().callServiceBroker(t,s,e)}async initOnboarding(t){this.hasToShowNewVersionPopup()?await this.addPendingAction(this.NEW_VERSION_POPUP_LOCKER,(()=>this.doInitOnboarding(t))):this.doInitOnboarding(t)}doInitOnboarding(t){u.getInstance().init(t,window.envContext)}async hasAccess(t,s){return new Promise(((e,i)=>{this.getAuth(s).then((s=>{this.getAuthList(s).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>i(t)))}))}))}async getAllAccess(t){return new Promise(((s,e)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const e={};e.isSup=t.isSup,Object.entries(I).forEach((s=>{e[s[0]]=t.actions[s[1]]||!1})),s(e)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,s="full",e=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{v.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{v.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){F.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{N.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,a)=>{const o=this.getDuPromissesStack(s),c=o.length>0;if(o.push(new B(r,a)),!c){const r=this.dataUnitFetcher.getDataUnit(t,n,e,i);r.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,r);o.length>0;)o.pop().resolve(r)})).catch((t=>{for(;o.length>0;)o.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i,n){return new Promise(((r,a)=>{const o=this._duCache.get(s);o?r(o):this.createDataunit(t,s,e,i,n).then((t=>{r(t)})).catch((t=>a(t)))}))}async addClientEvent(t,s){return new Promise((e=>{v.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{v.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(v.hasClientEvent(t))}))}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||F.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return f.alert(t,s,e,i)}async error(t,s,e,i){return f.error(t,s,e,i)}async success(t,s,e,i){return f.success(t,s,e,i)}async message(t,s,e,i){return f.message(t,s,e,i)}async confirm(t,s,e,i,n){return f.confirm(t,s,e,i,n)}async info(t,s){return f.info(t,s)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async isLoadedByPk(){return Promise.resolve(this._isLoadedByPk)}async getAuthList(t){return await(new T).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=g.getQueryParams(location.search)),this._urlParams}getMessage(t,s){var e;return null===(e=this.messagesBuilder)||void 0===e?void 0:e.getMessage(t,s)}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new _),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new O),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new S),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new A),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:n}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const m={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===l.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||d.TEXT,n=e.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(s,n,{entity:r,entityDescription:h,criteria:p,searchOptions:m})}}async executePreparedSearch(t,s,e){const{entity:i,entityDescription:n,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(n),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(i,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return F.getAppLabel(this.applicationResourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}async getApplicationPath(){return new Promise((t=>{"dev"===window.applicationenv?t(""):t(`/${this.getModuleName()}/labsApps/${window.APPLICATION_NAME}/build`)}))}getModuleName(){return window.MGE_MODULE_NAME||"mgefin-bff"}executeSelectDistinct(t,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(v.get())}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}async pkChangeListener(){const t=top.window.location.hash.split("/")[2];if(this._currentPkParameter===t)return;const s=this.getResourceIdFromToken(),e=g.getPkObjectFromUrlToken(top.window.location.hash);if(null==e||s!==this.applicationResourceID)return;const i={pk:e};if(this._isLoadedByPk=!0,this.loadByPK)return this.loadByPK(i),void(this._currentPkParameter=t);this.defaultLoadByPK(i)&&(this._currentPkParameter=t)}getResourceIdFromToken(){return top.window.location.pathname.indexOf("tabContent.jsp")>-1?g.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):g.getResourceIdFromUrlToken(top.window.location.hash)}defaultLoadByPK(t){if(!(null==t?void 0:t.pk))return;const s=this.getFirstDataUnitFromDOM();if(!s)return void console.warn("Dataunit não inicializado");const e={term:"",filter:{name:"LOAD_BY_PK_FILTER",expression:this.buildFilterExpressionByPkObject(t),params:this.getFilterParamsFromPkObject(t,s)}};return s.loadData(e),!0}getFirstDataUnitFromDOM(){let t=this._element.querySelector("snk-data-unit[data-load-by-pk]");if(t||(t=this._element.querySelector("snk-data-unit")),t)return t.dataUnit}getFilterParamsFromPkObject(t,s){var e;const i=[];for(const n in t.pk)t.pk.hasOwnProperty(n)&&!Array.isArray(t.pk[n])&&i.push({name:n,dataType:(null===(e=s.getField(n))||void 0===e?void 0:e.dataType)||this.getDefaultDataTypeLoadByPK(t.pk[n]),value:t.pk[n]});return i}getDefaultDataTypeLoadByPK(t){return"number"==typeof t||t instanceof Number?d.NUMBER:"boolean"==typeof t||t instanceof Boolean?d.BOOLEAN:t instanceof Date?d.DATE:d.TEXT}buildFilterExpressionByPkObject(t){let s="";for(const e in t.pk)r.isEmpty(s)||(s+=" AND "),Array.isArray(t.pk[e])?s+=`${e} IN (${t.pk[e].toString()})`:s+=`${e} = :${e}`;return s}async showNewVersionPopup(){const t=document.createElement("ez-modal-container"),s=await this.getAppLabel();t.modalTitle=this.getMessage("snkApplication.newVersionPopup.title",{screenName:s}),t.okButtonLabel=this.getMessage("snkApplication.newVersionPopup.okButton"),t.cancelButtonLabel=this.getMessage("snkApplication.newVersionPopup.cancelButton");const e=document.createElement("p");e.innerText=this.getMessage("snkApplication.newVersionPopup.info"),e.className="ez-text",t.appendChild(e),t.addEventListener("ezModalAction",this.newVersionPopupEventListener.bind(this));const i=await f.showPopup({content:t});this._removeVersionLayoutPopup=async()=>{await i(),await this.processPendingActions(this.NEW_VERSION_POPUP_LOCKER)}}async newVersionPopupEventListener(t){"LOAD"!==t.detail&&("OK"===t.detail&&F.setScreenToUseV3Layout(),"CANCEL"===t.detail&&F.setScreenToUseOldLayout(),this._popUp.opened=!1,this._removeVersionLayoutPopup&&await this._removeVersionLayoutPopup())}async handleShowNewVersionPopup(){this.hasToShowNewVersionPopup()&&await this.showNewVersionPopup()}hasToShowNewVersionPopup(){const t=new URLSearchParams(window.location.search).get("firstLoadConv");return t&&"S"===t}componentWillLoad(){m.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new z(this),this.messagesBuilder=new E,m.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${g.getUrlBase()}/mge/upload/file`),m.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),m.setContextValue("__EZUI__GRID_LICENSE__",M),setInterval((()=>{this.pkChangeListener()}),100),w.init(),y.preload(this.applicationResourceID,this.configName),document.addEventListener("click",(()=>F.applicationClick()))}connectedCallback(){m.setContextValue("__SNK__APPLICATION__",this),v.addRequestListener(this._requestListener)}disconnectedCallback(){v.removeRequestListener(this._requestListener)}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{m.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),p.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup()}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class x{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){if(null==t)return!1;if(t.url.includes("quietMode=true"))return!0;if(null==t.requestBody)return!1;if(1==t.requestBody.length){const{name:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class B{constructor(t,s){this.resolve=t,this.reject=s}}q.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{q as snk_application}
|
11
|
+
}`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,n)=>{g.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}function j(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(j=function(){return t})()}const U=$;function $(t,s){const e=j();return($=function(t){return e[t-=392]})(t,s)}!function(){const t=$,s=j();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const R=U(396);var M;class F{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}static setScreenToUseV3Layout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseV3Layout()}static setScreenToUseOldLayout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseOldLayout()}static applicationClick(){var t,s;(null===(t=window.workspace)||void 0===t?void 0:t.applicationClick)&&(null===(s=window.workspace)||void 0===s||s.applicationClick())}}F.resourceID=null===(M=window.workspace)||void 0===M?void 0:M.resourceID;class z{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof o||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof o||t instanceof c?this._app.alert(t.title,t.message):t instanceof h?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${a.objectToString(t)}"`;this._app.error(s,e)}}))}}const q=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this.NEW_VERSION_POPUP_LOCKER="NEW_VERSION_POPUP_LOCKER",this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new x,this._pendingActions=new Map,this._isLoadedByPk=!1,this.messagesBuilder=void 0,this.configName=void 0,this.loadByPK=void 0}async processPendingActions(t){const s=this._pendingActions.get(t);s&&s.length&&(s.forEach((t=>t())),this._pendingActions.set(t,[]))}get parameters(){return this._parameters||(this._parameters=new T),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((s,e)=>{this.authFetcher.getData(t).then((t=>{s(t)})).catch((t=>{e(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new B(t,s)),e||this.authFetcher.getData(this.applicationResourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,s)=>{this.getAuth().then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async addPendingAction(t,s){var e;const i=null!==(e=this._pendingActions.get(t))&&void 0!==e?e:[];this._pendingActions.set(t,[...i,s])}async callServiceBroker(t,s,e){return g.get().callServiceBroker(t,s,e)}async initOnboarding(t){this.hasToShowNewVersionPopup()?await this.addPendingAction(this.NEW_VERSION_POPUP_LOCKER,(()=>this.doInitOnboarding(t))):this.doInitOnboarding(t)}doInitOnboarding(t){u.getInstance().init(t,window.envContext)}async hasAccess(t,s){return new Promise(((e,i)=>{this.getAuth(s).then((s=>{this.getAuthList(s).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>i(t)))}))}))}async getAllAccess(t){return new Promise(((s,e)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const e={};e.isSup=t.isSup,Object.entries(I).forEach((s=>{e[s[0]]=t.actions[s[1]]||!1})),s(e)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,s="full",e=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{g.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{g.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){F.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{D.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,a)=>{const o=this.getDuPromissesStack(s),c=o.length>0;if(o.push(new B(r,a)),!c){const r=this.dataUnitFetcher.getDataUnit(t,n,e,i);r.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,r);o.length>0;)o.pop().resolve(r)})).catch((t=>{for(;o.length>0;)o.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i,n){return new Promise(((r,a)=>{const o=this._duCache.get(s);o?r(o):this.createDataunit(t,s,e,i,n).then((t=>{r(t)})).catch((t=>a(t)))}))}async addClientEvent(t,s){return new Promise((e=>{g.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{g.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(g.hasClientEvent(t))}))}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||F.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return f.alert(t,s,e,i)}async error(t,s,e,i){return f.error(t,s,e,i)}async success(t,s,e,i){return f.success(t,s,e,i)}async message(t,s,e,i){return f.message(t,s,e,i)}async confirm(t,s,e,i,n){return f.confirm(t,s,e,i,n)}async info(t,s){return f.info(t,s)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async isLoadedByPk(){return Promise.resolve(this._isLoadedByPk)}async getAuthList(t){return await(new k).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}getMessage(t,s){var e;return null===(e=this.messagesBuilder)||void 0===e?void 0:e.getMessage(t,s)}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new _),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new O),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new S),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new A),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:n}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const m={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===l.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||d.TEXT,n=e.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(s,n,{entity:r,entityDescription:h,criteria:p,searchOptions:m})}}async executePreparedSearch(t,s,e){const{entity:i,entityDescription:n,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(n),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(i,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return F.getAppLabel(this.applicationResourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}async getApplicationPath(){return new Promise((t=>{"dev"===window.applicationenv?t(""):t(`/${this.getModuleName()}/labsApps/${window.APPLICATION_NAME}/build`)}))}getModuleName(){return window.MGE_MODULE_NAME||"mgefin-bff"}executeSelectDistinct(t,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(g.get())}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}async pkChangeListener(){const t=top.window.location.hash.split("/")[2];if(this._currentPkParameter===t)return;const s=this.getResourceIdFromToken(),e=v.getPkObjectFromUrlToken(top.window.location.hash);if(null==e||s!==this.applicationResourceID)return;const i={pk:e};if(this._isLoadedByPk=!0,this.loadByPK)return this.loadByPK(i),void(this._currentPkParameter=t);this.defaultLoadByPK(i,t)}getResourceIdFromToken(){return top.window.location.pathname.indexOf("tabContent.jsp")>-1?v.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):v.getResourceIdFromUrlToken(top.window.location.hash)}defaultLoadByPK(t,s){if(!(null==t?void 0:t.pk))return;const e=this.getFirstDataUnitFromDOM(),i=e.dataUnit;if(!i)return console.warn("Dataunit não inicializado"),void e.addEventListener("dataUnitReady",(e=>{this.loadDataWithPKFilter(t,e.detail),this._currentPkParameter=s}));this.loadDataWithPKFilter(t,i),this._currentPkParameter=s}loadDataWithPKFilter(t,s){const e={term:"",filter:{name:"LOAD_BY_PK_FILTER",expression:this.buildFilterExpressionByPkObject(t),params:this.getFilterParamsFromPkObject(t,s)}};s.loadData(e)}getFirstDataUnitFromDOM(){let t=this._element.querySelector("snk-data-unit[data-load-by-pk]");if(t||(t=this._element.querySelector("snk-data-unit")),t)return t}getFilterParamsFromPkObject(t,s){var e;const i=[];for(const n in t.pk)t.pk.hasOwnProperty(n)&&!Array.isArray(t.pk[n])&&i.push({name:n,dataType:(null===(e=s.getField(n))||void 0===e?void 0:e.dataType)||this.getDefaultDataTypeLoadByPK(t.pk[n]),value:t.pk[n]});return i}getDefaultDataTypeLoadByPK(t){return"number"==typeof t||t instanceof Number?d.NUMBER:"boolean"==typeof t||t instanceof Boolean?d.BOOLEAN:t instanceof Date?d.DATE:d.TEXT}buildFilterExpressionByPkObject(t){let s="";for(const e in t.pk)r.isEmpty(s)||(s+=" AND "),Array.isArray(t.pk[e])?s+=`${e} IN (${t.pk[e].toString()})`:s+=`${e} = :${e}`;return s}async showNewVersionPopup(){const t=document.createElement("ez-modal-container"),s=await this.getAppLabel();t.modalTitle=this.getMessage("snkApplication.newVersionPopup.title",{screenName:s}),t.okButtonLabel=this.getMessage("snkApplication.newVersionPopup.okButton"),t.cancelButtonLabel=this.getMessage("snkApplication.newVersionPopup.cancelButton");const e=document.createElement("p");e.innerText=this.getMessage("snkApplication.newVersionPopup.info"),e.className="ez-text",t.appendChild(e),t.addEventListener("ezModalAction",this.newVersionPopupEventListener.bind(this));const i=await f.showPopup({content:t});this._removeVersionLayoutPopup=async()=>{await i(),await this.processPendingActions(this.NEW_VERSION_POPUP_LOCKER)}}async newVersionPopupEventListener(t){"LOAD"!==t.detail&&("OK"===t.detail&&F.setScreenToUseV3Layout(),"CANCEL"===t.detail&&F.setScreenToUseOldLayout(),this._popUp.opened=!1,this._removeVersionLayoutPopup&&await this._removeVersionLayoutPopup())}async handleShowNewVersionPopup(){this.hasToShowNewVersionPopup()&&await this.showNewVersionPopup()}hasToShowNewVersionPopup(){const t=new URLSearchParams(window.location.search).get("firstLoadConv");return t&&"S"===t}registerPkChangeListener(){window.hasOwnProperty("onhashchange")?window.onhashchange=this.pkChangeListener.bind(this):setInterval(this.pkChangeListener.bind(this),100)}componentWillLoad(){m.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new z(this),this.messagesBuilder=new C,m.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),m.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),m.setContextValue("__EZUI__GRID_LICENSE__",R),this.registerPkChangeListener(),w.init(),y.preload(this.applicationResourceID,this.configName),document.addEventListener("click",(()=>F.applicationClick()))}connectedCallback(){m.setContextValue("__SNK__APPLICATION__",this),g.addRequestListener(this._requestListener)}disconnectedCallback(){g.removeRequestListener(this._requestListener)}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{m.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),p.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup()}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class x{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){if(null==t)return!1;if(t.url.includes("quietMode=true"))return!0;if(null==t.requestBody)return!1;if(1==t.requestBody.length){const{name:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class B{constructor(t,s){this.resolve=t,this.reject=s}}q.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{q as snk_application}
|
@@ -1 +1 @@
|
|
1
|
-
import{DataType as r,NumberUtils as t,DateUtils as e,UserInterface as i}from"@sankhyalabs/core";import{F as a}from"./p-
|
1
|
+
import{DataType as r,NumberUtils as t,DateUtils as e,UserInterface as i}from"@sankhyalabs/core";import{F as a}from"./p-584d7212.js";import{F as n}from"./p-933c0c0b.js";class l{static buildFilterExpression(r){var t;if(null==r)return;let e=null!==(t=this.buildVariableParameterValue(r))&&void 0!==t?t:void 0,i=r.expression||"",a="'";switch(r.paramVariable&&(a=""),r.operand){case"IN":i+=` ${n[r.operand]} (${e})`;break;case"NULL":case"NOT_NULL":i+=` IS ${n[r.operand]}`;break;case"LIKE":i+=` LIKE '%${e}%'`;break;case"START_WITH":i+=` LIKE '${e}%'`;break;case"FINISHED_WITH":i+=` LIKE '%${e}'`;break;default:r.operand&&(i+=` ${n[r.operand]}`),["string","number"].includes(typeof e)&&(e=isNaN(e)?`${a}${e}${a}`:e,i+=` ${e}`)}return i}static buildVariableParameterValue(e){var a;if(null!=e){if(e.paramVariable)return this.proccessVarialbeParameter(e);if(e.operand!==n.NULL&&"NOT_NULL"!==e.operand){let n=e.value;const l=e.type;return i.SEARCH!==e.userInterface&&e.userInterface!==i.OPTIONSELECTOR&&r.OBJECT!=l||(n=null!==(a=null==n?void 0:n.value)&&void 0!==a?a:n),r.NUMBER==l&&null!=n?(n=t.stringToNumber(n),this.checkIsValidNumber(n)):r.DATE==l?n=this.convertDataValue(n):r.BOOLEAN==l&&(n=n?"S":"N"),n}return e.operand}}static checkIsValidNumber(r){if(isNaN(r))throw new Error("O valor informado não é um número válido.")}static proccessVarialbeParameter(r){if(null!=r.systemConfig){const t=r.systemConfig;return`?:{entidade=${t.entity||""};campo=${t.fieldName||""}}`}if(null!=r.userConfig){const t=r.userConfig;return`?:{desc=${t.description||""};tipo=${t.type||""}}`}return`?:{entidade=${r.entityName||""};campo=${r.fieldName||""}}`}static convertDataValue(r){return"string"==typeof r&&(r=new Date(r)),e.formatDate(r)}static buildGroupExpression(r){var t,e;if(!(null===(t=null==r?void 0:r.items)||void 0===t?void 0:t.length))return"";const i=r.items.map((r=>this.buildFilterExpression(r))).join(` ${r.operand} `);if((null===(e=null==r?void 0:r.childrenGroups)||void 0===e?void 0:e.length)>0){const t=r.childrenGroups.map((r=>this.buildGroupExpression(r))).join(` ${r.operand} `);return`(${i} ${r.operand} (${t}))`}return`(${i})`}static validateFields(r){const t=this.buildPlainExpressionItems(r);for(const r of t)if(!this.validateExpressionItem(r))return!1;return!0}static buildPlainExpressionItems(r){const{items:t=[],childrenGroups:e=[]}=r||{},i=r=>r.reduce(((r,t)=>{var e;return t.items&&(r=r.concat(t.items)),(null===(e=t.childrenGroups)||void 0===e?void 0:e.length)&&(r=r.concat(i(t.childrenGroups))),r}),[]);return t.concat(i(e))}static validateExpressionItem(r){return Object.entries({fieldName:r=>!!r,value:(r,t)=>!!t||null!=r,operand:r=>!!r}).every((t=>{const[e,i]=t,a=r.paramVariable||"SWITCH"===r.userInterface||["NULL","NOT_NULL"].includes(r.operand);return i(r[e],a)}))}static getNormalizedValue(t,e){return t.reduce(((t,e,i)=>(e.dataType!==r.BOOLEAN||null!=t&&null!=t[i]||((t=t&&!Array.isArray(t)?[t]:t||[])[i]=!1),t)),e)}static validateVariableValues(t,e){if(!t)return!0;let i=e||t.value,n=!0;if(t.type===a.PERSONALIZED){const e=(t.groupedItems||[]).filter((r=>r.visible)).filter((r=>{var t,e,i;return!!(null===(i=null===(e=null===(t=r.props)||void 0===t?void 0:t.personalizedFilter)||void 0===e?void 0:e.parameters)||void 0===i?void 0:i.length)})),a=e.flatMap((r=>{var t;return null===(t=r.props.personalizedFilter)||void 0===t?void 0:t.parameters})),l=e.flatMap((t=>t.props.personalizedFilter.parameters.flatMap(((e,i)=>t.value?(void 0!==t.value[i]||e.dataType!==r.BOOLEAN)&&t.value[i]:null))));i=this.getNormalizedValue(a,i),n=a.length===l.length&&l.every((r=>null!=r))}return n}static buildVariableParameters(r){const t=this.buildPlainExpressionItems(r),e=[];for(const r of t)r.paramVariable&&e.push({entityName:r.entityName,fieldName:r.fieldName});return e}}export{l as P}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,h as i,H as e,g as r}from"./p-d2d301a6.js";import{DataType as s,StringUtils as a,ObjectUtils as n,ElementIDUtils as l,ErrorException as o,ApplicationContext as d}from"@sankhyalabs/core";import{EzScrollDirection as c}from"@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection";import{C as h}from"./p-29176742.js";import{toString as f}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{F as u}from"./p-584d7212.js";import{F as p}from"./p-933c0c0b.js";import{ApplicationUtils as m}from"@sankhyalabs/ezui/dist/collection/utils";import{P as b}from"./p-5c1aacc7.js";import"./p-4651b43f.js";import"./p-c9399ce6.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";class v{constructor({filterConfig:t,configName:i,onComplete:e,getMessage:r,onAddPersonalizedFilter:s,onEditPersonalizedFilter:a}){this._filterConfig=t,this._configName=i,this._onComplete=e,this._getMessage=r,this._addPersonalizedFilterFn=s,this._editPersonalizedFilterFn=a}applyFilters(t){this._onComplete(t),this._closeModal()}buildFilterModal(){const t=document.createElement("snk-filter-modal");return t.className="ez-size-height--full",t.filters=this._filterConfig,t.configName=this._configName,t.getMessage=this._getMessage.bind(this),t.applyFilters=this.applyFilters.bind(this),t.closeModal=()=>this._closeModal(),t.addPersonalizedFilter=()=>this._addPersonalizedFilterFn(),t.editPersonalizedFilter=t=>this._editPersonalizedFilterFn(t),t}async showModal(){const t={content:this.buildFilterModal(),position:"left",heightMode:"full",closeOutsideClick:!1,useScrimLight:!0};this._closeModal=await m.showModal(t)}async closeModal(){this._closeModal()}}const k=class{constructor(i){t(this,i),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingVariables=!1,this._customfiltersToBeUpdated=[],this._calculateSortIndex=t=>{let i=t.hardFixed?1e6:0;return t.hardFixed||(i+=t.fixed?1e5:0,i+=null==t.value?0:1e4,i+=this._updateSequence.lastIndexOf(t.id)+1),i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t),this.dataUnit=void 0,this.configName=void 0,this.resourceID=void 0,this.filterConfig=void 0,this.messagesBuilder=void 0,this.allowDefault=void 0,this.scrollerLocked=!1,this.showPersonalizedFilter=!1,this.personalizedFilterId=void 0}observeFilterConfig(t,i){if(null!=i&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(i?i.map((t=>[t.id,t])):void 0);0===e.size&&t.length>0?(this._loadingPending=!0,this._configUpdated=!1):t.forEach((t=>{const i=e.get(t.id);if(null!=i){if(this._configUpdated=this._configUpdated||n.objectToString(i)!=n.objectToString(t),this._loadingPending=this._loadingPending||n.objectToString(i.value)!==n.objectToString(t.value),!this._loadingPending){const e=n.objectToString(i.groupedItems)!=n.objectToString(t.groupedItems);this._configUpdated=this._configUpdated||e,this._loadingPending=this._loadingPending||e}}else this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value}))}this.processAfterUpdateConfig()}async reload(){this.loadConfigFromStorage()}componentDidLoad(){this._element&&l.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}processPendingFilter(){if(this._pendingVariables){const t=this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");t&&t.showUp(!0).then((()=>{this.processAfterUpdateConfig()}))}else this.processAfterUpdateConfig()}getPersonalizedFilterItem(){return this.filterConfig.find((t=>t.type===u.PERSONALIZED))}async processAfterUpdateConfig(){if(this._loadingPending){if(await this._application.isLoadedByPk()&&!this._configUpdated)return;const t=this.getPersonalizedFilterItem();if(this._pendingVariables=!b.validateVariableValues(t),this._pendingVariables)return;this._loadingPending=!1,this.dataUnit.loadData(void 0,void 0,!0)}this._configUpdated&&(this._configUpdated=!1,h.saveFilterBarConfig(this.filterConfig,this.configName,this.resourceID))}getMessage(t,i,e){var r;return(null===(r=this.messagesBuilder)||void 0===r?void 0:r.getMessage(t,i))||e}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case u.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case u.BINARY_SELECT:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.options.find((t=>t.name===e)).expression,params:[]}}(t);case u.MULTI_SELECT:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:e}]}}(t);case u.MULTI_LIST:return function(t){const{id:i,value:e,props:r}=t,a=(null!==(o=null!==(l=null==(n=e)?void 0:n.elements)&&void 0!==l?l:null==n?void 0:n.members)&&void 0!==o?o:n).filter((t=>null==t?void 0:t.check)).map((({id:t})=>Number.isNaN(+t)?String(t):Number(t)));var n,l,o;if(a.length>0)return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:JSON.stringify(a)}]}}(t);case u.PERIOD:return function(t){const{id:i,value:e,props:r}=t;let{end:a,start:n}=e;"string"==typeof a&&(a=new Date(a)),"string"==typeof n&&(n=new Date(n));const l=[];let o;return a&&n?(o=r.expression.fullfill,l.push({name:`${i}.START`,dataType:s.DATE,value:f(s.DATE,n)},{name:`${i}.END`,dataType:s.DATE,value:f(s.DATE,a)})):n?(o=r.expression.onlystart,l.push({name:i,dataType:s.DATE,value:f(s.DATE,n)})):(o=r.expression.onlyend,l.push({name:i,dataType:s.DATE,value:f(s.DATE,a)})),{name:i,expression:o,params:l}}(t);case u.SEARCH:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:f(s.TEXT,e.value)}]}}(t);case u.TEXT:return function(t){let{id:i,value:e,props:r}=t;const n=r.expression;var l,o;return a.isEmpty(r.likeAs)||(l=e,e="CONTANIS"===(o=r.likeAs)?`%${l}%`:"STARTS_WITH"===o?`${l}%`:"ENDS_WITH"===o?`%${l}`:l),{name:i,expression:n,params:[{name:i,dataType:s.TEXT,value:f(s.TEXT,e)}]}}(t);case u.NUMBER:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.NUMBER,value:f(s.NUMBER,e)}]}}(t);case u.PERSONALIZED:return function(t){const{id:i,groupedItems:e=[]}=t,r=e.filter((t=>!!t.visible)).map((t=>{var i;const e=t.props.expression,r=((null===(i=t.props.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((i,e)=>{const r=Array.from(t.value||0),a=i.dataType;let n=e>=0&&e<r.length?r[e]:null;return null!=n&&"object"==typeof n&&"value"in n&&(n=n.value),null==n&&a===s.BOOLEAN&&(n=!1),{name:i.name,dataType:a,value:"string"==typeof n?n:f(a,n)}}));return{expression:e,name:t.id,params:r}}));return{name:i,expression:r.map((t=>`(${t.expression})`)).join(` ${p.AND} `),params:r.flatMap((t=>t.params))}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.type===u.DEFAULT_FILTER||this.filterActiveFilter(t)&&(t.groupedItems||null!=t.value)}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData(void 0,void 0,!0)}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}filterActiveFilter(t){return t.visible||t.removalBlocked}getFilterItems(){const t=[],e=[];this.filterConfig.filter(this.filterActiveFilter).forEach(((r,s)=>{const a=`filter-${(r=n.copy(r)).id}`,l=i("snk-filter-item",{onVisibleChanged:t=>this.scrollerLocked=t.detail,onFilterChange:t=>this.updateFilter(t.detail),onFocusin:()=>this.itemFocused(a),id:a,config:r,class:s>0?"ez-padding-left--medium":"",getMessage:(t,i)=>this.getMessage(t,i),key:r.id});return r.fixed||r.hardFixed?t.push(l):e.push(l),l}));const r=[];return r.push(...t),t.length>0&&e.length>0&&r.push(i("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),r.push(...e),r}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){this.filterConfig=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(n.objectToString(i)!=n.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)))}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromStorage(){return new Promise((t=>{h.loadFilterBarConfig(this.configName,this.resourceID,{contextURI:this.dataUnit.name}).then((i=>{t(),this.filterConfig=i.map((t=>this.normalizeItem(t)))})).catch((t=>{throw new o(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?this.registryFilterProvider():i.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}async showFilterModal(){const t={filterConfig:n.copy(this.filterConfig),configName:this.configName,onComplete:t=>{this.filterConfig=t.map(this.normalizeItem).sort(((t,i)=>this._filtersComparator(t,i)))},getMessage:(t,i)=>this.getMessage(t,i),onAddPersonalizedFilter:()=>this.addPersonalizedFilter(),onEditPersonalizedFilter:t=>this.editPersonalizedFilter(t)};this._filterModalFactory=new v(t),await this._filterModalFactory.showModal()}addPersonalizedFilter(){this._filterModalFactory.closeModal(),this.personalizedFilterId=void 0,this.showPersonalizedFilter=!0,window.requestAnimationFrame((()=>{this._elPersonalizedFilter.createPersonalizedFilter()}))}editPersonalizedFilter(t){this._filterModalFactory.closeModal(),this.showPersonalizedFilter=!0,this.personalizedFilterId=t}handleHidePersonalizedFilter(t){t?this.loadConfigFromStorage().then((()=>{this.hidePersonalizedFilter()})):this.hidePersonalizedFilter()}hidePersonalizedFilter(){this.personalizedFilterId=void 0,this.showPersonalizedFilter=!1}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromStorage()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return this.showPersonalizedFilter?i("snk-personalized-filter",{class:"filter-bar__personalized-filter",filterId:this.personalizedFilterId,ref:t=>this._elPersonalizedFilter=t,onEzCancel:()=>this.handleHidePersonalizedFilter(!1),onEzAfterSave:()=>this.handleHidePersonalizedFilter(!0),entityUri:this.dataUnit.name,configName:this.configName,resourceID:this.resourceID}):i(e,null,i("ez-scroller",{class:"snk-filter-bar__scroller",direction:c.HORIZONTAL,activeShadow:!0,locked:this.scrollerLocked},i("section",{class:"snk-filter-bar__filter-item-container"},this.getFilterItems())),i("ez-button",{class:"ez-padding-left--medium",size:"small",label:this.getMessage("snkFilterBar.filters",void 0,"Filtros"),onClick:this.showFilterModal.bind(this)},i("ez-icon",{slot:"leftIcon",iconName:"plus",class:"ez-padding-right--small"})))}get _element(){return r(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};k.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}';export{k as snk_filter_bar}
|
1
|
+
import{r as t,h as i,H as e,g as r}from"./p-d2d301a6.js";import{DataType as s,StringUtils as a,ObjectUtils as n,ElementIDUtils as l,ErrorException as o,ApplicationContext as d}from"@sankhyalabs/core";import{EzScrollDirection as c}from"@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection";import{C as h}from"./p-29176742.js";import{toString as f}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{F as u}from"./p-584d7212.js";import{F as p}from"./p-933c0c0b.js";import{ApplicationUtils as m}from"@sankhyalabs/ezui/dist/collection/utils";import{P as b}from"./p-43b2aad5.js";import"./p-4651b43f.js";import"./p-c9399ce6.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";class v{constructor({filterConfig:t,configName:i,onComplete:e,getMessage:r,onAddPersonalizedFilter:s,onEditPersonalizedFilter:a}){this._filterConfig=t,this._configName=i,this._onComplete=e,this._getMessage=r,this._addPersonalizedFilterFn=s,this._editPersonalizedFilterFn=a}applyFilters(t){this._onComplete(t),this._closeModal()}buildFilterModal(){const t=document.createElement("snk-filter-modal");return t.className="ez-size-height--full",t.filters=this._filterConfig,t.configName=this._configName,t.getMessage=this._getMessage.bind(this),t.applyFilters=this.applyFilters.bind(this),t.closeModal=()=>this._closeModal(),t.addPersonalizedFilter=()=>this._addPersonalizedFilterFn(),t.editPersonalizedFilter=t=>this._editPersonalizedFilterFn(t),t}async showModal(){const t={content:this.buildFilterModal(),position:"left",heightMode:"full",closeOutsideClick:!1,useScrimLight:!0};this._closeModal=await m.showModal(t)}async closeModal(){this._closeModal()}}const k=class{constructor(i){t(this,i),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingVariables=!1,this._customfiltersToBeUpdated=[],this._calculateSortIndex=t=>{let i=t.hardFixed?1e6:0;return t.hardFixed||(i+=t.fixed?1e5:0,i+=null==t.value?0:1e4,i+=this._updateSequence.lastIndexOf(t.id)+1),i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t),this.dataUnit=void 0,this.configName=void 0,this.resourceID=void 0,this.filterConfig=void 0,this.messagesBuilder=void 0,this.allowDefault=void 0,this.scrollerLocked=!1,this.showPersonalizedFilter=!1,this.personalizedFilterId=void 0}observeFilterConfig(t,i){if(null!=i&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(i?i.map((t=>[t.id,t])):void 0);0===e.size&&t.length>0?(this._loadingPending=!0,this._configUpdated=!1):t.forEach((t=>{const i=e.get(t.id);if(null!=i){if(this._configUpdated=this._configUpdated||n.objectToString(i)!=n.objectToString(t),this._loadingPending=this._loadingPending||n.objectToString(i.value)!==n.objectToString(t.value),!this._loadingPending){const e=n.objectToString(i.groupedItems)!=n.objectToString(t.groupedItems);this._configUpdated=this._configUpdated||e,this._loadingPending=this._loadingPending||e}}else this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value}))}this.processAfterUpdateConfig()}async reload(){this.loadConfigFromStorage()}componentDidLoad(){this._element&&l.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}processPendingFilter(){if(this._pendingVariables){const t=this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");t&&t.showUp(!0).then((()=>{this.processAfterUpdateConfig()}))}else this.processAfterUpdateConfig()}getPersonalizedFilterItem(){return this.filterConfig.find((t=>t.type===u.PERSONALIZED))}async processAfterUpdateConfig(){if(this._loadingPending){if(await this._application.isLoadedByPk()&&!this._configUpdated)return;const t=this.getPersonalizedFilterItem();if(this._pendingVariables=!b.validateVariableValues(t),this._pendingVariables)return;this._loadingPending=!1,this.dataUnit.loadData(void 0,void 0,!0)}this._configUpdated&&(this._configUpdated=!1,h.saveFilterBarConfig(this.filterConfig,this.configName,this.resourceID))}getMessage(t,i,e){var r;return(null===(r=this.messagesBuilder)||void 0===r?void 0:r.getMessage(t,i))||e}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case u.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case u.BINARY_SELECT:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.options.find((t=>t.name===e)).expression,params:[]}}(t);case u.MULTI_SELECT:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:e}]}}(t);case u.MULTI_LIST:return function(t){const{id:i,value:e,props:r}=t,a=(null!==(o=null!==(l=null==(n=e)?void 0:n.elements)&&void 0!==l?l:null==n?void 0:n.members)&&void 0!==o?o:n).filter((t=>null==t?void 0:t.check)).map((({id:t})=>Number.isNaN(+t)?String(t):Number(t)));var n,l,o;if(a.length>0)return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:JSON.stringify(a)}]}}(t);case u.PERIOD:return function(t){const{id:i,value:e,props:r}=t;let{end:a,start:n}=e;"string"==typeof a&&(a=new Date(a)),"string"==typeof n&&(n=new Date(n));const l=[];let o;return a&&n?(o=r.expression.fullfill,l.push({name:`${i}.START`,dataType:s.DATE,value:f(s.DATE,n)},{name:`${i}.END`,dataType:s.DATE,value:f(s.DATE,a)})):n?(o=r.expression.onlystart,l.push({name:i,dataType:s.DATE,value:f(s.DATE,n)})):(o=r.expression.onlyend,l.push({name:i,dataType:s.DATE,value:f(s.DATE,a)})),{name:i,expression:o,params:l}}(t);case u.SEARCH:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.TEXT,value:f(s.TEXT,e.value)}]}}(t);case u.TEXT:return function(t){let{id:i,value:e,props:r}=t;const n=r.expression;var l,o;return a.isEmpty(r.likeAs)||(l=e,e="CONTANIS"===(o=r.likeAs)?`%${l}%`:"STARTS_WITH"===o?`${l}%`:"ENDS_WITH"===o?`%${l}`:l),{name:i,expression:n,params:[{name:i,dataType:s.TEXT,value:f(s.TEXT,e)}]}}(t);case u.NUMBER:return function(t){const{id:i,value:e,props:r}=t;return{name:i,expression:r.expression,params:[{name:i,dataType:s.NUMBER,value:f(s.NUMBER,e)}]}}(t);case u.PERSONALIZED:return function(t){const{id:i,groupedItems:e=[]}=t,r=e.filter((t=>!!t.visible)).map((t=>{var i;const e=t.props.expression,r=((null===(i=t.props.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((i,e)=>{const r=Array.from(t.value||0),a=i.dataType;let n=e>=0&&e<r.length?r[e]:null;return null!=n&&"object"==typeof n&&"value"in n&&(n=n.value),null==n&&a===s.BOOLEAN&&(n=!1),{name:i.name,dataType:a,value:"string"==typeof n?n:f(a,n)}}));return{expression:e,name:t.id,params:r}}));return{name:i,expression:r.map((t=>`(${t.expression})`)).join(` ${p.AND} `),params:r.flatMap((t=>t.params))}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.type===u.DEFAULT_FILTER||this.filterActiveFilter(t)&&(t.groupedItems||null!=t.value)}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData(void 0,void 0,!0)}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}filterActiveFilter(t){return t.visible||t.removalBlocked}getFilterItems(){const t=[],e=[];this.filterConfig.filter(this.filterActiveFilter).forEach(((r,s)=>{const a=`filter-${(r=n.copy(r)).id}`,l=i("snk-filter-item",{onVisibleChanged:t=>this.scrollerLocked=t.detail,onFilterChange:t=>this.updateFilter(t.detail),onFocusin:()=>this.itemFocused(a),id:a,config:r,class:s>0?"ez-padding-left--medium":"",getMessage:(t,i)=>this.getMessage(t,i),key:r.id});return r.fixed||r.hardFixed?t.push(l):e.push(l),l}));const r=[];return r.push(...t),t.length>0&&e.length>0&&r.push(i("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),r.push(...e),r}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){this.filterConfig=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(n.objectToString(i)!=n.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)))}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromStorage(){return new Promise((t=>{h.loadFilterBarConfig(this.configName,this.resourceID,{contextURI:this.dataUnit.name}).then((i=>{t(),this.filterConfig=i.map((t=>this.normalizeItem(t)))})).catch((t=>{throw new o(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?this.registryFilterProvider():i.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}async showFilterModal(){const t={filterConfig:n.copy(this.filterConfig),configName:this.configName,onComplete:t=>{this.filterConfig=t.map(this.normalizeItem).sort(((t,i)=>this._filtersComparator(t,i)))},getMessage:(t,i)=>this.getMessage(t,i),onAddPersonalizedFilter:()=>this.addPersonalizedFilter(),onEditPersonalizedFilter:t=>this.editPersonalizedFilter(t)};this._filterModalFactory=new v(t),await this._filterModalFactory.showModal()}addPersonalizedFilter(){this._filterModalFactory.closeModal(),this.personalizedFilterId=void 0,this.showPersonalizedFilter=!0,window.requestAnimationFrame((()=>{this._elPersonalizedFilter.createPersonalizedFilter()}))}editPersonalizedFilter(t){this._filterModalFactory.closeModal(),this.showPersonalizedFilter=!0,this.personalizedFilterId=t}handleHidePersonalizedFilter(t){t?this.loadConfigFromStorage().then((()=>{this.hidePersonalizedFilter()})):this.hidePersonalizedFilter()}hidePersonalizedFilter(){this.personalizedFilterId=void 0,this.showPersonalizedFilter=!1}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromStorage()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return this.showPersonalizedFilter?i("snk-personalized-filter",{class:"filter-bar__personalized-filter",filterId:this.personalizedFilterId,ref:t=>this._elPersonalizedFilter=t,onEzCancel:()=>this.handleHidePersonalizedFilter(!1),onEzAfterSave:()=>this.handleHidePersonalizedFilter(!0),entityUri:this.dataUnit.name,configName:this.configName,resourceID:this.resourceID}):i(e,null,i("ez-scroller",{class:"snk-filter-bar__scroller",direction:c.HORIZONTAL,activeShadow:!0,locked:this.scrollerLocked},i("section",{class:"snk-filter-bar__filter-item-container"},this.getFilterItems())),i("ez-button",{class:"ez-padding-left--medium",size:"small",label:this.getMessage("snkFilterBar.filters",void 0,"Filtros"),onClick:this.showFilterModal.bind(this)},i("ez-icon",{slot:"leftIcon",iconName:"plus",class:"ez-padding-right--small"})))}get _element(){return r(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};k.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}';export{k as snk_filter_bar}
|
@@ -1 +1 @@
|
|
1
|
-
import{h as i,r as e,c as t,g as s}from"./p-d2d301a6.js";import{S as l}from"./p-f4184ce7.js";import{UserInterface as a,JSUtils as n,ElementIDUtils as r,ApplicationContext as o,StringUtils as h,DataType as c}from"@sankhyalabs/core";import{ModalAction as d}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{b as u,c as f,d as m}from"./p-933c0c0b.js";import{P as p}from"./p-5c1aacc7.js";import"./p-584d7212.js";const v={[a.SHORTTEXT]:"text",[a.LONGTEXT]:"text",[a.INTEGERNUMBER]:"number",[a.DECIMALNUMBER]:"number",[a.DATE]:"calendar",[a.DATETIME]:"calendar",[a.SWITCH]:"boolean",[a.CHECKBOX]:"check-circle-inverted",[a.OPTIONSELECTOR]:"list",[a.SEARCH]:"search",[a.HTML]:"tag_code",[a.IMAGE]:"png",[a.FILE]:"edit-file",[a.TIME]:"timer-outline",[a.ELAPSEDTIME]:"timer",[a.MASKEDTEXT]:"text",[a.PASSWORD]:"email"},b=({userInterface:e,description:t})=>i("ez-icon",{iconName:v[e],class:"ez-padding-left--small",title:t}),g="__SNK__APPLICATION__",z=/\w+:\/\/(\w+)/,k=class{constructor(i){e(this,i),this.ezSelectFilterItem=t(this,"ezSelectFilterItem",7),this._currentMetadata=null,this._filterText="",this._isLoading=!1,this.searchable=!0,this.fieldsDataSource=void 0,this.breadcrumbItems=[],this.linkItems=[],this.fieldItems=[],this.searchEmpty=!1,this.groupEmpty=!1}async show(i,e){var t;return i?null===(t=this._ezPopover)||void 0===t||t.showUnder(i,e):this._ezPopover.show(),this.loadData()}async applyFilter(i){if(this.searchable)throw new Error("This method is not available when searchable is true");this.handleFilterChange(i)}async loadData(){var i,e;this._isLoading=!0;let t=await this.fieldsDataSource.fetchData(this._currentLink);this._currentLink=t.currentLink;const{fields:s,links:l}=t||{};if(!Array.isArray(s)||!Array.isArray(l))throw new Error("Invalid metadata");this._currentMetadata=t,this.mapDataSourceToLinkItems(),this.mapDataSourceToFieldItems(),this._isLoading=!1,null===(i=this._ezFieldList)||void 0===i||i.scrollToTop(),null===(e=this._ezLinkList)||void 0===e||e.scrollToTop()}mapDataSourceToLinkItems(){var i;const{links:e}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.linkLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.map((i=>Object.assign({label:i.description},i)));this.groupEmpty=Boolean(0===s.length),this.linkItems=[{group:t,items:s}],0===this.breadcrumbItems.length&&(this.breadcrumbItems=[Object.assign({id:n.generateUUID(),label:this._currentLink.description},this._currentLink)])}mapDataSourceToFieldItems(){var i;const e=this._currentMetadata.fields,t=this.getMessage("snkFilterFieldSearch.fieldLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.filter((i=>{if(!this._currentLink)return!0;const e=i.description.toLowerCase().includes(this._filterText.toLowerCase()),t=i.name.toLowerCase().includes(this._filterText.toLowerCase());return e||t})).map((i=>Object.assign({label:i.description},i)));this.searchEmpty=Boolean(this._filterText&&0===s.length),this.fieldItems=[{group:t,items:s}]}handleFilterChange(i){this._isLoading||(this._filterText=i,this.mapDataSourceToFieldItems())}handleSelectLink({detail:i}){if(this._isLoading)return;const e=this.breadcrumbItems.findIndex((e=>e.id===i.id));this.breadcrumbItems=e>-1?this.breadcrumbItems.slice(0,e+1):[...this.breadcrumbItems,Object.assign({id:n.generateUUID(),label:i.description},i)];const t=Object.assign(Object.assign({},i),{type:l.LINK});this._currentLink=t,this.ezSelectFilterItem.emit(t),this.loadData()}getEntityFromBreadCrumbItem(i){const e=z.exec(i.uri);if(e)return e[1]}handleSelectField({detail:i}){var e;const t=this.breadcrumbItems.map((i=>i.label)).join(">>"),s=Object.assign(Object.assign({},i),{type:l.FIELD,entityPath:this.breadcrumbItems.map((i=>this.getEntityFromBreadCrumbItem(i))).filter((i=>null!=i)),path:`${t} >> ${i.description}`});this.ezSelectFilterItem.emit(s),null===(e=this._ezPopover)||void 0===e||e.hide()}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getMessage(i,e){var t,s,l;return this._application||(this._application=o.getContextValue(g)),null===(l=null===(s=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)||void 0===s?void 0:s.getMessage)||void 0===l?void 0:l.call(s,i,e)}componentWillLoad(){this._application=o.getContextValue(g)}componentDidLoad(){r.addIDInfoIfNotExists(this._ezPopover,"popover")}disconnectedCallback(){var i;null===(i=this._ezPopover)||void 0===i||i.hide()}render(){var e;const t=this.getMessage("snkFilterFieldSearch.searchLabel");return i("ez-popover",Object.assign({ref:i=>this._ezPopover=i,role:"dialog",overlayType:"none","aria-hidden":!(null===(e=this._ezPopover)||void 0===e?void 0:e.opened)},this.getElementID("EzPopover")),i("div",{class:"snk-filter-field-search__container"},i("header",{class:"snk-filter-field-search__header"},this.searchable&&!!t&&i("ez-filter-input",Object.assign({class:"snk-filter-field-search__input",label:t,asyncSearch:!0,canShowError:!1,onEzSearching:i=>this.handleFilterChange.bind(this)(i.detail),"aria-label":t,"aria-required":"false","aria-invalid":"false"},this.getElementID("EzFilterInput"))),this.breadcrumbItems.length>0&&i("ez-breadcrumb",Object.assign({items:this.breadcrumbItems,onSelectedItem:this.handleSelectLink.bind(this),role:"navigation","aria-current":"step"},this.getElementID("EzBreadcrumb"))),i("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})),i("section",{class:`snk-filter-field-search__section ${this.groupEmpty&&this.searchEmpty&&" ez-margin--auto"}`},this.groupEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.groupEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezLinkList=i,class:"snk-filter-field-search__list",id:"filterLinkList",useGroups:!0,dataSource:this.linkItems,onEzSelectItem:this.handleSelectLink.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:e=>i("ez-badge",{label:e.fieldCount}),"aria-describedby":"filterLinkLabel"},this.getElementID("EzListLinks"))),this.searchEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.searchEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezFieldList=i,class:"snk-filter-field-search__list",id:"filterFieldList",useGroups:!0,dataSource:this.fieldItems,onEzSelectItem:this.handleSelectField.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:b,"aria-describedby":"filterFieldLabel"},this.getElementID("EzListFields"))))))}};k.style=".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";const y=class{constructor(i){e(this,i),this._opened=!1,this._configType=u.SYSTEM_CONFIG,this._expressionItem=void 0,this._informedInstance=!1,this._canSave=!1,this.messagesBuilder=void 0}open(i){return this._opened=!0,this._expressionItem=i,this.loadValues(),new Promise((i=>{this._promiseResolver=i}))}close(){return this._opened=!1,new Promise((i=>{this._promiseResolver=i}))}getMessage(i,e){var t;return null===(t=this.messagesBuilder)||void 0===t?void 0:t.getMessage(i,e)}getConfigValue(i,e,t=""){var s,l,a;return(null===(l=null===(s=this._expressionItem)||void 0===s?void 0:s[i])||void 0===l?void 0:l[e])||(null===(a=this._expressionItem)||void 0===a?void 0:a[t||e])}loadValues(){var i;const e=this.getConfigValue("systemConfig","entity","entityName"),t=this.getConfigValue("systemConfig","fieldName"),s=this.getConfigValue("userConfig","description"),l=this.getConfigValue("userConfig","type");this._configType=null!=(null===(i=this._expressionItem)||void 0===i?void 0:i.userConfig)?u.USER_CONFIG:u.SYSTEM_CONFIG,h.isEmpty(e)||h.isEmpty(t)||(this._instanceElement.value={value:e,label:""},this._fieldElement.value={value:t,label:""}),h.isEmpty(s)||h.isEmpty(l)||(this._descriptionElement.value=s,this._typeElement.value=l),this.buildFilterExpression()}changeDefinitionUsed(i){if(this._configType=null!=i?i:u.SYSTEM_CONFIG,this._configType===u.SYSTEM_CONFIG){const i=this.getConfigValue("systemConfig","entity","entityName"),e=this.getConfigValue("systemConfig","fieldName");this._instanceElement.value=this._instanceElement.value||{value:i,label:""},this._fieldElement.value=this._fieldElement.value||{value:e,label:""}}else if(this._configType===u.USER_CONFIG){const i=this.getConfigValue("userConfig","description"),e=this.getConfigValue("userConfig","type");this._descriptionElement.value=this._descriptionElement.value||i,this._typeElement.value=this._typeElement.value||e}this.buildFilterExpression()}getTypeValue(){var i;const e=null===(i=this._typeElement)||void 0===i?void 0:i.value;return(null==e?void 0:e.value)||e}getExpressionValues(){var i,e,t,s,l;let a,n;return this._configType===u.SYSTEM_CONFIG?a={entity:null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value,fieldName:null===(s=null===(t=this._fieldElement)||void 0===t?void 0:t.value)||void 0===s?void 0:s.value}:this._configType===u.USER_CONFIG&&(n={description:null===(l=this._descriptionElement)||void 0===l?void 0:l.value,type:this.getTypeValue()}),Object.assign(Object.assign(Object.assign({},this._expressionItem),{systemConfig:a}),{userConfig:n})}isEnabled(i){return this._configType===i}isInformedInstance(){var i,e;return!h.isEmpty(null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value)}save(){var i;this._expressionItem=Object.assign(Object.assign({},this.getExpressionValues()),{expression:null===(i=this._expressionElement)||void 0===i?void 0:i.value}),this._promiseResolver(this._expressionItem),this._opened=!1}buildFilterExpression(){var i;this._informedInstance=this.isInformedInstance();const e=p.buildFilterExpression(this.getExpressionValues());this._expressionElement.value=e||(null===(i=this._expressionItem)||void 0===i?void 0:i.expression),this._canSave=this.getCanSave()}handleChangeInstance(){this._informedInstance=this.isInformedInstance(),null==this._fieldElement||h.isEmpty(this._fieldElement.value)||(this._fieldElement.value=null),this.buildFilterExpression()}getInstanceCriteria(){var i,e;const t=null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value;return{expression:"this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",params:[{name:"NOMEINSTANCIA",dataType:c.TEXT,value:t}]}}onSearch({mode:i,argument:e},t){if(null==this._application||!this._opened)return;const s=t===f.FIELD,l=s?this.getInstanceCriteria():void 0,a={entity:t,entityDescription:this.getMessage("snkFilterParamConfig.label"+(s?"Field":"Instance")),criteria:l,searchOptions:{descriptionFieldName:s?"DESCRCAMPO":"DESCRINSTANCIA",codeFieldName:s?"NOMECAMPO":"NOMEINSTANCIA",showInactives:!1}};return new Promise((t=>{this._application.executePreparedSearch(i,e,a).then((i=>t(i)))}))}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getCanSave(){var i;if(this._configType===u.USER_CONFIG){const e=null===(i=this._descriptionElement)||void 0===i?void 0:i.value,t=this.getTypeValue();return!h.isEmpty(e)&&!h.isEmpty(t)}return!0}componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__")}render(){return r.addIDInfoIfNotExists(this._element,"snkFilterParamConfig"),i("ez-popup",Object.assign({useHeader:!1,size:"small",heightMode:"auto",opened:this._opened},this.getElementID("popup")),i("ez-modal-container",Object.assign({onEzModalAction:i=>{i.detail===d.CLOSE&&this.close()},modalTitle:this.getMessage("snkFilterParamConfig.modalTitle")},this.getElementID("modalContainer")),i("div",{class:"ez-flex"},i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("systemConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelSystemConfig"),value:u.SYSTEM_CONFIG})),i("ez-search",Object.assign({ref:i=>this._instanceElement=i,label:this.getMessage("snkFilterParamConfig.labelInstance"),enabled:this.isEnabled(u.SYSTEM_CONFIG),suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.handleChangeInstance(),optionLoader:i=>this.onSearch(i,f.INSTANCE)},this.getElementID("configFindEntity"))),i("ez-search",Object.assign({ref:i=>this._fieldElement=i,label:this.getMessage("snkFilterParamConfig.labelField"),enabled:this.isEnabled(u.SYSTEM_CONFIG)&&this._informedInstance,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.buildFilterExpression(),optionLoader:i=>this.onSearch(i,f.FIELD)},this.getElementID("configFindField")))),i("div",{class:"ez-flex ez-padding--medium"},i("hr",{class:"ez-divider-vertical"})),i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("userConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelUserConfig"),value:u.USER_CONFIG})),i("ez-text-input",Object.assign({ref:i=>this._descriptionElement=i,label:this.getMessage("snkFilterParamConfig.labelDescription"),enabled:this.isEnabled(u.USER_CONFIG),onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamLabel"))),i("ez-combo-box",Object.assign({ref:i=>this._typeElement=i,label:this.getMessage("snkFilterParamConfig.labelType"),enabled:this.isEnabled(u.USER_CONFIG),suppressEmptyOption:!0,onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamType")),Object.keys(m).map((e=>i("option",{value:m[e]},this.getMessage(`snkFilterParamConfig.labelTypeValues.${e.toLowerCase()}`))))))),i("ez-text-area",Object.assign({ref:i=>this._expressionElement=i,class:"snk-filter-param-config__expression",label:this.getMessage("snkFilterParamConfig.labelExpression"),enabled:!1},this.getElementID("presentationExpression"))),i("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},i("ez-button",Object.assign({class:"ez-padding-right--medium",label:this.getMessage("snkFilterParamConfig.labelCancel"),onClick:()=>this.close()},this.getElementID("cancelEditParam"))),i("ez-button",Object.assign({class:"ez-button--primary",label:this.getMessage("snkFilterParamConfig.labelSave"),onClick:()=>this.save(),enabled:this._canSave},this.getElementID("saveEditParam"))))))}get _element(){return s(this)}};y.style=":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";export{k as snk_filter_field_search,y as snk_filter_param_config}
|
1
|
+
import{h as i,r as e,c as t,g as s}from"./p-d2d301a6.js";import{S as l}from"./p-f4184ce7.js";import{UserInterface as a,JSUtils as n,ElementIDUtils as r,ApplicationContext as o,StringUtils as h,DataType as d}from"@sankhyalabs/core";import{ModalAction as c}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{b as u,c as f,d as m}from"./p-933c0c0b.js";import{P as p}from"./p-43b2aad5.js";import"./p-584d7212.js";const v={[a.SHORTTEXT]:"text",[a.LONGTEXT]:"text",[a.INTEGERNUMBER]:"number",[a.DECIMALNUMBER]:"number",[a.DATE]:"calendar",[a.DATETIME]:"calendar",[a.SWITCH]:"boolean",[a.CHECKBOX]:"check-circle-inverted",[a.OPTIONSELECTOR]:"list",[a.SEARCH]:"search",[a.HTML]:"tag_code",[a.IMAGE]:"png",[a.FILE]:"edit-file",[a.TIME]:"timer-outline",[a.ELAPSEDTIME]:"timer",[a.MASKEDTEXT]:"text",[a.PASSWORD]:"email"},b=({userInterface:e,description:t})=>i("ez-icon",{iconName:v[e],class:"ez-padding-left--small",title:t}),g="__SNK__APPLICATION__",z=/\w+:\/\/(\w+)/,k=class{constructor(i){e(this,i),this.ezSelectFilterItem=t(this,"ezSelectFilterItem",7),this._currentMetadata=null,this._filterText="",this._isLoading=!1,this.searchable=!0,this.fieldsDataSource=void 0,this.breadcrumbItems=[],this.linkItems=[],this.fieldItems=[],this.searchEmpty=!1,this.groupEmpty=!1}async show(i,e){var t;return i?null===(t=this._ezPopover)||void 0===t||t.showUnder(i,e):this._ezPopover.show(),this.loadData()}async applyFilter(i){if(this.searchable)throw new Error("This method is not available when searchable is true");this.handleFilterChange(i)}async loadData(){var i,e;this._isLoading=!0;let t=await this.fieldsDataSource.fetchData(this._currentLink);this._currentLink=t.currentLink;const{fields:s,links:l}=t||{};if(!Array.isArray(s)||!Array.isArray(l))throw new Error("Invalid metadata");this._currentMetadata=t,this.mapDataSourceToLinkItems(),this.mapDataSourceToFieldItems(),this._isLoading=!1,null===(i=this._ezFieldList)||void 0===i||i.scrollToTop(),null===(e=this._ezLinkList)||void 0===e||e.scrollToTop()}mapDataSourceToLinkItems(){var i;const{links:e}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.linkLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.map((i=>Object.assign({label:i.description},i)));this.groupEmpty=Boolean(0===s.length),this.linkItems=[{group:t,items:s}],0===this.breadcrumbItems.length&&(this.breadcrumbItems=[Object.assign({id:n.generateUUID(),label:this._currentLink.description},this._currentLink)])}mapDataSourceToFieldItems(){var i;const e=this._currentMetadata.fields,t=this.getMessage("snkFilterFieldSearch.fieldLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.filter((i=>{if(!this._currentLink)return!0;const e=i.description.toLowerCase().includes(this._filterText.toLowerCase()),t=i.name.toLowerCase().includes(this._filterText.toLowerCase());return e||t})).map((i=>Object.assign({label:i.description},i)));this.searchEmpty=Boolean(this._filterText&&0===s.length),this.fieldItems=[{group:t,items:s}]}handleFilterChange(i){this._isLoading||(this._filterText=i,this.mapDataSourceToFieldItems())}handleSelectLink({detail:i}){if(this._isLoading)return;const e=this.breadcrumbItems.findIndex((e=>e.id===i.id));this.breadcrumbItems=e>-1?this.breadcrumbItems.slice(0,e+1):[...this.breadcrumbItems,Object.assign({id:n.generateUUID(),label:i.description},i)];const t=Object.assign(Object.assign({},i),{type:l.LINK});this._currentLink=t,this.ezSelectFilterItem.emit(t),this.loadData()}getEntityFromBreadCrumbItem(i){const e=z.exec(i.uri);if(e)return e[1]}handleSelectField({detail:i}){var e;const t=this.breadcrumbItems.map((i=>i.label)).join(">>"),s=Object.assign(Object.assign({},i),{type:l.FIELD,entityPath:this.breadcrumbItems.map((i=>this.getEntityFromBreadCrumbItem(i))).filter((i=>null!=i)),path:`${t} >> ${i.description}`});this.ezSelectFilterItem.emit(s),null===(e=this._ezPopover)||void 0===e||e.hide()}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getMessage(i,e){var t,s,l;return this._application||(this._application=o.getContextValue(g)),null===(l=null===(s=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)||void 0===s?void 0:s.getMessage)||void 0===l?void 0:l.call(s,i,e)}componentWillLoad(){this._application=o.getContextValue(g)}componentDidLoad(){r.addIDInfoIfNotExists(this._ezPopover,"popover")}disconnectedCallback(){var i;null===(i=this._ezPopover)||void 0===i||i.hide()}render(){var e;const t=this.getMessage("snkFilterFieldSearch.searchLabel");return i("ez-popover",Object.assign({ref:i=>this._ezPopover=i,role:"dialog",overlayType:"none","aria-hidden":!(null===(e=this._ezPopover)||void 0===e?void 0:e.opened)},this.getElementID("EzPopover")),i("div",{class:"snk-filter-field-search__container"},i("header",{class:"snk-filter-field-search__header"},this.searchable&&!!t&&i("ez-filter-input",Object.assign({class:"snk-filter-field-search__input",label:t,asyncSearch:!0,canShowError:!1,onEzSearching:i=>this.handleFilterChange.bind(this)(i.detail),"aria-label":t,"aria-required":"false","aria-invalid":"false"},this.getElementID("EzFilterInput"))),this.breadcrumbItems.length>0&&i("ez-breadcrumb",Object.assign({items:this.breadcrumbItems,onSelectedItem:this.handleSelectLink.bind(this),role:"navigation","aria-current":"step"},this.getElementID("EzBreadcrumb"))),i("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})),i("section",{class:`snk-filter-field-search__section ${this.groupEmpty&&this.searchEmpty&&" ez-margin--auto"}`},this.groupEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.groupEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezLinkList=i,class:"snk-filter-field-search__list",id:"filterLinkList",useGroups:!0,dataSource:this.linkItems,onEzSelectItem:this.handleSelectLink.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:e=>i("ez-badge",{label:e.fieldCount}),"aria-describedby":"filterLinkLabel"},this.getElementID("EzListLinks"))),this.searchEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.searchEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezFieldList=i,class:"snk-filter-field-search__list",id:"filterFieldList",useGroups:!0,dataSource:this.fieldItems,onEzSelectItem:this.handleSelectField.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:b,"aria-describedby":"filterFieldLabel"},this.getElementID("EzListFields"))))))}};k.style=".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";const y=class{constructor(i){e(this,i),this._opened=!1,this._configType=u.SYSTEM_CONFIG,this._expressionItem=void 0,this._informedInstance=!1,this._canSave=!1,this.messagesBuilder=void 0}open(i){return this._opened=!0,this._expressionItem=i,this.loadValues(),new Promise((i=>{this._promiseResolver=i}))}close(){return this._opened=!1,new Promise((i=>{this._promiseResolver=i}))}getMessage(i,e){var t;return null===(t=this.messagesBuilder)||void 0===t?void 0:t.getMessage(i,e)}getConfigValue(i,e,t=""){var s,l,a;return(null===(l=null===(s=this._expressionItem)||void 0===s?void 0:s[i])||void 0===l?void 0:l[e])||(null===(a=this._expressionItem)||void 0===a?void 0:a[t||e])}loadValues(){var i;const e=this.getConfigValue("systemConfig","entity","entityName"),t=this.getConfigValue("systemConfig","fieldName"),s=this.getConfigValue("userConfig","description"),l=this.getConfigValue("userConfig","type");this._configType=null!=(null===(i=this._expressionItem)||void 0===i?void 0:i.userConfig)?u.USER_CONFIG:u.SYSTEM_CONFIG,h.isEmpty(e)||h.isEmpty(t)||(this._instanceElement.value={value:e,label:""},this._fieldElement.value={value:t,label:""}),h.isEmpty(s)||h.isEmpty(l)||(this._descriptionElement.value=s,this._typeElement.value=l),this.buildFilterExpression()}changeDefinitionUsed(i){if(this._configType=null!=i?i:u.SYSTEM_CONFIG,this._configType===u.SYSTEM_CONFIG){const i=this.getConfigValue("systemConfig","entity","entityName"),e=this.getConfigValue("systemConfig","fieldName");this._instanceElement.value=this._instanceElement.value||{value:i,label:""},this._fieldElement.value=this._fieldElement.value||{value:e,label:""}}else if(this._configType===u.USER_CONFIG){const i=this.getConfigValue("userConfig","description"),e=this.getConfigValue("userConfig","type");this._descriptionElement.value=this._descriptionElement.value||i,this._typeElement.value=this._typeElement.value||e}this.buildFilterExpression()}getTypeValue(){var i;const e=null===(i=this._typeElement)||void 0===i?void 0:i.value;return(null==e?void 0:e.value)||e}getExpressionValues(){var i,e,t,s,l;let a,n;return this._configType===u.SYSTEM_CONFIG?a={entity:null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value,fieldName:null===(s=null===(t=this._fieldElement)||void 0===t?void 0:t.value)||void 0===s?void 0:s.value}:this._configType===u.USER_CONFIG&&(n={description:null===(l=this._descriptionElement)||void 0===l?void 0:l.value,type:this.getTypeValue()}),Object.assign(Object.assign(Object.assign({},this._expressionItem),{systemConfig:a}),{userConfig:n})}isEnabled(i){return this._configType===i}isInformedInstance(){var i,e;return!h.isEmpty(null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value)}save(){var i;this._expressionItem=Object.assign(Object.assign({},this.getExpressionValues()),{expression:null===(i=this._expressionElement)||void 0===i?void 0:i.value}),this._promiseResolver(this._expressionItem),this._opened=!1}buildFilterExpression(){var i;this._informedInstance=this.isInformedInstance();const e=p.buildFilterExpression(this.getExpressionValues());this._expressionElement.value=e||(null===(i=this._expressionItem)||void 0===i?void 0:i.expression),this._canSave=this.getCanSave()}handleChangeInstance(){this._informedInstance=this.isInformedInstance(),null==this._fieldElement||h.isEmpty(this._fieldElement.value)||(this._fieldElement.value=null),this.buildFilterExpression()}getInstanceCriteria(){var i,e;const t=null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value;return{expression:"this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",params:[{name:"NOMEINSTANCIA",dataType:d.TEXT,value:t}]}}onSearch({mode:i,argument:e},t){if(null==this._application||!this._opened)return;const s=t===f.FIELD,l=s?this.getInstanceCriteria():void 0,a={entity:t,entityDescription:this.getMessage("snkFilterParamConfig.label"+(s?"Field":"Instance")),criteria:l,searchOptions:{descriptionFieldName:s?"DESCRCAMPO":"DESCRINSTANCIA",codeFieldName:s?"NOMECAMPO":"NOMEINSTANCIA",showInactives:!1}};return new Promise((t=>{this._application.executePreparedSearch(i,e,a).then((i=>t(i)))}))}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getCanSave(){var i;if(this._configType===u.USER_CONFIG){const e=null===(i=this._descriptionElement)||void 0===i?void 0:i.value,t=this.getTypeValue();return!h.isEmpty(e)&&!h.isEmpty(t)}return!0}componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__")}render(){return r.addIDInfoIfNotExists(this._element,"snkFilterParamConfig"),i("ez-popup",Object.assign({useHeader:!1,size:"small",heightMode:"auto",opened:this._opened},this.getElementID("popup")),i("ez-modal-container",Object.assign({onEzModalAction:i=>{i.detail===c.CLOSE&&this.close()},modalTitle:this.getMessage("snkFilterParamConfig.modalTitle")},this.getElementID("modalContainer")),i("div",{class:"ez-flex"},i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("systemConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelSystemConfig"),value:u.SYSTEM_CONFIG})),i("ez-search",Object.assign({ref:i=>this._instanceElement=i,label:this.getMessage("snkFilterParamConfig.labelInstance"),enabled:this.isEnabled(u.SYSTEM_CONFIG),suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.handleChangeInstance(),optionLoader:i=>this.onSearch(i,f.INSTANCE)},this.getElementID("configFindEntity"))),i("ez-search",Object.assign({ref:i=>this._fieldElement=i,label:this.getMessage("snkFilterParamConfig.labelField"),enabled:this.isEnabled(u.SYSTEM_CONFIG)&&this._informedInstance,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.buildFilterExpression(),optionLoader:i=>this.onSearch(i,f.FIELD)},this.getElementID("configFindField")))),i("div",{class:"ez-flex ez-padding--medium"},i("hr",{class:"ez-divider-vertical"})),i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("userConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelUserConfig"),value:u.USER_CONFIG})),i("ez-text-input",Object.assign({ref:i=>this._descriptionElement=i,label:this.getMessage("snkFilterParamConfig.labelDescription"),enabled:this.isEnabled(u.USER_CONFIG),onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamLabel"))),i("ez-combo-box",Object.assign({ref:i=>this._typeElement=i,label:this.getMessage("snkFilterParamConfig.labelType"),enabled:this.isEnabled(u.USER_CONFIG),suppressEmptyOption:!0,onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamType")),Object.keys(m).map((e=>i("option",{value:m[e]},this.getMessage(`snkFilterParamConfig.labelTypeValues.${e.toLowerCase()}`))))))),i("ez-text-area",Object.assign({ref:i=>this._expressionElement=i,class:"snk-filter-param-config__expression",label:this.getMessage("snkFilterParamConfig.labelExpression"),enabled:!1},this.getElementID("presentationExpression"))),i("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},i("ez-button",Object.assign({class:"ez-padding-right--medium",label:this.getMessage("snkFilterParamConfig.labelCancel"),onClick:()=>this.close()},this.getElementID("cancelEditParam"))),i("ez-button",Object.assign({class:"ez-button--primary",label:this.getMessage("snkFilterParamConfig.labelSave"),onClick:()=>this.save(),enabled:this._canSave},this.getElementID("saveEditParam"))))))}get _element(){return s(this)}};y.style=":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";export{k as snk_filter_field_search,y as snk_filter_param_config}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as e,F as s,H as l,g as r}from"./p-d2d301a6.js";import{ApplicationUtils as n}from"@sankhyalabs/ezui/dist/collection/utils";import{F as a}from"./p-584d7212.js";import{ElementIDUtils as o,ObjectUtils as h}from"@sankhyalabs/core";import{E as c}from"./p-1a68fb59.js";import{P as d}from"./p-
|
1
|
+
import{r as t,c as i,h as e,F as s,H as l,g as r}from"./p-d2d301a6.js";import{ApplicationUtils as n}from"@sankhyalabs/ezui/dist/collection/utils";import{F as a}from"./p-584d7212.js";import{ElementIDUtils as o,ObjectUtils as h}from"@sankhyalabs/core";import{E as c}from"./p-1a68fb59.js";import{P as d}from"./p-43b2aad5.js";import"./p-933c0c0b.js";const u=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.config=void 0,this.getMessage=void 0}async show(){var t,i;null===(i=null===(t=this._editor)||void 0===t?void 0:t.show)||void 0===i||i.call(t)}observeConfig(t){var i,e;this._editor&&(this._editor.config=t),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.config.id}`}}changeConfig(t){this.filterChange.emit(t)}getContentEditor(){switch(this.config.type){case a.BINARY_SELECT:return{tag:"snk-filter-binary-select"};case a.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case a.PERIOD:return{tag:"snk-filter-period"};case a.SEARCH:return{tag:"snk-filter-search"};case a.NUMBER:return{tag:"snk-filter-number"};case a.PERSONALIZED:return{tag:"snk-personalized-filter-editor",props:{presentationMode:c.CHIP,onValueChanged:t=>this.handleValueChanged(t)}};case a.MULTI_LIST:return{tag:"snk-entity-list",props:{onValueChanged:t=>this.config=Object.assign(Object.assign({},this.config),{value:t.detail})}}}return{tag:"snk-filter-text"}}handleValueChanged({detail:t}){const i=(null==t?void 0:t.items)||this.config.groupedItems;this.config=Object.assign(Object.assign({},this.config),{groupedItems:i,visible:(i||[]).filter((t=>t.visible)).length>0})}removeItem(){const t=this.config.type===a.MULTI_LIST&&Array.isArray(this.config.value)?this.config.value.map((t=>Object.assign(Object.assign({},t),{check:!1}))):void 0,i=Object.assign(Object.assign({},this.config),{visible:!1,fixed:!1,value:t});null!=i.groupedItems&&(i.groupedItems=i.groupedItems.map((t=>Object.assign(Object.assign({},t),{visible:!1,fixed:!1,value:void 0})))),this.changeConfig(i)}removeItemFromGroup(t){return Object.assign(Object.assign({},t),{visible:!1,fixed:!1,value:void 0})}getPopUpHeaderButtons(){return e(s,null,!this.config.removalBlocked&&this.buildIcon(this.getMessage("snkFilterBar.removeFilter"),"delete",(()=>this.removeItem())),!this.config.hardFixed&&this.buildIcon(this.getMessage(this.config.fixed?"snkFilterBar.unpinFilter":"snkFilterBar.pinFilter"),this.config.fixed?"un-pin":"push-pin",(()=>this.changeConfig(Object.assign(Object.assign({},this.config),{fixed:!this.config.fixed})))))}buildIcon(t,i,s){return e("button",{onClick:()=>s(),class:"sc-snk-filter-bar snk-filter-item__editor-header-button",ref:i=>i&&this.buildIdButton(i,t)},e("ez-icon",Object.assign({title:t,iconName:i},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo(`_${t}`)}`})))}buildIdButton(t,i){if(!t)return;const e={id:i};t.removeAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME),o.addIDInfoIfNotExists(t,"button",e)}clearBinarySelectValues(){var t;const i=this._editor||{};null===(t=i.resetValues)||void 0===t||t.call(i),this.config=h.copy(this.originalConfig),this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}apply(){if(!d.validateVariableValues(this.config,this._editor.value))return n.alert(this.getMessage("snkFilterBar.filterModal.validations.notFullFilled.title"),this.getMessage("snkFilterBar.filterModal.validations.notFullFilled.message"));const t=void 0!==this._editor.value?this._editor.value:this.config.value;this.changeConfig(Object.assign(Object.assign({},this.config),{visible:this.isVisible(),value:t}))}isVisible(){return!(this.config.groupedItems&&this.config.groupedItems.length>0)||this.config.groupedItems.filter((t=>t.visible)).length>0}clear(){var t;if(this.config.type!==a.BINARY_SELECT){if(a.MULTI_LIST===this.config.type){const i=h.copy(this.config);return null===(t=i.value)||void 0===t||t.forEach((t=>!!t&&(t.check=!1))),void(this.config=h.copy(i))}this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}else this.clearBinarySelectValues()}filterCanBeCleared(){return this.config.type!==a.PERSONALIZED}onKeyDonwListener(t){"Enter"===t.key&&this._applyButton.setFocus().then((()=>this.apply()))}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e;if(this.config){const s=h.copy(this.config),l=null===(i=s.value)||void 0===i?void 0:i.findIndex((i=>(null==i?void 0:i.id)===t.id));null===(e=s.value)||void 0===e||e.splice(l,1),this.config=h.copy(s)}}componentWillLoad(){this.originalConfig=h.copy(this.config)}render(){const{tag:t,props:i}=this.getContentEditor();return e(l,null,e("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},e("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.config.detailTitle),this.getPopUpHeaderButtons()),e(t,Object.assign({maxHeightList:"240px",ref:t=>this._editor=t,value:this.config.value,config:this.config,onKeyDown:t=>this.onKeyDonwListener(t),"data-element-id":this._idContentEditor,getMessage:this.getMessage,rightListSlotBuilder:t=>this.buildRightSlot(t)},i)),e("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),e("div",{class:"ez-col ez-col--sd-12 ez-align--right"},this.filterCanBeCleared()&&e("ez-button",{label:this.getMessage("snkFilterBar.cleanFilter"),onClick:()=>this.clear(),size:"small"}),e("ez-button",{ref:t=>this._applyButton=t,label:this.getMessage("snkFilterBar.applyFilter"),onClick:()=>this.apply(),size:"small",class:"ez-button--primary ez-padding-left--medium"})))}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};export{u as snk_filter_detail}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as s,h as t,H as i}from"./p-d2d301a6.js";import{P as a}from"./p-
|
1
|
+
import{r as e,c as s,h as t,H as i}from"./p-d2d301a6.js";import{P as a}from"./p-43b2aad5.js";import"@sankhyalabs/core";import"./p-584d7212.js";import"./p-933c0c0b.js";const r=class{constructor(t){e(this,t),this.ezExpressionChange=s(this,"ezExpressionChange",7),this.filterAssistent=void 0,this.application=void 0}getMessage(e,s){return this.application.messagesBuilder.getMessage(e,s)}render(){var e;return t(i,null,t("span",{class:"ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title"},this.getMessage("snkPersonalizedFilter.info.applyExpression")),t("ez-text-area",{rows:9,label:this.getMessage("snkPersonalizedFilter.info.labelExpression"),value:null===(e=this.filterAssistent)||void 0===e?void 0:e.expression,onEzChange:e=>this.ezExpressionChange.emit(e.detail)}))}};r.style=".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";const n=class{constructor(t){e(this,t),this.ezChangeFilter=s(this,"ezChangeFilter",7),this.filterAssistent=void 0,this.messagesBuilder=void 0,this.filterId=void 0,this.entityUri=void 0,this.application=void 0}getMessage(e,s){return this.application.messagesBuilder.getMessage(e,s)}async handleFilterGroupChange(){const e=await this._mainExpressionGroup.getExpressionGroup();this.filterAssistent=Object.assign(Object.assign({},this.filterAssistent),{assistent:e}),this.filterAssistent.parameters=a.buildVariableParameters(this.filterAssistent.assistent),this.filterAssistent.expression=a.buildGroupExpression(this.filterAssistent.assistent),this.ezChangeFilter.emit(this.filterAssistent)}render(){var e,s;return t(i,null,t("div",{class:"ez-padding-top--small snk-personalized-filter__group"},t("snk-expression-group",{ref:e=>this._mainExpressionGroup=e,group:null===(e=this.filterAssistent)||void 0===e?void 0:e.assistent,messagesBuilder:this.messagesBuilder,onEzFilterGroupChange:this.handleFilterGroupChange.bind(this),filterId:this.filterId,entityURI:this.entityUri})),t("div",{class:"ez-margin-top--auto"},t("div",{class:"snk-personalized-filter__expression-input--line"}),t("ez-collapsible-box",{label:this.getMessage("snkPersonalizedFilter.info.titleCollapsible"),headerSize:"medium",value:!0},t("div",{class:"ez-box"},t("div",{class:"ez-box__container--external"},t("div",{class:"ez-box__container--internal"},t("span",{class:"ez-box__container--title"},this.getMessage("snkPersonalizedFilter.info.labelExpression")),t("span",{class:"ez-box__container--expression"},null===(s=this.filterAssistent)||void 0===s?void 0:s.expression)))))))}};n.style=".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{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)}";export{r as snk_filter_advanced_mode,n as snk_filter_assistent_mode}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,h as i}from"./p-d2d301a6.js";import{ModalAction as e}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{ApplicationUtils as s}from"@sankhyalabs/ezui/dist/collection/utils";import{F as l}from"./p-d9804798.js";import{F as o}from"./p-584d7212.js";import{ObjectUtils as r}from"@sankhyalabs/core";import{P as a}from"./p-
|
1
|
+
import{r as t,h as i}from"./p-d2d301a6.js";import{ModalAction as e}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{ApplicationUtils as s}from"@sankhyalabs/ezui/dist/collection/utils";import{F as l}from"./p-d9804798.js";import{F as o}from"./p-584d7212.js";import{ObjectUtils as r}from"@sankhyalabs/core";import{P as a}from"./p-43b2aad5.js";import"./p-933c0c0b.js";const n=class{constructor(i){t(this,i),this.getMessage=void 0,this.configName=void 0,this.filters=void 0,this.applyFilters=void 0,this.closeModal=void 0,this.addPersonalizedFilter=void 0,this.editPersonalizedFilter=void 0}getCustomMessage(t,i){var e;return null===(e=this.getMessage)||void 0===e?void 0:e.call(this,`snkFilterBar.filterModal.${t}`,i)}handleClearAll(){const{customFilters:t,quickFilters:i,otherFilters:e,multiListFilters:s}=this.filters.reduce(((t,i)=>i.type===o.MULTI_LIST?(t.multiListFilters.push(i),t):i.filterType===l.QUICK_FILTER?(t.quickFilters.push(i),t):i.filterType===l.CUSTOM_FILTER?(t.customFilters.push(i),t):i.filterType===l.OTHER_FILTERS?(t.otherFilters.push(i),t):t),{quickFilters:[],customFilters:[],otherFilters:[],multiListFilters:[]});this.handleClearFilterList(i),this.handleClearCustomFilters(t),this.handleClearOthersFilters(e),s.forEach((t=>this.handleClearSigleFilter(t)))}handleClearOthersFilters(t){this.filters=this.filters.map((i=>t.includes(i)?Object.assign(Object.assign({},i),{value:void 0}):i))}handleClearCustomFilters(t){this.filters.forEach(((i,e)=>{i.filterType===l.CUSTOM_FILTER&&(this.filters[e]=this.clearAllCustomFilter(t).shift())}))}clearAllCustomFilter(t){return t.map((t=>{const i=Object.assign({},t);return delete i.value,i.visible=!1,i.groupedItems&&(i.groupedItems=this.clearAllCustomFilter(i.groupedItems)),i}))}handleClose(){if(r.objectToString(this.filters)!==r.objectToString(this._originalFilterConfig))return s.confirm(this.getCustomMessage("validations.notSaved.title"),this.getCustomMessage("validations.notSaved.message")).then((t=>{t&&this.closeModal()}));this.closeModal()}handleApplyFilters(){const t=this.filters.find((t=>t.filterType===l.CUSTOM_FILTER));this.isValidCustomFilter(t)&&this.applyFilters(this.filters)}isValidCustomFilter(t){return!!a.validateVariableValues(t)||(s.alert(this.getCustomMessage("validations.notFullFilled.title"),this.getCustomMessage("validations.notFullFilled.message")),!1)}modalActionListener(t){switch(t.detail){case e.CANCEL:this.handleClearAll();break;case e.OK:this.handleApplyFilters();break;case e.CLOSE:this.handleClose()}}handleFilterChange(t){this.filters=this.filters.map((i=>i.id===t.id?t:i))}handleClearFilterList(t){this.filters=this.filters.map((i=>t.includes(i)?Object.assign(Object.assign({},i),{value:void 0}):i))}handleClearSigleFilter(t){if(o.MULTI_LIST===t.type){let i=r.copy(t);this.uncheckFilterValues(i.value);const e=r.copy(this.filters),s=e.findIndex((i=>i.id===t.id));e.splice(s,1,i),this.filters=r.copy(e)}else this.filters.find((i=>i.id===t.id)).value=void 0}uncheckFilterValues(t){return t.forEach((t=>{t&&(t.check=!1)})),t}renderFilterItem(t,e){return i("snk-filter-modal-item",{class:e?"ez-col ez-col--sd-12":"ez-col ez-col--sd-6 ez-padding--small",filterItem:t,configName:this.configName,onFilterChange:t=>this.handleFilterChange(t.detail),onEditPersonalizedFilter:t=>this.editPersonalizedFilter(t.detail),onAddPersonalizedFilter:()=>this.addPersonalizedFilter()})}mountFiltersLines(t){let i=0,e=!1;const s={};for(let l=0;l<t.length;l++){s[i]=s[i]||[];const r=t[l],a=l===t.length-1,n=[o.TEXT,o.NUMBER].includes(r.type),d=!a&&[o.TEXT,o.NUMBER].includes(t[l+1].type);n&&d||e?(s[i].push(r),e=s[i].length<2,2===s[i].length&&++i):(s[i]=s[i]||[],s[i].push(r),++i)}return Object.values(s)}renderFilterLine(t){const i=1===t.length;return t.map((t=>this.renderFilterItem(t,i)))}getIformedFiltersCount(t){let i=0;return t.forEach((t=>{var e,s,l,r,a;o.MULTI_LIST!==t.type?null==t.groupedItems?t.value&&i++:i=t.groupedItems.filter((t=>t.visible)).length:i+=null!==(a=null===(r=null===(l=null!==(s=null===(e=t.value)||void 0===e?void 0:e.elements)&&void 0!==s?s:t.value)||void 0===l?void 0:l.filter((t=>null==t?void 0:t.check)))||void 0===r?void 0:r.length)&&void 0!==a?a:0})),i}renderCollapsibleFilterBox(t,e,s,l=!0){if(!e.length)return null;const o=this.getIformedFiltersCount(e),r=this.mountFiltersLines(e);return i("ez-collapsible-box",{class:"snk-filter-modal__collapsible-box",headerSize:"medium",value:!0,label:t},!!o&&i("ez-badge",{class:"ez-badge--primary-subtle",slot:"rightSlot",label:null==o?void 0:o.toString()}),i("div",{class:"ez-row snk-filter-modal__rendered-items"},r.map(this.renderFilterLine.bind(this))),l&&i("div",{class:"ez-flex ez-flex--justify-end grow"},i("ez-button",{class:"ez-button--tertiary",size:"medium",label:"Limpar",onClick:()=>s?this.handleClearSigleFilter(e[0]):this.handleClearFilterList(e)})))}componentWillRender(){this._modalTitle=this.getCustomMessage("title"),this._okButtonLabel=this.getCustomMessage("okButtonLabel"),this._cancelButtonLabel=this.getCustomMessage("cancelButtonLabel")}componentDidLoad(){this._originalFilterConfig||(this._originalFilterConfig=this.filters)}render(){const t=this.filters.filter((t=>t.filterType===l.CUSTOM_FILTER)),e=this.filters.filter((t=>t.filterType===l.QUICK_FILTER)),s=this.filters.filter((t=>t.filterType===l.OTHER_FILTERS));return i("ez-modal-container",{class:"snk-filter-modal__container",modalTitle:this._modalTitle,cancelButtonLabel:this._cancelButtonLabel,okButtonLabel:this._okButtonLabel,onEzModalAction:this.modalActionListener.bind(this)},i("div",{class:"snk-filter-modal__content ez-col--sd-12"},this.renderCollapsibleFilterBox(this.getCustomMessage("customFilters"),t,!1,!1),this.renderCollapsibleFilterBox(this.getCustomMessage("quickFilters"),e,!1),s.map((t=>this.renderCollapsibleFilterBox(t.label,[t],!0)))))}};n.style="ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";export{n as snk_filter_modal}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as i,c as e,h as s,F as t,H as n}from"./p-d2d301a6.js";import{StringUtils as l,ObjectUtils as r,ApplicationContext as a,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-5c1aacc7.js";import{P as d,C as c}from"./p-29176742.js";import{ApplicationUtils as p}from"@sankhyalabs/ezui/dist/collection/utils";import{a as f}from"./p-933c0c0b.js";import{s as z}from"./p-6dc031de.js";import"./p-584d7212.js";import"./p-4651b43f.js";import"./p-c9399ce6.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";const m=class{constructor(s){i(this,s),this.ezCancel=e(this,"ezCancel",7),this.ezSave=e(this,"ezSave",7),this.ezAfterSave=e(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let e=null==i?void 0:i.uri;if(l.isEmpty(e)&&(e=this.entityUri),!this._filterMetadataStorage.has(e)){const i=await this._personalizedFilterFetcher.loadFields(e);this._filterMetadataStorage.set(e,i)}return this._filterMetadataStorage.get(e)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:"Valor",type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:f.AND}};this._originalFilterAssistent=r.copy(i),this._filterAssistent=r.copy(i)}loadFilter(i,e){null!=i&&e!=i&&null!=this.resourceID&&c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const e=this.applyDefaultValues(i);this._filterAssistent=e,this._originalFilterAssistent=r.copy(e),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent}))}componentWillLoad(){var i;null==z.get(`filterFieldsDataSource.${this.entityUri}`)&&z.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=a.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}saveFilter(){c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName).then((i=>{this._elButtonSave.enabled=!1,p.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const e=Object.assign(Object.assign({},i),this._filterAssistent);e.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=r.copy(e),this._filterAssistent=r.copy(e),this.ezAfterSave.emit()}))}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:e}=this._filterAssistent,s=i?h.buildGroupExpression(i):e;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?p.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:e=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),e.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();p.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var e;i&&(this._filterAssistent=r.copy(null!==(e=this._originalFilterAssistent)&&void 0!==e?e:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent.operand||(i.assistent.operand=f.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((e=>{if(null==e.fieldLabel){const s=(i.parameters||[]).find((i=>i.fieldName===e.fieldName));s&&(e.fieldLabel=s.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const e=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(e)}buildExpression(i,e,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${e}`:`${i}.${e}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(t,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:i=>this._viewStackRef=i},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail)})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,e;if(this._filterAssistentMode)p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(e=this._originalFilterAssistent)||void 0===e?void 0:e.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,e=h.buildGroupExpression(this._filterAssistent.assistent);i!==e?p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:e}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}render(){var i,e,t,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return s(n,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.getMessage(this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd"),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(e=this._filterAssistent)||void 0===e?void 0:e.name,onEzChange:i=>this.handleTitleChange(i.detail)}),this.renderButtonAddField(),s("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".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}";export{m as snk_personalized_filter}
|
1
|
+
import{r as i,c as e,h as s,F as t,H as n}from"./p-d2d301a6.js";import{StringUtils as l,ObjectUtils as r,ApplicationContext as a,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-43b2aad5.js";import{P as d,C as c}from"./p-29176742.js";import{ApplicationUtils as p}from"@sankhyalabs/ezui/dist/collection/utils";import{a as f}from"./p-933c0c0b.js";import{s as z}from"./p-6dc031de.js";import"./p-584d7212.js";import"./p-4651b43f.js";import"./p-c9399ce6.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";const m=class{constructor(s){i(this,s),this.ezCancel=e(this,"ezCancel",7),this.ezSave=e(this,"ezSave",7),this.ezAfterSave=e(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let e=null==i?void 0:i.uri;if(l.isEmpty(e)&&(e=this.entityUri),!this._filterMetadataStorage.has(e)){const i=await this._personalizedFilterFetcher.loadFields(e);this._filterMetadataStorage.set(e,i)}return this._filterMetadataStorage.get(e)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:"Valor",type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:f.AND}};this._originalFilterAssistent=r.copy(i),this._filterAssistent=r.copy(i)}loadFilter(i,e){null!=i&&e!=i&&null!=this.resourceID&&c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const e=this.applyDefaultValues(i);this._filterAssistent=e,this._originalFilterAssistent=r.copy(e),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent}))}componentWillLoad(){var i;null==z.get(`filterFieldsDataSource.${this.entityUri}`)&&z.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=a.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}saveFilter(){c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName).then((i=>{this._elButtonSave.enabled=!1,p.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const e=Object.assign(Object.assign({},i),this._filterAssistent);e.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=r.copy(e),this._filterAssistent=r.copy(e),this.ezAfterSave.emit()}))}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:e}=this._filterAssistent,s=i?h.buildGroupExpression(i):e;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?p.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:e=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),e.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();p.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var e;i&&(this._filterAssistent=r.copy(null!==(e=this._originalFilterAssistent)&&void 0!==e?e:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent.operand||(i.assistent.operand=f.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((e=>{if(null==e.fieldLabel){const s=(i.parameters||[]).find((i=>i.fieldName===e.fieldName));s&&(e.fieldLabel=s.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const e=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(e)}buildExpression(i,e,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${e}`:`${i}.${e}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(t,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:i=>this._viewStackRef=i},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail)})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,e;if(this._filterAssistentMode)p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(e=this._originalFilterAssistent)||void 0===e?void 0:e.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,e=h.buildGroupExpression(this._filterAssistent.assistent);i!==e?p.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:e}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}render(){var i,e,t,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return s(n,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.getMessage(this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd"),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(e=this._filterAssistent)||void 0===e?void 0:e.name,onEzChange:i=>this.handleTitleChange(i.detail)}),this.renderButtonAddField(),s("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".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}";export{m as snk_personalized_filter}
|
@@ -1 +1 @@
|
|
1
|
-
import{p as e,b as t}from"./p-d2d301a6.js";export{s as setNonce}from"./p-d2d301a6.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t(JSON.parse('[["p-118e769b",[[1,"teste-pesquisa"]]],["p-5d04ae42",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16]}]]],["p-ac8d1cd6",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-9531fd46",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-69754d94",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-d4f9ee17",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-eb636e15",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-d3f53df2",[[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]]]],["p-cb37982f",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-e3a82e1c",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-959e0835",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-fe49067d",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-96a89d58",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-26ad62b9",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-72fc257b",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-3bf4df20",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-989937ee",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["p-88aa931b",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-2eb547d9",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-73d3daa8",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-247a8b36",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["p-0885ed3c",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-9d3a025a",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-25c5428f",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-767db365",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-70150991",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"filterConfig":[1040],"messagesBuilder":[1040],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64]},[[0,"filterChange","filterChangeListener"]]]]],["p-bd628455",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"messagesBuilder":[1040],"_defaultType":[32]}]]],["p-f30526a7",[[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16],"messagesBuilder":[1040]}]]],["p-d3ec3586",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"tabItems":[16],"messagesBuilder":[1040],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["p-80692cbd",[[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"messagesBuilder":[1040],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["p-838f8234",[[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}]]],["p-47e4b6c9",[[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"application":[16],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-b3dc25aa",[[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-3eb28447",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64]}]]],["p-219f888d",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-54e3e05c",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32],"_releasedToExport":[32]}]]],["p-d4fb9642",[[6,"snk-taskbar",{"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32]}]]],["p-7dc44b05",[[6,"snk-grid",{"columnFilterDataSource":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64]}]]],["p-cab6a969",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"showFormConfig":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-7749c662",[[6,"snk-crud",{"configName":[1025,"config-name"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64]}]]],["p-06e76ed2",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64]}]]],["p-4efe1a8a",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"loadByPK":[16],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64]}]]],["p-651b4f89",[[6,"snk-simple-crud",{"dataState":[16],"dataUnit":[16],"mode":[2],"gridConfig":[16],"formConfig":[16],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"_currentViewMode":[32],"_config":[32],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-0383e477",[[2,"snk-attach",{"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"dataUnit":[32],"crudConfig":[32]}]]],["p-26b0ce3e",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-c555075c",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"showUp":[64]}]]],["p-47d20cb0",[[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32],"_actions":[32],"_isOrderActions":[32]}]]]]'),e)));
|
1
|
+
import{p as e,b as t}from"./p-d2d301a6.js";export{s as setNonce}from"./p-d2d301a6.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t(JSON.parse('[["p-118e769b",[[1,"teste-pesquisa"]]],["p-e11c5038",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16]}]]],["p-ac8d1cd6",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-9531fd46",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-69754d94",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-d4f9ee17",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-eb636e15",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-d3f53df2",[[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]]]],["p-cb37982f",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-e3a82e1c",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-959e0835",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-fe49067d",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-96a89d58",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-26ad62b9",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-72fc257b",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-3bf4df20",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-c606c748",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["p-88aa931b",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-2eb547d9",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-73d3daa8",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-247a8b36",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["p-c0931902",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-9d3a025a",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-c78a80ae",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-e60325bc",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-6d765e32",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"filterConfig":[1040],"messagesBuilder":[1040],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64]},[[0,"filterChange","filterChangeListener"]]]]],["p-bd628455",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"messagesBuilder":[1040],"_defaultType":[32]}]]],["p-f30526a7",[[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16],"messagesBuilder":[1040]}]]],["p-d3ec3586",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"tabItems":[16],"messagesBuilder":[1040],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["p-80692cbd",[[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"messagesBuilder":[1040],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["p-838f8234",[[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}]]],["p-47e4b6c9",[[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"application":[16],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-b3dc25aa",[[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-3eb28447",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64]}]]],["p-219f888d",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-54e3e05c",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32],"_releasedToExport":[32]}]]],["p-d4fb9642",[[6,"snk-taskbar",{"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32]}]]],["p-7dc44b05",[[6,"snk-grid",{"columnFilterDataSource":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64]}]]],["p-cab6a969",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"showFormConfig":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-7749c662",[[6,"snk-crud",{"configName":[1025,"config-name"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64]}]]],["p-06e76ed2",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64]}]]],["p-3532eb1c",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"loadByPK":[16],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64]}]]],["p-651b4f89",[[6,"snk-simple-crud",{"dataState":[16],"dataUnit":[16],"mode":[2],"gridConfig":[16],"formConfig":[16],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"_currentViewMode":[32],"_config":[32],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-0383e477",[[2,"snk-attach",{"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"dataUnit":[32],"crudConfig":[32]}]]],["p-26b0ce3e",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-c555075c",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"showUp":[64]}]]],["p-47d20cb0",[[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32],"_actions":[32],"_isOrderActions":[32]}]]]]'),e)));
|
@@ -291,6 +291,7 @@ export declare class SnkApplication {
|
|
291
291
|
private pkChangeListener;
|
292
292
|
private getResourceIdFromToken;
|
293
293
|
private defaultLoadByPK;
|
294
|
+
private loadDataWithPKFilter;
|
294
295
|
private getFirstDataUnitFromDOM;
|
295
296
|
private getFilterParamsFromPkObject;
|
296
297
|
private getDefaultDataTypeLoadByPK;
|
@@ -299,6 +300,7 @@ export declare class SnkApplication {
|
|
299
300
|
private newVersionPopupEventListener;
|
300
301
|
private handleShowNewVersionPopup;
|
301
302
|
private hasToShowNewVersionPopup;
|
303
|
+
private registerPkChangeListener;
|
302
304
|
componentWillLoad(): void;
|
303
305
|
connectedCallback(): void;
|
304
306
|
disconnectedCallback(): void;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IExpressionGroup, IExpressionItem } from "../../../interfaces";
|
2
1
|
import { SnkFilterItemConfig } from "../../../../snk-filter-bar/filter-item/snk-filter-item";
|
2
|
+
import { IExpressionGroup, IExpressionItem } from "../../../interfaces";
|
3
3
|
import { IParameter } from "../../../interfaces/IParameter";
|
4
4
|
export declare class PersonalizedFilterUtils {
|
5
5
|
/**
|