@sankhyalabs/sankhyablocks 6.5.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{PersonalizedFilterUtils-7d959e91.js → PersonalizedFilterUtils-cfcd9af2.js} +47 -10
- package/dist/cjs/{SnkMessageBuilder-aec46b5d.js → SnkMessageBuilder-ba6d4ade.js} +4 -1
- package/dist/cjs/{index-614af008.js → index-0e663819.js} +0 -36
- 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 +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-ba0c368c.js → snk-data-unit-5f434275.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-expression-group.cjs.entry.js +21 -17
- package/dist/cjs/snk-expression-item_3.cjs.entry.js +21 -31
- package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -16
- package/dist/cjs/snk-filter-detail.cjs.entry.js +11 -7
- package/dist/cjs/snk-filter-item.cjs.entry.js +16 -7
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +10 -8
- package/dist/cjs/snk-filter-modal.cjs.entry.js +13 -7
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-7bedfa91.js → snk-guides-viewer-27586701.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/{snk-filter-personalized.cjs.entry.js → snk-personalized-filter-editor.cjs.entry.js} +35 -12
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +24 -13
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-7f91f4cd.js → taskbar-elements-b98dd6e9.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.js → snk-personalized-filter-editor/snk-personalized-filter-editor.js} +36 -13
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +9 -5
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +16 -7
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +11 -5
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +10 -8
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +4 -5
- package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +2 -12
- package/dist/collection/components/snk-personalized-filter/interfaces/index.js +39 -0
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +24 -12
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +25 -21
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +7 -7
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +3 -3
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +6 -6
- package/dist/collection/lib/@types/index.js +0 -36
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +4 -1
- package/dist/components/PersonalizedFilterUtils.js +49 -7
- package/dist/components/SnkMessageBuilder.js +4 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -37
- package/dist/components/snk-expression-group2.js +22 -23
- package/dist/components/snk-expression-item2.js +4 -4
- package/dist/components/snk-filter-bar2.js +5 -7
- package/dist/components/snk-filter-detail2.js +9 -5
- package/dist/components/snk-filter-field-search2.js +2 -12
- package/dist/components/snk-filter-item2.js +16 -7
- package/dist/components/snk-filter-modal-item2.js +10 -8
- package/dist/components/snk-filter-modal.js +11 -5
- package/dist/components/snk-filter-param-config2.js +1 -2
- package/dist/components/snk-personalized-filter-editor.d.ts +11 -0
- package/dist/components/{snk-filter-personalized.js → snk-personalized-filter-editor.js} +42 -19
- package/dist/components/snk-personalized-filter2.js +25 -13
- package/dist/esm/{PersonalizedFilterUtils-202cd721.js → PersonalizedFilterUtils-1a167d89.js} +44 -7
- package/dist/esm/{SnkMessageBuilder-a4f7d858.js → SnkMessageBuilder-9d2becfb.js} +4 -1
- package/dist/esm/index-1564817d.js +33 -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 +1 -1
- package/dist/esm/snk-attach.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-3ecaf52c.js → snk-data-unit-ca4bcba6.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-expression-group.entry.js +21 -17
- package/dist/esm/snk-expression-item_3.entry.js +7 -17
- package/dist/esm/snk-filter-bar.entry.js +6 -7
- package/dist/esm/snk-filter-detail.entry.js +11 -7
- package/dist/esm/snk-filter-item.entry.js +16 -7
- package/dist/esm/snk-filter-modal-item.entry.js +10 -8
- package/dist/esm/snk-filter-modal.entry.js +13 -7
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-9240c017.js → snk-guides-viewer-950dd3b5.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/{snk-filter-personalized.entry.js → snk-personalized-filter-editor.entry.js} +35 -12
- package/dist/esm/snk-personalized-filter.entry.js +24 -13
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-139b1058.js → taskbar-elements-2c761819.js} +1 -1
- package/dist/sankhyablocks/{p-ab33e180.js → p-01070d6d.js} +1 -1
- package/dist/sankhyablocks/p-25df01a1.entry.js +1 -0
- package/dist/sankhyablocks/p-30134b16.entry.js +1 -0
- package/dist/sankhyablocks/{p-09f33525.entry.js → p-402db136.entry.js} +1 -1
- package/dist/sankhyablocks/p-40a5d35e.entry.js +1 -0
- package/dist/sankhyablocks/p-5534e08c.js +1 -0
- package/dist/sankhyablocks/{p-257aeea4.entry.js → p-5e06e139.entry.js} +1 -1
- package/dist/sankhyablocks/{p-43485c54.js → p-602dfb9e.js} +1 -1
- package/dist/sankhyablocks/{p-78a226a1.js → p-6f4f88ef.js} +1 -1
- package/dist/sankhyablocks/p-775e60f5.entry.js +1 -0
- package/dist/sankhyablocks/{p-aa4e880f.entry.js → p-7c10486f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a1cab141.entry.js → p-7c50ded4.entry.js} +1 -1
- package/dist/sankhyablocks/p-7d68a43a.js +1 -0
- package/dist/sankhyablocks/{p-f75dceb1.entry.js → p-7f37b801.entry.js} +1 -1
- package/dist/sankhyablocks/p-86e10ecc.entry.js +1 -0
- package/dist/sankhyablocks/p-88a40b96.entry.js +1 -0
- package/dist/sankhyablocks/{p-f1edaec0.js → p-a2493d11.js} +1 -1
- package/dist/sankhyablocks/p-b6f9f702.entry.js +1 -0
- package/dist/sankhyablocks/{p-6564f621.entry.js → p-c2d3e4fb.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2adb4481.entry.js → p-c6380ea2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0d670404.entry.js → p-c7c4ed56.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e8be0aae.entry.js → p-ca29b093.entry.js} +1 -1
- package/dist/sankhyablocks/p-d881cab2.entry.js +1 -0
- package/dist/sankhyablocks/p-d9586ead.entry.js +1 -0
- package/dist/sankhyablocks/p-f8ce17d3.entry.js +1 -0
- package/dist/sankhyablocks/{p-cea58f8b.entry.js → p-fdc262aa.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.d.ts → snk-personalized-filter-editor/snk-personalized-filter-editor.d.ts} +8 -25
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +3 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
- package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +0 -1
- package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionItem.d.ts +1 -1
- package/dist/types/components/snk-personalized-filter/interfaces/IParameter.d.ts +37 -0
- package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IUserFilterConfig.d.ts +1 -1
- package/dist/types/components/snk-personalized-filter/interfaces/index.d.ts +35 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +3 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +5 -2
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +1 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +2 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +1 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
- package/dist/types/components.d.ts +62 -62
- package/dist/types/lib/@types/index.d.ts +0 -32
- package/dist/types/lib/configs/ConfigStorage.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +1 -1
- package/react/components.js +1 -1
- package/react/components.js.map +1 -1
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.js +0 -3
- package/dist/components/snk-filter-personalized.d.ts +0 -11
- package/dist/esm/index-a255b326.js +0 -69
- package/dist/sankhyablocks/p-0364abc8.entry.js +0 -1
- package/dist/sankhyablocks/p-18e3a2b7.entry.js +0 -1
- package/dist/sankhyablocks/p-36ecb6ab.js +0 -1
- package/dist/sankhyablocks/p-4374cc15.entry.js +0 -1
- package/dist/sankhyablocks/p-50c3700f.entry.js +0 -1
- package/dist/sankhyablocks/p-6ce48ae3.entry.js +0 -1
- package/dist/sankhyablocks/p-7add855c.entry.js +0 -1
- package/dist/sankhyablocks/p-abc4ae66.entry.js +0 -1
- package/dist/sankhyablocks/p-c7dd701c.entry.js +0 -1
- package/dist/sankhyablocks/p-d5a25c7d.entry.js +0 -1
- package/dist/sankhyablocks/p-e962ce72.entry.js +0 -1
- package/dist/sankhyablocks/p-eb90de43.js +0 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IParameter.d.ts +0 -21
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.d.ts +0 -3
- /package/dist/cjs/{IExpressionItem-1090c3fd.js → IExpressionItem-0e32ebb7.js} +0 -0
- /package/dist/collection/components/snk-filter-bar/filter-item/editors/{snk-filter-personalized/snk-filter-personalized.css → snk-personalized-filter-editor/snk-personalized-filter-editor.css} +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionGroup.js +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionItem.js +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IParameter.js +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IPersonalizedFilter.js +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/ISystemFilterConfig.js +0 -0
- /package/dist/collection/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IUserFilterConfig.js +0 -0
- /package/dist/esm/{IExpressionItem-2e922b2c.js → IExpressionItem-21f225bf.js} +0 -0
- /package/dist/sankhyablocks/{p-c6bf66e0.js → p-63bff2a8.js} +0 -0
- /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IExpressionGroup.d.ts +0 -0
- /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/IPersonalizedFilter.d.ts +0 -0
- /package/dist/types/components/snk-personalized-filter/{subcomponents/snk-filter-param-config/interfaces → interfaces}/ISystemFilterConfig.d.ts +0 -0
@@ -1,19 +1,13 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, forceUpdate, Host } from '@stencil/core/internal/client';
|
2
|
+
import { F as FilterGroupCondition } from './PersonalizedFilterUtils.js';
|
2
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
3
4
|
import { ApplicationContext, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
4
5
|
import { d as defineCustomElement$3 } from './snk-expression-item2.js';
|
5
6
|
import { d as defineCustomElement$2 } from './snk-filter-field-search2.js';
|
6
7
|
import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
|
7
8
|
|
8
|
-
var FilterGroupCondition;
|
9
|
-
(function (FilterGroupCondition) {
|
10
|
-
FilterGroupCondition["AND"] = "AND";
|
11
|
-
FilterGroupCondition["OR"] = "OR";
|
12
|
-
})(FilterGroupCondition || (FilterGroupCondition = {}));
|
13
|
-
|
14
9
|
const snkExpressionGroupCss = ".sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff)}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition=\"AND\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition=\"OR\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}";
|
15
10
|
|
16
|
-
const LIMIT_GROUP_LEVEL = 4;
|
17
11
|
const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
18
12
|
constructor() {
|
19
13
|
super();
|
@@ -22,6 +16,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
22
16
|
this.ezFilterGroupRemove = createEvent(this, "ezFilterGroupRemove", 7);
|
23
17
|
this.ezExpressionGroupLayoutChanged = createEvent(this, "ezExpressionLayoutChanged", 7);
|
24
18
|
this.FIRST_LEVEL = "0";
|
19
|
+
this.LIMIT_GROUP_LEVEL = 4;
|
25
20
|
this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
26
21
|
this._conditionOperator = FilterGroupCondition.AND;
|
27
22
|
this._group = undefined;
|
@@ -48,11 +43,11 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
48
43
|
}
|
49
44
|
watchGroup(newValue) {
|
50
45
|
this._group = newValue;
|
51
|
-
this._conditionOperator =
|
46
|
+
this._conditionOperator = this.getOperand();
|
52
47
|
}
|
53
48
|
componentWillLoad() {
|
54
49
|
this._group = this.group;
|
55
|
-
this._conditionOperator =
|
50
|
+
this._conditionOperator = this.getOperand();
|
56
51
|
if (!this.getDataGroupLevel()) {
|
57
52
|
this._element.setAttribute('data-group-level', this.FIRST_LEVEL);
|
58
53
|
}
|
@@ -78,6 +73,9 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
78
73
|
getDashedHeight() {
|
79
74
|
return this._selfTop - this.parentTop;
|
80
75
|
}
|
76
|
+
getOperand() {
|
77
|
+
return !this._group.operand ? FilterGroupCondition.AND : this._group.operand;
|
78
|
+
}
|
81
79
|
getMessage(key, params) {
|
82
80
|
return this.application.messagesBuilder.getMessage(key, params);
|
83
81
|
}
|
@@ -111,18 +109,19 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
111
109
|
this.changeHandler();
|
112
110
|
this.canAddExpression = true;
|
113
111
|
}
|
112
|
+
isFilledItem(item) {
|
113
|
+
if (!item.fieldName || !item.operand)
|
114
|
+
return false;
|
115
|
+
if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
|
116
|
+
return true;
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
|
120
|
+
}
|
121
|
+
}
|
114
122
|
handleFilterItemChange() {
|
115
123
|
this.ezFilterGroupChange.emit(this._group);
|
116
|
-
this.canAddExpression = this.group.items.every(
|
117
|
-
if (!item.fieldName || !item.operand)
|
118
|
-
return false;
|
119
|
-
if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
|
120
|
-
return true;
|
121
|
-
}
|
122
|
-
else {
|
123
|
-
return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
|
124
|
-
}
|
125
|
-
});
|
124
|
+
this.canAddExpression = this.group.items.every(this.isFilledItem);
|
126
125
|
}
|
127
126
|
handleAddExpression() {
|
128
127
|
const newItem = {
|
@@ -211,7 +210,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
211
210
|
}
|
212
211
|
canAddGroup() {
|
213
212
|
const dataGroupLevel = Number(this.getDataGroupLevel() || this.FIRST_LEVEL);
|
214
|
-
return dataGroupLevel < LIMIT_GROUP_LEVEL;
|
213
|
+
return dataGroupLevel < this.LIMIT_GROUP_LEVEL;
|
215
214
|
}
|
216
215
|
isFirstLevel() {
|
217
216
|
return Boolean(this.getDataGroupLevel() === this.FIRST_LEVEL);
|
@@ -220,7 +219,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
220
219
|
evt.preventDefault();
|
221
220
|
evt.stopPropagation();
|
222
221
|
}
|
223
|
-
|
222
|
+
getMessageAddTooltip() {
|
224
223
|
if (this.isFirstLevel()) {
|
225
224
|
const allValidItems = this.group.items.every(item => {
|
226
225
|
if (!item.fieldName || !item.operand)
|
@@ -239,7 +238,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
239
238
|
}
|
240
239
|
render() {
|
241
240
|
const canAddGroup = this.canAddGroup();
|
242
|
-
return (h(Host, null, h("div", { class: !this.isFirstLevel() && this._showDashes ? 'dashes' : 'hidden', style: this.buildGroupStyle() }), h("div", { class: !this.isFirstLevel() && this._showDashes ? 'horizontal-dashes' : 'hidden' }), h("div", { class: 'ez-flex ez-flex--align-items-center' }, h("div", { class: 'snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center', "data-condition": this._conditionOperator, title: this.getTooltipMessageForOperator() }, h("label", { class: "ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary" }, "
|
241
|
+
return (h(Host, null, h("div", { class: !this.isFirstLevel() && this._showDashes ? 'dashes' : 'hidden', style: this.buildGroupStyle() }), h("div", { class: !this.isFirstLevel() && this._showDashes ? 'horizontal-dashes' : 'hidden' }), h("div", { class: 'ez-flex ez-flex--align-items-center' }, h("div", { class: 'snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center', "data-condition": this._conditionOperator, title: this.getTooltipMessageForOperator() }, h("label", { class: "ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary" }, this.getMessage("snkPersonalizedFilter.info.condition")), h("div", null, h("ez-combo-box", Object.assign({ class: "snk-expression-group__container-option", canShowError: false, mode: "slim", suppressEmptyOption: true, enabled: this.canChangeGroupCondition(), value: this._conditionOperator, onEzChange: (evt) => this.handleConditionOperatorChange(evt.detail.value) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxConditions_level_${this.getDataGroupLevel()}` }), h("option", { value: FilterGroupCondition.AND }, "E"), h("option", { value: FilterGroupCondition.OR }, "OU")))), h("ez-button", { class: "ez-padding-right--medium ez-padding-left--medium", mode: "icon", iconName: "plus", size: "small", enabled: this.canAddExpression, title: this.getMessageAddTooltip(), onClick: () => this.handleAddExpression() }), h("ez-button", { label: this.getMessage("snkPersonalizedFilter.info.addGroup"), size: "small", enabled: canAddGroup, title: !canAddGroup ? this.getMessage('snkPersonalizedFilter.info.labelDisabledAddGroupButton', { LIMIT_GROUP_LEVEL: this.LIMIT_GROUP_LEVEL + 1 }) : '', onClick: () => this.handleAddGroup() }, h("ez-icon", { slot: "leftIcon", iconName: "plus" })), !this.isFirstLevel() && h("ez-button", { title: this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"), class: "ez-padding-left--medium", mode: "icon", iconName: "delete", size: "small", onClick: (evt) => this.confirmRemoveGroup(evt) })), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderExpressionItems())), h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, h("div", { class: "ez-padding-top--small" }, this.renderGroups()))));
|
243
242
|
}
|
244
243
|
get _element() { return this; }
|
245
244
|
static get watchers() { return {
|
@@ -293,4 +292,4 @@ function defineCustomElement() {
|
|
293
292
|
} });
|
294
293
|
}
|
295
294
|
|
296
|
-
export {
|
295
|
+
export { SnkExpressionGroup as S, defineCustomElement as d };
|
@@ -3,7 +3,7 @@ import { UserInterface, ApplicationContext, ElementIDUtils } from '@sankhyalabs/
|
|
3
3
|
import { a as SelectedItemType, d as defineCustomElement$2 } from './snk-filter-field-search2.js';
|
4
4
|
import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { fieldBuilder } from '@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder';
|
6
|
-
import {
|
6
|
+
import { a as FilterOperand } from './PersonalizedFilterUtils.js';
|
7
7
|
import { s as store } from './index3.js';
|
8
8
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
9
9
|
import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
|
@@ -36,7 +36,6 @@ const FIELD_TYPE_SEARCH_AND_TEXT = [
|
|
36
36
|
|
37
37
|
const snkExpressionItemCss = ".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid);--snk-expression-item__background-color-dashed:var(--background--body, #fafcff)}.box.sc-snk-expression-item{width:100%;height:56px;background:var(--snk-expression-item--background-color);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}.dashes.sc-snk-expression-item{z-index:var(--more-visible, 2);background:var(--snk-expression-item__background-color-dashed);border-bottom:2px dashed var(--text-secondary, #A2ABB9);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:62px;margin-left:-15px;margin-top:-33.5px}";
|
38
38
|
|
39
|
-
const DEFAULT_FIELD_NAME = 'NOT_DEFINED';
|
40
39
|
const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
41
40
|
constructor() {
|
42
41
|
super();
|
@@ -46,6 +45,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
46
45
|
this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
47
46
|
this.filterOperandDefault = FilterOperandDefault;
|
48
47
|
this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
|
48
|
+
this.DEFAULT_FIELD_NAME = 'NOT_DEFINED';
|
49
49
|
this._showValueVariable = false;
|
50
50
|
this._fieldSelected = undefined;
|
51
51
|
this._optionNotNull = false;
|
@@ -230,7 +230,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
230
230
|
if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData || this.expression.paramVariable || this._showValueVariable || !((_c = this._fieldSelected) === null || _c === void 0 ? void 0 : _c.dataType)) {
|
231
231
|
inputFieldData.$attrs$.enabled = false;
|
232
232
|
}
|
233
|
-
if (this.expression.value) {
|
233
|
+
if (this.expression.value != undefined) {
|
234
234
|
inputFieldData.$attrs$.value = this.getExpressiontValue(this.expression);
|
235
235
|
}
|
236
236
|
inputFieldData.$attrs$.onEzChange = (event) => {
|
@@ -285,7 +285,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
285
285
|
}
|
286
286
|
render() {
|
287
287
|
var _a;
|
288
|
-
return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
|
288
|
+
return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
|
289
289
|
h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
|
290
290
|
this.buildFieldByType()), h("div", { class: "box__container--input-value-variable" }, !this._optionNotNull &&
|
291
291
|
h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
|
@@ -4,9 +4,8 @@ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
6
6
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
7
|
-
import {
|
7
|
+
import { a as FilterOperand, P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
8
8
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
9
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
10
9
|
import { d as defineCustomElement$8 } from './snk-expression-group2.js';
|
11
10
|
import { d as defineCustomElement$7 } from './snk-expression-item2.js';
|
12
11
|
import { d as defineCustomElement$6 } from './snk-filter-detail2.js';
|
@@ -271,13 +270,12 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
271
270
|
this.processAfterUpdateConfig();
|
272
271
|
}
|
273
272
|
}
|
273
|
+
getPersonalizedFilterItem() {
|
274
|
+
return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
|
275
|
+
}
|
274
276
|
async processAfterUpdateConfig() {
|
275
277
|
if (this._loadingPending) {
|
276
|
-
const personalizedFilter = this.
|
277
|
-
if (item.type === FilterItemType.PERSONALIZED) {
|
278
|
-
return true;
|
279
|
-
}
|
280
|
-
});
|
278
|
+
const personalizedFilter = this.getPersonalizedFilterItem();
|
281
279
|
this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
|
282
280
|
if (this._pendingVariables) {
|
283
281
|
return;
|
@@ -51,12 +51,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
51
51
|
return { tag: "snk-filter-number" };
|
52
52
|
case FilterItemType.PERSONALIZED:
|
53
53
|
const snkFilterPersonalizedProps = {
|
54
|
-
tag: "snk-filter-
|
54
|
+
tag: "snk-personalized-filter-editor", props: {
|
55
55
|
presentationMode: EPresentationMode.CHIP,
|
56
|
-
onValueChanged:
|
57
|
-
const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
|
58
|
-
this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
|
59
|
-
}
|
56
|
+
onValueChanged: evt => this.handleValueChanged(evt),
|
60
57
|
}
|
61
58
|
};
|
62
59
|
return snkFilterPersonalizedProps;
|
@@ -65,6 +62,10 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
65
62
|
}
|
66
63
|
return { tag: "snk-filter-text" };
|
67
64
|
}
|
65
|
+
handleValueChanged({ detail }) {
|
66
|
+
const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
|
67
|
+
this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
|
68
|
+
}
|
68
69
|
removeItem() {
|
69
70
|
const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
|
70
71
|
const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
|
@@ -74,6 +75,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
74
75
|
}
|
75
76
|
this.changeConfig(removedConfig);
|
76
77
|
}
|
78
|
+
removeItemFromGroup(item) {
|
79
|
+
return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
|
80
|
+
}
|
77
81
|
getPopUpHeaderButtons() {
|
78
82
|
return (h(Fragment, 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 })))));
|
79
83
|
}
|
@@ -39,7 +39,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
39
39
|
super();
|
40
40
|
this.__registerHost();
|
41
41
|
this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
|
42
|
-
this._filterMetadataStorage = new Map();
|
43
42
|
this._currentMetadata = null;
|
44
43
|
this._filterText = "";
|
45
44
|
this._isLoading = false;
|
@@ -82,15 +81,8 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
82
81
|
async loadData() {
|
83
82
|
var _a, _b;
|
84
83
|
this._isLoading = true;
|
85
|
-
let metadata;
|
86
|
-
|
87
|
-
metadata = this._filterMetadataStorage.get(this._currentLink.uri);
|
88
|
-
}
|
89
|
-
if (!metadata) {
|
90
|
-
metadata = await this.fieldsDataSource.fetchData(this._currentLink);
|
91
|
-
this._currentLink = metadata.currentLink;
|
92
|
-
this._filterMetadataStorage.set(this._currentLink.uri, metadata);
|
93
|
-
}
|
84
|
+
let metadata = await this.fieldsDataSource.fetchData(this._currentLink);
|
85
|
+
this._currentLink = metadata.currentLink;
|
94
86
|
const { fields, links } = metadata || {};
|
95
87
|
if (!Array.isArray(fields) || !Array.isArray(links))
|
96
88
|
throw new Error('Invalid metadata');
|
@@ -143,7 +135,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
143
135
|
if (this._isLoading)
|
144
136
|
return;
|
145
137
|
const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
|
146
|
-
item.cache = this._filterMetadataStorage.has(item.uri);
|
147
138
|
if (breadcrumbByIndex > -1) {
|
148
139
|
this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
|
149
140
|
}
|
@@ -195,7 +186,6 @@ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
195
186
|
}
|
196
187
|
disconnectedCallback() {
|
197
188
|
var _a;
|
198
|
-
this._filterMetadataStorage.clear();
|
199
189
|
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
|
200
190
|
}
|
201
191
|
render() {
|
@@ -183,11 +183,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
183
183
|
return `${label}: ${value.value} - ${value.label}`;
|
184
184
|
}
|
185
185
|
if (type === FilterItemType.PERSONALIZED) {
|
186
|
-
const activeCount =
|
187
|
-
if (!!item.visible)
|
188
|
-
return total + 1;
|
189
|
-
return total;
|
190
|
-
}, 0);
|
186
|
+
const activeCount = this.calculateActiveCount(groupedItems);
|
191
187
|
if (activeCount <= 0)
|
192
188
|
return label;
|
193
189
|
return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
|
@@ -211,6 +207,13 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
211
207
|
}
|
212
208
|
return label;
|
213
209
|
}
|
210
|
+
calculateActiveCount(groupedItems) {
|
211
|
+
return groupedItems.reduce((total, item) => {
|
212
|
+
if (!!item.visible)
|
213
|
+
return total + 1;
|
214
|
+
return total;
|
215
|
+
}, 0);
|
216
|
+
}
|
214
217
|
applyTooltip() {
|
215
218
|
if (!this.config.value)
|
216
219
|
return undefined;
|
@@ -259,13 +262,19 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
259
262
|
}
|
260
263
|
return undefined;
|
261
264
|
}
|
265
|
+
hasActiveElements(value) {
|
266
|
+
var _a, _b, _c;
|
267
|
+
return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
268
|
+
}
|
269
|
+
hasActiveValue(config) {
|
270
|
+
return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
|
271
|
+
}
|
262
272
|
getEnabledChip() {
|
263
|
-
var _a, _b, _c, _d;
|
264
273
|
if (this.config.type === FilterItemType.PERSONALIZED) {
|
265
274
|
const { groupedItems = [] } = this.config;
|
266
275
|
return groupedItems.some(item => item.visible);
|
267
276
|
}
|
268
|
-
return
|
277
|
+
return this.hasActiveValue(this.config);
|
269
278
|
}
|
270
279
|
render() {
|
271
280
|
const leftIcon = this.getLeftIconName();
|
@@ -46,19 +46,21 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
46
46
|
case FilterItemType.NUMBER:
|
47
47
|
return { tag: "snk-filter-number" };
|
48
48
|
case FilterItemType.PERSONALIZED:
|
49
|
-
|
50
|
-
tag: "snk-filter-personalized", props: {
|
51
|
-
onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
|
52
|
-
onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
|
53
|
-
onAddFilter: () => this.addPersonalizedFilter.emit(),
|
54
|
-
}
|
55
|
-
};
|
56
|
-
return snkFilterPersonalizedProps;
|
49
|
+
return this.buildSnkFilterPersonalizedProps();
|
57
50
|
case FilterItemType.MULTI_LIST:
|
58
51
|
return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
|
59
52
|
}
|
60
53
|
return { tag: "snk-filter-text" };
|
61
54
|
}
|
55
|
+
buildSnkFilterPersonalizedProps() {
|
56
|
+
return {
|
57
|
+
tag: "snk-personalized-filter-editor", props: {
|
58
|
+
onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
|
59
|
+
onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
|
60
|
+
onAddFilter: () => this.addPersonalizedFilter.emit(),
|
61
|
+
}
|
62
|
+
};
|
63
|
+
}
|
62
64
|
isVisible(newValue) {
|
63
65
|
return !this.filterItem.visible ? newValue !== undefined : true;
|
64
66
|
}
|
@@ -71,7 +71,7 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
71
71
|
});
|
72
72
|
}
|
73
73
|
handleClose() {
|
74
|
-
const hasChangesToSave =
|
74
|
+
const hasChangesToSave = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
|
75
75
|
if (!hasChangesToSave) {
|
76
76
|
this.closeModal();
|
77
77
|
return;
|
@@ -81,13 +81,19 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
81
81
|
this.closeModal();
|
82
82
|
});
|
83
83
|
}
|
84
|
-
|
84
|
+
handleApplyFilters() {
|
85
85
|
const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
|
86
|
+
if (this.isValidCustomFilter(filterPersonalized)) {
|
87
|
+
this.applyFilters(this.filters);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
isValidCustomFilter(filterPersonalized) {
|
86
91
|
const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
87
92
|
if (!isValid) {
|
88
|
-
|
93
|
+
ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
|
94
|
+
return false;
|
89
95
|
}
|
90
|
-
|
96
|
+
return true;
|
91
97
|
}
|
92
98
|
modalActionListener(evt) {
|
93
99
|
const modalAction = evt.detail;
|
@@ -96,7 +102,7 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
96
102
|
this.handleClearAll();
|
97
103
|
break;
|
98
104
|
case ModalAction.OK:
|
99
|
-
this.
|
105
|
+
this.handleApplyFilters();
|
100
106
|
break;
|
101
107
|
case ModalAction.CLOSE:
|
102
108
|
this.handleClose();
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
2
2
|
import { StringUtils, DataType, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
4
|
-
import {
|
5
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
4
|
+
import { b as FilterConfigType, P as PersonalizedFilterUtils, c as FilterEntities, d as FilterUserConfigTypes } from './PersonalizedFilterUtils.js';
|
6
5
|
|
7
6
|
const snkFilterParamConfigCss = ":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)}";
|
8
7
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface SnkPersonalizedFilterEditor extends Components.SnkPersonalizedFilterEditor, HTMLElement {}
|
4
|
+
export const SnkPersonalizedFilterEditor: {
|
5
|
+
prototype: SnkPersonalizedFilterEditor;
|
6
|
+
new (): SnkPersonalizedFilterEditor;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h,
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
2
|
import { ElementIDUtils, UserInterface, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
4
4
|
import { E as EPresentationMode } from './presentationMode.js';
|
5
5
|
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
6
6
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
7
7
|
|
8
|
-
const
|
8
|
+
const snkPersonalizedFilterEditorCss = ".sc-snk-personalized-filter-editor-h{--snk-filter-personalized__max-height:21;--snk-filter-personalized__max-width:21.5}.SnkFilterPersonalized_list-container.sc-snk-personalized-filter-editor{margin:0;padding:0;list-style:none;display:flex;flex-direction:column}.SnkFilterPersonalized_list-container-chip.sc-snk-personalized-filter-editor{width:400px}.SnkFilterPersonalized_list-scroller.sc-snk-personalized-filter-editor{display:block;max-height:calc(var(--space--2xl) * var(--snk-filter-personalized__max-height));cursor:auto;--ez-scroller__max-height:300px}.SnkFilterPersonalized_checkbox.sc-snk-personalized-filter-editor{display:grid;grid-template-columns:auto auto;justify-content:start}.SnkFilterPersonalized_list-container.sc-snk-personalized-filter-editor:has(.SnkFilterPersonalized_list-item--chip){gap:var(--space--small, 6px);max-width:calc(var(--space--md) * var(--snk-filter-personalized__max-width))}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor{display:flex;border-radius:var(--border--radius-regular)}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor:hover{background-color:var(--background--medium, #f0f3f7)}.SnkFilterPersonalized_list-actions.sc-snk-personalized-filter-editor{display:none;align-items:center}.SnkFilterPersonalized_list-item--modal.sc-snk-personalized-filter-editor:hover .SnkFilterPersonalized_list-actions.sc-snk-personalized-filter-editor{display:flex}.SnkFilterPersonalized_list-item--chip.sc-snk-personalized-filter-editor{display:flex;flex-direction:column;border:var(--border--small, 1px solid) var(--color-strokes, #DCE0E8);border-radius:var(--border--radius-regular)}.SnkFilterPersonalized_list-item--chip.sc-snk-personalized-filter-editor .sc-snk-personalized-filter-editor:first-of-type{gap:var(--space--3xs)}";
|
9
9
|
|
10
|
-
const SnkFilterPersonalized
|
10
|
+
const SnkFilterPersonalized = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
11
11
|
constructor() {
|
12
12
|
super();
|
13
13
|
this.__registerHost();
|
@@ -50,10 +50,15 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
50
50
|
var _a, _b;
|
51
51
|
const CheckboxElement = () => (h("ez-check", Object.assign({ class: "SnkFilterPersonalized_checkbox", id: `param_${item.id}`, key: item.id, compact: true, value: item.visible, label: item.label, onEzChange: ({ detail: visible }) => this.handleItemChange.bind(this)(visible, item.id) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`checkboxFilter_${item.id}`)}` })));
|
52
52
|
const isVariable = !!((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters.length);
|
53
|
-
return (h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, h(CheckboxElement, null), this.
|
53
|
+
return (h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, h(CheckboxElement, null), this.buildModalListActions(item, isVariable))), (item.visible && isVariable) && (h("div", { class: "ez-row ez-padding--small" }, this.getFormField(item)))));
|
54
|
+
}
|
55
|
+
buildModalListActions(item, isVariable) {
|
56
|
+
if (!this.isModalMode())
|
57
|
+
return;
|
58
|
+
return (this.isModalMode() ?
|
54
59
|
h("div", { class: "SnkFilterPersonalized_list-actions" }, h("ez-button", { size: "small", mode: "icon", iconName: "edit", title: this.getMessage('snkPersonalizedFilter.listActions.edit'), onClick: () => this.editFilter.emit(item.id) }), h("ez-button", { size: "small", mode: "icon", iconName: "delete", title: this.getMessage('snkPersonalizedFilter.listActions.delete'), onClick: this.handleDeleteFilter.bind(this, item) }))
|
55
60
|
:
|
56
|
-
isVariable && (h("ez-badge", Object.assign({ class: "ez-badge--warning-subtle ez-margin-right--small", label: this.getMessage('snkPersonalizedFilter.info.badgeVariable'), size: "medium" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`variableBadge_${item.id}`)}` }))))
|
61
|
+
isVariable && (h("ez-badge", Object.assign({ class: "ez-badge--warning-subtle ez-margin-right--small", label: this.getMessage('snkPersonalizedFilter.info.badgeVariable'), size: "medium" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`variableBadge_${item.id}`)}` }))));
|
57
62
|
}
|
58
63
|
isModalMode() {
|
59
64
|
return this.presentationMode === EPresentationMode.MODAL;
|
@@ -120,7 +125,7 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
120
125
|
});
|
121
126
|
this.emitChange();
|
122
127
|
}
|
123
|
-
|
128
|
+
handleSearchFilterList({ detail: query = "" }) {
|
124
129
|
this.items = query ? this.originalItems.filter(item => item.label.toLowerCase().includes(query.toLowerCase())) : this.originalItems;
|
125
130
|
}
|
126
131
|
handleFilterItemChange(value, formProp) {
|
@@ -153,11 +158,11 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
153
158
|
}
|
154
159
|
handleDeleteFilter(item) {
|
155
160
|
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.deleteConfirm.message', { filterName: item.label })).then((actionConfirmed) => {
|
156
|
-
if (actionConfirmed)
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
+
if (!actionConfirmed)
|
162
|
+
return;
|
163
|
+
this.deleteFilter.emit(item);
|
164
|
+
this.items = this.originalItems = this.originalItems.filter(originalItem => originalItem.id !== item.id);
|
165
|
+
this.emitChange();
|
161
166
|
});
|
162
167
|
}
|
163
168
|
componentDidLoad() {
|
@@ -169,17 +174,35 @@ const SnkFilterPersonalized$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
169
174
|
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
170
175
|
this.items = this.originalItems = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.groupedItems) || [];
|
171
176
|
}
|
177
|
+
buildModeModalHeader() {
|
178
|
+
if (this.presentationMode !== EPresentationMode.MODAL)
|
179
|
+
return;
|
180
|
+
return (h("div", { class: "ez-margin-bottom--medium" }, h(Fragment, null, h("ez-filter-input", Object.assign({ label: this.config.label, onEzChange: this.handleSearchFilterList.bind(this) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("filterSearch")}` })), h("span", { class: "ez-text ez-title--small ez-title--primary" }, " ", this.config.detailTitle, " "))));
|
181
|
+
}
|
182
|
+
buildModeModalFooter() {
|
183
|
+
if (this.presentationMode !== EPresentationMode.MODAL)
|
184
|
+
return;
|
185
|
+
return (h("div", { class: "ez-flex ez-flex--justify-end grow ez-margin-top--medium" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: this.getMessage('snkPersonalizedFilter.footerActions.clear'), onClick: this.handleClearFilters.bind(this) }), h("ez-button", { class: "ez-button--secondary", size: "medium", label: this.getMessage('snkPersonalizedFilter.footerActions.create'), onClick: () => this.addFilter.emit() })));
|
186
|
+
}
|
187
|
+
buildContainerFiltersCreated() {
|
188
|
+
if (this.items.length) {
|
189
|
+
return (h("ez-scroller", { class: "SnkFilterPersonalized_list-scroller", direction: EzScrollDirection.VERTICAL }, h("ul", { class: `SnkFilterPersonalized_list-container ${!this.isModalMode() ? "SnkFilterPersonalized_list-container-chip" : ""}` }, this.items.map((itemConfig) => this.getItemContent(itemConfig)))));
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
return (h("div", { class: "ez-margin--auto" }, h("span", { class: "ez-text ez-text--secondary ez-text--small" }, this.getMessage('snkPersonalizedFilter.info.noDataFound'))));
|
193
|
+
}
|
194
|
+
}
|
172
195
|
render() {
|
173
196
|
if (!this.config || this.config.type !== FilterItemType.PERSONALIZED)
|
174
197
|
return undefined;
|
175
|
-
return (h(Host, null,
|
198
|
+
return (h(Host, null, this.buildModeModalHeader(), this.buildContainerFiltersCreated(), this.buildModeModalFooter()));
|
176
199
|
}
|
177
200
|
get _element() { return this; }
|
178
201
|
static get watchers() { return {
|
179
202
|
"config": ["configWatcher"]
|
180
203
|
}; }
|
181
|
-
static get style() { return
|
182
|
-
}, [2, "snk-filter-
|
204
|
+
static get style() { return snkPersonalizedFilterEditorCss; }
|
205
|
+
}, [2, "snk-personalized-filter-editor", {
|
183
206
|
"messagesBuilder": [1040],
|
184
207
|
"presentationMode": [2, "presentation-mode"],
|
185
208
|
"config": [16],
|
@@ -191,17 +214,17 @@ function defineCustomElement$1() {
|
|
191
214
|
if (typeof customElements === "undefined") {
|
192
215
|
return;
|
193
216
|
}
|
194
|
-
const components = ["snk-filter-
|
217
|
+
const components = ["snk-personalized-filter-editor"];
|
195
218
|
components.forEach(tagName => { switch (tagName) {
|
196
|
-
case "snk-filter-
|
219
|
+
case "snk-personalized-filter-editor":
|
197
220
|
if (!customElements.get(tagName)) {
|
198
|
-
customElements.define(tagName, SnkFilterPersonalized
|
221
|
+
customElements.define(tagName, SnkFilterPersonalized);
|
199
222
|
}
|
200
223
|
break;
|
201
224
|
} });
|
202
225
|
}
|
203
226
|
|
204
|
-
const
|
227
|
+
const SnkPersonalizedFilterEditor = SnkFilterPersonalized;
|
205
228
|
const defineCustomElement = defineCustomElement$1;
|
206
229
|
|
207
|
-
export {
|
230
|
+
export { SnkPersonalizedFilterEditor, defineCustomElement };
|