@sankhyalabs/sankhyablocks 8.16.0-dev.112 → 8.16.0-dev.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-df09fb78.js → ConfigStorage-48ba265b.js} +45 -17
- package/dist/cjs/{PersonalizedFilterUtils-0184ffbb.js → PersonalizedFilterUtils-7259cf65.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-45a8d7b7.js → SnkFormConfigManager-ce7b0951.js} +1 -1
- package/dist/cjs/{SnkMessageBuilder-9deeae08.js → SnkMessageBuilder-21cc7f09.js} +12 -1
- package/dist/cjs/default-filters-a09bf82b.js +8 -0
- package/dist/cjs/{filter-type.enum-b14ce507.js → filter-type.enum-2bb46d2a.js} +1 -0
- package/dist/cjs/{index-c5771aba.js → index-62760a9c.js} +5 -0
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_8.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-config-options_3.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-57916de4.js → snk-data-unit-7913a033.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-default-filter.cjs.entry.js +77 -0
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-expression-group_2.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +4 -3
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +81 -27
- package/dist/cjs/snk-filter-detail.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-d33379cd.js → snk-guides-viewer-450baf6a.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +51 -16
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +80 -12
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.css +34 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.js +142 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +24 -15
- package/dist/collection/components/snk-filter-bar/types/default-filters.js +6 -0
- package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +4 -4
- package/dist/collection/components/snk-grid/snk-grid.css +1 -0
- package/dist/collection/components/snk-personalized-filter/interfaces/index.js +5 -0
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +67 -13
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.css +3 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +20 -1
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +22 -3
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +20 -1
- package/dist/collection/lib/configs/ConfigStorage.js +16 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +29 -9
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +6 -0
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +6 -1
- package/dist/components/ConfigStorage.js +45 -17
- package/dist/components/PersonalizedFilterUtils.js +6 -1
- package/dist/components/SnkMessageBuilder.js +12 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-default-filter.d.ts +11 -0
- package/dist/components/snk-default-filter.js +6 -0
- package/dist/components/snk-default-filter2.js +97 -0
- package/dist/components/snk-expression-group2.js +4 -2
- package/dist/components/snk-expression-item2.js +5 -3
- package/dist/components/snk-filter-assistent-mode2.js +4 -2
- package/dist/components/snk-filter-bar2.js +28 -19
- package/dist/components/snk-filter-modal-item2.js +1 -0
- package/dist/components/snk-filter-modal.js +59 -8
- package/dist/components/snk-grid2.js +1 -1
- package/dist/components/snk-personalized-filter2.js +50 -14
- package/dist/esm/{ConfigStorage-71e6766f.js → ConfigStorage-79b9e180.js} +45 -17
- package/dist/esm/{PersonalizedFilterUtils-e2b38ef7.js → PersonalizedFilterUtils-2db38ff2.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-be490a33.js → SnkFormConfigManager-327dfdd4.js} +1 -1
- package/dist/esm/{SnkMessageBuilder-2dbd8fa2.js → SnkMessageBuilder-0f112c19.js} +12 -1
- package/dist/esm/default-filters-50105e43.js +8 -0
- package/dist/esm/{filter-type.enum-a80c1b6b.js → filter-type.enum-f6a8fe23.js} +1 -0
- package/dist/esm/{index-ae591a44.js → index-8acbae97.js} +6 -1
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_8.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-config-options_3.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-65c9dd1a.js → snk-data-unit-a95dc9fe.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-default-filter.entry.js +73 -0
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-expression-group_2.entry.js +8 -6
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +4 -3
- package/dist/esm/snk-filter-bar_4.entry.js +81 -27
- package/dist/esm/snk-filter-detail.entry.js +2 -2
- package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
- package/dist/esm/snk-filter-modal-item.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-72953334.js → snk-guides-viewer-ebb40908.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-personalized-filter.entry.js +51 -16
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-165cde3b.entry.js → p-043bef5f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ebdb9d89.js → p-088d7e7b.js} +1 -1
- package/dist/sankhyablocks/p-13a0ead0.entry.js +1 -0
- package/dist/sankhyablocks/{p-52d10014.entry.js → p-34f7a3ab.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ddf93f36.entry.js → p-39f3b02d.entry.js} +1 -1
- package/dist/sankhyablocks/p-5182513e.entry.js +1 -0
- package/dist/sankhyablocks/p-6416975c.js +56 -0
- package/dist/sankhyablocks/p-6a4b21dd.js +1 -0
- package/dist/sankhyablocks/{p-a4ebeec4.entry.js → p-6a5f061b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-54a5d52a.entry.js → p-70da6817.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2f7e2251.entry.js → p-794840bd.entry.js} +1 -1
- package/dist/sankhyablocks/p-79b3cccc.js +1 -0
- package/dist/sankhyablocks/{p-bc101064.entry.js → p-7effe55f.entry.js} +1 -1
- package/dist/sankhyablocks/p-814d99ec.entry.js +1 -0
- package/dist/sankhyablocks/p-84345e7a.js +1 -0
- package/dist/sankhyablocks/{p-057fad05.js → p-988afe78.js} +1 -1
- package/dist/sankhyablocks/p-a9813a81.entry.js +1 -0
- package/dist/sankhyablocks/{p-3372178e.entry.js → p-ab12216c.entry.js} +1 -1
- package/dist/sankhyablocks/p-b568c1d4.js +1 -0
- package/dist/sankhyablocks/{p-c9675d64.js → p-bd6a6203.js} +1 -1
- package/dist/sankhyablocks/{p-7beeabc1.entry.js → p-bd7ccf60.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0fadb620.js → p-c7492861.js} +1 -1
- package/dist/sankhyablocks/p-d257ff20.entry.js +1 -0
- package/dist/sankhyablocks/{p-8002dcd0.entry.js → p-def1fe2d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5ffa0493.entry.js → p-e3c71e43.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b8d649dd.entry.js → p-e6d90f89.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +16 -4
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.d.ts +27 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -3
- package/dist/types/components/snk-filter-bar/types/default-filters.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -3
- package/dist/types/components/snk-personalized-filter/interfaces/index.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +7 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +4 -0
- package/dist/types/components.d.ts +81 -6
- package/dist/types/lib/configs/ConfigStorage.d.ts +4 -2
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +8 -4
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-03b68a74.js +0 -56
- package/dist/sankhyablocks/p-3ab6df3d.entry.js +0 -1
- package/dist/sankhyablocks/p-4689c2e6.js +0 -1
- package/dist/sankhyablocks/p-490b75b5.entry.js +0 -1
- package/dist/sankhyablocks/p-60137b7a.entry.js +0 -1
- package/dist/sankhyablocks/p-933c0c0b.js +0 -1
- package/dist/sankhyablocks/p-9d3a025a.entry.js +0 -1
- package/dist/sankhyablocks/p-d9804798.js +0 -1
@@ -4,10 +4,10 @@ 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-
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
7
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-7259cf65.js');
|
8
|
+
const ConfigStorage = require('./ConfigStorage-48ba265b.js');
|
9
9
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
10
|
-
const index$1 = require('./index-
|
10
|
+
const index$1 = require('./index-62760a9c.js');
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
12
12
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
13
13
|
require('./form-config-fetcher-40d3f752.js');
|
@@ -45,6 +45,7 @@ const SnkPersonalizedFilter = class {
|
|
45
45
|
this.filterId = undefined;
|
46
46
|
this.configName = undefined;
|
47
47
|
this.resourceID = undefined;
|
48
|
+
this.isDefaultFilter = false;
|
48
49
|
}
|
49
50
|
/*
|
50
51
|
* Cria um novo filtro se não houver nenhum filtro existente
|
@@ -77,6 +78,9 @@ const SnkPersonalizedFilter = class {
|
|
77
78
|
operand: index$1.FilterGroupCondition.AND
|
78
79
|
}
|
79
80
|
};
|
81
|
+
if (this.isDefaultFilter) {
|
82
|
+
this.buildDataDefaultFilter(newPersonalizedFilter);
|
83
|
+
}
|
80
84
|
this._originalFilterAssistent = core.ObjectUtils.copy(newPersonalizedFilter);
|
81
85
|
this._filterAssistent = core.ObjectUtils.copy(newPersonalizedFilter);
|
82
86
|
}
|
@@ -84,6 +88,16 @@ const SnkPersonalizedFilter = class {
|
|
84
88
|
if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
|
85
89
|
return;
|
86
90
|
}
|
91
|
+
if (newValue === index$1.DefaultFilter.id) {
|
92
|
+
ConfigStorage.ConfigStorage.loadDefaultFilter(newValue, this.resourceID, this.configName)
|
93
|
+
.then((resp) => {
|
94
|
+
const personalizedFilter = this.applyDefaultValues(resp);
|
95
|
+
this._filterAssistent = personalizedFilter;
|
96
|
+
this._originalFilterAssistent = core.ObjectUtils.copy(personalizedFilter);
|
97
|
+
this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
|
98
|
+
});
|
99
|
+
return;
|
100
|
+
}
|
87
101
|
ConfigStorage.ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
|
88
102
|
.then((resp) => {
|
89
103
|
const personalizedFilter = this.applyDefaultValues(resp);
|
@@ -110,20 +124,29 @@ const SnkPersonalizedFilter = class {
|
|
110
124
|
this._elButtonMode.setAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME, core.ElementIDUtils.getInternalIDInfo(`${this._filterAssistentMode ? "advancedMode_ezButton" : "assistentMode_ezButton"}`));
|
111
125
|
}
|
112
126
|
}
|
127
|
+
buildDataDefaultFilter(data) {
|
128
|
+
data.name = index$1.DefaultFilter.name;
|
129
|
+
data.id = index$1.DefaultFilter.id;
|
130
|
+
}
|
113
131
|
getMessage(key, params) {
|
114
132
|
return this._application.messagesBuilder.getMessage(key, params);
|
115
133
|
}
|
116
|
-
saveFilter() {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
});
|
134
|
+
async saveFilter() {
|
135
|
+
let response;
|
136
|
+
if (this.isDefaultFilter) {
|
137
|
+
response = await ConfigStorage.ConfigStorage.saveDefaultFilter(this._filterAssistent, this.resourceID, this.configName);
|
138
|
+
}
|
139
|
+
else {
|
140
|
+
response = await ConfigStorage.ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
|
141
|
+
}
|
142
|
+
this._elButtonSave.enabled = false;
|
143
|
+
const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
|
144
|
+
utils.ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
|
145
|
+
const updatedFilterAssistent = Object.assign(Object.assign({}, response), this._filterAssistent);
|
146
|
+
updatedFilterAssistent.parameters = PersonalizedFilterUtils.PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
147
|
+
this._originalFilterAssistent = core.ObjectUtils.copy(updatedFilterAssistent);
|
148
|
+
this._filterAssistent = core.ObjectUtils.copy(updatedFilterAssistent);
|
149
|
+
this.ezAfterSave.emit();
|
127
150
|
}
|
128
151
|
removeFilter() {
|
129
152
|
ConfigStorage.ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
|
@@ -259,7 +282,7 @@ const SnkPersonalizedFilter = class {
|
|
259
282
|
}
|
260
283
|
buildContainerPersonalizedFilter() {
|
261
284
|
return (index.h("ez-view-stack", { ref: (ref) => this._viewStackRef = ref }, index.h("stack-item", null, this._filterAssistentMode &&
|
262
|
-
index.h("snk-filter-assistent-mode", { filterAssistent: this._filterAssistent, messagesBuilder: this.messagesBuilder, filterId: this.filterId, entityUri: this.entityUri, application: this._application, onEzChangeFilter: (ev) => this.handleChangeFilterAssistentMode(ev.detail) })), index.h("stack-item", null, index.h("snk-filter-advanced-mode", { ref: (ref) => this._elAdvancedMode = ref, filterAssistent: this._filterAssistent, application: this._application, onEzExpressionChange: (ev) => this.handleExpressionChangeAdvancedMode(ev.detail) }))));
|
285
|
+
index.h("snk-filter-assistent-mode", { filterAssistent: this._filterAssistent, messagesBuilder: this.messagesBuilder, filterId: this.filterId, entityUri: this.entityUri, application: this._application, onEzChangeFilter: (ev) => this.handleChangeFilterAssistentMode(ev.detail), isDefaultFilter: this.isDefaultFilter })), index.h("stack-item", null, index.h("snk-filter-advanced-mode", { ref: (ref) => this._elAdvancedMode = ref, filterAssistent: this._filterAssistent, application: this._application, onEzExpressionChange: (ev) => this.handleExpressionChangeAdvancedMode(ev.detail) }))));
|
263
286
|
}
|
264
287
|
handleModeChange() {
|
265
288
|
var _a, _b;
|
@@ -298,12 +321,24 @@ const SnkPersonalizedFilter = class {
|
|
298
321
|
}
|
299
322
|
}
|
300
323
|
}
|
324
|
+
buildTitle() {
|
325
|
+
if (this.isDefaultFilter && !this.filterId) {
|
326
|
+
return this.getMessage("snkPersonalizedFilter.info.titleCreateDefault");
|
327
|
+
}
|
328
|
+
if (this.isDefaultFilter && this.filterId) {
|
329
|
+
return this.getMessage("snkPersonalizedFilter.info.titleEditDefault");
|
330
|
+
}
|
331
|
+
if (this.filterId) {
|
332
|
+
return this.getMessage("snkPersonalizedFilter.info.titleEdit");
|
333
|
+
}
|
334
|
+
return this.getMessage("snkPersonalizedFilter.info.titleAdd");
|
335
|
+
}
|
301
336
|
render() {
|
302
337
|
var _a, _b, _c, _d;
|
303
338
|
if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
|
304
339
|
return;
|
305
340
|
}
|
306
|
-
return (index.h(index.Host, null, index.h("div", { class: "snk-personalized-filter" }, index.h("div", null, index.h("snk-simple-bar", { label: this.
|
341
|
+
return (index.h(index.Host, null, index.h("div", { class: "snk-personalized-filter" }, index.h("div", null, index.h("snk-simple-bar", { label: this.buildTitle(), 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-tooltip", { message: this.getMessage("snkPersonalizedFilter.info.textInputDisabled"), active: this.isDefaultFilter }, 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), enabled: !this.isDefaultFilter })), this.renderButtonAddField(), index.h("ez-button", { ref: (el) => this._elButtonMode = el, class: "snk-personalized-filter__button-mode", label: this._filterAssistentMode ? this.getMessage("snkPersonalizedFilter.info.activeModeAdvanced") : this.getMessage("snkPersonalizedFilter.info.activeModeAssistent"), onClick: () => this.handleModeChange(), "data-tooltip": !(this._filterAssistentMode || ((_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent)) ? this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode") : undefined, "data-flow": "bottom", enabled: (!this._filterAssistent.name || Boolean(this._filterAssistentMode || ((_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.assistent))) })), this.buildContainerPersonalizedFilter()))))));
|
307
342
|
}
|
308
343
|
static get watchers() { return {
|
309
344
|
"filterId": ["loadFilter"]
|
@@ -17,8 +17,8 @@ const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
18
|
const formConfigFetcher = require('./form-config-fetcher-40d3f752.js');
|
19
19
|
const taskbarProcessor = require('./taskbar-processor-2fba34a8.js');
|
20
|
-
const ConfigStorage = require('./ConfigStorage-
|
21
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
20
|
+
const ConfigStorage = require('./ConfigStorage-48ba265b.js');
|
21
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-ce7b0951.js');
|
22
22
|
const index$2 = require('./index-102ba62d.js');
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
24
24
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"./components/snk-filter-bar/filter-item/editors/snk-filter-text.js",
|
33
33
|
"./components/snk-filter-bar/filter-modal/snk-filter-modal.js",
|
34
34
|
"./components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js",
|
35
|
+
"./components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.js",
|
35
36
|
"./components/snk-filter-field-search/snk-filter-field-search.js",
|
36
37
|
"./components/snk-form/snk-form.js",
|
37
38
|
"./components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config.js",
|
@@ -3,9 +3,11 @@ import { ModalAction } from "@sankhyalabs/ezui/dist/collection/components/ez-mod
|
|
3
3
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
4
4
|
import FilterType from '../types/filter-type.enum';
|
5
5
|
import FilterItemType from '../filter-item/filter-item-type.enum';
|
6
|
-
import { ObjectUtils } from '@sankhyalabs/core';
|
6
|
+
import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
|
7
7
|
import { PersonalizedFilterUtils } from '../../snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
|
8
8
|
import { FilterNumberVariation } from '../filter-item/editors/enum/filterNumberVariation';
|
9
|
+
import { ActionDefaultFilter } from '../types/default-filters';
|
10
|
+
import { DefaultFilter } from '../../snk-personalized-filter/interfaces';
|
9
11
|
export class SnkFilterModal {
|
10
12
|
constructor() {
|
11
13
|
this.getMessage = undefined;
|
@@ -17,6 +19,7 @@ export class SnkFilterModal {
|
|
17
19
|
this.editPersonalizedFilter = undefined;
|
18
20
|
this.deletePersonalizedFilter = undefined;
|
19
21
|
this.filtersToDelete = [];
|
22
|
+
this.filterDefaultToDelete = undefined;
|
20
23
|
this.disablePersonalizedFilter = undefined;
|
21
24
|
}
|
22
25
|
/**
|
@@ -75,8 +78,12 @@ export class SnkFilterModal {
|
|
75
78
|
return copy;
|
76
79
|
});
|
77
80
|
}
|
81
|
+
hasChangeToSave() {
|
82
|
+
const hasChangesPersonalizedFilters = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
|
83
|
+
return hasChangesPersonalizedFilters;
|
84
|
+
}
|
78
85
|
handleClose() {
|
79
|
-
const hasChangesToSave =
|
86
|
+
const hasChangesToSave = this.hasChangeToSave();
|
80
87
|
if (!hasChangesToSave) {
|
81
88
|
this.closeModal();
|
82
89
|
return;
|
@@ -87,7 +94,7 @@ export class SnkFilterModal {
|
|
87
94
|
});
|
88
95
|
}
|
89
96
|
handleApplyFilters() {
|
90
|
-
const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
|
97
|
+
const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER || filter.filterType === FilterType.DEFAULT_FILTER);
|
91
98
|
if (this.isValidCustomFilter(filterPersonalized)) {
|
92
99
|
this.applyFilters(this.filters);
|
93
100
|
}
|
@@ -97,6 +104,11 @@ export class SnkFilterModal {
|
|
97
104
|
});
|
98
105
|
this.filtersToDelete = [];
|
99
106
|
}
|
107
|
+
if (this.filterDefaultToDelete) {
|
108
|
+
this.deletePersonalizedFilter(this.filterDefaultToDelete, this.configName, true);
|
109
|
+
this._defaultFilter = undefined;
|
110
|
+
this.filterDefaultToDelete = undefined;
|
111
|
+
}
|
100
112
|
}
|
101
113
|
isValidCustomFilter(filterPersonalized) {
|
102
114
|
const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
@@ -223,6 +235,41 @@ export class SnkFilterModal {
|
|
223
235
|
const lines = this.mountFiltersLines(listItems);
|
224
236
|
return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
|
225
237
|
}
|
238
|
+
handleDeleteFilter() {
|
239
|
+
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.info.deleteDefaultFilterConfirm'), "alert-circle-inverted", "critical").then((actionConfirmed) => {
|
240
|
+
if (!actionConfirmed) {
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
this.filterDefaultToDelete = this._defaultFilter;
|
244
|
+
this.filters = this.filters.filter(filter => filter.id !== FilterType.DEFAULT_FILTER);
|
245
|
+
});
|
246
|
+
}
|
247
|
+
handleActionSelectedDefaultFilter({ detail: action }) {
|
248
|
+
switch (action) {
|
249
|
+
case ActionDefaultFilter.CREATE:
|
250
|
+
this.addPersonalizedFilter(true);
|
251
|
+
break;
|
252
|
+
case ActionDefaultFilter.EDIT:
|
253
|
+
this.editPersonalizedFilter(this._defaultFilter.id, true);
|
254
|
+
break;
|
255
|
+
case ActionDefaultFilter.REMOVE:
|
256
|
+
this.handleDeleteFilter();
|
257
|
+
break;
|
258
|
+
default:
|
259
|
+
break;
|
260
|
+
}
|
261
|
+
}
|
262
|
+
getCustomFilter(filters) {
|
263
|
+
const customFilters = filters.filter((filter) => filter.filterType === FilterType.CUSTOM_FILTER);
|
264
|
+
return customFilters;
|
265
|
+
}
|
266
|
+
getDefaultFilter(filters) {
|
267
|
+
const defaultFilter = filters.find((item) => item.id === DefaultFilter.id);
|
268
|
+
return defaultFilter;
|
269
|
+
}
|
270
|
+
componentWillLoad() {
|
271
|
+
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
272
|
+
}
|
226
273
|
componentWillRender() {
|
227
274
|
this._modalTitle = this.getCustomMessage('title');
|
228
275
|
this._okButtonLabel = this.getCustomMessage('okButtonLabel');
|
@@ -233,10 +280,11 @@ export class SnkFilterModal {
|
|
233
280
|
this._originalFilterConfig = this.filters;
|
234
281
|
}
|
235
282
|
render() {
|
236
|
-
|
283
|
+
this._defaultFilter = this.getDefaultFilter(this.filters);
|
284
|
+
const customFilters = this.getCustomFilter(this.filters);
|
237
285
|
const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
|
238
286
|
const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
|
239
|
-
return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
287
|
+
return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, h("snk-default-filter", { getMessage: this.getCustomMessage.bind(this), hasDefaultFilter: !!this._defaultFilter, onActionSelected: this.handleActionSelectedDefaultFilter.bind(this) }), !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
240
288
|
}
|
241
289
|
static get is() { return "snk-filter-modal"; }
|
242
290
|
static get originalStyleUrls() {
|
@@ -348,8 +396,8 @@ export class SnkFilterModal {
|
|
348
396
|
"type": "unknown",
|
349
397
|
"mutable": false,
|
350
398
|
"complexType": {
|
351
|
-
"original": "() => void",
|
352
|
-
"resolved": "() => void",
|
399
|
+
"original": "(isDefault?: boolean) => void",
|
400
|
+
"resolved": "(isDefault?: boolean) => void",
|
353
401
|
"references": {}
|
354
402
|
},
|
355
403
|
"required": false,
|
@@ -363,8 +411,8 @@ export class SnkFilterModal {
|
|
363
411
|
"type": "unknown",
|
364
412
|
"mutable": false,
|
365
413
|
"complexType": {
|
366
|
-
"original": "(id:string) => void",
|
367
|
-
"resolved": "(id: string) => void",
|
414
|
+
"original": "(id:string, isDefault?: boolean) => void",
|
415
|
+
"resolved": "(id: string, isDefault?: boolean) => void",
|
368
416
|
"references": {}
|
369
417
|
},
|
370
418
|
"required": false,
|
@@ -378,8 +426,8 @@ export class SnkFilterModal {
|
|
378
426
|
"type": "unknown",
|
379
427
|
"mutable": false,
|
380
428
|
"complexType": {
|
381
|
-
"original": "(filter: IPersonalizedFilter, configName: string) => void",
|
382
|
-
"resolved": "(filter: IPersonalizedFilter, configName: string) => void",
|
429
|
+
"original": "(filter: IPersonalizedFilter, configName: string, isDefault?: boolean) => void",
|
430
|
+
"resolved": "(filter: IPersonalizedFilter, configName: string, isDefault?: boolean) => void",
|
383
431
|
"references": {
|
384
432
|
"IPersonalizedFilter": {
|
385
433
|
"location": "import",
|
@@ -396,7 +444,7 @@ export class SnkFilterModal {
|
|
396
444
|
},
|
397
445
|
"filtersToDelete": {
|
398
446
|
"type": "unknown",
|
399
|
-
"mutable":
|
447
|
+
"mutable": true,
|
400
448
|
"complexType": {
|
401
449
|
"original": "IPersonalizedFilter[]",
|
402
450
|
"resolved": "IPersonalizedFilter[]",
|
@@ -415,6 +463,26 @@ export class SnkFilterModal {
|
|
415
463
|
},
|
416
464
|
"defaultValue": "[]"
|
417
465
|
},
|
466
|
+
"filterDefaultToDelete": {
|
467
|
+
"type": "unknown",
|
468
|
+
"mutable": true,
|
469
|
+
"complexType": {
|
470
|
+
"original": "SnkFilterItemConfig",
|
471
|
+
"resolved": "SnkFilterItemConfig",
|
472
|
+
"references": {
|
473
|
+
"SnkFilterItemConfig": {
|
474
|
+
"location": "import",
|
475
|
+
"path": "../filter-item/snk-filter-item"
|
476
|
+
}
|
477
|
+
}
|
478
|
+
},
|
479
|
+
"required": false,
|
480
|
+
"optional": false,
|
481
|
+
"docs": {
|
482
|
+
"tags": [],
|
483
|
+
"text": "Guarda o filtro a ser deletado no Apply do modal"
|
484
|
+
}
|
485
|
+
},
|
418
486
|
"disablePersonalizedFilter": {
|
419
487
|
"type": "boolean",
|
420
488
|
"mutable": false,
|
@@ -0,0 +1,34 @@
|
|
1
|
+
:host {
|
2
|
+
display: flex;
|
3
|
+
justify-content: flex-end;
|
4
|
+
}
|
5
|
+
|
6
|
+
.default_container {
|
7
|
+
border: none;
|
8
|
+
background: none;
|
9
|
+
display: flex;
|
10
|
+
align-items: center;
|
11
|
+
gap: var(--space--3xs, 4px);
|
12
|
+
font-family: var(--font-pattern);
|
13
|
+
color: var(--title--primary, #2b3a54);
|
14
|
+
font-size: var(--text--medium, 14px);
|
15
|
+
padding: 0;
|
16
|
+
outline: none;
|
17
|
+
}
|
18
|
+
|
19
|
+
.default_container ez-icon {
|
20
|
+
cursor: pointer;
|
21
|
+
}
|
22
|
+
|
23
|
+
.default_container ez-icon:hover {
|
24
|
+
color: var(--color--primary-600);
|
25
|
+
}
|
26
|
+
|
27
|
+
.new_filter {
|
28
|
+
cursor: pointer;
|
29
|
+
margin: 0 var(--space--3xs, 4px);
|
30
|
+
}
|
31
|
+
|
32
|
+
.new_filter:hover {
|
33
|
+
color: var(--color--primary-600);
|
34
|
+
}
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
2
|
+
import { ActionDefaultFilter } from '../../../types/default-filters';
|
3
|
+
export class SnkDefaultFilter {
|
4
|
+
constructor() {
|
5
|
+
this.OFFSET_HEIGHT = 5;
|
6
|
+
this.getMessage = undefined;
|
7
|
+
this.hasDefaultFilter = false;
|
8
|
+
this._opened = false;
|
9
|
+
}
|
10
|
+
repositionDropDown() {
|
11
|
+
if (!this._refIcon || !this._refDropdown) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
const boundingIcon = this._refIcon.getBoundingClientRect();
|
15
|
+
const boundingDropDown = this._refDropdown.getBoundingClientRect();
|
16
|
+
this._refDropdown.style.top = (boundingIcon.y + boundingIcon.height + this.OFFSET_HEIGHT) + "px";
|
17
|
+
this._refDropdown.style.left = ((boundingIcon.x + (boundingIcon.width / 2)) - boundingDropDown.width) + "px";
|
18
|
+
}
|
19
|
+
toggleDropdown() {
|
20
|
+
this._opened = !this._opened;
|
21
|
+
}
|
22
|
+
closeDropdown(evt) {
|
23
|
+
const target = evt === null || evt === void 0 ? void 0 : evt.target;
|
24
|
+
if (!target) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
if (!target.closest("#dropdown-parent-demo")) {
|
28
|
+
this._opened = false;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
buildItems() {
|
32
|
+
return ([
|
33
|
+
{
|
34
|
+
id: ActionDefaultFilter.EDIT,
|
35
|
+
label: this.getMessage('defaultFilter.edit'),
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: ActionDefaultFilter.REMOVE,
|
39
|
+
label: this.getMessage('defaultFilter.remove'),
|
40
|
+
},
|
41
|
+
]);
|
42
|
+
}
|
43
|
+
onValueSelected({ detail: item }) {
|
44
|
+
this._opened = false;
|
45
|
+
this.actionSelected.emit(item.id);
|
46
|
+
}
|
47
|
+
openCreateNewFilter() {
|
48
|
+
this.actionSelected.emit(ActionDefaultFilter.CREATE);
|
49
|
+
}
|
50
|
+
componentDidRender() {
|
51
|
+
this.repositionDropDown();
|
52
|
+
}
|
53
|
+
componentWillLoad() {
|
54
|
+
this._items = this.buildItems();
|
55
|
+
document.removeEventListener("scroll", this.repositionDropDown.bind(this));
|
56
|
+
document.addEventListener("scroll", this.repositionDropDown.bind(this));
|
57
|
+
}
|
58
|
+
render() {
|
59
|
+
if (!this.hasDefaultFilter) {
|
60
|
+
return (h(Host, null, h("button", { class: "default_container new_filter", onClick: this.openCreateNewFilter.bind(this) }, h("span", null, this.getMessage('defaultFilter.create')))));
|
61
|
+
}
|
62
|
+
return (h(Host, null, h("button", { class: "default_container", onClick: this.toggleDropdown.bind(this) }, h("span", null, this.getMessage('defaultFilter.title')), h("ez-icon", { ref: (ref) => this._refIcon = ref, iconName: 'dots-vertical' })), this._opened &&
|
63
|
+
h("ez-dropdown", { ref: (ref) => this._refDropdown = ref, items: this._items, onEzClick: this.onValueSelected.bind(this), onEzOutsideClick: this.closeDropdown.bind(this) })));
|
64
|
+
}
|
65
|
+
static get is() { return "snk-default-filter"; }
|
66
|
+
static get encapsulation() { return "scoped"; }
|
67
|
+
static get originalStyleUrls() {
|
68
|
+
return {
|
69
|
+
"$": ["snk-default-filter.css"]
|
70
|
+
};
|
71
|
+
}
|
72
|
+
static get styleUrls() {
|
73
|
+
return {
|
74
|
+
"$": ["snk-default-filter.css"]
|
75
|
+
};
|
76
|
+
}
|
77
|
+
static get properties() {
|
78
|
+
return {
|
79
|
+
"getMessage": {
|
80
|
+
"type": "unknown",
|
81
|
+
"mutable": false,
|
82
|
+
"complexType": {
|
83
|
+
"original": "(key: string, props?: any) => string",
|
84
|
+
"resolved": "(key: string, props?: any) => string",
|
85
|
+
"references": {}
|
86
|
+
},
|
87
|
+
"required": false,
|
88
|
+
"optional": false,
|
89
|
+
"docs": {
|
90
|
+
"tags": [],
|
91
|
+
"text": "Usado pra flexibilizar os verbetes e mensagens de acordo com o SnkMessageBuilder."
|
92
|
+
}
|
93
|
+
},
|
94
|
+
"hasDefaultFilter": {
|
95
|
+
"type": "boolean",
|
96
|
+
"mutable": false,
|
97
|
+
"complexType": {
|
98
|
+
"original": "boolean",
|
99
|
+
"resolved": "boolean",
|
100
|
+
"references": {}
|
101
|
+
},
|
102
|
+
"required": false,
|
103
|
+
"optional": false,
|
104
|
+
"docs": {
|
105
|
+
"tags": [],
|
106
|
+
"text": "Informa se j\u00E1 existe um filtro padr\u00E3o criado."
|
107
|
+
},
|
108
|
+
"attribute": "has-default-filter",
|
109
|
+
"reflect": false,
|
110
|
+
"defaultValue": "false"
|
111
|
+
}
|
112
|
+
};
|
113
|
+
}
|
114
|
+
static get states() {
|
115
|
+
return {
|
116
|
+
"_opened": {}
|
117
|
+
};
|
118
|
+
}
|
119
|
+
static get events() {
|
120
|
+
return [{
|
121
|
+
"method": "actionSelected",
|
122
|
+
"name": "actionSelected",
|
123
|
+
"bubbles": true,
|
124
|
+
"cancelable": true,
|
125
|
+
"composed": true,
|
126
|
+
"docs": {
|
127
|
+
"tags": [],
|
128
|
+
"text": ""
|
129
|
+
},
|
130
|
+
"complexType": {
|
131
|
+
"original": "ActionDefaultFilter",
|
132
|
+
"resolved": "ActionDefaultFilter.CREATE | ActionDefaultFilter.EDIT | ActionDefaultFilter.REMOVE",
|
133
|
+
"references": {
|
134
|
+
"ActionDefaultFilter": {
|
135
|
+
"location": "import",
|
136
|
+
"path": "../../../types/default-filters"
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}];
|
141
|
+
}
|
142
|
+
}
|
@@ -13,6 +13,7 @@ export class SnkFilterBar {
|
|
13
13
|
this._configUpdated = false;
|
14
14
|
this._firstLoad = true;
|
15
15
|
this._pendingVariables = false;
|
16
|
+
this._isDefaultFilter = false;
|
16
17
|
this._customfiltersToBeUpdated = [];
|
17
18
|
this._resolveLoading = undefined;
|
18
19
|
this._calculateSortIndex = (item) => {
|
@@ -246,10 +247,10 @@ export class SnkFilterBar {
|
|
246
247
|
}
|
247
248
|
return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
|
248
249
|
}
|
249
|
-
registryFilterProvider() {
|
250
|
+
async registryFilterProvider() {
|
250
251
|
this.dataUnit.addFilterProvider(this);
|
251
252
|
if (this.filterConfig) {
|
252
|
-
this.doLoadData();
|
253
|
+
await this.doLoadData();
|
253
254
|
}
|
254
255
|
}
|
255
256
|
itemFocused(selectedItem) {
|
@@ -338,7 +339,7 @@ export class SnkFilterBar {
|
|
338
339
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
339
340
|
}
|
340
341
|
addFilterBarLegacyConfigName() {
|
341
|
-
if (this.filterBarLegacyConfigName
|
342
|
+
if (this.filterBarLegacyConfigName) {
|
342
343
|
ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
|
343
344
|
}
|
344
345
|
}
|
@@ -361,7 +362,7 @@ export class SnkFilterBar {
|
|
361
362
|
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
|
362
363
|
}
|
363
364
|
}
|
364
|
-
attachDataUnit() {
|
365
|
+
async attachDataUnit() {
|
365
366
|
if (this.dataUnit == undefined) {
|
366
367
|
let parent = this._element.parentElement;
|
367
368
|
while (parent) {
|
@@ -369,12 +370,12 @@ export class SnkFilterBar {
|
|
369
370
|
const snkDataUnit = parent;
|
370
371
|
this.dataUnit = snkDataUnit.dataUnit;
|
371
372
|
if (this.dataUnit) {
|
372
|
-
this.registryFilterProvider();
|
373
|
+
await this.registryFilterProvider();
|
373
374
|
}
|
374
375
|
else {
|
375
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
376
|
+
snkDataUnit.addEventListener("dataUnitReady", async (evt) => {
|
376
377
|
this.dataUnit = evt.detail;
|
377
|
-
this.registryFilterProvider();
|
378
|
+
await this.registryFilterProvider();
|
378
379
|
});
|
379
380
|
}
|
380
381
|
break;
|
@@ -383,7 +384,7 @@ export class SnkFilterBar {
|
|
383
384
|
parent = parent.parentElement;
|
384
385
|
}
|
385
386
|
else {
|
386
|
-
this.registryFilterProvider();
|
387
|
+
await this.registryFilterProvider();
|
387
388
|
}
|
388
389
|
}
|
389
390
|
/**
|
@@ -411,27 +412,34 @@ export class SnkFilterBar {
|
|
411
412
|
onComplete: callbackOnApplyFilter,
|
412
413
|
disablePersonalizedFilter: this.disablePersonalizedFilter,
|
413
414
|
getMessage: (key, props) => this.getMessage(key, props),
|
414
|
-
onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
|
415
|
-
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
|
416
|
-
onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
|
415
|
+
onAddPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault),
|
416
|
+
onEditPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault),
|
417
|
+
onDeletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName, isDefault),
|
417
418
|
};
|
418
419
|
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
419
420
|
await this._filterModalFactory.showModal();
|
420
421
|
}
|
421
|
-
addPersonalizedFilter() {
|
422
|
+
addPersonalizedFilter(isDefault = false) {
|
422
423
|
this._filterModalFactory.closeModal();
|
424
|
+
this._isDefaultFilter = isDefault;
|
423
425
|
this.personalizedFilterId = undefined;
|
424
426
|
this.showPersonalizedFilter = true;
|
425
427
|
window.requestAnimationFrame(() => {
|
426
428
|
this._elPersonalizedFilter.createPersonalizedFilter();
|
427
429
|
});
|
428
430
|
}
|
429
|
-
editPersonalizedFilter(id) {
|
431
|
+
editPersonalizedFilter(id, isDefault = false) {
|
430
432
|
this._filterModalFactory.closeModal();
|
433
|
+
this._isDefaultFilter = isDefault;
|
431
434
|
this.showPersonalizedFilter = true;
|
432
435
|
this.personalizedFilterId = id;
|
433
436
|
}
|
434
|
-
deletePersonalizedFilter(filter, filterItemType, configName) {
|
437
|
+
deletePersonalizedFilter(filter, filterItemType, configName, isDefault = false) {
|
438
|
+
if (isDefault) {
|
439
|
+
ConfigStorage.removeDefaultFilter(filter, this.resourceID, configName);
|
440
|
+
this._isDefaultFilter = false;
|
441
|
+
return;
|
442
|
+
}
|
435
443
|
if (filterItemType === FilterItemType.PERSONALIZED) {
|
436
444
|
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
437
445
|
}
|
@@ -449,6 +457,7 @@ export class SnkFilterBar {
|
|
449
457
|
hidePersonalizedFilter() {
|
450
458
|
this.personalizedFilterId = undefined;
|
451
459
|
this.showPersonalizedFilter = false;
|
460
|
+
this._isDefaultFilter = false;
|
452
461
|
}
|
453
462
|
async componentWillLoad() {
|
454
463
|
var _a;
|
@@ -479,7 +488,7 @@ export class SnkFilterBar {
|
|
479
488
|
return undefined;
|
480
489
|
}
|
481
490
|
if (this.showPersonalizedFilter) {
|
482
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
491
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, isDefaultFilter: this._isDefaultFilter, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
483
492
|
}
|
484
493
|
if (this.mode !== "regular") {
|
485
494
|
return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
|
@@ -3,5 +3,6 @@ export var FilterType;
|
|
3
3
|
FilterType["QUICK_FILTER"] = "QUICK_FILTER";
|
4
4
|
FilterType["CUSTOM_FILTER"] = "CUSTOM_FILTER";
|
5
5
|
FilterType["OTHER_FILTERS"] = "OTHER_FILTERS";
|
6
|
+
FilterType["DEFAULT_FILTER"] = "DEFAULT_FILTER";
|
6
7
|
})(FilterType || (FilterType = {}));
|
7
8
|
export default FilterType;
|