@sankhyalabs/ezui 4.18.2 → 4.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants-3a1d64fb.js +7 -0
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +373 -282
- package/dist/cjs/ez-list.cjs.entry.js +85 -72
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +181 -0
- package/dist/cjs/{ez-filter-input_4.cjs.entry.js → ez-scroller_3.cjs.entry.js} +0 -116
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +108 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ez-check/ez-check.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +186 -119
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +8 -1
- package/dist/collection/components/ez-grid/ez-grid.css +14 -4
- package/dist/collection/components/ez-grid/ez-grid.js +49 -20
- package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +297 -0
- package/dist/collection/components/ez-list/ez-list.css +0 -1
- package/dist/collection/components/ez-list/ez-list.js +88 -77
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +318 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
- package/dist/collection/utils/constants.js +1 -0
- package/dist/custom-elements/index.d.ts +18 -0
- package/dist/custom-elements/index.js +761 -362
- package/dist/esm/constants-6dab64f7.js +4 -0
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +2 -2
- package/dist/esm/ez-filter-input_2.entry.js +132 -0
- package/dist/esm/ez-form-view.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +373 -282
- package/dist/esm/ez-list.entry.js +85 -72
- package/dist/esm/ez-multi-selection-list.entry.js +177 -0
- package/dist/esm/{ez-filter-input_4.entry.js → ez-scroller_3.entry.js} +3 -118
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +104 -0
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-06b3c6cd.entry.js +1 -0
- package/dist/ezui/{p-967758ac.entry.js → p-0dc118f3.entry.js} +1 -1
- package/dist/ezui/p-27a01a26.js +1 -0
- package/dist/ezui/p-353be5eb.entry.js +1 -0
- package/dist/ezui/p-3e25ecbc.entry.js +1 -0
- package/dist/ezui/{p-b945133d.entry.js → p-4186ca4f.entry.js} +1 -1
- package/dist/ezui/{p-b2056805.entry.js → p-5c0ac5ba.entry.js} +1 -1
- package/dist/ezui/{p-9334e296.entry.js → p-b7dd1382.entry.js} +2 -2
- package/dist/ezui/p-c72a799e.entry.js +1 -0
- package/dist/ezui/p-e04e9dbd.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +5 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +14 -5
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +9 -7
- package/dist/types/components/ez-grid/ez-grid.d.ts +14 -4
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +45 -0
- package/dist/types/components/ez-list/ez-list.d.ts +5 -5
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +64 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
- package/dist/types/components.d.ts +117 -1
- package/dist/types/utils/constants.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/constants-5a75e2f3.js +0 -5
- package/dist/esm/constants-ca136201.js +0 -3
- package/dist/ezui/p-3f4ae3a3.js +0 -1
- package/dist/ezui/p-4ebb1d15.entry.js +0 -1
- package/dist/ezui/p-afea6e50.entry.js +0 -1
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { calcFilterColumnLeftPosition } from '../AgGridUtils';
|
|
1
2
|
export class EzGridCustomHeader {
|
|
2
3
|
init(agParams) {
|
|
3
4
|
var _a;
|
|
@@ -29,9 +30,14 @@ export class EzGridCustomHeader {
|
|
|
29
30
|
configFilterButton() {
|
|
30
31
|
this.filterButton = this.element.querySelector('#ez-grid-filter-icon');
|
|
31
32
|
this.filterButton.style.display = this.params.hasFilter() ? 'flex' : 'none';
|
|
32
|
-
this.onFilterButtonClickListener = this.
|
|
33
|
+
this.onFilterButtonClickListener = this.onClickFilter.bind(this);
|
|
33
34
|
this.filterButton.addEventListener('click', this.onFilterButtonClickListener);
|
|
34
35
|
}
|
|
36
|
+
onClickFilter() {
|
|
37
|
+
var _a;
|
|
38
|
+
const iconLeft = (_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left;
|
|
39
|
+
this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`);
|
|
40
|
+
}
|
|
35
41
|
configSortIcon() {
|
|
36
42
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
37
43
|
this.sortUpIcon.style.display = this.params.column.isSortAscending() ? 'flex' : 'none';
|
|
@@ -77,5 +83,6 @@ export class EzGridCustomHeader {
|
|
|
77
83
|
this.filterButton.removeEventListener('click', this.onFilterButtonClickListener);
|
|
78
84
|
}
|
|
79
85
|
this.params.column.removeEventListener('sortChanged', this.onSortChangedListener);
|
|
86
|
+
this.params.column.removeEventListener('applyFilterColumnOptions', this.onFilterAppliedListener);
|
|
80
87
|
}
|
|
81
88
|
}
|
|
@@ -19,12 +19,10 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.grid-header {
|
|
22
|
-
|
|
23
|
-
display: flex;
|
|
22
|
+
display: grid;
|
|
24
23
|
justify-content: space-between;
|
|
25
24
|
align-items: center;
|
|
26
|
-
|
|
27
|
-
/*public*/
|
|
25
|
+
grid-template-columns: 1fr;
|
|
28
26
|
background-color: var(--ez-grid__header--background-color, #FFF);
|
|
29
27
|
z-index: var(--visible);
|
|
30
28
|
}
|
|
@@ -39,12 +37,24 @@
|
|
|
39
37
|
background-color: var(--ez-grid__header--background-color);
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
.grid-header__popover {
|
|
41
|
+
position: relative;
|
|
42
|
+
top: var(--space--sm, 16px);
|
|
43
|
+
}
|
|
44
|
+
|
|
42
45
|
.grid-header__container {
|
|
43
46
|
/*private*/
|
|
44
47
|
display: flex;
|
|
45
48
|
align-items: center;
|
|
46
49
|
}
|
|
47
50
|
|
|
51
|
+
.grid-header__position {
|
|
52
|
+
/*private*/
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
.grid__selection-counter {
|
|
49
59
|
/*private*/
|
|
50
60
|
position: fixed;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { ElementIDUtils, JSUtils } from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { ElementIDUtils, JSUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
3
|
+
import { Host, h } from '@stencil/core';
|
|
4
|
+
import AgGridController from './controller/ag-grid/AgGridController';
|
|
5
|
+
import { SelectionCounter } from './subcomponents/selection-counter';
|
|
6
|
+
const windowInstace = window;
|
|
6
7
|
export class EzGrid {
|
|
7
8
|
constructor() {
|
|
8
9
|
this._gridController = new AgGridController(false);
|
|
10
|
+
this.timeFadeOutInMs = 3000;
|
|
11
|
+
this.toastMessageToUpdateFilterColumn = 'Filtro de coluna aplicado com sucesso!';
|
|
9
12
|
this._paginationInfo = undefined;
|
|
10
13
|
this._paginationChangedByKeyboard = true;
|
|
11
14
|
this._showSelectionCounter = false;
|
|
@@ -17,6 +20,7 @@ export class EzGrid {
|
|
|
17
20
|
this.serverUrl = undefined;
|
|
18
21
|
this.dataUnit = undefined;
|
|
19
22
|
this.statusResolver = undefined;
|
|
23
|
+
this.columnfilterDataSource = undefined;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Aplica a definição de colunas.
|
|
@@ -88,7 +92,6 @@ export class EzGrid {
|
|
|
88
92
|
onSelectPageRecords() {
|
|
89
93
|
var _a;
|
|
90
94
|
(_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.setSelection(this.dataUnit.records.map(record => record.__record__id__)).then(selection => this.setSelection(selection));
|
|
91
|
-
;
|
|
92
95
|
}
|
|
93
96
|
onClearSelectedRecords() {
|
|
94
97
|
var _a;
|
|
@@ -104,7 +107,7 @@ export class EzGrid {
|
|
|
104
107
|
newConfigColumn['width'] = columnState.width;
|
|
105
108
|
}
|
|
106
109
|
if (columnState.sort) {
|
|
107
|
-
newConfigColumn['ascending'] =
|
|
110
|
+
newConfigColumn['ascending'] = columnState.sort.toUpperCase() === 'ASC';
|
|
108
111
|
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
109
112
|
}
|
|
110
113
|
else {
|
|
@@ -128,23 +131,23 @@ export class EzGrid {
|
|
|
128
131
|
return;
|
|
129
132
|
}
|
|
130
133
|
const limitBottom = boundingContainer.bottom - 30;
|
|
131
|
-
this._gridSelectionCounter.style.bottom =
|
|
134
|
+
this._gridSelectionCounter.style.bottom = document.body.clientHeight - limitBottom + 'px';
|
|
132
135
|
}
|
|
133
136
|
else {
|
|
134
|
-
this._gridSelectionCounter.style.bottom =
|
|
137
|
+
this._gridSelectionCounter.style.bottom = '';
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
setEvents() {
|
|
138
|
-
window.removeEventListener(
|
|
139
|
-
window.addEventListener(
|
|
141
|
+
window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
|
|
142
|
+
window.addEventListener('scroll', this.positionSelectionCounter.bind(this));
|
|
140
143
|
}
|
|
141
144
|
resizeSelectionCounter() {
|
|
142
145
|
if (this._gridSelectionCounter == undefined) {
|
|
143
146
|
return;
|
|
144
147
|
}
|
|
145
|
-
this._gridSelectionCounter.style.width =
|
|
148
|
+
this._gridSelectionCounter.style.width = '';
|
|
146
149
|
if (this._gridSelectionCounter.clientHeight > 42) {
|
|
147
|
-
this._gridSelectionCounter.style.width =
|
|
150
|
+
this._gridSelectionCounter.style.width = 'min-content';
|
|
148
151
|
}
|
|
149
152
|
this.positionSelectionCounter();
|
|
150
153
|
}
|
|
@@ -203,8 +206,8 @@ export class EzGrid {
|
|
|
203
206
|
buildDataElementId() {
|
|
204
207
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
205
208
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
206
|
-
const dtInfo = { id:
|
|
207
|
-
ElementIDUtils.addIDInfo(this._refPaginationControl,
|
|
209
|
+
const dtInfo = { id: 'ezGrid' };
|
|
210
|
+
ElementIDUtils.addIDInfo(this._refPaginationControl, 'pagination', dtInfo);
|
|
208
211
|
}
|
|
209
212
|
previousPage() {
|
|
210
213
|
if (this.dataUnit) {
|
|
@@ -224,7 +227,7 @@ export class EzGrid {
|
|
|
224
227
|
return [
|
|
225
228
|
h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, `${firstRecord}-${lastRecord}`), ` de ${total}`),
|
|
226
229
|
h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }),
|
|
227
|
-
h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
|
|
230
|
+
h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }),
|
|
228
231
|
];
|
|
229
232
|
}
|
|
230
233
|
return null;
|
|
@@ -250,7 +253,7 @@ export class EzGrid {
|
|
|
250
253
|
allowMultipleSelection: this.multipleSelection,
|
|
251
254
|
serverURL: this.serverUrl,
|
|
252
255
|
dataUnit: this.dataUnit,
|
|
253
|
-
statusResolver: this.statusResolver
|
|
256
|
+
statusResolver: this.statusResolver,
|
|
254
257
|
});
|
|
255
258
|
if (this.config) {
|
|
256
259
|
this.observeConfig(this.config);
|
|
@@ -258,15 +261,21 @@ export class EzGrid {
|
|
|
258
261
|
this.buildDataElementId();
|
|
259
262
|
this.setEvents();
|
|
260
263
|
this.componentReady.emit();
|
|
264
|
+
this._gridController.configFilterColumn(this._filterColumn);
|
|
261
265
|
}
|
|
262
266
|
componentWillRender() {
|
|
263
267
|
this.configSelectionCounter();
|
|
264
268
|
}
|
|
269
|
+
componentDidRender() {
|
|
270
|
+
windowInstace.addEventListener('onSubmitFilter', () => {
|
|
271
|
+
this.toastElementRef.show(this.toastMessageToUpdateFilterColumn, this.timeFadeOutInMs, true, true);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
265
274
|
render() {
|
|
266
275
|
var _a;
|
|
267
|
-
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => this._refPaginationControl = ref }, this.getPaginationControl())), h("div", { ref: (ref) => this._gridSelectionCounter = ref, class: `grid__selection-counter
|
|
268
|
-
${this._showSelectionCounter ?
|
|
269
|
-
` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, hasPagination: !!this._paginationInfo, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => this._showSelectionCounter = false })), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
|
|
276
|
+
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", dataSource: this.columnfilterDataSource, dataUnit: this.dataUnit, ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter
|
|
277
|
+
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
278
|
+
` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, hasPagination: !!this._paginationInfo, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "grid__footer" }, h("slot", { name: "footer" })), h("ez-toast", { ref: (element) => (this.toastElementRef = element) }, h("ez-icon", { slot: "icon", iconName: "check" }))));
|
|
270
279
|
}
|
|
271
280
|
static get is() { return "ez-grid"; }
|
|
272
281
|
static get encapsulation() { return "scoped"; }
|
|
@@ -380,6 +389,26 @@ export class EzGrid {
|
|
|
380
389
|
"tags": [],
|
|
381
390
|
"text": "Define um `IStatusResolver` respons\u00E1vel pelo estado da coluna de status."
|
|
382
391
|
}
|
|
392
|
+
},
|
|
393
|
+
"columnfilterDataSource": {
|
|
394
|
+
"type": "unknown",
|
|
395
|
+
"mutable": false,
|
|
396
|
+
"complexType": {
|
|
397
|
+
"original": "IMultiSelectionListDataSource",
|
|
398
|
+
"resolved": "IMultiSelectionListDataSource",
|
|
399
|
+
"references": {
|
|
400
|
+
"IMultiSelectionListDataSource": {
|
|
401
|
+
"location": "import",
|
|
402
|
+
"path": "../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource"
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"required": false,
|
|
407
|
+
"optional": false,
|
|
408
|
+
"docs": {
|
|
409
|
+
"tags": [],
|
|
410
|
+
"text": "Define um `IMultiSelectionListDataSource` respons\u00E1vel por alimentar o filtro de colunas."
|
|
411
|
+
}
|
|
383
412
|
}
|
|
384
413
|
};
|
|
385
414
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.filter-column {
|
|
2
|
+
padding: var(--space--2xs, 8px);
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.filter-column__header {
|
|
7
|
+
margin-bottom: var(--space--2xs, 8px);
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
height: var(--space--xl, 32px);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.filter-column__footer {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
align-items: center;
|
|
21
|
+
width: 100%;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
padding-top: var(--space--2xs, 8px);
|
|
25
|
+
border-top: var(--border--medium) var(--color--disable-secondary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.filter-column__popover {
|
|
29
|
+
position: absolute;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.filter-column__header-title {
|
|
33
|
+
margin-left: 8px;
|
|
34
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { UserInterface } from '@sankhyalabs/core';
|
|
2
|
+
import { h } from '@stencil/core';
|
|
3
|
+
const windowInstace = window;
|
|
4
|
+
const onSubmitFilter = new CustomEvent('onSubmitFilter', {
|
|
5
|
+
detail: {
|
|
6
|
+
showToast: true,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
export class FilterColumn {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.TOP_POSITION = '65px';
|
|
12
|
+
this.opened = true;
|
|
13
|
+
this.columnName = undefined;
|
|
14
|
+
this.columnLabel = undefined;
|
|
15
|
+
this.dataSource = undefined;
|
|
16
|
+
this.dataUnit = undefined;
|
|
17
|
+
this.options = undefined;
|
|
18
|
+
this.selectedItems = undefined;
|
|
19
|
+
this.fieldDescriptor = undefined;
|
|
20
|
+
this.useOptions = false;
|
|
21
|
+
}
|
|
22
|
+
async hide() {
|
|
23
|
+
await this.ezPopoverElement.hide();
|
|
24
|
+
await this.clearConfigs();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Abre o filtro de coluna.
|
|
28
|
+
* @Params IFilterColumnConfigs informações para configurar o filtro
|
|
29
|
+
*/
|
|
30
|
+
async show(configs) {
|
|
31
|
+
if (this.canShow(configs)) {
|
|
32
|
+
await this.hide();
|
|
33
|
+
this.fieldDescriptor = this.dataUnit.getField(configs.columnName);
|
|
34
|
+
this.setOptions(configs.filteredOptions);
|
|
35
|
+
this.columnName = configs.columnName;
|
|
36
|
+
this.columnLabel = configs.columnLabel;
|
|
37
|
+
await this.ezPopoverElement.show(this.TOP_POSITION, configs.leftPosition);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async clearConfigs() {
|
|
41
|
+
var _a;
|
|
42
|
+
await ((_a = this.ezMultiSelectionList) === null || _a === void 0 ? void 0 : _a.clearFilteredOptions());
|
|
43
|
+
this.options = null;
|
|
44
|
+
this.columnName = null;
|
|
45
|
+
}
|
|
46
|
+
canShow(configs) {
|
|
47
|
+
return !this.ezPopoverElement.opened || configs.columnName !== this.columnName;
|
|
48
|
+
}
|
|
49
|
+
submit() {
|
|
50
|
+
this.applyFilterColumnOptions.emit({ field: this.columnName, values: this.selectedItems });
|
|
51
|
+
windowInstace.dispatchEvent(onSubmitFilter);
|
|
52
|
+
this.hide();
|
|
53
|
+
}
|
|
54
|
+
changeSelectedItems(items) {
|
|
55
|
+
this.selectedItems = items;
|
|
56
|
+
}
|
|
57
|
+
hasToUseOptions() {
|
|
58
|
+
return this.fieldDescriptor.userInterface === UserInterface.OPTIONSELECTOR
|
|
59
|
+
|| this.fieldDescriptor.userInterface === UserInterface.SWITCH
|
|
60
|
+
|| this.fieldDescriptor.userInterface === UserInterface.CHECKBOX;
|
|
61
|
+
}
|
|
62
|
+
isCheckBoxOrSwitch() {
|
|
63
|
+
return this.fieldDescriptor.userInterface === UserInterface.SWITCH
|
|
64
|
+
|| this.fieldDescriptor.userInterface === UserInterface.CHECKBOX;
|
|
65
|
+
}
|
|
66
|
+
setOptions(selectedItems) {
|
|
67
|
+
const validateFieldUserInterfaceOptionSelector = this.hasToUseOptions();
|
|
68
|
+
this.useOptions = validateFieldUserInterfaceOptionSelector;
|
|
69
|
+
this.options = validateFieldUserInterfaceOptionSelector ? this.buildOptions(selectedItems) : (selectedItems !== null && selectedItems !== void 0 ? selectedItems : null);
|
|
70
|
+
}
|
|
71
|
+
buildOptions(selectedItems) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if (selectedItems && selectedItems.length > 0) {
|
|
74
|
+
return selectedItems;
|
|
75
|
+
}
|
|
76
|
+
if (this.isCheckBoxOrSwitch()) {
|
|
77
|
+
return [
|
|
78
|
+
{ label: "Sim", value: "true", check: true },
|
|
79
|
+
{ label: "Não", value: "false", check: true }
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
const optionsObject = JSON.parse((_b = (_a = this.fieldDescriptor) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.options);
|
|
83
|
+
const objectKeys = Object.keys(optionsObject);
|
|
84
|
+
return objectKeys.map(key => {
|
|
85
|
+
return { label: optionsObject[key], value: key, check: true };
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
handleEzVisibilityChange(event) {
|
|
89
|
+
if (event.detail === false) {
|
|
90
|
+
this.clearConfigs();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
return (h("ez-popover", { class: "filter-column__popover", "overlay-type": "none", ref: (element) => (this.ezPopoverElement = element), autoClose: true, onEzVisibilityChange: this.handleEzVisibilityChange.bind(this) }, h("section", { class: "filter-column" }, h("header", { class: "filter-column__header" }, h("span", { class: "ez-text ez-text--medium filter-column__header-title" }, "Filtro da coluna ", this.columnLabel), h("ez-button", { mode: "icon", "icon-name": "close", class: "ez-button--tertiary", onClick: () => this.hide() })), h("ez-multi-selection-list", { columnName: this.columnName, dataSource: this.dataSource, options: this.options, useOptions: this.useOptions, ref: (element) => (this.ezMultiSelectionList = element), onChangeFilteredOptions: (event) => this.changeSelectedItems(event.detail) }), h("footer", { class: "filter-column__footer" }, h("ez-button", { label: "Aplicar", class: "ez-button--primary", onClick: this.submit.bind(this) })))));
|
|
95
|
+
}
|
|
96
|
+
static get is() { return "filter-column"; }
|
|
97
|
+
static get originalStyleUrls() {
|
|
98
|
+
return {
|
|
99
|
+
"$": ["filter-column.css"]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static get styleUrls() {
|
|
103
|
+
return {
|
|
104
|
+
"$": ["filter-column.css"]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static get properties() {
|
|
108
|
+
return {
|
|
109
|
+
"opened": {
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "boolean",
|
|
114
|
+
"resolved": "boolean",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": ""
|
|
122
|
+
},
|
|
123
|
+
"attribute": "opened",
|
|
124
|
+
"reflect": false,
|
|
125
|
+
"defaultValue": "true"
|
|
126
|
+
},
|
|
127
|
+
"columnName": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "string",
|
|
132
|
+
"resolved": "string",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": ""
|
|
140
|
+
},
|
|
141
|
+
"attribute": "column-name",
|
|
142
|
+
"reflect": false
|
|
143
|
+
},
|
|
144
|
+
"columnLabel": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"mutable": false,
|
|
147
|
+
"complexType": {
|
|
148
|
+
"original": "string",
|
|
149
|
+
"resolved": "string",
|
|
150
|
+
"references": {}
|
|
151
|
+
},
|
|
152
|
+
"required": false,
|
|
153
|
+
"optional": false,
|
|
154
|
+
"docs": {
|
|
155
|
+
"tags": [],
|
|
156
|
+
"text": ""
|
|
157
|
+
},
|
|
158
|
+
"attribute": "column-label",
|
|
159
|
+
"reflect": false
|
|
160
|
+
},
|
|
161
|
+
"dataSource": {
|
|
162
|
+
"type": "unknown",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "IMultiSelectionListDataSource",
|
|
166
|
+
"resolved": "IMultiSelectionListDataSource",
|
|
167
|
+
"references": {
|
|
168
|
+
"IMultiSelectionListDataSource": {
|
|
169
|
+
"location": "import",
|
|
170
|
+
"path": "../../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": ""
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"dataUnit": {
|
|
182
|
+
"type": "unknown",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "DataUnit",
|
|
186
|
+
"resolved": "DataUnit",
|
|
187
|
+
"references": {
|
|
188
|
+
"DataUnit": {
|
|
189
|
+
"location": "import",
|
|
190
|
+
"path": "@sankhyalabs/core"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"docs": {
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": ""
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"options": {
|
|
202
|
+
"type": "unknown",
|
|
203
|
+
"mutable": true,
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "IMultiSelectionOption[]",
|
|
206
|
+
"resolved": "IMultiSelectionOption[]",
|
|
207
|
+
"references": {
|
|
208
|
+
"IMultiSelectionOption": {
|
|
209
|
+
"location": "import",
|
|
210
|
+
"path": "../../ez-multi-selection-list/interfaces/IMultiSelectionOption"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": false,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": ""
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
static get states() {
|
|
224
|
+
return {
|
|
225
|
+
"selectedItems": {},
|
|
226
|
+
"fieldDescriptor": {},
|
|
227
|
+
"useOptions": {}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
static get events() {
|
|
231
|
+
return [{
|
|
232
|
+
"method": "applyFilterColumnOptions",
|
|
233
|
+
"name": "applyFilterColumnOptions",
|
|
234
|
+
"bubbles": true,
|
|
235
|
+
"cancelable": true,
|
|
236
|
+
"composed": true,
|
|
237
|
+
"docs": {
|
|
238
|
+
"tags": [],
|
|
239
|
+
"text": ""
|
|
240
|
+
},
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "IAppliedFilterColumnOptions",
|
|
243
|
+
"resolved": "IAppliedFilterColumnOptions",
|
|
244
|
+
"references": {
|
|
245
|
+
"IAppliedFilterColumnOptions": {
|
|
246
|
+
"location": "local"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}];
|
|
251
|
+
}
|
|
252
|
+
static get methods() {
|
|
253
|
+
return {
|
|
254
|
+
"hide": {
|
|
255
|
+
"complexType": {
|
|
256
|
+
"signature": "() => Promise<void>",
|
|
257
|
+
"parameters": [],
|
|
258
|
+
"references": {
|
|
259
|
+
"Promise": {
|
|
260
|
+
"location": "global"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"return": "Promise<void>"
|
|
264
|
+
},
|
|
265
|
+
"docs": {
|
|
266
|
+
"text": "",
|
|
267
|
+
"tags": []
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"show": {
|
|
271
|
+
"complexType": {
|
|
272
|
+
"signature": "(configs: IFilterColumnConfigs) => Promise<void>",
|
|
273
|
+
"parameters": [{
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": ""
|
|
276
|
+
}],
|
|
277
|
+
"references": {
|
|
278
|
+
"Promise": {
|
|
279
|
+
"location": "global"
|
|
280
|
+
},
|
|
281
|
+
"IFilterColumnConfigs": {
|
|
282
|
+
"location": "local"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"return": "Promise<void>"
|
|
286
|
+
},
|
|
287
|
+
"docs": {
|
|
288
|
+
"text": "Abre o filtro de coluna.",
|
|
289
|
+
"tags": [{
|
|
290
|
+
"name": "Params",
|
|
291
|
+
"text": "IFilterColumnConfigs informa\u00E7\u00F5es para configurar o filtro"
|
|
292
|
+
}]
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|