@sankhyalabs/sankhyablocks 1.3.31-beta.14 → 1.3.31-beta.17
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/{SnkMessageBuilder-bb55d4c4.js → SnkMessageBuilder-cb132e6d.js} +134 -1
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-b8158822.js +6 -0
- package/dist/cjs/dom-36862b77.js +75 -0
- package/dist/cjs/filter-item-type.enum-e2e1bc5b.js +14 -0
- package/dist/cjs/index-02201bc9.js +2397 -0
- package/dist/cjs/index-b0b676c5.js +3298 -0
- package/dist/cjs/loader.cjs.js +19 -3
- package/dist/cjs/sankhyablocks.cjs.js +117 -5
- package/dist/cjs/shadow-css-346c0795.js +389 -0
- package/dist/cjs/snk-application.cjs.entry.js +542 -66
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +23 -24
- package/dist/cjs/snk-filter-bar.cjs.entry.js +199 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +47 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +44 -0
- package/dist/cjs/snk-filter-item.cjs.entry.js +131 -0
- package/dist/cjs/snk-filter-list.cjs.entry.js +91 -0
- package/dist/cjs/snk-filter-number.cjs.entry.js +23 -0
- package/dist/cjs/snk-filter-period.cjs.entry.js +26 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +44 -0
- package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
- package/dist/cjs/{snk-form_2.cjs.entry.js → snk-form.cjs.entry.js} +3 -65
- package/dist/cjs/snk-grid.cjs.entry.js +69 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-taskbar.cjs.entry.js +5 -4
- package/dist/cjs/{taskbar-elements-2888ceb6.js → taskbar-elements-efa44ff1.js} +1 -1
- package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +11 -2
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +7 -0
- package/dist/collection/components/snk-application/snk-application.js +775 -695
- package/dist/collection/components/snk-crud/snk-crud.js +75 -73
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +262 -250
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +64 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +69 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +10 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +113 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +209 -0
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +182 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +99 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +257 -0
- package/dist/collection/components/snk-form/snk-form.js +111 -111
- package/dist/collection/components/snk-grid/snk-grid.css +14 -1
- package/dist/collection/components/snk-grid/snk-grid.js +93 -92
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +128 -116
- package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +24 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +268 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -0
- package/dist/components/SnkMessageBuilder.js +134 -2
- package/dist/components/filter-item-type.enum.js +12 -0
- package/dist/components/index.d.ts +17 -5
- package/dist/components/index.js +21 -0
- package/dist/components/index2.js +2384 -0
- package/dist/components/snk-application2.js +508 -30
- package/dist/components/snk-crud.js +25 -1
- package/dist/components/snk-data-unit.js +3 -4
- package/dist/components/snk-filter-bar.d.ts +11 -0
- package/dist/components/snk-filter-bar.js +6 -0
- package/dist/components/snk-filter-bar2.js +230 -0
- package/dist/components/snk-filter-binary-select.d.ts +11 -0
- package/dist/components/snk-filter-binary-select.js +63 -0
- package/dist/components/snk-filter-detail.d.ts +11 -0
- package/dist/components/snk-filter-detail.js +6 -0
- package/dist/components/snk-filter-detail2.js +58 -0
- package/dist/components/snk-filter-item.d.ts +11 -0
- package/dist/components/snk-filter-item.js +6 -0
- package/dist/components/snk-filter-item2.js +151 -0
- package/dist/components/snk-filter-list.d.ts +11 -0
- package/dist/components/snk-filter-list.js +6 -0
- package/dist/components/snk-filter-list2.js +108 -0
- package/dist/components/snk-filter-number.d.ts +11 -0
- package/dist/components/snk-filter-number.js +39 -0
- package/dist/components/snk-filter-period.d.ts +11 -0
- package/dist/components/snk-filter-period.js +42 -0
- package/dist/components/snk-filter-search.d.ts +11 -0
- package/dist/components/snk-filter-search.js +62 -0
- package/dist/components/snk-filter-text.d.ts +11 -0
- package/dist/components/snk-filter-text.js +38 -0
- package/dist/components/snk-form2.js +1 -1
- package/dist/components/snk-grid2.js +28 -4
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-taskbar2.js +2 -1
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/esm/{SnkMessageBuilder-17d91b88.js → SnkMessageBuilder-cff80920.js} +134 -2
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-b3f2ee8d.js +4 -0
- package/dist/esm/dom-665d6011.js +73 -0
- package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
- package/dist/esm/index-2b4d2d14.js +3262 -0
- package/dist/esm/index-e5b61043.js +2384 -0
- package/dist/esm/loader.js +19 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/sankhyablocks.js +117 -5
- package/dist/esm/shadow-css-b18e99d7.js +387 -0
- package/dist/esm/snk-application.entry.js +507 -31
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-unit.entry.js +4 -5
- package/dist/esm/snk-filter-bar.entry.js +195 -0
- package/dist/esm/snk-filter-binary-select.entry.js +43 -0
- package/dist/esm/snk-filter-detail.entry.js +40 -0
- package/dist/esm/snk-filter-item.entry.js +127 -0
- package/dist/esm/snk-filter-list.entry.js +87 -0
- package/dist/esm/snk-filter-number.entry.js +19 -0
- package/dist/esm/snk-filter-period.entry.js +22 -0
- package/dist/esm/snk-filter-search.entry.js +40 -0
- package/dist/esm/snk-filter-text.entry.js +18 -0
- package/dist/esm/{snk-form_2.entry.js → snk-form.entry.js} +3 -64
- package/dist/esm/snk-grid.entry.js +65 -0
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/snk-taskbar.entry.js +4 -3
- package/dist/esm/{taskbar-elements-5ea74223.js → taskbar-elements-c119510a.js} +1 -1
- package/dist/esm/teste-pesquisa.entry.js +2 -2
- package/dist/sankhyablocks/SnkMessageBuilder-cff80920.js +299 -0
- package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
- package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
- package/dist/sankhyablocks/dom-665d6011.js +73 -0
- package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
- package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
- package/dist/sankhyablocks/index-e5b61043.js +2384 -0
- package/dist/sankhyablocks/index.esm.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
- package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
- package/dist/sankhyablocks/snk-application.entry.js +8306 -0
- package/dist/sankhyablocks/snk-crud.entry.js +60 -0
- package/dist/sankhyablocks/snk-data-unit.entry.js +272 -0
- package/dist/sankhyablocks/snk-filter-bar.entry.js +195 -0
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
- package/dist/sankhyablocks/snk-filter-detail.entry.js +40 -0
- package/dist/sankhyablocks/snk-filter-item.entry.js +127 -0
- package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
- package/dist/sankhyablocks/snk-filter-number.entry.js +19 -0
- package/dist/sankhyablocks/snk-filter-period.entry.js +22 -0
- package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
- package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
- package/dist/sankhyablocks/snk-form.entry.js +111 -0
- package/dist/sankhyablocks/snk-grid.entry.js +65 -0
- package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
- package/dist/sankhyablocks/snk-taskbar.entry.js +153 -0
- package/dist/sankhyablocks/taskbar-elements-c119510a.js +72 -0
- package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
- package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
- package/dist/types/components/snk-application/snk-application.d.ts +9 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +13 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +13 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +37 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +43 -0
- package/dist/types/components.d.ts +199 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +5 -0
- package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/loader/package.json +1 -0
- package/package.json +5 -5
- package/react/components.d.ts +0 -7
- package/react/components.js +0 -7
- package/react/components.js.map +1 -1
- package/dist/cjs/index-c6671817.js +0 -1642
- package/dist/esm/index-6a83ac96.js +0 -1614
- package/dist/sankhyablocks/p-4c7b32d6.entry.js +0 -1
- package/dist/sankhyablocks/p-56a32417.entry.js +0 -1
- package/dist/sankhyablocks/p-825d2c38.entry.js +0 -74
- package/dist/sankhyablocks/p-ab694dbc.js +0 -1
- package/dist/sankhyablocks/p-b559117b.js +0 -1
- package/dist/sankhyablocks/p-cd1dc099.js +0 -2
- package/dist/sankhyablocks/p-ce2d1214.entry.js +0 -1
- package/dist/sankhyablocks/p-d25637c9.entry.js +0 -1
- package/dist/sankhyablocks/p-d25803a1.entry.js +0 -1
- package/dist/sankhyablocks/p-edf81d2c.entry.js +0 -1
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-bb55d4c4.js');
|
|
5
|
+
const index = require('./index-b0b676c5.js');
|
|
6
|
+
const index$1 = require('./index-02201bc9.js');
|
|
7
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-cb132e6d.js');
|
|
9
8
|
|
|
10
9
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
|
|
11
10
|
|
|
@@ -42,23 +41,23 @@ const SnkDataUnit = class {
|
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
this.dataState = duState;
|
|
45
|
-
if (action.type ===
|
|
44
|
+
if (action.type === index$1.Action.DATA_SAVED) {
|
|
46
45
|
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
|
|
47
46
|
if (msg != undefined) {
|
|
48
47
|
this.showSuccessMessage(msg);
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
if (action.type ===
|
|
50
|
+
if (action.type === index$1.Action.RECORDS_ADDED || action.type === index$1.Action.RECORDS_COPIED) {
|
|
52
51
|
this.insertionMode.emit();
|
|
53
52
|
}
|
|
54
|
-
if (action.type ===
|
|
53
|
+
if (action.type === index$1.Action.EDITION_CANCELED) {
|
|
55
54
|
this.cancelEdition.emit();
|
|
56
55
|
const cancelFinishMsg = this.getMessage("snkDataUnit.cancelInfo");
|
|
57
56
|
if (cancelFinishMsg != undefined) {
|
|
58
57
|
this.showSuccessMessage(cancelFinishMsg);
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
if (action.type ===
|
|
60
|
+
if (action.type === index$1.Action.RECORDS_REMOVED) {
|
|
62
61
|
const removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
|
63
62
|
if (removeFinishMsg != undefined) {
|
|
64
63
|
this.showSuccessMessage(removeFinishMsg);
|
|
@@ -112,33 +111,33 @@ const SnkDataUnit = class {
|
|
|
112
111
|
async interceptAction(action) {
|
|
113
112
|
return new Promise(resolve => {
|
|
114
113
|
switch (action.type) {
|
|
115
|
-
case
|
|
114
|
+
case index$1.Action.RECORDS_ADDED:
|
|
116
115
|
if (this.isAllowed("INSERT")) {
|
|
117
116
|
resolve(action);
|
|
118
117
|
}
|
|
119
118
|
else {
|
|
120
|
-
|
|
119
|
+
SnkMessageBuilder.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
121
120
|
}
|
|
122
121
|
break;
|
|
123
|
-
case
|
|
122
|
+
case index$1.Action.RECORDS_COPIED:
|
|
124
123
|
if (this.isAllowed("CLONE")) {
|
|
125
124
|
resolve(action);
|
|
126
125
|
}
|
|
127
126
|
else {
|
|
128
|
-
|
|
127
|
+
SnkMessageBuilder.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
129
128
|
}
|
|
130
129
|
break;
|
|
131
|
-
case
|
|
132
|
-
case
|
|
130
|
+
case index$1.Action.DATA_CHANGED:
|
|
131
|
+
case index$1.Action.CHANGING_DATA:
|
|
133
132
|
if (this.isAllowed("UPDATE")) {
|
|
134
133
|
resolve(action);
|
|
135
134
|
}
|
|
136
135
|
else {
|
|
137
136
|
this.dataUnit.cancelEdition();
|
|
138
|
-
|
|
137
|
+
SnkMessageBuilder.ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate"));
|
|
139
138
|
}
|
|
140
139
|
break;
|
|
141
|
-
case
|
|
140
|
+
case index$1.Action.SAVING_DATA:
|
|
142
141
|
if (this.beforeSave) {
|
|
143
142
|
const continueAction = this.beforeSave(this.dataUnit);
|
|
144
143
|
if (continueAction instanceof Promise) {
|
|
@@ -152,7 +151,7 @@ const SnkDataUnit = class {
|
|
|
152
151
|
resolve(action);
|
|
153
152
|
}
|
|
154
153
|
break;
|
|
155
|
-
case
|
|
154
|
+
case index$1.Action.DATA_SAVED:
|
|
156
155
|
if (this.afterSave) {
|
|
157
156
|
this.afterSave(this.dataUnit);
|
|
158
157
|
}
|
|
@@ -160,7 +159,7 @@ const SnkDataUnit = class {
|
|
|
160
159
|
resolve(action);
|
|
161
160
|
}
|
|
162
161
|
break;
|
|
163
|
-
case
|
|
162
|
+
case index$1.Action.EDITION_CANCELED:
|
|
164
163
|
if (this.dataState.hasDirtyRecords) {
|
|
165
164
|
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
|
166
165
|
if (cancelConfirmation == undefined) {
|
|
@@ -168,7 +167,7 @@ const SnkDataUnit = class {
|
|
|
168
167
|
}
|
|
169
168
|
else {
|
|
170
169
|
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
|
171
|
-
|
|
170
|
+
SnkMessageBuilder.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
|
|
172
171
|
.then((result) => resolve(result ? action : undefined));
|
|
173
172
|
}
|
|
174
173
|
}
|
|
@@ -176,7 +175,7 @@ const SnkDataUnit = class {
|
|
|
176
175
|
resolve(action);
|
|
177
176
|
}
|
|
178
177
|
break;
|
|
179
|
-
case
|
|
178
|
+
case index$1.Action.REMOVING_RECORDS:
|
|
180
179
|
if (this.isAllowed("REMOVE")) {
|
|
181
180
|
const removeConfirmation = this.getMessage("snkDataUnit.removeConfirmation");
|
|
182
181
|
if (removeConfirmation == undefined) {
|
|
@@ -184,12 +183,12 @@ const SnkDataUnit = class {
|
|
|
184
183
|
}
|
|
185
184
|
else {
|
|
186
185
|
const removeConfirmationTitle = this.getMessage("snkDataUnit.removeConfirmationTitle");
|
|
187
|
-
|
|
186
|
+
SnkMessageBuilder.ApplicationUtils.confirm(removeConfirmationTitle, removeConfirmation, "delete", SnkMessageBuilder.DialogType.CRITICAL, { btnConfirmDanger: true })
|
|
188
187
|
.then((result) => resolve(result ? action : undefined));
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
else {
|
|
192
|
-
|
|
191
|
+
SnkMessageBuilder.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenRemove"));
|
|
193
192
|
}
|
|
194
193
|
break;
|
|
195
194
|
default:
|
|
@@ -198,7 +197,7 @@ const SnkDataUnit = class {
|
|
|
198
197
|
});
|
|
199
198
|
}
|
|
200
199
|
showSuccessMessage(message) {
|
|
201
|
-
|
|
200
|
+
SnkMessageBuilder.ApplicationUtils.info(message, { iconName: "check" });
|
|
202
201
|
}
|
|
203
202
|
isAllowed(flag) {
|
|
204
203
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
|
@@ -256,7 +255,7 @@ const SnkDataUnit = class {
|
|
|
256
255
|
// Lifecycle web component
|
|
257
256
|
//---------------------------------------------
|
|
258
257
|
componentWillLoad() {
|
|
259
|
-
this._application =
|
|
258
|
+
this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
260
259
|
this._application.getAllAccess().then(access => this._permissions = access);
|
|
261
260
|
this.loadDataUnit();
|
|
262
261
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b0b676c5.js');
|
|
6
|
+
const index$1 = require('./index-02201bc9.js');
|
|
7
|
+
const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
|
|
8
|
+
|
|
9
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}";
|
|
10
|
+
|
|
11
|
+
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
12
|
+
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
13
|
+
const SnkFilterBar = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
index.registerInstance(this, hostRef);
|
|
16
|
+
this._updateSequence = [];
|
|
17
|
+
this._calculateSortIndex = (item) => {
|
|
18
|
+
let index = item.hardFixed ? 1000000 : 0;
|
|
19
|
+
//campos Hard Fixed não variam a ordem
|
|
20
|
+
if (!item.hardFixed) {
|
|
21
|
+
index += item.fixed ? 100000 : 0;
|
|
22
|
+
index += item.value == undefined ? 0 : 10000;
|
|
23
|
+
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
|
24
|
+
}
|
|
25
|
+
return index;
|
|
26
|
+
};
|
|
27
|
+
this._filtersComparator = (a, b) => {
|
|
28
|
+
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
33
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
34
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
35
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
|
|
36
|
+
*/
|
|
37
|
+
getMessage(key, params) {
|
|
38
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
39
|
+
}
|
|
40
|
+
getFilter(_dataUnit) {
|
|
41
|
+
const filters = [];
|
|
42
|
+
this.filterConfig.filter(item => item.value).forEach(item => {
|
|
43
|
+
const filter = this.buildDUFilter(item);
|
|
44
|
+
if (filter) {
|
|
45
|
+
filters.push(filter);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return filters;
|
|
49
|
+
}
|
|
50
|
+
buildDUFilter(item) {
|
|
51
|
+
const { id, value, type, props, visible } = item;
|
|
52
|
+
if (value && visible) {
|
|
53
|
+
if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
54
|
+
const options = props.options;
|
|
55
|
+
const selectedOption = options.find(opt => opt.name === value);
|
|
56
|
+
//FIXME: ajustar o backend para não exigir parametros
|
|
57
|
+
return { name: id, expression: selectedOption.expression, params: [] };
|
|
58
|
+
}
|
|
59
|
+
if (type === filterItemType_enum.FilterItemType.PERIOD) {
|
|
60
|
+
const { end, start } = value;
|
|
61
|
+
const params = [];
|
|
62
|
+
let expression;
|
|
63
|
+
if (end && start) {
|
|
64
|
+
expression = props.expression.fullfill;
|
|
65
|
+
params.push({ name: `${id}.START`, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, start) }, { name: `${id}.END`, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, end) });
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (start) {
|
|
69
|
+
expression = props.expression.onlystart;
|
|
70
|
+
params.push({ name: id, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, start) });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
expression = props.expression.onlyend;
|
|
74
|
+
params.push({ name: id, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, end) });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { name: id, expression, params };
|
|
78
|
+
}
|
|
79
|
+
if (type === filterItemType_enum.FilterItemType.SEARCH) {
|
|
80
|
+
const expression = props.expression;
|
|
81
|
+
return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value: index$1.toString(index$1.DataType.TEXT, value.value) }] };
|
|
82
|
+
}
|
|
83
|
+
if (type === filterItemType_enum.FilterItemType.TEXT) {
|
|
84
|
+
const expression = props.expression;
|
|
85
|
+
return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value: index$1.toString(index$1.DataType.TEXT, value) }] };
|
|
86
|
+
}
|
|
87
|
+
if (type === filterItemType_enum.FilterItemType.NUMBER) {
|
|
88
|
+
const expression = props.expression;
|
|
89
|
+
return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.NUMBER, value: index$1.toString(index$1.DataType.NUMBER, value) }] };
|
|
90
|
+
}
|
|
91
|
+
//No mapeamento dos outros tipos precisamos saber o tipo de dado.
|
|
92
|
+
}
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
componentWillLoad() {
|
|
96
|
+
this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
97
|
+
if (this._application) {
|
|
98
|
+
this._application.getFilterBarConfig()
|
|
99
|
+
.then((filters) => {
|
|
100
|
+
this.filterConfig = filters;
|
|
101
|
+
})
|
|
102
|
+
.catch(reason => {
|
|
103
|
+
throw new index$1.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (this.dataUnit == undefined) {
|
|
107
|
+
let parent = this._element.parentElement;
|
|
108
|
+
while (parent) {
|
|
109
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
110
|
+
const snkDataUnit = parent;
|
|
111
|
+
this.dataUnit = snkDataUnit.dataUnit;
|
|
112
|
+
if (this.dataUnit) {
|
|
113
|
+
this.dataUnit.addFilterProvider(this);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
117
|
+
this.dataUnit = evt.detail;
|
|
118
|
+
this.dataUnit.addFilterProvider(this);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
parent = parent.parentElement;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
getFilterItems() {
|
|
128
|
+
const pinnedItems = [];
|
|
129
|
+
const unpinnedItems = [];
|
|
130
|
+
this._items = this.filterConfig
|
|
131
|
+
.filter(item => item.visible)
|
|
132
|
+
.sort((a, b) => this._filtersComparator(a, b))
|
|
133
|
+
.map((item, index$1) => {
|
|
134
|
+
const filterItem = (index.h("snk-filter-item", { config: item, class: index$1 > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
135
|
+
if (item.fixed || item.hardFixed) {
|
|
136
|
+
pinnedItems.push(filterItem);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
unpinnedItems.push(filterItem);
|
|
140
|
+
}
|
|
141
|
+
return filterItem;
|
|
142
|
+
});
|
|
143
|
+
const elements = [];
|
|
144
|
+
elements.push(...pinnedItems);
|
|
145
|
+
if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
|
|
146
|
+
elements.push(index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
|
|
147
|
+
}
|
|
148
|
+
elements.push(...unpinnedItems);
|
|
149
|
+
return elements;
|
|
150
|
+
}
|
|
151
|
+
calculateUpdateSequence(item) {
|
|
152
|
+
this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
|
|
153
|
+
this._updateSequence.push(item.id);
|
|
154
|
+
}
|
|
155
|
+
filterChangeListener(evt) {
|
|
156
|
+
this.updateFilter(evt.detail);
|
|
157
|
+
}
|
|
158
|
+
updateFilter(newItem) {
|
|
159
|
+
this.calculateUpdateSequence(newItem);
|
|
160
|
+
let needRefresh = false;
|
|
161
|
+
this.filterConfig = this.filterConfig.map(item => {
|
|
162
|
+
if (item.id === newItem.id) {
|
|
163
|
+
needRefresh = index$1.ObjectUtils.objectToString(item.value) !== index$1.ObjectUtils.objectToString(newItem.value);
|
|
164
|
+
return newItem;
|
|
165
|
+
}
|
|
166
|
+
return item;
|
|
167
|
+
});
|
|
168
|
+
if (needRefresh) {
|
|
169
|
+
this.dataUnit.loadData();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
getAddListItems() {
|
|
173
|
+
const hiddenItems = this.filterConfig
|
|
174
|
+
.filter(item => !item.visible)
|
|
175
|
+
.sort(this._filtersComparator);
|
|
176
|
+
return hiddenItems.map(filter => {
|
|
177
|
+
return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
|
|
178
|
+
}).concat([
|
|
179
|
+
{ name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" },
|
|
180
|
+
{ name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
183
|
+
addFilterHandler(itemName) {
|
|
184
|
+
const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
|
|
185
|
+
if (filterItem) {
|
|
186
|
+
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
render() {
|
|
190
|
+
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
return (index.h(index.Host, null, index.h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), index.h("ez-button", { mode: "icon", size: "small", iconName: "filter", class: "ez-padding-left--medium" }), index.h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, index.h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
194
|
+
}
|
|
195
|
+
get _element() { return index.getElement(this); }
|
|
196
|
+
};
|
|
197
|
+
SnkFilterBar.style = snkFilterBarCss;
|
|
198
|
+
|
|
199
|
+
exports.snk_filter_bar = SnkFilterBar;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b0b676c5.js');
|
|
6
|
+
const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
|
|
7
|
+
|
|
8
|
+
const SnkFilterBinarySelect = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
isSelected(option) {
|
|
13
|
+
return this.config.value == undefined || this.config.value === option;
|
|
14
|
+
}
|
|
15
|
+
ezChangeListener(evt) {
|
|
16
|
+
if (!evt.detail) {
|
|
17
|
+
this.assertCheckedOption(evt.target);
|
|
18
|
+
}
|
|
19
|
+
this.updateValue();
|
|
20
|
+
}
|
|
21
|
+
assertCheckedOption(updatingCheck) {
|
|
22
|
+
if (updatingCheck === this._checkOne) {
|
|
23
|
+
this._checkTwo.value = true;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this._checkOne.value = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
updateValue() {
|
|
30
|
+
if (!this._checkOne.value || !this._checkTwo.value) {
|
|
31
|
+
const [optOne, optTwo] = this.config.props.options;
|
|
32
|
+
this.value = this._checkOne.value ? optOne.name : optTwo.name;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.value = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const [optOne, optTwo] = this.config.props.options;
|
|
43
|
+
return (index.h(index.Host, null, index.h("ez-check", { label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), index.h("ez-check", { label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) })));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.snk_filter_binary_select = SnkFilterBinarySelect;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b0b676c5.js');
|
|
6
|
+
const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
|
|
7
|
+
|
|
8
|
+
const SnkFilterDetail = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.filterChange = index.createEvent(this, "filterChange", 7);
|
|
12
|
+
}
|
|
13
|
+
changeConfig(newConfig) {
|
|
14
|
+
this.filterChange.emit(newConfig);
|
|
15
|
+
}
|
|
16
|
+
getContentEditor() {
|
|
17
|
+
switch (this.config.type) {
|
|
18
|
+
case filterItemType_enum.FilterItemType.BINARY_SELECT:
|
|
19
|
+
return "snk-filter-binary-select";
|
|
20
|
+
case filterItemType_enum.FilterItemType.PERIOD:
|
|
21
|
+
return "snk-filter-period";
|
|
22
|
+
case filterItemType_enum.FilterItemType.SEARCH:
|
|
23
|
+
return "snk-filter-search";
|
|
24
|
+
case filterItemType_enum.FilterItemType.NUMBER:
|
|
25
|
+
return "snk-filter-number";
|
|
26
|
+
}
|
|
27
|
+
return "snk-filter-text";
|
|
28
|
+
}
|
|
29
|
+
getPopUpHeaderButtons() {
|
|
30
|
+
if (this.config.hardFixed) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return ([
|
|
34
|
+
index.h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false })) }),
|
|
35
|
+
index.h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const ContentEditor = this.getContentEditor();
|
|
40
|
+
return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(ContentEditor, { ref: ref => this._editor = ref, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), index.h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.snk_filter_detail = SnkFilterDetail;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-b0b676c5.js');
|
|
6
|
+
const index$1 = require('./index-02201bc9.js');
|
|
7
|
+
const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
|
|
8
|
+
|
|
9
|
+
const SnkFilterItem = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.filterChange = index.createEvent(this, "filterChange", 7);
|
|
13
|
+
this.innerClickCheck = (floatingContainer, node) => {
|
|
14
|
+
if (this._popover.keepOpened) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (node && floatingContainer) {
|
|
18
|
+
if (!node.offsetParent) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
let current = node;
|
|
22
|
+
do {
|
|
23
|
+
if (current === floatingContainer) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
} while ((current = current.offsetParent) != null);
|
|
27
|
+
}
|
|
28
|
+
this.detailIsVisible = false;
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
showDetail() {
|
|
33
|
+
this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
|
|
34
|
+
this.detailIsVisible = true;
|
|
35
|
+
}
|
|
36
|
+
getScrollOffset() {
|
|
37
|
+
return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
|
|
38
|
+
}
|
|
39
|
+
hideDetail() {
|
|
40
|
+
if (this._floatingID != undefined) {
|
|
41
|
+
index$1.FloatingManager.close(this._floatingID);
|
|
42
|
+
}
|
|
43
|
+
this._floatingID = undefined;
|
|
44
|
+
this.detailIsVisible = false;
|
|
45
|
+
}
|
|
46
|
+
//---------------------------------------------
|
|
47
|
+
// Event handlers
|
|
48
|
+
//---------------------------------------------
|
|
49
|
+
clickListener(evt) {
|
|
50
|
+
if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
51
|
+
if (evt.target === this._rightIconElement && this.config.value != undefined) {
|
|
52
|
+
this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (this.detailIsVisible) {
|
|
56
|
+
this.hideDetail();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.showDetail();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
evt.preventDefault();
|
|
63
|
+
evt.stopImmediatePropagation();
|
|
64
|
+
evt.stopPropagation();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
mouseDownListener(evt) {
|
|
68
|
+
if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
69
|
+
evt.preventDefault();
|
|
70
|
+
evt.stopImmediatePropagation();
|
|
71
|
+
evt.stopPropagation();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
getLabel() {
|
|
75
|
+
const { type, value, label, props } = this.config;
|
|
76
|
+
if (value) {
|
|
77
|
+
if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
78
|
+
const [optOne, optTwo] = props.options;
|
|
79
|
+
if (optOne.name === value) {
|
|
80
|
+
return optOne.label;
|
|
81
|
+
}
|
|
82
|
+
if (optTwo.name === value) {
|
|
83
|
+
return optTwo.label;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (type === filterItemType_enum.FilterItemType.PERIOD) {
|
|
87
|
+
const period = value;
|
|
88
|
+
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
89
|
+
if (period.end && period.start) {
|
|
90
|
+
return `${label}: ${dateFormater.format(period.start)} a ${dateFormater.format(period.end)}`;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (period.start) {
|
|
94
|
+
return `${label}: A partir de ${dateFormater.format(period.end)}`;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return `${label}: Até ${dateFormater.format(period.end)}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (type === filterItemType_enum.FilterItemType.SEARCH) {
|
|
102
|
+
return `${label}: ${value.value} - ${value.label}`;
|
|
103
|
+
}
|
|
104
|
+
return `${label}: ${value}`;
|
|
105
|
+
}
|
|
106
|
+
return label;
|
|
107
|
+
}
|
|
108
|
+
componentDidRender() {
|
|
109
|
+
if (this._floatingID == undefined) {
|
|
110
|
+
if (this._popover) {
|
|
111
|
+
this._popover.remove();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
filterChangeListener() {
|
|
116
|
+
this.hideDetail();
|
|
117
|
+
}
|
|
118
|
+
getIconName() {
|
|
119
|
+
if (this.config.value != undefined) {
|
|
120
|
+
return "close";
|
|
121
|
+
}
|
|
122
|
+
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
const leftIcon = this.config.type === filterItemType_enum.FilterItemType.PERIOD ? "calendar" : undefined;
|
|
126
|
+
return (index.h(index.Host, null, index.h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? index.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, index.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
|
|
127
|
+
}
|
|
128
|
+
get _filterItemElement() { return index.getElement(this); }
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
exports.snk_filter_item = SnkFilterItem;
|