@sankhyalabs/sankhyablocks 8.9.5 → 8.10.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-90552fe8.js → ConfigStorage-49d4681c.js} +1 -1
- package/dist/cjs/{PersonalizedFilterUtils-2f7823fc.js → PersonalizedFilterUtils-0184ffbb.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-0561602d.js → SnkFormConfigManager-d4184bfa.js} +1 -1
- package/dist/cjs/{filter-item-type.enum-aa823a00.js → filter-item-type.enum-a7ffdaa6.js} +1 -0
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +37 -2
- package/dist/cjs/snk-crud.cjs.entry.js +72 -8
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar.cjs.entry.js +27 -4
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +52 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +9 -2
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-item.cjs.entry.js +25 -14
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -3
- package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -5
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-676dd526.js → snk-guides-viewer-0d5aad6b.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-application/snk-application.js +47 -1
- package/dist/collection/components/snk-crud/snk-crud.js +71 -7
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +95 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +24 -13
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +14 -3
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +3 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +5 -1
- package/dist/collection/lib/workspace/workspace.js +12 -0
- package/dist/components/filter-item-type.enum.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +37 -1
- package/dist/components/snk-crud.js +71 -7
- package/dist/components/snk-filter-bar2.js +24 -1
- package/dist/components/snk-filter-checkbox-list.d.ts +11 -0
- package/dist/components/snk-filter-checkbox-list.js +68 -0
- package/dist/components/snk-filter-detail2.js +7 -0
- package/dist/components/snk-filter-item2.js +24 -13
- package/dist/components/snk-filter-modal-item2.js +3 -1
- package/dist/components/snk-filter-modal.js +14 -3
- package/dist/esm/{ConfigStorage-84abda58.js → ConfigStorage-9a086412.js} +1 -1
- package/dist/esm/{PersonalizedFilterUtils-49a5dcb7.js → PersonalizedFilterUtils-e2b38ef7.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-655943d0.js → SnkFormConfigManager-709e68a2.js} +1 -1
- package/dist/esm/{filter-item-type.enum-5028ed3f.js → filter-item-type.enum-d45e026f.js} +1 -0
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +38 -3
- package/dist/esm/snk-crud.entry.js +72 -8
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
- package/dist/esm/snk-filter-bar.entry.js +27 -4
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +48 -0
- package/dist/esm/snk-filter-detail.entry.js +9 -2
- package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
- package/dist/esm/snk-filter-item.entry.js +25 -14
- package/dist/esm/snk-filter-modal-item.entry.js +5 -3
- package/dist/esm/snk-filter-modal.entry.js +16 -5
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +3 -3
- package/dist/esm/snk-grid-config.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-746e2547.js → snk-guides-viewer-9c50ebea.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -4
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +1 -1
- package/dist/sankhyablocks/{p-29529c8f.entry.js → p-01ba23cd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-43b2aad5.js → p-057fad05.js} +1 -1
- package/dist/sankhyablocks/p-117b0848.entry.js +11 -0
- package/dist/sankhyablocks/{p-c6800fd4.entry.js → p-1626c58f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6e32de4b.entry.js → p-1b7105ae.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cb37982f.entry.js → p-20726710.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8f307ef2.entry.js → p-29ffb7d7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a3fbded7.entry.js → p-2e1a8609.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c78a80ae.entry.js → p-3ab6df3d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5eb3ac18.js → p-3fd145ac.js} +1 -1
- package/dist/sankhyablocks/{p-eb636e15.entry.js → p-41f8bfa3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d7665a57.entry.js → p-57196255.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a9b6acf1.js → p-5cff2f60.js} +1 -1
- package/dist/sankhyablocks/p-6977a26c.entry.js +1 -0
- package/dist/sankhyablocks/{p-fc257290.entry.js → p-7e2ded86.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c0931902.entry.js → p-8002dcd0.entry.js} +1 -1
- package/dist/sankhyablocks/p-84a53f61.entry.js +1 -0
- package/dist/sankhyablocks/p-a037f5b4.entry.js +1 -0
- package/dist/sankhyablocks/p-aaa3ee68.entry.js +1 -0
- package/dist/sankhyablocks/{p-26ad62b9.entry.js → p-c758265f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fe49067d.entry.js → p-c8622597.entry.js} +1 -1
- package/dist/sankhyablocks/p-d05d3e37.entry.js +1 -0
- package/dist/sankhyablocks/p-d6317851.entry.js +1 -0
- package/dist/sankhyablocks/{p-718ecd01.entry.js → p-df841828.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a4401f5f.entry.js → p-e1aec599.entry.js} +1 -1
- package/dist/sankhyablocks/p-fab8339c.entry.js +1 -0
- package/dist/sankhyablocks/{p-b54e06ca.js → p-fad0a721.js} +1 -1
- package/dist/sankhyablocks/{p-584d7212.js → p-ff1990ad.js} +1 -1
- package/dist/sankhyablocks/{p-0d5e8a37.entry.js → p-ff90e0e6.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +10 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +27 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
- package/dist/types/components.d.ts +35 -1
- package/dist/types/lib/workspace/workspace.d.ts +3 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-1ae31937.entry.js +0 -1
- package/dist/sankhyablocks/p-25df73bf.entry.js +0 -1
- package/dist/sankhyablocks/p-2640ba03.entry.js +0 -1
- package/dist/sankhyablocks/p-993e27ad.entry.js +0 -1
- package/dist/sankhyablocks/p-c606c748.entry.js +0 -1
- package/dist/sankhyablocks/p-d4c72815.entry.js +0 -1
- package/dist/sankhyablocks/p-f3479d53.entry.js +0 -11
@@ -1,7 +1,7 @@
|
|
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-e2b38ef7.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
|
-
import './filter-item-type.enum-
|
4
|
+
import './filter-item-type.enum-d45e026f.js';
|
5
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)}";
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
4
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage-9a086412.js';
|
5
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
6
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
6
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
7
7
|
import { F as FilterOperand } from './index-ae591a44.js';
|
8
8
|
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
9
9
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
10
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
10
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
11
11
|
import './form-config-fetcher-24f43afd.js';
|
12
12
|
import './DataFetcher-7814568f.js';
|
13
13
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -33,6 +33,8 @@ const buildFilter = (item) => {
|
|
33
33
|
return buildNumber(item);
|
34
34
|
case FilterItemType.PERSONALIZED:
|
35
35
|
return buildPersonalized(item);
|
36
|
+
case FilterItemType.CHECK_BOX_LIST:
|
37
|
+
return buildCheckboxList(item);
|
36
38
|
default:
|
37
39
|
return undefined;
|
38
40
|
}
|
@@ -65,6 +67,23 @@ function buildMultiList(item) {
|
|
65
67
|
};
|
66
68
|
}
|
67
69
|
}
|
70
|
+
function buildCheckboxList(item) {
|
71
|
+
var _a;
|
72
|
+
const { id, value, props } = item;
|
73
|
+
const selectedOptionNames = Object.entries(value !== null && value !== void 0 ? value : {})
|
74
|
+
.filter(([_, valueChecked]) => valueChecked === true)
|
75
|
+
.map(([key, _]) => key);
|
76
|
+
const selectedOptionsObject = (_a = props.options) === null || _a === void 0 ? void 0 : _a.filter(option => selectedOptionNames.includes(option.name));
|
77
|
+
return { name: id, expression: buildCheckboxListExpression(selectedOptionsObject), params: [] };
|
78
|
+
}
|
79
|
+
function buildCheckboxListExpression(options) {
|
80
|
+
let expression = "";
|
81
|
+
options.forEach((option, index) => {
|
82
|
+
var _a;
|
83
|
+
expression += ` ${index > 0 ? ((_a = option.operand) !== null && _a !== void 0 ? _a : 'OR') : ''} ${option.expression}`;
|
84
|
+
});
|
85
|
+
return expression.trim();
|
86
|
+
}
|
68
87
|
function parseMultiListValues(multiListValue) {
|
69
88
|
var _a, _b;
|
70
89
|
const value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
|
@@ -534,8 +553,12 @@ const SnkFilterBar = class {
|
|
534
553
|
const callbackOnApplyFilter = (filters) => {
|
535
554
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
536
555
|
};
|
556
|
+
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
557
|
+
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
558
|
+
return itemA.originOrder - itemB.originOrder;
|
559
|
+
});
|
537
560
|
const factoryParams = {
|
538
|
-
filterConfig:
|
561
|
+
filterConfig: filtersConfigCopy,
|
539
562
|
configName: this.configName,
|
540
563
|
onComplete: callbackOnApplyFilter,
|
541
564
|
getMessage: (key, props) => this.getMessage(key, props),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
5
5
|
|
6
6
|
const SnkFilterBinarySelect = class {
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
|
+
|
5
|
+
const SnkFilterCheckboxList = class {
|
6
|
+
constructor(hostRef) {
|
7
|
+
registerInstance(this, hostRef);
|
8
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
9
|
+
this.config = undefined;
|
10
|
+
this.optionsList = [];
|
11
|
+
}
|
12
|
+
componentDidLoad() {
|
13
|
+
if (this._element) {
|
14
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
15
|
+
}
|
16
|
+
}
|
17
|
+
handleToggleCheck(itemChanged, checked) {
|
18
|
+
var _a, _b;
|
19
|
+
let configValueMap = (_a = this.config.value) !== null && _a !== void 0 ? _a : {};
|
20
|
+
configValueMap[itemChanged.name] = checked;
|
21
|
+
this.config = Object.assign(Object.assign({}, this.config), { value: configValueMap });
|
22
|
+
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
23
|
+
}
|
24
|
+
renderOptions() {
|
25
|
+
return this.optionsList.map(option => (h("ez-check", { label: option.label, compact: true, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
26
|
+
}
|
27
|
+
isChecked(itemName) {
|
28
|
+
var _a;
|
29
|
+
return (_a = this.config.value) === null || _a === void 0 ? void 0 : _a[itemName];
|
30
|
+
}
|
31
|
+
buidOptions() {
|
32
|
+
var _a, _b, _c;
|
33
|
+
const propsOptions = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.options) !== null && _c !== void 0 ? _c : [];
|
34
|
+
this.optionsList = [...propsOptions];
|
35
|
+
}
|
36
|
+
componentWillRender() {
|
37
|
+
this.buidOptions();
|
38
|
+
}
|
39
|
+
render() {
|
40
|
+
if (!this.config || this.config.type !== FilterItemType.CHECK_BOX_LIST) {
|
41
|
+
return undefined;
|
42
|
+
}
|
43
|
+
return (h("div", { class: 'ez-flex ez-flex--column' }, this.renderOptions()));
|
44
|
+
}
|
45
|
+
get _element() { return getElement(this); }
|
46
|
+
};
|
47
|
+
|
48
|
+
export { SnkFilterCheckboxList as snk_filter_checkbox_list };
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.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-e2b38ef7.js';
|
7
7
|
import './index-ae591a44.js';
|
8
8
|
|
9
9
|
const SnkFilterDetail = class {
|
@@ -55,6 +55,13 @@ const SnkFilterDetail = class {
|
|
55
55
|
}
|
56
56
|
};
|
57
57
|
return snkFilterPersonalizedProps;
|
58
|
+
case FilterItemType.CHECK_BOX_LIST:
|
59
|
+
return {
|
60
|
+
tag: "snk-filter-checkbox-list",
|
61
|
+
props: {
|
62
|
+
onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
|
63
|
+
}
|
64
|
+
};
|
58
65
|
case FilterItemType.MULTI_LIST:
|
59
66
|
return {
|
60
67
|
tag: "snk-entity-list",
|
@@ -3,8 +3,8 @@ 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-
|
7
|
-
import './filter-item-type.enum-
|
6
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
7
|
+
import './filter-item-type.enum-d45e026f.js';
|
8
8
|
|
9
9
|
const ICON_MODES = {
|
10
10
|
[UserInterface.SHORTTEXT]: 'text',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { FloatingManager, DateUtils, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
5
5
|
|
6
6
|
const SnkFilterItem = class {
|
@@ -128,7 +128,7 @@ const SnkFilterItem = class {
|
|
128
128
|
}
|
129
129
|
}
|
130
130
|
getLabel(isTooltipLabel = false) {
|
131
|
-
var _a;
|
131
|
+
var _a, _b;
|
132
132
|
const { type, value, label, props, groupedItems = [] } = this.config;
|
133
133
|
if (value || groupedItems.length) {
|
134
134
|
if (type === FilterItemType.BINARY_SELECT) {
|
@@ -189,18 +189,15 @@ const SnkFilterItem = class {
|
|
189
189
|
}
|
190
190
|
if (type === FilterItemType.MULTI_LIST) {
|
191
191
|
const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
}
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
202
|
-
}
|
203
|
-
return `${label}: ${selectedOptions[0].label}`;
|
192
|
+
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
193
|
+
}
|
194
|
+
if (type === FilterItemType.CHECK_BOX_LIST) {
|
195
|
+
const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
|
196
|
+
.filter(([_, value]) => value === true)
|
197
|
+
.map(([key, _]) => key);
|
198
|
+
const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
|
199
|
+
const selectedOptions = options.filter(option => selectedValues.includes(option.name));
|
200
|
+
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
204
201
|
}
|
205
202
|
if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
|
206
203
|
const { start, end } = value;
|
@@ -218,6 +215,20 @@ const SnkFilterItem = class {
|
|
218
215
|
}
|
219
216
|
return label;
|
220
217
|
}
|
218
|
+
getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
|
219
|
+
const checkedAmount = selectedOptions.length;
|
220
|
+
if (checkedAmount === 0) {
|
221
|
+
return `${label}`;
|
222
|
+
}
|
223
|
+
if (checkedAmount > 1) {
|
224
|
+
if (isTooltipLabel) {
|
225
|
+
const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
|
226
|
+
return `${label}: ${selectedOptionsDescrptions.join(',')}`;
|
227
|
+
}
|
228
|
+
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
229
|
+
}
|
230
|
+
return `${label}: ${selectedOptions[0].label}`;
|
231
|
+
}
|
221
232
|
calculateActiveCount(groupedItems) {
|
222
233
|
return groupedItems.reduce((total, item) => {
|
223
234
|
if (!!item.visible)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
5
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
5
|
+
import { C as ConfigStorage } from './ConfigStorage-9a086412.js';
|
6
6
|
import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
|
7
7
|
import './form-config-fetcher-24f43afd.js';
|
8
8
|
import './DataFetcher-7814568f.js';
|
@@ -42,6 +42,8 @@ const SnkFilterModalItem = class {
|
|
42
42
|
return { tag: "snk-filter-number", props };
|
43
43
|
case FilterItemType.PERSONALIZED:
|
44
44
|
return this.buildSnkFilterPersonalizedProps();
|
45
|
+
case FilterItemType.CHECK_BOX_LIST:
|
46
|
+
return { tag: "snk-filter-checkbox-list", props };
|
45
47
|
case FilterItemType.MULTI_LIST:
|
46
48
|
return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
|
47
49
|
}
|
@@ -65,7 +67,7 @@ const SnkFilterModalItem = class {
|
|
65
67
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
|
66
68
|
}
|
67
69
|
else {
|
68
|
-
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
|
70
|
+
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
|
69
71
|
}
|
70
72
|
}
|
71
73
|
handleDeleteFilter(filter, filterItemType) {
|
@@ -2,9 +2,9 @@ import { r as registerInstance, h } from './index-a7d3d3f1.js';
|
|
2
2
|
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
3
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
|
5
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
5
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
6
6
|
import { ObjectUtils } from '@sankhyalabs/core';
|
7
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-
|
7
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
8
8
|
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
9
9
|
import './index-ae591a44.js';
|
10
10
|
|
@@ -124,10 +124,15 @@ const SnkFilterModal = class {
|
|
124
124
|
const index = filterListCopy.findIndex(item => item.id === filterItem.id);
|
125
125
|
filterListCopy.splice(index, 1, filterItemCopy);
|
126
126
|
this.filters = ObjectUtils.copy(filterListCopy);
|
127
|
+
return;
|
127
128
|
}
|
128
|
-
|
129
|
-
|
129
|
+
if (FilterItemType.CHECK_BOX_LIST === filterItem.type) {
|
130
|
+
const filterListCopy = ObjectUtils.copy(this.filters);
|
131
|
+
filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
|
132
|
+
this.filters = ObjectUtils.copy(filterListCopy);
|
133
|
+
return;
|
130
134
|
}
|
135
|
+
this.filters.find(filter => filter.id === filterItem.id).value = undefined;
|
131
136
|
}
|
132
137
|
uncheckFilterValues(valueList) {
|
133
138
|
valueList.forEach(value => {
|
@@ -176,11 +181,17 @@ const SnkFilterModal = class {
|
|
176
181
|
getIformedFiltersCount(listItems) {
|
177
182
|
let countInformedItens = 0;
|
178
183
|
listItems.forEach(item => {
|
179
|
-
var _a, _b, _c, _d, _e;
|
184
|
+
var _a, _b, _c, _d, _e, _f;
|
180
185
|
if (FilterItemType.MULTI_LIST === item.type) {
|
181
186
|
countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
|
182
187
|
return;
|
183
188
|
}
|
189
|
+
if (FilterItemType.CHECK_BOX_LIST === item.type) {
|
190
|
+
countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
|
191
|
+
.filter(([_, value]) => value === true)
|
192
|
+
.map(([key, _]) => key).length;
|
193
|
+
return;
|
194
|
+
}
|
184
195
|
if (item.groupedItems != undefined) {
|
185
196
|
countInformedItens = item.groupedItems.filter(item => item.visible).length;
|
186
197
|
return;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
|
5
5
|
const SnkFilterMultiSelect = class {
|
6
6
|
constructor(hostRef) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
5
5
|
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
5
5
|
|
6
6
|
const SnkFilterPeriod = class {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
|
5
5
|
const SnkFilterSearch = class {
|
6
6
|
constructor(hostRef) {
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-709e68a2.js';
|
4
4
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
5
|
-
import './ConfigStorage-
|
5
|
+
import './ConfigStorage-9a086412.js';
|
6
6
|
import './form-config-fetcher-24f43afd.js';
|
7
7
|
import './DataFetcher-7814568f.js';
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
9
9
|
import './PrintUtils-3e4ff0f5.js';
|
10
|
-
import './filter-item-type.enum-
|
10
|
+
import './filter-item-type.enum-d45e026f.js';
|
11
11
|
|
12
12
|
const snkFormCss = ".sc-snk-form-h{--snk-form__header--min-height:94px;display:block}.snk-form__form--hidden.sc-snk-form{display:none}";
|
13
13
|
|
@@ -2,13 +2,13 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
2
2
|
import { StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
|
5
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
5
|
+
import { C as ConfigStorage } from './ConfigStorage-9a086412.js';
|
6
6
|
import { O as ORDER_VALUES } from './constants-8457af36.js';
|
7
7
|
import './form-config-fetcher-24f43afd.js';
|
8
8
|
import './DataFetcher-7814568f.js';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
10
|
import './PrintUtils-3e4ff0f5.js';
|
11
|
-
import './filter-item-type.enum-
|
11
|
+
import './filter-item-type.enum-d45e026f.js';
|
12
12
|
|
13
13
|
const snkGridConfigCss = ".sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);--snk-grid-config__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-grid-config__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-grid-config__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-grid-config__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__scrollbar--width:var(--space--medium, 12px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-grid-config-h{width:359px;max-width:359px}}.padding-right--medium.sc-snk-grid-config{padding-right:var(--space--medium)}ez-list.sc-snk-grid-config{height:100%}.height-calc.sc-snk-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-snk-grid-config{display:flex;justify-content:flex-end;width:100%;padding-top:var(--snk-grid-config__footer--padding-top)}.hidden.sc-snk-grid-config{display:none}.tabselector-container.sc-snk-grid-config{padding:var(--snk-grid-config__tabselector-container--padding) 0}.button-close.sc-snk-grid-config{padding-left:var(--snk-grid-config__button-close--padding-left)}.title-container.sc-snk-grid-config{display:flex;justify-content:space-between;align-items:center;width:100%}.title.sc-snk-grid-config{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-grid-config__title--color);font-size:var(--snk-grid-config__title--font-size);font-family:var(--snk-grid-config__title--font-family);font-weight:var(--snk-grid-config__title--font-weight)}.subtitle.sc-snk-grid-config{color:var(--text--primary);font-size:var(--snk-grid-config__subtitle--font-size);font-family:var(--snk-grid-config__subtitle--font-family)}.grid-config__main.sc-snk-grid-config{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-grid-config__scrollbar--color-clicked) var(--snk-grid-config__scrollbar--color-background);padding-right:var(--snk-grid-config__main--padding-right)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar{width:var(--snk-grid-config__scrollbar--width);max-width:var(--snk-grid-config__scrollbar--width);min-width:var(--snk-grid-config__scrollbar--width);background-color:var(--snk-grid-config__scrollbar--color-background)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-track{background-color:var(--snk-grid-config__scrollbar--color-background);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb{background-color:var(--snk-grid-config__scrollbar--color-default);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:hover,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-grid-config__scrollbar--color-hover)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:active,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-grid-config__scrollbar--color-clicked)}.group-name.sc-snk-grid-config{font-family:var(--snk-grid-config__group--font-family);font-size:var(--snk-grid-config__group--font-size);font-weight:var(--snk-grid-config__group--font-weight);padding-bottom:var(--snk-grid-config__group--padding-bottom)}";
|
14
14
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElem
|
|
2
2
|
import { SortMode, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
5
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
5
|
+
import { C as ConfigStorage } from './ConfigStorage-9a086412.js';
|
6
6
|
import { P as PresentationMode } from './index-1564817d.js';
|
7
7
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
8
8
|
import { s as store } from './index-bdf75557.js';
|
@@ -11,7 +11,7 @@ import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
11
11
|
import './form-config-fetcher-24f43afd.js';
|
12
12
|
import './DataFetcher-7814568f.js';
|
13
13
|
import './PrintUtils-3e4ff0f5.js';
|
14
|
-
import './filter-item-type.enum-
|
14
|
+
import './filter-item-type.enum-d45e026f.js';
|
15
15
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
16
16
|
import './PreloadManager-c1c2f2b4.js';
|
17
17
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
|
2
2
|
import { Action, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-709e68a2.js';
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
5
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
6
6
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
@@ -13,7 +13,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
13
13
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
14
14
|
import './dataunit-fetcher-aa70ea72.js';
|
15
15
|
import './PreloadManager-c1c2f2b4.js';
|
16
|
-
import './filter-item-type.enum-
|
16
|
+
import './filter-item-type.enum-d45e026f.js';
|
17
17
|
import './form-config-fetcher-24f43afd.js';
|
18
18
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
19
19
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-9c50ebea.js';
|
2
2
|
import './index-a7d3d3f1.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
|
-
import './SnkFormConfigManager-
|
5
|
-
import './ConfigStorage-
|
4
|
+
import './SnkFormConfigManager-709e68a2.js';
|
5
|
+
import './ConfigStorage-9a086412.js';
|
6
6
|
import './form-config-fetcher-24f43afd.js';
|
7
7
|
import './DataFetcher-7814568f.js';
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
9
9
|
import './PrintUtils-3e4ff0f5.js';
|
10
|
-
import './filter-item-type.enum-
|
10
|
+
import './filter-item-type.enum-d45e026f.js';
|
11
11
|
import '@sankhyalabs/ezui/dist/collection/utils/form';
|
12
12
|
import './taskbar-processor-94402e6e.js';
|
13
13
|
import './taskbar-elements-0a6b8b95.js';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils, UserInterface, ApplicationContext } from '@sankhyalabs/core';
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
|
5
5
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
6
6
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
@@ -1,11 +1,11 @@
|
|
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-
|
4
|
-
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-
|
3
|
+
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
4
|
+
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-9a086412.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { a as FilterGroupCondition } from './index-ae591a44.js';
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
8
|
-
import './filter-item-type.enum-
|
8
|
+
import './filter-item-type.enum-d45e026f.js';
|
9
9
|
import './form-config-fetcher-24f43afd.js';
|
10
10
|
import './DataFetcher-7814568f.js';
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -10,7 +10,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
11
|
import { I as InMemoryLoader } from './dataunit-fetcher-aa70ea72.js';
|
12
12
|
import './PreloadManager-c1c2f2b4.js';
|
13
|
-
import './filter-item-type.enum-
|
13
|
+
import './filter-item-type.enum-d45e026f.js';
|
14
14
|
import './form-config-fetcher-24f43afd.js';
|
15
15
|
import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
|
16
16
|
import { S as SnkMultiSelectionListDataSource } from './SnkMultiSelectionListDataSource-44494b0e.js';
|
@@ -1 +1 @@
|
|
1
|
-
import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{F as h}from"./p-
|
1
|
+
import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{F as h}from"./p-ff1990ad.js";import{E as a}from"./p-1a68fb59.js";import{F as l}from"./p-fa80e546.js";const n=class{constructor(s){i(this,s),this.valueChanged=t(this,"valueChanged",7),this._startIntervalLabel="Inicial",this._endIntervalLabel="Final",this.config=void 0,this.getMessage=void 0,this.value=void 0,this.presentationMode=a.CHIP}ezChangeListener(i){if(this.getVariation()===l.INTERVAL){const i=this._startInterval.value,t=this._endInterval.value;return this.value=i||t?{start:i,end:t}:void 0,void this.valueChanged.emit(this.value)}this.value=i.detail,this.valueChanged.emit(this.value)}async show(){this.getVariation()!==l.INTERVAL?this._numberElement.setFocus():this._startInterval.setFocus()}getIntervalValue(i){const t=this.value?this.value[i]:null;return null!=t?t:null}buildLabel(){if(this.presentationMode===a.CHIP)return s("label",{class:"ez-text ez-text--medium ez-text--primary ez-margin--medium"},"até")}getVariation(){var i,t;return null!==(t=null===(i=this.config.props)||void 0===i?void 0:i.variation)&&void 0!==t?t:l.DEFAULT}componentWillLoad(){this.getMessage&&(this._startIntervalLabel=this.getMessage("snkFilterBar.labelStart"),this._endIntervalLabel=this.getMessage("snkFilterBar.labelEnd"))}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}render(){var i,t,e;if(this.config&&this.config.type===h.NUMBER)return this.getVariation()===l.INTERVAL?s("div",{class:"ez-col ez-col--nowrap"},s("ez-number-input",{id:`${this.config.id}_start`,class:this.presentationMode===a.MODAL?"ez-padding--small":"",label:this._startIntervalLabel,ref:i=>this._startInterval=i,value:this.getIntervalValue("start"),precision:null===(i=this.config.props)||void 0===i?void 0:i.precision}),this.buildLabel(),s("ez-number-input",{id:`${this.config.id}_end`,class:this.presentationMode===a.MODAL?"ez-padding--small":"",label:this._endIntervalLabel,ref:i=>this._endInterval=i,value:this.getIntervalValue("end"),precision:null===(t=this.config.props)||void 0===t?void 0:t.precision})):s("ez-number-input",{id:this.config.id,ref:i=>this._numberElement=i,label:this.config.label,value:this.config.value,precision:null===(e=this.config.props)||void 0===e?void 0:e.precision})}get _element(){return e(this)}};export{n as snk_filter_number}
|
@@ -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-ff1990ad.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}
|
@@ -0,0 +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,KeyboardManager as u,OnboardingUtils as l,DependencyType as p,ElementIDUtils as d,DataType as m,ApplicationContext as w,ErrorTracking as f}from"@sankhyalabs/core";import{ApplicationUtils as y}from"@sankhyalabs/ezui/dist/collection/utils";import{C as P}from"./p-5cff2f60.js";import{d as v,D as g,U as A}from"./p-88039a7f.js";import{A as I,a as _}from"./p-3f0fe056.js";import{D as S}from"./p-ee49df44.js";import{P as D}from"./p-e38f28ae.js";import{S as k}from"./p-aa3b0d19.js";import"./p-e47d966c.js";import"./p-ff1990ad.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 C{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 L{[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 T("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 T{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 O{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",v.gql`query($name: String!) {
|
2
|
+
$queryAlias$: fetchResource(name: $name){
|
3
|
+
name
|
4
|
+
resource
|
5
|
+
}
|
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 j{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",v.gql`query($filters: [InputFilter!] $name: String!) {
|
7
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
8
|
+
name
|
9
|
+
value
|
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)=>{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 U(){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(U=function(){return t})()}const M=$;function $(t,s){const e=U();return($=function(t){return e[t-=392]})(t,s)}!function(){const t=$,s=U();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 F=M(396);var R;class q{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 showDesktop(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.showDesktop)||void 0===s||s.call(t)}static searchApp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.searchApp)||void 0===s||s.call(t)}static openHelp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.openHelp)||void 0===s||s.call(t)}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())}}q.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 x=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._keyboardManager=new u,this._duCache=new Map,this._duPromises=new Map,this._requestListener=new B,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 O),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 V(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 getKeyboardManager(){return Promise.resolve(this._keyboardManager)}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){l.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}showAlerts(t){return y.showAlerts({alerts:t})}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){q.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{C.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 V(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")||q.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 y.alert(t,s,e,i)}async error(t,s,e,i){return y.error(t,s,e,i)}async success(t,s,e,i){return y.success(t,s,e,i)}async message(t,s,e,i){return y.message(t,s,e,i)}async confirm(t,s,e,i,n){return y.confirm(t,s,e,i,n)}async info(t,s){return y.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 L).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=A.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 S),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new j),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new D),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new _),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 l;const d={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===p.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(l={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||m.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:l,searchOptions:d})}}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[d.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 q.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=A.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?A.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):A.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?m.NUMBER:"boolean"==typeof t||t instanceof Boolean?m.BOOLEAN:t instanceof Date?m.DATE:m.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 y.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&&q.setScreenToUseV3Layout(),"CANCEL"===t.detail&&q.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(){w.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new z(this),this.messagesBuilder=new k,w.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${A.getUrlBase()}/mge/upload/file`),w.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),w.setContextValue("__EZUI__GRID_LICENSE__",F),this.registerPkChangeListener(),f.init(),P.preload(this.applicationResourceID,this.configName),document.addEventListener("click",(()=>q.applicationClick()))}connectedCallback(){w.setContextValue("__SNK__APPLICATION__",this),g.addRequestListener(this._requestListener)}disconnectedCallback(){g.removeRequestListener(this._requestListener),this.removeShortcuts()}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{w.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),d.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup(),this.initKeyboardManager()}initKeyboardManager(){this._keyboardManager.bind("ctrl + g",q.searchApp.bind(this),{description:"Pesquisar por telas"}).bind("ctrl + d",q.showDesktop.bind(this),{description:"Mostrar o desktop"}).bind("F1",q.openHelp.bind(this),{description:"Abrir ajuda"})}removeShortcuts(){this._keyboardManager.unbind("ctrl + g").unbind("ctrl + d").unbind("F1")}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 B{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 V{constructor(t,s){this.resolve=t,this.reject=s}}x.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{x as snk_application}
|