@sankhyalabs/sankhyablocks 1.4.0-beta.5 → 1.4.0-beta.7
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/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +37 -2
- package/dist/cjs/snk-filter-bar_5.cjs.entry.js +122 -36
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +14 -3
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +14 -7
- package/dist/cjs/snk-filter-search.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +34 -7
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +34 -3
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +37 -15
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +82 -8
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +30 -5
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +17 -4
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +35 -0
- package/dist/components/snk-application2.js +37 -2
- package/dist/components/snk-filter-bar2.js +19 -9
- package/dist/components/snk-filter-binary-select.js +5 -1
- package/dist/components/snk-filter-detail2.js +16 -4
- package/dist/components/snk-filter-item2.js +23 -16
- package/dist/components/snk-filter-list2.js +56 -10
- package/dist/components/snk-filter-modal2.js +30 -5
- package/dist/components/snk-filter-multi-select.js +6 -2
- package/dist/components/snk-filter-number.js +6 -2
- package/dist/components/snk-filter-period.js +5 -1
- package/dist/components/snk-filter-personalized.js +16 -8
- package/dist/components/snk-filter-search.js +5 -1
- package/dist/components/snk-filter-text.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +37 -2
- package/dist/esm/snk-filter-bar_5.entry.js +122 -36
- package/dist/esm/snk-filter-binary-select.entry.js +3 -0
- package/dist/esm/snk-filter-detail.entry.js +14 -3
- package/dist/esm/snk-filter-multi-select.entry.js +4 -1
- package/dist/esm/snk-filter-number.entry.js +4 -1
- package/dist/esm/snk-filter-period.entry.js +3 -0
- package/dist/esm/snk-filter-personalized.entry.js +14 -7
- package/dist/esm/snk-filter-search.entry.js +3 -0
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/sankhyablocks/{p-01823784.entry.js → p-0ea25487.entry.js} +1 -1
- package/dist/sankhyablocks/p-21e940aa.entry.js +1 -0
- package/dist/sankhyablocks/p-40b27004.entry.js +1 -0
- package/dist/sankhyablocks/{p-c564f823.entry.js → p-42036db1.entry.js} +13 -3
- package/dist/sankhyablocks/p-4574a955.entry.js +1 -0
- package/dist/sankhyablocks/p-49580cdd.entry.js +1 -0
- package/dist/sankhyablocks/p-5bdb8452.entry.js +1 -0
- package/dist/sankhyablocks/p-6386d720.entry.js +1 -0
- package/dist/sankhyablocks/p-a14c49db.entry.js +1 -0
- package/dist/sankhyablocks/p-ba426ea9.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +7 -2
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -2
- package/dist/types/components.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/package.json +3 -3
- package/dist/sankhyablocks/p-07ebda01.entry.js +0 -1
- package/dist/sankhyablocks/p-46caa101.entry.js +0 -1
- package/dist/sankhyablocks/p-6f8303f3.entry.js +0 -1
- package/dist/sankhyablocks/p-746fc78b.entry.js +0 -1
- package/dist/sankhyablocks/p-c1c3b5d8.entry.js +0 -1
- package/dist/sankhyablocks/p-c9eec639.entry.js +0 -1
- package/dist/sankhyablocks/p-eea6444c.entry.js +0 -1
- package/dist/sankhyablocks/p-fb705f81.entry.js +0 -1
|
@@ -46,7 +46,10 @@
|
|
|
46
46
|
|
|
47
47
|
.snk-filter-item__editor-header-button{
|
|
48
48
|
cursor: pointer;
|
|
49
|
-
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
border: none;
|
|
51
|
+
padding: 3px;
|
|
52
|
+
outline-color: var(--color--primary);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
.snk-filter-bar__divider{
|
|
@@ -62,6 +65,8 @@
|
|
|
62
65
|
.snk-filter-bar__filter-list-item{
|
|
63
66
|
cursor: pointer;
|
|
64
67
|
border-radius: var(--border--radius-small, 6px);
|
|
68
|
+
border: none;
|
|
69
|
+
background-color: transparent;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
.snk-filter-bar__filter-list-item__label{
|
|
@@ -80,8 +85,8 @@
|
|
|
80
85
|
--ez-icon--color: var(--text--secondary);
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
.snk-filter-bar__filter-list-item
|
|
84
|
-
|
|
88
|
+
.snk-filter-bar__filter-list-item:focus-visible {
|
|
89
|
+
outline: none;
|
|
85
90
|
background-color: var(--background--medium);
|
|
86
91
|
}
|
|
87
92
|
|
|
@@ -114,10 +119,19 @@
|
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
.snk-filter-bar__filter-modal-item{
|
|
122
|
+
--modal-item-border-width: 2px;
|
|
117
123
|
display: flex;
|
|
118
124
|
flex-direction: row;
|
|
125
|
+
margin-left: var(--modal-item-border-width);
|
|
119
126
|
border-radius: var(--border--radius-medium, 12px);
|
|
120
127
|
background-color: var(--background--medium, #f0f3f7);
|
|
128
|
+
border: none;
|
|
129
|
+
width: 100%;
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.snk-filter-bar__filter-modal-item:focus-visible{
|
|
134
|
+
outline: var(--color--primary) solid var(--modal-item-border-width);
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
.snk-filter-bar__filter-modal-item__check{
|
|
@@ -125,7 +139,6 @@
|
|
|
125
139
|
}
|
|
126
140
|
.snk-filter-bar__filter-modal-item__label{
|
|
127
141
|
font-weight: var(--text-weight--medium);
|
|
128
|
-
width: 100%;
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
.snk-filter-bar__filter-modal-content{
|
|
@@ -6,6 +6,8 @@ import buildFilter from './filter-item/dataunitfilter/data-unit-filter-builder';
|
|
|
6
6
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
7
7
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
8
8
|
const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
|
|
9
|
+
const ADD_FILTER = "ADD_FILTER";
|
|
10
|
+
const APPLIED_FILTERS = "APPLIED_FILTERS";
|
|
9
11
|
export class SnkFilterBar {
|
|
10
12
|
constructor() {
|
|
11
13
|
this._updateSequence = [];
|
|
@@ -103,13 +105,26 @@ export class SnkFilterBar {
|
|
|
103
105
|
this.dataUnit.loadData();
|
|
104
106
|
}
|
|
105
107
|
}
|
|
108
|
+
itemFocused(selectedItem) {
|
|
109
|
+
this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
|
|
110
|
+
if (item.id === selectedItem) {
|
|
111
|
+
if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
|
|
112
|
+
item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
item["hideDetail"]();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
106
120
|
getFilterItems() {
|
|
107
121
|
const pinnedItems = [];
|
|
108
122
|
const unpinnedItems = [];
|
|
109
123
|
this.filterConfig
|
|
110
124
|
.filter(item => item.visible)
|
|
111
125
|
.forEach((item, index) => {
|
|
112
|
-
const
|
|
126
|
+
const itemId = `filter-${item.id}`;
|
|
127
|
+
const filterItem = (h("snk-filter-item", { onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
113
128
|
if (item.fixed || item.hardFixed) {
|
|
114
129
|
pinnedItems.push(filterItem);
|
|
115
130
|
}
|
|
@@ -313,13 +328,8 @@ export class SnkFilterBar {
|
|
|
313
328
|
this.openDefaultFilterModal();
|
|
314
329
|
}
|
|
315
330
|
else if (filterItem) {
|
|
331
|
+
this._pendingFilters.push(itemName);
|
|
316
332
|
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
317
|
-
window.requestAnimationFrame(() => {
|
|
318
|
-
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
319
|
-
if (filterItemElement) {
|
|
320
|
-
filterItemElement.showUp();
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
333
|
}
|
|
324
334
|
}
|
|
325
335
|
appliedFilterHandler(itemName) {
|
|
@@ -350,7 +360,7 @@ export class SnkFilterBar {
|
|
|
350
360
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
351
361
|
return undefined;
|
|
352
362
|
}
|
|
353
|
-
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
363
|
+
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { id: APPLIED_FILTERS, onFocusin: () => this.itemFocused(APPLIED_FILTERS), items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { id: ADD_FILTER, onFocusin: () => this.itemFocused(ADD_FILTER), items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
354
364
|
}
|
|
355
365
|
static get is() { return "snk-filter-bar"; }
|
|
356
366
|
static get encapsulation() { return "scoped"; }
|
|
@@ -60,6 +60,17 @@ export default class DataUnitFetcher {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}`);
|
|
63
|
+
this.templateByQuery.set("fetchDataRecord", gql `query($dataunit: String! $recordID: [String!]) {
|
|
64
|
+
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
65
|
+
record(id: $recordID){
|
|
66
|
+
id
|
|
67
|
+
fields {
|
|
68
|
+
name
|
|
69
|
+
value
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}`);
|
|
63
74
|
}
|
|
64
75
|
getDataUnit(entityName, resourceID) {
|
|
65
76
|
const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
|
|
@@ -67,6 +78,7 @@ export default class DataUnitFetcher {
|
|
|
67
78
|
dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
|
|
68
79
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
69
80
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
81
|
+
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
|
70
82
|
return dataUnit;
|
|
71
83
|
}
|
|
72
84
|
loadMetadata(dataUnit) {
|
|
@@ -235,4 +247,27 @@ export default class DataUnitFetcher {
|
|
|
235
247
|
});
|
|
236
248
|
});
|
|
237
249
|
}
|
|
250
|
+
loadRecord(dataUnit, recordIds) {
|
|
251
|
+
return new Promise((resolve, reject) => {
|
|
252
|
+
DataFetcher.get()
|
|
253
|
+
.callGraphQL({
|
|
254
|
+
values: { recordID: recordIds, dataunit: dataUnit.name },
|
|
255
|
+
query: this.templateByQuery.get("fetchDataRecord"),
|
|
256
|
+
})
|
|
257
|
+
.then((response) => {
|
|
258
|
+
const dataUnitRecords = [];
|
|
259
|
+
response.record.forEach(responseRecord => {
|
|
260
|
+
const duRecord = { __record__id__: responseRecord.id };
|
|
261
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
262
|
+
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
263
|
+
});
|
|
264
|
+
dataUnitRecords.push(duRecord);
|
|
265
|
+
});
|
|
266
|
+
resolve(dataUnitRecords);
|
|
267
|
+
})
|
|
268
|
+
.catch((error) => {
|
|
269
|
+
reject(error);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
}
|
|
238
273
|
}
|
|
@@ -6770,6 +6770,17 @@ class DataUnitFetcher {
|
|
|
6770
6770
|
}
|
|
6771
6771
|
}
|
|
6772
6772
|
}`);
|
|
6773
|
+
this.templateByQuery.set("fetchDataRecord", dist.gql `query($dataunit: String! $recordID: [String!]) {
|
|
6774
|
+
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
6775
|
+
record(id: $recordID){
|
|
6776
|
+
id
|
|
6777
|
+
fields {
|
|
6778
|
+
name
|
|
6779
|
+
value
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
}
|
|
6783
|
+
}`);
|
|
6773
6784
|
}
|
|
6774
6785
|
getDataUnit(entityName, resourceID) {
|
|
6775
6786
|
const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
|
|
@@ -6777,6 +6788,7 @@ class DataUnitFetcher {
|
|
|
6777
6788
|
dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
|
|
6778
6789
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
6779
6790
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
6791
|
+
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
|
6780
6792
|
return dataUnit;
|
|
6781
6793
|
}
|
|
6782
6794
|
loadMetadata(dataUnit) {
|
|
@@ -6945,6 +6957,29 @@ class DataUnitFetcher {
|
|
|
6945
6957
|
});
|
|
6946
6958
|
});
|
|
6947
6959
|
}
|
|
6960
|
+
loadRecord(dataUnit, recordIds) {
|
|
6961
|
+
return new Promise((resolve, reject) => {
|
|
6962
|
+
DataFetcher.get()
|
|
6963
|
+
.callGraphQL({
|
|
6964
|
+
values: { recordID: recordIds, dataunit: dataUnit.name },
|
|
6965
|
+
query: this.templateByQuery.get("fetchDataRecord"),
|
|
6966
|
+
})
|
|
6967
|
+
.then((response) => {
|
|
6968
|
+
const dataUnitRecords = [];
|
|
6969
|
+
response.record.forEach(responseRecord => {
|
|
6970
|
+
const duRecord = { __record__id__: responseRecord.id };
|
|
6971
|
+
responseRecord.fields.forEach(({ name, value }) => {
|
|
6972
|
+
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6973
|
+
});
|
|
6974
|
+
dataUnitRecords.push(duRecord);
|
|
6975
|
+
});
|
|
6976
|
+
resolve(dataUnitRecords);
|
|
6977
|
+
})
|
|
6978
|
+
.catch((error) => {
|
|
6979
|
+
reject(error);
|
|
6980
|
+
});
|
|
6981
|
+
});
|
|
6982
|
+
}
|
|
6948
6983
|
}
|
|
6949
6984
|
|
|
6950
6985
|
var _a;
|
|
@@ -7277,7 +7312,7 @@ class SnkErrorHandler {
|
|
|
7277
7312
|
return '<br><a href="#" onclick="' + onclick + '">Código: ' + exception.errorCode + '</a>';
|
|
7278
7313
|
}
|
|
7279
7314
|
processException(exception) {
|
|
7280
|
-
if (exception.errorCode
|
|
7315
|
+
if (exception.errorCode) {
|
|
7281
7316
|
exception.message += this.buildErrorCodeHTML(exception);
|
|
7282
7317
|
}
|
|
7283
7318
|
if (exception instanceof WaitingChangeException) {
|
|
@@ -7953,7 +7988,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
7953
7988
|
});
|
|
7954
7989
|
}
|
|
7955
7990
|
render() {
|
|
7956
|
-
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "col col--sd-3", closeOutsideClick: true })));
|
|
7991
|
+
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "col col--sd-3", closeOutsideClick: true, closeEsc: true })));
|
|
7957
7992
|
}
|
|
7958
7993
|
static get style() { return snkApplicationCss; }
|
|
7959
7994
|
}, [2, "snk-application", {
|
|
@@ -105,11 +105,13 @@ function buildPersonalized(item) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
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;
|
|
108
|
+
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;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.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);border:none;background-color:transparent}.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.sc-snk-filter-bar:focus-visible{outline:none;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}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:100%;height:100%}";
|
|
109
109
|
|
|
110
110
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
111
111
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
112
112
|
const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
|
|
113
|
+
const ADD_FILTER = "ADD_FILTER";
|
|
114
|
+
const APPLIED_FILTERS = "APPLIED_FILTERS";
|
|
113
115
|
const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
114
116
|
constructor() {
|
|
115
117
|
super();
|
|
@@ -209,13 +211,26 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
209
211
|
this.dataUnit.loadData();
|
|
210
212
|
}
|
|
211
213
|
}
|
|
214
|
+
itemFocused(selectedItem) {
|
|
215
|
+
this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
|
|
216
|
+
if (item.id === selectedItem) {
|
|
217
|
+
if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
|
|
218
|
+
item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
item["hideDetail"]();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
212
226
|
getFilterItems() {
|
|
213
227
|
const pinnedItems = [];
|
|
214
228
|
const unpinnedItems = [];
|
|
215
229
|
this.filterConfig
|
|
216
230
|
.filter(item => item.visible)
|
|
217
231
|
.forEach((item, index) => {
|
|
218
|
-
const
|
|
232
|
+
const itemId = `filter-${item.id}`;
|
|
233
|
+
const filterItem = (h("snk-filter-item", { onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
219
234
|
if (item.fixed || item.hardFixed) {
|
|
220
235
|
pinnedItems.push(filterItem);
|
|
221
236
|
}
|
|
@@ -419,13 +434,8 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
419
434
|
this.openDefaultFilterModal();
|
|
420
435
|
}
|
|
421
436
|
else if (filterItem) {
|
|
437
|
+
this._pendingFilters.push(itemName);
|
|
422
438
|
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
423
|
-
window.requestAnimationFrame(() => {
|
|
424
|
-
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
425
|
-
if (filterItemElement) {
|
|
426
|
-
filterItemElement.showUp();
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
439
|
}
|
|
430
440
|
}
|
|
431
441
|
appliedFilterHandler(itemName) {
|
|
@@ -456,7 +466,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
456
466
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
457
467
|
return undefined;
|
|
458
468
|
}
|
|
459
|
-
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
469
|
+
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { id: APPLIED_FILTERS, onFocusin: () => this.itemFocused(APPLIED_FILTERS), items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { id: ADD_FILTER, onFocusin: () => this.itemFocused(ADD_FILTER), items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
460
470
|
}
|
|
461
471
|
get _element() { return this; }
|
|
462
472
|
static get watchers() { return {
|
|
@@ -32,6 +32,9 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
32
32
|
this.value = undefined;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
async show() {
|
|
36
|
+
this._checkOne.setFocus();
|
|
37
|
+
}
|
|
35
38
|
render() {
|
|
36
39
|
if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
|
|
37
40
|
return undefined;
|
|
@@ -41,7 +44,8 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
41
44
|
}
|
|
42
45
|
}, [0, "snk-filter-binary-select", {
|
|
43
46
|
"value": [1544],
|
|
44
|
-
"config": [16]
|
|
47
|
+
"config": [16],
|
|
48
|
+
"show": [64]
|
|
45
49
|
}, [[0, "ezChange", "ezChangeListener"]]]);
|
|
46
50
|
function defineCustomElement$1() {
|
|
47
51
|
if (typeof customElements === "undefined") {
|
|
@@ -8,6 +8,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
8
8
|
this.__registerHost();
|
|
9
9
|
this.filterChange = createEvent(this, "filterChange", 7);
|
|
10
10
|
}
|
|
11
|
+
async show() {
|
|
12
|
+
this._editor["show"]();
|
|
13
|
+
}
|
|
11
14
|
changeConfig(newConfig) {
|
|
12
15
|
this.filterChange.emit(newConfig);
|
|
13
16
|
}
|
|
@@ -36,10 +39,13 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
36
39
|
return undefined;
|
|
37
40
|
}
|
|
38
41
|
return ([
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
|
|
43
|
+
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 })))
|
|
41
44
|
]);
|
|
42
45
|
}
|
|
46
|
+
buildIcon(title, iconName, action) {
|
|
47
|
+
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
|
|
48
|
+
}
|
|
43
49
|
apply() {
|
|
44
50
|
var _a;
|
|
45
51
|
let value = this._editor["value"];
|
|
@@ -83,13 +89,19 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
83
89
|
clear() {
|
|
84
90
|
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
85
91
|
}
|
|
92
|
+
onKeyDonwListener(event) {
|
|
93
|
+
if (event.key === "Enter") {
|
|
94
|
+
this._applyButton.setFocus().then(() => this.apply());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
86
97
|
render() {
|
|
87
98
|
const ContentEditor = this.getContentEditor();
|
|
88
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, 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()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
99
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, 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()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt) }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
89
100
|
}
|
|
90
101
|
}, [0, "snk-filter-detail", {
|
|
91
102
|
"config": [1040],
|
|
92
|
-
"getMessage": [16]
|
|
103
|
+
"getMessage": [16],
|
|
104
|
+
"show": [64]
|
|
93
105
|
}]);
|
|
94
106
|
function defineCustomElement() {
|
|
95
107
|
if (typeof customElements === "undefined") {
|
|
@@ -13,7 +13,6 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
this.detailIsVisible = false;
|
|
16
|
-
this.executeCloseCallback();
|
|
17
16
|
return false;
|
|
18
17
|
};
|
|
19
18
|
}
|
|
@@ -21,29 +20,36 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
21
20
|
return new Promise(resolve => {
|
|
22
21
|
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
23
22
|
if (open) {
|
|
23
|
+
this._closeCallback = resolve;
|
|
24
24
|
window.requestAnimationFrame(() => {
|
|
25
|
-
this.
|
|
26
|
-
|
|
25
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
26
|
+
autoClose: true,
|
|
27
|
+
innerClickTest: this.innerClickCheck,
|
|
28
|
+
backClickListener: () => this.onDetailCloseCallback(),
|
|
29
|
+
left: this.getScrollOffset(),
|
|
30
|
+
useOverlay: true
|
|
31
|
+
});
|
|
32
|
+
this._popover.show();
|
|
33
|
+
this.detailIsVisible = true;
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
36
|
});
|
|
30
37
|
}
|
|
31
|
-
showDetail() {
|
|
32
|
-
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
|
|
33
|
-
this.detailIsVisible = true;
|
|
34
|
-
}
|
|
35
38
|
getScrollOffset() {
|
|
36
|
-
|
|
39
|
+
const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
|
|
40
|
+
const rect = this._filterItemElement.getBoundingClientRect();
|
|
41
|
+
return `calc(${rect.left}px + ${padding})`;
|
|
37
42
|
}
|
|
38
|
-
hideDetail() {
|
|
39
|
-
if (this.
|
|
40
|
-
|
|
43
|
+
async hideDetail() {
|
|
44
|
+
if (this.detailIsVisible) {
|
|
45
|
+
if (this._floatingID != undefined) {
|
|
46
|
+
FloatingManager.close(this._floatingID);
|
|
47
|
+
}
|
|
41
48
|
}
|
|
49
|
+
}
|
|
50
|
+
onDetailCloseCallback() {
|
|
42
51
|
this._floatingID = undefined;
|
|
43
52
|
this.detailIsVisible = false;
|
|
44
|
-
this.executeCloseCallback();
|
|
45
|
-
}
|
|
46
|
-
executeCloseCallback() {
|
|
47
53
|
if (this._closeCallback) {
|
|
48
54
|
this._closeCallback();
|
|
49
55
|
this._closeCallback = undefined;
|
|
@@ -62,7 +68,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
62
68
|
this.hideDetail();
|
|
63
69
|
}
|
|
64
70
|
else {
|
|
65
|
-
this.
|
|
71
|
+
this.showUp(true);
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
evt.preventDefault();
|
|
@@ -163,7 +169,8 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
163
169
|
"config": [1040],
|
|
164
170
|
"getMessage": [16],
|
|
165
171
|
"detailIsVisible": [32],
|
|
166
|
-
"showUp": [64]
|
|
172
|
+
"showUp": [64],
|
|
173
|
+
"hideDetail": [64]
|
|
167
174
|
}, [[2, "click", "clickListener"], [2, "mousedown", "mouseDownListener"], [0, "filterChange", "filterChangeListener"]]]);
|
|
168
175
|
function defineCustomElement() {
|
|
169
176
|
if (typeof customElements === "undefined") {
|
|
@@ -8,6 +8,7 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8
8
|
super();
|
|
9
9
|
this.__registerHost();
|
|
10
10
|
this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
|
|
11
|
+
this._preselection = -1;
|
|
11
12
|
this.innerClickCheck = (_floatingContainer, node) => {
|
|
12
13
|
if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
|
|
13
14
|
return true;
|
|
@@ -16,25 +17,34 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
16
17
|
return false;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
this.
|
|
20
|
+
showDetail() {
|
|
21
|
+
this._preselection = -1;
|
|
22
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
23
|
+
autoClose: true,
|
|
24
|
+
innerClickTest: this.innerClickCheck,
|
|
25
|
+
backClickListener: () => this.onListCloseCallback(),
|
|
26
|
+
useOverlay: true
|
|
27
|
+
});
|
|
21
28
|
this._detailIsVisible = true;
|
|
22
29
|
this._showAll = false;
|
|
23
30
|
this._filterArgument = "";
|
|
31
|
+
this._filterInput.setFocus();
|
|
24
32
|
}
|
|
25
|
-
|
|
33
|
+
async hideDetail() {
|
|
26
34
|
if (this._floatingID != undefined) {
|
|
27
35
|
FloatingManager.close(this._floatingID);
|
|
28
36
|
}
|
|
37
|
+
}
|
|
38
|
+
onListCloseCallback() {
|
|
29
39
|
this._floatingID = undefined;
|
|
30
40
|
this._detailIsVisible = false;
|
|
31
41
|
}
|
|
32
42
|
buttonClick() {
|
|
33
43
|
if (this._detailIsVisible) {
|
|
34
|
-
this.
|
|
44
|
+
this.hideDetail();
|
|
35
45
|
}
|
|
36
46
|
else {
|
|
37
|
-
this.
|
|
47
|
+
this.showDetail();
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
componentDidRender() {
|
|
@@ -45,14 +55,15 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
45
55
|
}
|
|
46
56
|
}
|
|
47
57
|
buildItemElement(item) {
|
|
48
|
-
|
|
58
|
+
const itemId = ++this._selectableItemsCount;
|
|
59
|
+
return (h("button", { id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
|
|
49
60
|
}
|
|
50
61
|
itemSelected(itemName) {
|
|
51
62
|
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
52
63
|
this._showAll = true;
|
|
53
64
|
}
|
|
54
65
|
else {
|
|
55
|
-
this.
|
|
66
|
+
this.hideDetail();
|
|
56
67
|
this.snkItemSelected.emit(itemName);
|
|
57
68
|
}
|
|
58
69
|
}
|
|
@@ -66,13 +77,47 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
66
77
|
items.splice(MAX_FILTERS);
|
|
67
78
|
items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
|
|
68
79
|
}
|
|
80
|
+
this._selectableItemsCount = 0;
|
|
69
81
|
return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
70
82
|
}
|
|
71
83
|
getFooterItems() {
|
|
72
84
|
return this.items.filter(item => item.kind === "FOOTER");
|
|
73
85
|
}
|
|
86
|
+
keyDownHandler(event) {
|
|
87
|
+
switch (event.key) {
|
|
88
|
+
case "ArrowDown":
|
|
89
|
+
this.changePreselection(this._preselection + 1);
|
|
90
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
91
|
+
event.stopImmediatePropagation();
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
break;
|
|
95
|
+
case "ArrowUp":
|
|
96
|
+
this.changePreselection(this._preselection - 1);
|
|
97
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
98
|
+
event.stopImmediatePropagation();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
changePreselection(newSelection) {
|
|
105
|
+
if (newSelection < 0) {
|
|
106
|
+
newSelection = this._selectableItemsCount;
|
|
107
|
+
}
|
|
108
|
+
this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
|
|
109
|
+
if (this._preselection === 0) {
|
|
110
|
+
this._filterInput.setFocus();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const item = this._element.querySelector(`#filter-item${this._preselection}`);
|
|
114
|
+
if (item) {
|
|
115
|
+
item.focus();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
74
119
|
render() {
|
|
75
|
-
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
120
|
+
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail, onFocus: () => this._preselection = 0 }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
76
121
|
}
|
|
77
122
|
get _element() { return this; }
|
|
78
123
|
}, [4, "snk-filter-list", {
|
|
@@ -84,8 +129,9 @@ const SnkFilterList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
84
129
|
"findFilterText": [1, "find-filter-text"],
|
|
85
130
|
"buttonClass": [1, "button-class"],
|
|
86
131
|
"_filterArgument": [32],
|
|
87
|
-
"_showAll": [32]
|
|
88
|
-
|
|
132
|
+
"_showAll": [32],
|
|
133
|
+
"hideDetail": [64]
|
|
134
|
+
}, [[2, "keydown", "keyDownHandler"]]]);
|
|
89
135
|
function defineCustomElement() {
|
|
90
136
|
if (typeof customElements === "undefined") {
|
|
91
137
|
return;
|