@sankhyalabs/sankhyablocks 6.5.0 → 6.6.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/{PersonalizedFilterUtils-7d959e91.js → PersonalizedFilterUtils-cfcd9af2.js} +47 -10
- package/dist/cjs/{SnkMessageBuilder-aec46b5d.js → SnkMessageBuilder-ba6d4ade.js} +4 -1
- package/dist/cjs/SnkMultiSelectionListDataSource-804ff4c7.js +34 -0
- 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 +4 -32
- 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 +44 -15
- 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/components/snk-simple-crud/snk-simple-crud.js +10 -2
- package/dist/collection/lib/@types/index.js +0 -36
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +25 -4
- 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/{taskbar-processor.js → SnkMultiSelectionListDataSource.js} +32 -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-detail-view2.js +1 -1
- 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-grid2.js +4 -33
- 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/components/snk-simple-crud2.js +34 -6
- 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/SnkMultiSelectionListDataSource-892f37f9.js +32 -0
- 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 +6 -34
- 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 +36 -7
- 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-18de3bbd.entry.js +1 -0
- 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-4c8d0516.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-7d68a43a.js +1 -0
- 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-fa9d3f73.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/snk-simple-crud/snk-simple-crud.d.ts +3 -0
- 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/dataUnit/InMemoryLoader.d.ts +3 -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-a1cab141.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/sankhyablocks/p-f75dceb1.entry.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
@@ -9,7 +9,7 @@ const presentationMode = require('./presentationMode-52ec3bdd.js');
|
|
9
9
|
const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
|
10
10
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
11
11
|
|
12
|
-
const
|
12
|
+
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)}";
|
13
13
|
|
14
14
|
const SnkFilterPersonalized = class {
|
15
15
|
constructor(hostRef) {
|
@@ -53,10 +53,15 @@ const SnkFilterPersonalized = class {
|
|
53
53
|
var _a, _b;
|
54
54
|
const CheckboxElement = () => (index.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) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo(`checkboxFilter_${item.id}`)}` })));
|
55
55
|
const isVariable = !!((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters.length);
|
56
|
-
return (index.h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, index.h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, index.h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, index.h(CheckboxElement, null), this.
|
56
|
+
return (index.h("div", { class: `${!this.isModalMode() ? "SnkFilterPersonalized_list-item--chip" : ""}` }, index.h("li", { class: `${this.isModalMode() ? "SnkFilterPersonalized_list-item--modal" : ""}` }, index.h("div", { class: "ez-flex ez-flex--align-items-center ez-margin-right--small ez-size-width--full" }, index.h(CheckboxElement, null), this.buildModalListActions(item, isVariable))), (item.visible && isVariable) && (index.h("div", { class: "ez-row ez-padding--small" }, this.getFormField(item)))));
|
57
|
+
}
|
58
|
+
buildModalListActions(item, isVariable) {
|
59
|
+
if (!this.isModalMode())
|
60
|
+
return;
|
61
|
+
return (this.isModalMode() ?
|
57
62
|
index.h("div", { class: "SnkFilterPersonalized_list-actions" }, index.h("ez-button", { size: "small", mode: "icon", iconName: "edit", title: this.getMessage('snkPersonalizedFilter.listActions.edit'), onClick: () => this.editFilter.emit(item.id) }), index.h("ez-button", { size: "small", mode: "icon", iconName: "delete", title: this.getMessage('snkPersonalizedFilter.listActions.delete'), onClick: this.handleDeleteFilter.bind(this, item) }))
|
58
63
|
:
|
59
|
-
isVariable && (index.h("ez-badge", Object.assign({ class: "ez-badge--warning-subtle ez-margin-right--small", label: this.getMessage('snkPersonalizedFilter.info.badgeVariable'), size: "medium" }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo(`variableBadge_${item.id}`)}` }))))
|
64
|
+
isVariable && (index.h("ez-badge", Object.assign({ class: "ez-badge--warning-subtle ez-margin-right--small", label: this.getMessage('snkPersonalizedFilter.info.badgeVariable'), size: "medium" }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo(`variableBadge_${item.id}`)}` }))));
|
60
65
|
}
|
61
66
|
isModalMode() {
|
62
67
|
return this.presentationMode === presentationMode.EPresentationMode.MODAL;
|
@@ -123,7 +128,7 @@ const SnkFilterPersonalized = class {
|
|
123
128
|
});
|
124
129
|
this.emitChange();
|
125
130
|
}
|
126
|
-
|
131
|
+
handleSearchFilterList({ detail: query = "" }) {
|
127
132
|
this.items = query ? this.originalItems.filter(item => item.label.toLowerCase().includes(query.toLowerCase())) : this.originalItems;
|
128
133
|
}
|
129
134
|
handleFilterItemChange(value, formProp) {
|
@@ -156,11 +161,11 @@ const SnkFilterPersonalized = class {
|
|
156
161
|
}
|
157
162
|
handleDeleteFilter(item) {
|
158
163
|
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.deleteConfirm.message', { filterName: item.label })).then((actionConfirmed) => {
|
159
|
-
if (actionConfirmed)
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
+
if (!actionConfirmed)
|
165
|
+
return;
|
166
|
+
this.deleteFilter.emit(item);
|
167
|
+
this.items = this.originalItems = this.originalItems.filter(originalItem => originalItem.id !== item.id);
|
168
|
+
this.emitChange();
|
164
169
|
});
|
165
170
|
}
|
166
171
|
componentDidLoad() {
|
@@ -172,16 +177,34 @@ const SnkFilterPersonalized = class {
|
|
172
177
|
this._application = core.ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
173
178
|
this.items = this.originalItems = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.groupedItems) || [];
|
174
179
|
}
|
180
|
+
buildModeModalHeader() {
|
181
|
+
if (this.presentationMode !== presentationMode.EPresentationMode.MODAL)
|
182
|
+
return;
|
183
|
+
return (index.h("div", { class: "ez-margin-bottom--medium" }, index.h(index.Fragment, null, index.h("ez-filter-input", Object.assign({ label: this.config.label, onEzChange: this.handleSearchFilterList.bind(this) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("filterSearch")}` })), index.h("span", { class: "ez-text ez-title--small ez-title--primary" }, " ", this.config.detailTitle, " "))));
|
184
|
+
}
|
185
|
+
buildModeModalFooter() {
|
186
|
+
if (this.presentationMode !== presentationMode.EPresentationMode.MODAL)
|
187
|
+
return;
|
188
|
+
return (index.h("div", { class: "ez-flex ez-flex--justify-end grow ez-margin-top--medium" }, index.h("ez-button", { class: "ez-button--tertiary", size: "medium", label: this.getMessage('snkPersonalizedFilter.footerActions.clear'), onClick: this.handleClearFilters.bind(this) }), index.h("ez-button", { class: "ez-button--secondary", size: "medium", label: this.getMessage('snkPersonalizedFilter.footerActions.create'), onClick: () => this.addFilter.emit() })));
|
189
|
+
}
|
190
|
+
buildContainerFiltersCreated() {
|
191
|
+
if (this.items.length) {
|
192
|
+
return (index.h("ez-scroller", { class: "SnkFilterPersonalized_list-scroller", direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("ul", { class: `SnkFilterPersonalized_list-container ${!this.isModalMode() ? "SnkFilterPersonalized_list-container-chip" : ""}` }, this.items.map((itemConfig) => this.getItemContent(itemConfig)))));
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
return (index.h("div", { class: "ez-margin--auto" }, index.h("span", { class: "ez-text ez-text--secondary ez-text--small" }, this.getMessage('snkPersonalizedFilter.info.noDataFound'))));
|
196
|
+
}
|
197
|
+
}
|
175
198
|
render() {
|
176
199
|
if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.PERSONALIZED)
|
177
200
|
return undefined;
|
178
|
-
return (index.h(index.Host, null,
|
201
|
+
return (index.h(index.Host, null, this.buildModeModalHeader(), this.buildContainerFiltersCreated(), this.buildModeModalFooter()));
|
179
202
|
}
|
180
203
|
get _element() { return index.getElement(this); }
|
181
204
|
static get watchers() { return {
|
182
205
|
"config": ["configWatcher"]
|
183
206
|
}; }
|
184
207
|
};
|
185
|
-
SnkFilterPersonalized.style =
|
208
|
+
SnkFilterPersonalized.style = snkPersonalizedFilterEditorCss;
|
186
209
|
|
187
|
-
exports.
|
210
|
+
exports.snk_personalized_filter_editor = SnkFilterPersonalized;
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-
|
7
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-cfcd9af2.js');
|
8
8
|
const ConfigStorage = require('./ConfigStorage-0a738cdc.js');
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
10
|
-
const IExpressionItem = require('./IExpressionItem-
|
10
|
+
const IExpressionItem = require('./IExpressionItem-0e32ebb7.js');
|
11
11
|
const index$1 = require('./index-102ba62d.js');
|
12
|
-
require('./index-614af008.js');
|
13
12
|
require('./filter-item-type.enum-aa823a00.js');
|
14
13
|
require('./form-config-fetcher-92bc8fe7.js');
|
15
14
|
require('./DataFetcher-a9d0228f.js');
|
@@ -25,13 +24,18 @@ const SnkPersonalizedFilter = class {
|
|
25
24
|
this.ezCancel = index.createEvent(this, "ezCancel", 7);
|
26
25
|
this.ezSave = index.createEvent(this, "ezSave", 7);
|
27
26
|
this._personalizedFilterFetcher = new ConfigStorage.PersonalizedFilterFetcher();
|
27
|
+
this._filterMetadataStorage = new Map();
|
28
28
|
this._dataSourceFetcher = {
|
29
29
|
fetchData: async (entity) => {
|
30
30
|
let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
|
31
31
|
if (core.StringUtils.isEmpty(entityURI)) {
|
32
32
|
entityURI = this.entityUri;
|
33
33
|
}
|
34
|
-
|
34
|
+
if (!this._filterMetadataStorage.has(entityURI)) {
|
35
|
+
const filterMetadata = await this._personalizedFilterFetcher.loadFields(entityURI);
|
36
|
+
this._filterMetadataStorage.set(entityURI, filterMetadata);
|
37
|
+
}
|
38
|
+
return this._filterMetadataStorage.get(entityURI);
|
35
39
|
}
|
36
40
|
};
|
37
41
|
this._filterAssistentMode = true;
|
@@ -144,11 +148,11 @@ const SnkPersonalizedFilter = class {
|
|
144
148
|
utils.ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"), this.getMessage("snkPersonalizedFilter.confirmCancel.description"))
|
145
149
|
.then((canCancel) => {
|
146
150
|
var _a;
|
147
|
-
if (canCancel)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
151
|
+
if (!canCancel)
|
152
|
+
return;
|
153
|
+
this._filterAssistent = core.ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
|
154
|
+
this.ezCancel.emit();
|
155
|
+
this._elButtonSave.enabled = false;
|
152
156
|
});
|
153
157
|
}
|
154
158
|
handleTitleChange(name) {
|
@@ -181,14 +185,21 @@ const SnkPersonalizedFilter = class {
|
|
181
185
|
}
|
182
186
|
return (index.h("div", { class: "ez-flex" }, index.h("ez-alert", { alertType: "warn" }, this._filterAssistent.warningMessage)));
|
183
187
|
}
|
188
|
+
buildContainerPersonalizedFilter() {
|
189
|
+
var _a, _b, _c;
|
190
|
+
if (this._filterAssistentMode) {
|
191
|
+
return (index.h(index.Fragment, null, index.h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, index.h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), index.h("div", null, index.h("div", { class: "snk-personalized-filter__expression-input--line" }), index.h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, index.h("div", { class: "ez-box" }, index.h("div", { class: "ez-box__container" }, index.h("ez-text-area", { ref: (el) => this._elTextAreaExpression = el, enabled: false, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.expression })))))));
|
192
|
+
}
|
193
|
+
else {
|
194
|
+
return (index.h(index.Fragment, null, index.h("span", { class: "ez-text ez-text--small ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), index.h("ez-text-area", { label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.expression, onEzChange: (evt) => this.handleExpressionChange(evt.detail) }), this.getWarningMessageComponent()));
|
195
|
+
}
|
196
|
+
}
|
184
197
|
render() {
|
185
|
-
var _a, _b
|
198
|
+
var _a, _b;
|
186
199
|
if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
|
187
200
|
return;
|
188
201
|
}
|
189
|
-
return (index.h(index.Host, null, index.h("div", { class: "snk-personalized-filter" }, index.h("div", null, index.h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, index.h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, index.h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), index.h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), index.h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, index.h("div", { class: "ez-box__container" }, index.h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, index.h("div", { class: "ez-flex" }, index.h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this.
|
190
|
-
index.h(index.Fragment, null, index.h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, index.h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), index.h("div", null, index.h("div", { class: "snk-personalized-filter__expression-input--line" }), index.h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, index.h("div", { class: "ez-box" }, index.h("div", { class: "ez-box__container" }, index.h("ez-text-area", { ref: (el) => this._elTextAreaExpression = el, enabled: false, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.expression })))))) :
|
191
|
-
index.h(index.Fragment, null, index.h("span", { class: "ez-text ez-text--small ez-text--bold ez-padding-bottom--medium" }, "Express\u00E3o a ser aplicada:"), index.h("ez-text-area", { label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_e = this._filterAssistent) === null || _e === void 0 ? void 0 : _e.expression, onEzChange: (evt) => this.handleExpressionChange(evt.detail) }), this.getWarningMessageComponent())))))));
|
202
|
+
return (index.h(index.Host, null, index.h("div", { class: "snk-personalized-filter" }, index.h("div", null, index.h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, index.h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, index.h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), index.h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), index.h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, index.h("div", { class: "ez-box__container" }, index.h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, index.h("div", { class: "ez-flex" }, index.h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this.buildContainerPersonalizedFilter()))))));
|
192
203
|
}
|
193
204
|
static get watchers() { return {
|
194
205
|
"filterId": ["loadFilter"]
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const constants = require('./constants-d187e03e.js');
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
7
|
+
const constants$1 = require('./constants-d187e03e.js');
|
8
|
+
const taskbarElements = require('./taskbar-elements-b98dd6e9.js');
|
9
9
|
require('./DataFetcher-a9d0228f.js');
|
10
10
|
require('./pesquisa-fetcher-954b74c3.js');
|
11
|
-
const index$1 = require('./index-
|
11
|
+
const index$1 = require('./index-0e663819.js');
|
12
12
|
const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
|
13
|
+
const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
14
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-804ff4c7.js');
|
13
15
|
require('./index-102ba62d.js');
|
14
16
|
require('./_commonjsHelpers-537d719a.js');
|
15
17
|
|
@@ -19,7 +21,7 @@ class InMemoryLoader {
|
|
19
21
|
this.metadata = metadata;
|
20
22
|
this._dataUnit = new core.DataUnit("InMemoryDataUnit");
|
21
23
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
22
|
-
this._dataUnit.dataLoader = (
|
24
|
+
this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
23
25
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
24
26
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
25
27
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
@@ -56,8 +58,9 @@ class InMemoryLoader {
|
|
56
58
|
metadaLoader() {
|
57
59
|
return Promise.resolve(this._metadata);
|
58
60
|
}
|
59
|
-
dataLoader(
|
60
|
-
|
61
|
+
dataLoader(dataUnit, request) {
|
62
|
+
const filters = this.getColumnFilters(dataUnit);
|
63
|
+
let records = this.applyFilters(filters);
|
61
64
|
if (request.sort) {
|
62
65
|
request.sort.forEach(sort => {
|
63
66
|
records = records.sort((recordA, recordB) => {
|
@@ -70,6 +73,25 @@ class InMemoryLoader {
|
|
70
73
|
}
|
71
74
|
return Promise.resolve({ records: records });
|
72
75
|
}
|
76
|
+
applyFilters(filters) {
|
77
|
+
let records = [...this._records];
|
78
|
+
filters.forEach(filter => {
|
79
|
+
records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
|
80
|
+
});
|
81
|
+
return records;
|
82
|
+
}
|
83
|
+
getColumnFilters(dataUnit) {
|
84
|
+
var _a, _b;
|
85
|
+
const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
|
86
|
+
const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(constants.DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
|
87
|
+
return columnFilters.map(filter => {
|
88
|
+
var _a, _b;
|
89
|
+
return {
|
90
|
+
column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(constants.DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
|
91
|
+
values: filter.params.map(param => param.value),
|
92
|
+
};
|
93
|
+
});
|
94
|
+
}
|
73
95
|
getSortFn(type) {
|
74
96
|
switch (type) {
|
75
97
|
case core.DataType.NUMBER:
|
@@ -135,6 +157,7 @@ const SnkSimpleCrud = class {
|
|
135
157
|
this.actionClick = index.createEvent(this, "actionClick", 7);
|
136
158
|
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
137
159
|
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
160
|
+
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
|
138
161
|
this._taskbarProcessor = new taskbarProcessor.TaskbarProcessor({
|
139
162
|
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(taskbarElements.TaskbarElement.GRID_MODE),
|
140
163
|
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(taskbarElements.TaskbarElement.FORM_MODE),
|
@@ -142,11 +165,11 @@ const SnkSimpleCrud = class {
|
|
142
165
|
"snkSimpleCrudTaskbar.grid_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(taskbarElements.TaskbarElement.FORM_MODE),
|
143
166
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
144
167
|
});
|
145
|
-
this._currentViewMode = constants.VIEW_MODE.GRID;
|
168
|
+
this._currentViewMode = constants$1.VIEW_MODE.GRID;
|
146
169
|
this._config = undefined;
|
147
170
|
this.dataState = undefined;
|
148
171
|
this.dataUnit = undefined;
|
149
|
-
this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
|
172
|
+
this.mode = constants$1.SIMPLE_CRUD_MODE.SERVER;
|
150
173
|
this.gridConfig = undefined;
|
151
174
|
this.formConfig = undefined;
|
152
175
|
this.multipleSelection = undefined;
|
@@ -156,7 +179,7 @@ const SnkSimpleCrud = class {
|
|
156
179
|
}
|
157
180
|
resolveInMemoryBtns(taskbarButtons) {
|
158
181
|
const newTaskBarConfig = [...taskbarButtons];
|
159
|
-
if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
182
|
+
if (this.mode === constants$1.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
160
183
|
newTaskBarConfig.splice(1, 1);
|
161
184
|
}
|
162
185
|
return newTaskBarConfig;
|
@@ -173,15 +196,15 @@ const SnkSimpleCrud = class {
|
|
173
196
|
actionClickListener(evt) {
|
174
197
|
const act = evt.detail;
|
175
198
|
if (act === taskbarElements.TaskbarElement.GRID_MODE) {
|
176
|
-
this.goToView(constants.VIEW_MODE.GRID);
|
199
|
+
this.goToView(constants$1.VIEW_MODE.GRID);
|
177
200
|
}
|
178
201
|
else if (act === taskbarElements.TaskbarElement.FORM_MODE) {
|
179
|
-
this.goToView(constants.VIEW_MODE.FORM);
|
202
|
+
this.goToView(constants$1.VIEW_MODE.FORM);
|
180
203
|
}
|
181
204
|
evt.stopPropagation();
|
182
205
|
}
|
183
206
|
onModeChange() {
|
184
|
-
if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
207
|
+
if (this.mode == constants$1.SIMPLE_CRUD_MODE.IN_MEMORY) {
|
185
208
|
this.initInMemoryDataUnit();
|
186
209
|
}
|
187
210
|
}
|
@@ -196,6 +219,12 @@ const SnkSimpleCrud = class {
|
|
196
219
|
componentWillLoad() {
|
197
220
|
this.processMetadata();
|
198
221
|
this.onModeChange();
|
222
|
+
this.configDatasource();
|
223
|
+
}
|
224
|
+
configDatasource() {
|
225
|
+
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
226
|
+
this._multiSelectionListDataSource.setApplication(application);
|
227
|
+
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
199
228
|
}
|
200
229
|
getTaskBarId() {
|
201
230
|
var _a, _b, _c;
|
@@ -205,9 +234,9 @@ const SnkSimpleCrud = class {
|
|
205
234
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
206
235
|
!this.dataState.selectionInfo.isAllRecords() &&
|
207
236
|
((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
208
|
-
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
237
|
+
return this._currentViewMode === constants$1.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
209
238
|
}
|
210
|
-
return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
239
|
+
return this._currentViewMode === constants$1.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
211
240
|
}
|
212
241
|
initInMemoryDataUnit() {
|
213
242
|
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
@@ -281,7 +310,7 @@ const SnkSimpleCrud = class {
|
|
281
310
|
}
|
282
311
|
render() {
|
283
312
|
var _a;
|
284
|
-
return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM) }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
313
|
+
return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(constants$1.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants$1.VIEW_MODE.FORM), columnfilterDataSource: this._multiSelectionListDataSource }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
|
285
314
|
}
|
286
315
|
get _element() { return index.getElement(this); }
|
287
316
|
static get watchers() { return {
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
9
|
-
const index$1 = require('./index-
|
8
|
+
const taskbarElements = require('./taskbar-elements-b98dd6e9.js');
|
9
|
+
const index$1 = require('./index-0e663819.js');
|
10
10
|
require('./index-102ba62d.js');
|
11
11
|
|
12
12
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
@@ -19,8 +19,8 @@
|
|
19
19
|
"./components/snk-data-exporter/snk-data-exporter.js",
|
20
20
|
"./components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js",
|
21
21
|
"./components/snk-entity-list/snk-entity-list.js",
|
22
|
-
"./components/snk-filter-bar/filter-item/editors/snk-filter-personalized/snk-filter-personalized.js",
|
23
22
|
"./components/snk-filter-bar/snk-filter-bar.js",
|
23
|
+
"./components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js",
|
24
24
|
"./components/snk-filter-bar/filter-item/snk-filter-detail.js",
|
25
25
|
"./components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js",
|
26
26
|
"./components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { DataType } from "@sankhyalabs/core";
|
2
2
|
import { toString } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
|
3
3
|
import FilterItemType from "../filter-item-type.enum";
|
4
|
-
import { FilterOperand } from "
|
4
|
+
import { FilterOperand } from "../../../snk-personalized-filter/interfaces/index";
|
5
5
|
const buildFilter = (item) => {
|
6
6
|
switch (item.type) {
|
7
7
|
case FilterItemType.DEFAULT_FILTER:
|
@@ -41,10 +41,15 @@ export class SnkFilterPersonalized {
|
|
41
41
|
var _a, _b;
|
42
42
|
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}`)}` })));
|
43
43
|
const isVariable = !!((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters.length);
|
44
|
-
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.
|
44
|
+
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)))));
|
45
|
+
}
|
46
|
+
buildModalListActions(item, isVariable) {
|
47
|
+
if (!this.isModalMode())
|
48
|
+
return;
|
49
|
+
return (this.isModalMode() ?
|
45
50
|
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) }))
|
46
51
|
:
|
47
|
-
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}`)}` }))))
|
52
|
+
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}`)}` }))));
|
48
53
|
}
|
49
54
|
isModalMode() {
|
50
55
|
return this.presentationMode === EPresentationMode.MODAL;
|
@@ -111,7 +116,7 @@ export class SnkFilterPersonalized {
|
|
111
116
|
});
|
112
117
|
this.emitChange();
|
113
118
|
}
|
114
|
-
|
119
|
+
handleSearchFilterList({ detail: query = "" }) {
|
115
120
|
this.items = query ? this.originalItems.filter(item => item.label.toLowerCase().includes(query.toLowerCase())) : this.originalItems;
|
116
121
|
}
|
117
122
|
handleFilterItemChange(value, formProp) {
|
@@ -144,11 +149,11 @@ export class SnkFilterPersonalized {
|
|
144
149
|
}
|
145
150
|
handleDeleteFilter(item) {
|
146
151
|
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.deleteConfirm.message', { filterName: item.label })).then((actionConfirmed) => {
|
147
|
-
if (actionConfirmed)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
+
if (!actionConfirmed)
|
153
|
+
return;
|
154
|
+
this.deleteFilter.emit(item);
|
155
|
+
this.items = this.originalItems = this.originalItems.filter(originalItem => originalItem.id !== item.id);
|
156
|
+
this.emitChange();
|
152
157
|
});
|
153
158
|
}
|
154
159
|
componentDidLoad() {
|
@@ -160,21 +165,39 @@ export class SnkFilterPersonalized {
|
|
160
165
|
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
161
166
|
this.items = this.originalItems = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.groupedItems) || [];
|
162
167
|
}
|
168
|
+
buildModeModalHeader() {
|
169
|
+
if (this.presentationMode !== EPresentationMode.MODAL)
|
170
|
+
return;
|
171
|
+
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, " "))));
|
172
|
+
}
|
173
|
+
buildModeModalFooter() {
|
174
|
+
if (this.presentationMode !== EPresentationMode.MODAL)
|
175
|
+
return;
|
176
|
+
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() })));
|
177
|
+
}
|
178
|
+
buildContainerFiltersCreated() {
|
179
|
+
if (this.items.length) {
|
180
|
+
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)))));
|
181
|
+
}
|
182
|
+
else {
|
183
|
+
return (h("div", { class: "ez-margin--auto" }, h("span", { class: "ez-text ez-text--secondary ez-text--small" }, this.getMessage('snkPersonalizedFilter.info.noDataFound'))));
|
184
|
+
}
|
185
|
+
}
|
163
186
|
render() {
|
164
187
|
if (!this.config || this.config.type !== FilterItemType.PERSONALIZED)
|
165
188
|
return undefined;
|
166
|
-
return (h(Host, null,
|
189
|
+
return (h(Host, null, this.buildModeModalHeader(), this.buildContainerFiltersCreated(), this.buildModeModalFooter()));
|
167
190
|
}
|
168
|
-
static get is() { return "snk-filter-
|
191
|
+
static get is() { return "snk-personalized-filter-editor"; }
|
169
192
|
static get encapsulation() { return "scoped"; }
|
170
193
|
static get originalStyleUrls() {
|
171
194
|
return {
|
172
|
-
"$": ["snk-filter-
|
195
|
+
"$": ["snk-personalized-filter-editor.css"]
|
173
196
|
};
|
174
197
|
}
|
175
198
|
static get styleUrls() {
|
176
199
|
return {
|
177
|
-
"$": ["snk-filter-
|
200
|
+
"$": ["snk-personalized-filter-editor.css"]
|
178
201
|
};
|
179
202
|
}
|
180
203
|
static get properties() {
|
@@ -292,7 +315,7 @@ export class SnkFilterPersonalized {
|
|
292
315
|
"references": {
|
293
316
|
"IPersonalizedFilter": {
|
294
317
|
"location": "import",
|
295
|
-
"path": "../../../../snk-personalized-filter/
|
318
|
+
"path": "../../../../snk-personalized-filter/interfaces/IPersonalizedFilter"
|
296
319
|
}
|
297
320
|
}
|
298
321
|
}
|
@@ -47,12 +47,9 @@ export class SnkFilterDetail {
|
|
47
47
|
return { tag: "snk-filter-number" };
|
48
48
|
case FilterItemType.PERSONALIZED:
|
49
49
|
const snkFilterPersonalizedProps = {
|
50
|
-
tag: "snk-filter-
|
50
|
+
tag: "snk-personalized-filter-editor", props: {
|
51
51
|
presentationMode: EPresentationMode.CHIP,
|
52
|
-
onValueChanged:
|
53
|
-
const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
|
54
|
-
this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
|
55
|
-
}
|
52
|
+
onValueChanged: evt => this.handleValueChanged(evt),
|
56
53
|
}
|
57
54
|
};
|
58
55
|
return snkFilterPersonalizedProps;
|
@@ -61,6 +58,10 @@ export class SnkFilterDetail {
|
|
61
58
|
}
|
62
59
|
return { tag: "snk-filter-text" };
|
63
60
|
}
|
61
|
+
handleValueChanged({ detail }) {
|
62
|
+
const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
|
63
|
+
this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
|
64
|
+
}
|
64
65
|
removeItem() {
|
65
66
|
const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
|
66
67
|
const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
|
@@ -70,6 +71,9 @@ export class SnkFilterDetail {
|
|
70
71
|
}
|
71
72
|
this.changeConfig(removedConfig);
|
72
73
|
}
|
74
|
+
removeItemFromGroup(item) {
|
75
|
+
return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
|
76
|
+
}
|
73
77
|
getPopUpHeaderButtons() {
|
74
78
|
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 })))));
|
75
79
|
}
|
@@ -177,11 +177,7 @@ export class SnkFilterItem {
|
|
177
177
|
return `${label}: ${value.value} - ${value.label}`;
|
178
178
|
}
|
179
179
|
if (type === FilterItemType.PERSONALIZED) {
|
180
|
-
const activeCount =
|
181
|
-
if (!!item.visible)
|
182
|
-
return total + 1;
|
183
|
-
return total;
|
184
|
-
}, 0);
|
180
|
+
const activeCount = this.calculateActiveCount(groupedItems);
|
185
181
|
if (activeCount <= 0)
|
186
182
|
return label;
|
187
183
|
return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
|
@@ -205,6 +201,13 @@ export class SnkFilterItem {
|
|
205
201
|
}
|
206
202
|
return label;
|
207
203
|
}
|
204
|
+
calculateActiveCount(groupedItems) {
|
205
|
+
return groupedItems.reduce((total, item) => {
|
206
|
+
if (!!item.visible)
|
207
|
+
return total + 1;
|
208
|
+
return total;
|
209
|
+
}, 0);
|
210
|
+
}
|
208
211
|
applyTooltip() {
|
209
212
|
if (!this.config.value)
|
210
213
|
return undefined;
|
@@ -253,13 +256,19 @@ export class SnkFilterItem {
|
|
253
256
|
}
|
254
257
|
return undefined;
|
255
258
|
}
|
259
|
+
hasActiveElements(value) {
|
260
|
+
var _a, _b, _c;
|
261
|
+
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;
|
262
|
+
}
|
263
|
+
hasActiveValue(config) {
|
264
|
+
return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
|
265
|
+
}
|
256
266
|
getEnabledChip() {
|
257
|
-
var _a, _b, _c, _d;
|
258
267
|
if (this.config.type === FilterItemType.PERSONALIZED) {
|
259
268
|
const { groupedItems = [] } = this.config;
|
260
269
|
return groupedItems.some(item => item.visible);
|
261
270
|
}
|
262
|
-
return
|
271
|
+
return this.hasActiveValue(this.config);
|
263
272
|
}
|
264
273
|
render() {
|
265
274
|
const leftIcon = this.getLeftIconName();
|
@@ -66,7 +66,7 @@ export class SnkFilterModal {
|
|
66
66
|
});
|
67
67
|
}
|
68
68
|
handleClose() {
|
69
|
-
const hasChangesToSave =
|
69
|
+
const hasChangesToSave = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
|
70
70
|
if (!hasChangesToSave) {
|
71
71
|
this.closeModal();
|
72
72
|
return;
|
@@ -76,13 +76,19 @@ export class SnkFilterModal {
|
|
76
76
|
this.closeModal();
|
77
77
|
});
|
78
78
|
}
|
79
|
-
|
79
|
+
handleApplyFilters() {
|
80
80
|
const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
|
81
|
+
if (this.isValidCustomFilter(filterPersonalized)) {
|
82
|
+
this.applyFilters(this.filters);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
isValidCustomFilter(filterPersonalized) {
|
81
86
|
const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
82
87
|
if (!isValid) {
|
83
|
-
|
88
|
+
ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
|
89
|
+
return false;
|
84
90
|
}
|
85
|
-
|
91
|
+
return true;
|
86
92
|
}
|
87
93
|
modalActionListener(evt) {
|
88
94
|
const modalAction = evt.detail;
|
@@ -91,7 +97,7 @@ export class SnkFilterModal {
|
|
91
97
|
this.handleClearAll();
|
92
98
|
break;
|
93
99
|
case ModalAction.OK:
|
94
|
-
this.
|
100
|
+
this.handleApplyFilters();
|
95
101
|
break;
|
96
102
|
case ModalAction.CLOSE:
|
97
103
|
this.handleClose();
|