@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-75065.0 → 0.0.0-bugfix-dev-KB-83282.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/ez-badge.cjs.entry.js +2 -14
- package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +387 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +58 -184
- package/dist/cjs/ez-grid.cjs.entry.js +58 -0
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +186 -0
- package/dist/cjs/{ez-multi-selection-list_2.cjs.entry.js → ez-popover-core_2.cjs.entry.js} +115 -196
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +8 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-badge/ez-badge.css +1 -12
- package/dist/collection/components/ez-badge/ez-badge.js +1 -31
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.css +205 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +426 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -250
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +61 -194
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -0
- package/dist/collection/components/ez-grid/ez-grid.js +56 -1
- package/dist/collection/components/ez-icon/ez-icon.css +4 -1
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.css +0 -64
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +47 -127
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +67 -0
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +468 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +395 -219
- package/dist/esm/ez-badge.entry.js +2 -14
- package/dist/esm/ez-combo-box-list_3.entry.js +381 -0
- package/dist/esm/ez-combo-box.entry.js +59 -185
- package/dist/esm/ez-grid.entry.js +59 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-multi-selection-list.entry.js +182 -0
- package/dist/esm/{ez-multi-selection-list_2.entry.js → ez-popover-core_2.entry.js} +116 -197
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +8 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-3a009184.entry.js +1 -0
- package/dist/ezui/{p-a5950a0d.entry.js → p-53116373.entry.js} +46 -46
- package/dist/ezui/p-56fe5341.entry.js +1 -0
- package/dist/ezui/p-650e4b6d.entry.js +1 -0
- package/dist/ezui/p-7bd15498.entry.js +1 -0
- package/dist/ezui/p-dc73e1fe.entry.js +1 -0
- package/dist/ezui/p-f5931caa.entry.js +1 -0
- package/dist/types/components/ez-badge/ez-badge.d.ts +0 -5
- package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +104 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -16
- package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
- package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +6 -19
- package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +81 -0
- package/dist/types/components.d.ts +218 -11
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +0 -236
- package/dist/esm/ez-custom-form-input_2.entry.js +0 -231
- package/dist/ezui/p-0ca05a2f.entry.js +0 -1
- package/dist/ezui/p-64b461b3.entry.js +0 -1
- package/dist/ezui/p-cdac80f1.entry.js +0 -1
- package/dist/ezui/p-dc8b36c3.entry.js +0 -1
- package/dist/ezui/p-e75c7a23.entry.js +0 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-a7b0c73d.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezMultiSelectionListCss = ".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;--ez-multi-selection-default-height:322px;display:block;width:304px;height:var(--ez-multi-selection-default-height);min-height:fit-content;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
|
9
|
+
|
|
10
|
+
var ViewScenarios;
|
|
11
|
+
(function (ViewScenarios) {
|
|
12
|
+
ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
|
|
13
|
+
ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
|
|
14
|
+
ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
|
|
15
|
+
ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
|
|
16
|
+
ViewScenarios["OPTIONS"] = "OPTIONS";
|
|
17
|
+
})(ViewScenarios || (ViewScenarios = {}));
|
|
18
|
+
const EzMuiltiSelectionList = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
index.registerInstance(this, hostRef);
|
|
21
|
+
this.changeFilteredOptions = index.createEvent(this, "changeFilteredOptions", 7);
|
|
22
|
+
this.columnName = undefined;
|
|
23
|
+
this.dataSource = undefined;
|
|
24
|
+
this.useOptions = false;
|
|
25
|
+
this.options = undefined;
|
|
26
|
+
this.isTextSearch = false;
|
|
27
|
+
this.filteredOptions = undefined;
|
|
28
|
+
this.displayOptions = undefined;
|
|
29
|
+
this.viewScenario = undefined;
|
|
30
|
+
this.displayOptionToCheckAllItems = true;
|
|
31
|
+
}
|
|
32
|
+
async clearFilteredOptions() {
|
|
33
|
+
this.setInitialScenario();
|
|
34
|
+
this.filteredOptions = [];
|
|
35
|
+
if (this.searchInput) {
|
|
36
|
+
this.searchInput.value = '';
|
|
37
|
+
}
|
|
38
|
+
if (this.filterInput) {
|
|
39
|
+
this.filterInput.value = '';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onChangeUseOptions() {
|
|
43
|
+
this.setInitialScenario();
|
|
44
|
+
}
|
|
45
|
+
onChangeOptions() {
|
|
46
|
+
if (this.options) {
|
|
47
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
|
|
48
|
+
}
|
|
49
|
+
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
50
|
+
this.setInitialScenario();
|
|
51
|
+
}
|
|
52
|
+
onChangeFilteredOptions(optionsListUpdated) {
|
|
53
|
+
this.displayOptions = this.filteredOptions;
|
|
54
|
+
this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
|
|
55
|
+
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
56
|
+
this.changeFilteredOptions.emit(optionsListUpdated);
|
|
57
|
+
}
|
|
58
|
+
componentDidRender() {
|
|
59
|
+
this.changeCheckAllValeuFromFilteredOptions();
|
|
60
|
+
}
|
|
61
|
+
ordenationByCheckStateAndAlphabetically(filteredOptions) {
|
|
62
|
+
const listWithSelectChecked = [];
|
|
63
|
+
const listWithNotSelectChecked = [];
|
|
64
|
+
let emptyElement;
|
|
65
|
+
filteredOptions.forEach(item => {
|
|
66
|
+
if (item.value == undefined || item.label === "") {
|
|
67
|
+
emptyElement = Object.assign(Object.assign({}, item), { label: "(Vazio)" });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
(item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return (emptyElement == undefined ? [] : [emptyElement])
|
|
74
|
+
.concat(this.dataSource == undefined ? core.ArrayUtils.sortAlphabetically(listWithSelectChecked) : this.dataSource.sortItems(this.columnName, listWithSelectChecked))
|
|
75
|
+
.concat(this.dataSource == undefined ? core.ArrayUtils.sortAlphabetically(listWithNotSelectChecked) : this.dataSource.sortItems(this.columnName, listWithNotSelectChecked));
|
|
76
|
+
}
|
|
77
|
+
changeCheckAllValeuFromFilteredOptions() {
|
|
78
|
+
var _a, _b, _c, _d;
|
|
79
|
+
const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
|
|
80
|
+
const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
|
|
81
|
+
const selectIndeterminated = ((_c = this.filteredOptions) === null || _c === void 0 ? void 0 : _c.some(item => item.check === false)) && ((_d = this.filteredOptions) === null || _d === void 0 ? void 0 : _d.some(item => item.check === true)) && (!selectAll || !notSelectAll);
|
|
82
|
+
if (this.checkInput && selectAll) {
|
|
83
|
+
this.checkInput.indeterminate = false;
|
|
84
|
+
this.checkInput.value = true;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (this.checkInput && selectIndeterminated) {
|
|
88
|
+
this.checkInput.indeterminate = true;
|
|
89
|
+
this.checkInput.value = false;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (this.checkInput && notSelectAll) {
|
|
93
|
+
this.checkInput.indeterminate = false;
|
|
94
|
+
this.checkInput.value = false;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
setInitialScenario() {
|
|
99
|
+
if (this.useOptions) {
|
|
100
|
+
this.viewScenario = ViewScenarios.OPTIONS;
|
|
101
|
+
this.changeCheckAllValeuFromFilteredOptions();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
|
|
105
|
+
}
|
|
106
|
+
async searchWithDataSource(searchArgument, fieldName) {
|
|
107
|
+
const { argument, mode } = searchArgument;
|
|
108
|
+
if (mode !== 'PRELOAD' && fieldName) {
|
|
109
|
+
return this.dataSource.fetchData(argument, fieldName);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
handleSearchOnDataSource(event) {
|
|
113
|
+
var _a;
|
|
114
|
+
const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
|
|
115
|
+
if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
|
|
116
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
|
|
117
|
+
}
|
|
118
|
+
this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
|
|
119
|
+
this.searchInput.value = "";
|
|
120
|
+
}
|
|
121
|
+
handleRemoveItemFromOptions(item) {
|
|
122
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
|
|
123
|
+
if (this.filteredOptions.length === 0) {
|
|
124
|
+
this.viewScenario = ViewScenarios.DATASOURCE_INIT;
|
|
125
|
+
}
|
|
126
|
+
if (this.searchInput) {
|
|
127
|
+
this.searchInput.value = '';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
handleSearchOnOption(event) {
|
|
131
|
+
if (event.detail) {
|
|
132
|
+
this.displayOptions = core.ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
|
|
133
|
+
this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.displayOptions = this.filteredOptions;
|
|
137
|
+
this.viewScenario = ViewScenarios.OPTIONS;
|
|
138
|
+
}
|
|
139
|
+
handleChangeSelectAllItems(event) {
|
|
140
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
|
|
141
|
+
...this.filteredOptions.map(item => {
|
|
142
|
+
item.check = !!event.detail;
|
|
143
|
+
return item;
|
|
144
|
+
}),
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
147
|
+
handleChangeSelectedItem(event) {
|
|
148
|
+
const { detail: itemCheckSelected } = event;
|
|
149
|
+
const itemSelected = this.filteredOptions.find(item => item.label === itemCheckSelected.label);
|
|
150
|
+
itemSelected.check = itemCheckSelected.check;
|
|
151
|
+
}
|
|
152
|
+
buildViewList(hasDelete) {
|
|
153
|
+
return (index.h(index.Fragment, null, this.displayOptionToCheckAllItems && (index.h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), index.h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
|
|
154
|
+
}
|
|
155
|
+
buildDeleteIconSlot(item) {
|
|
156
|
+
return index.h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
|
|
157
|
+
}
|
|
158
|
+
buildInitViewWithDataSource() {
|
|
159
|
+
return index.h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
|
|
160
|
+
}
|
|
161
|
+
buildViewEmptyResults() {
|
|
162
|
+
return index.h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
|
|
163
|
+
}
|
|
164
|
+
scenarioToDisplay(view) {
|
|
165
|
+
const scenarios = {
|
|
166
|
+
[ViewScenarios.DATASOURCE_INIT]: () => this.buildInitViewWithDataSource(),
|
|
167
|
+
[ViewScenarios.DATASOURCE_RESULTS]: () => this.buildViewList(true),
|
|
168
|
+
[ViewScenarios.DATASOURCE_RESULTS_EMPTY]: () => this.buildViewEmptyResults(),
|
|
169
|
+
[ViewScenarios.OPTIONS_EMPTY]: () => this.buildViewEmptyResults(),
|
|
170
|
+
[ViewScenarios.OPTIONS]: () => this.buildViewList(false),
|
|
171
|
+
};
|
|
172
|
+
const scenarioBuilder = scenarios[view];
|
|
173
|
+
return scenarioBuilder ? scenarioBuilder() : undefined;
|
|
174
|
+
}
|
|
175
|
+
render() {
|
|
176
|
+
return (index.h(index.Host, null, index.h("div", { class: "multi-selection" }, this.useOptions ? (index.h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (index.h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this), isTextSearch: this.isTextSearch })), index.h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
|
|
177
|
+
}
|
|
178
|
+
static get watchers() { return {
|
|
179
|
+
"useOptions": ["onChangeUseOptions"],
|
|
180
|
+
"options": ["onChangeOptions"],
|
|
181
|
+
"filteredOptions": ["onChangeFilteredOptions"]
|
|
182
|
+
}; }
|
|
183
|
+
};
|
|
184
|
+
EzMuiltiSelectionList.style = ezMultiSelectionListCss;
|
|
185
|
+
|
|
186
|
+
exports.ez_multi_selection_list = EzMuiltiSelectionList;
|
|
@@ -3,185 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-a7b0c73d.js');
|
|
6
|
-
const core = require('@sankhyalabs/core');
|
|
7
|
-
|
|
8
|
-
const ezMultiSelectionListCss = ".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;--ez-multi-selection-default-height:322px;display:block;width:304px;height:var(--ez-multi-selection-default-height);min-height:fit-content;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
|
9
|
-
|
|
10
|
-
var ViewScenarios;
|
|
11
|
-
(function (ViewScenarios) {
|
|
12
|
-
ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
|
|
13
|
-
ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
|
|
14
|
-
ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
|
|
15
|
-
ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
|
|
16
|
-
ViewScenarios["OPTIONS"] = "OPTIONS";
|
|
17
|
-
})(ViewScenarios || (ViewScenarios = {}));
|
|
18
|
-
const EzMuiltiSelectionList = class {
|
|
19
|
-
constructor(hostRef) {
|
|
20
|
-
index.registerInstance(this, hostRef);
|
|
21
|
-
this.changeFilteredOptions = index.createEvent(this, "changeFilteredOptions", 7);
|
|
22
|
-
this.columnName = undefined;
|
|
23
|
-
this.dataSource = undefined;
|
|
24
|
-
this.useOptions = false;
|
|
25
|
-
this.options = undefined;
|
|
26
|
-
this.isTextSearch = false;
|
|
27
|
-
this.filteredOptions = undefined;
|
|
28
|
-
this.displayOptions = undefined;
|
|
29
|
-
this.viewScenario = undefined;
|
|
30
|
-
this.displayOptionToCheckAllItems = true;
|
|
31
|
-
}
|
|
32
|
-
async clearFilteredOptions() {
|
|
33
|
-
this.setInitialScenario();
|
|
34
|
-
this.filteredOptions = [];
|
|
35
|
-
if (this.searchInput) {
|
|
36
|
-
this.searchInput.value = '';
|
|
37
|
-
}
|
|
38
|
-
if (this.filterInput) {
|
|
39
|
-
this.filterInput.value = '';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
onChangeUseOptions() {
|
|
43
|
-
this.setInitialScenario();
|
|
44
|
-
}
|
|
45
|
-
onChangeOptions() {
|
|
46
|
-
if (this.options) {
|
|
47
|
-
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
|
|
48
|
-
}
|
|
49
|
-
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
50
|
-
this.setInitialScenario();
|
|
51
|
-
}
|
|
52
|
-
onChangeFilteredOptions(optionsListUpdated) {
|
|
53
|
-
this.displayOptions = this.filteredOptions;
|
|
54
|
-
this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
|
|
55
|
-
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
56
|
-
this.changeFilteredOptions.emit(optionsListUpdated);
|
|
57
|
-
}
|
|
58
|
-
componentDidRender() {
|
|
59
|
-
this.changeCheckAllValeuFromFilteredOptions();
|
|
60
|
-
}
|
|
61
|
-
ordenationByCheckStateAndAlphabetically(filteredOptions) {
|
|
62
|
-
const listWithSelectChecked = [];
|
|
63
|
-
const listWithNotSelectChecked = [];
|
|
64
|
-
let emptyElement;
|
|
65
|
-
filteredOptions.forEach(item => {
|
|
66
|
-
if (item.value == undefined || item.label === "") {
|
|
67
|
-
emptyElement = Object.assign(Object.assign({}, item), { label: "(Vazio)" });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
(item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return (emptyElement == undefined ? [] : [emptyElement])
|
|
74
|
-
.concat(this.dataSource == undefined ? core.ArrayUtils.sortAlphabetically(listWithSelectChecked) : this.dataSource.sortItems(this.columnName, listWithSelectChecked))
|
|
75
|
-
.concat(this.dataSource == undefined ? core.ArrayUtils.sortAlphabetically(listWithNotSelectChecked) : this.dataSource.sortItems(this.columnName, listWithNotSelectChecked));
|
|
76
|
-
}
|
|
77
|
-
changeCheckAllValeuFromFilteredOptions() {
|
|
78
|
-
var _a, _b, _c, _d;
|
|
79
|
-
const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
|
|
80
|
-
const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
|
|
81
|
-
const selectIndeterminated = ((_c = this.filteredOptions) === null || _c === void 0 ? void 0 : _c.some(item => item.check === false)) && ((_d = this.filteredOptions) === null || _d === void 0 ? void 0 : _d.some(item => item.check === true)) && (!selectAll || !notSelectAll);
|
|
82
|
-
if (this.checkInput && selectAll) {
|
|
83
|
-
this.checkInput.indeterminate = false;
|
|
84
|
-
this.checkInput.value = true;
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (this.checkInput && selectIndeterminated) {
|
|
88
|
-
this.checkInput.indeterminate = true;
|
|
89
|
-
this.checkInput.value = false;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (this.checkInput && notSelectAll) {
|
|
93
|
-
this.checkInput.indeterminate = false;
|
|
94
|
-
this.checkInput.value = false;
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
setInitialScenario() {
|
|
99
|
-
if (this.useOptions) {
|
|
100
|
-
this.viewScenario = ViewScenarios.OPTIONS;
|
|
101
|
-
this.changeCheckAllValeuFromFilteredOptions();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
|
|
105
|
-
}
|
|
106
|
-
async searchWithDataSource(searchArgument, fieldName) {
|
|
107
|
-
const { argument, mode } = searchArgument;
|
|
108
|
-
if (mode !== 'PRELOAD' && fieldName) {
|
|
109
|
-
return this.dataSource.fetchData(argument, fieldName);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
handleSearchOnDataSource(event) {
|
|
113
|
-
var _a;
|
|
114
|
-
const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
|
|
115
|
-
if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
|
|
116
|
-
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
|
|
117
|
-
}
|
|
118
|
-
this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
|
|
119
|
-
this.searchInput.value = "";
|
|
120
|
-
}
|
|
121
|
-
handleRemoveItemFromOptions(item) {
|
|
122
|
-
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
|
|
123
|
-
if (this.filteredOptions.length === 0) {
|
|
124
|
-
this.viewScenario = ViewScenarios.DATASOURCE_INIT;
|
|
125
|
-
}
|
|
126
|
-
if (this.searchInput) {
|
|
127
|
-
this.searchInput.value = '';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
handleSearchOnOption(event) {
|
|
131
|
-
if (event.detail) {
|
|
132
|
-
this.displayOptions = core.ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
|
|
133
|
-
this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
this.displayOptions = this.filteredOptions;
|
|
137
|
-
this.viewScenario = ViewScenarios.OPTIONS;
|
|
138
|
-
}
|
|
139
|
-
handleChangeSelectAllItems(event) {
|
|
140
|
-
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
|
|
141
|
-
...this.filteredOptions.map(item => {
|
|
142
|
-
item.check = !!event.detail;
|
|
143
|
-
return item;
|
|
144
|
-
}),
|
|
145
|
-
]);
|
|
146
|
-
}
|
|
147
|
-
handleChangeSelectedItem(event) {
|
|
148
|
-
const { detail: itemCheckSelected } = event;
|
|
149
|
-
const itemSelected = this.filteredOptions.find(item => item.label === itemCheckSelected.label);
|
|
150
|
-
itemSelected.check = itemCheckSelected.check;
|
|
151
|
-
}
|
|
152
|
-
buildViewList(hasDelete) {
|
|
153
|
-
return (index.h(index.Fragment, null, this.displayOptionToCheckAllItems && (index.h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), index.h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
|
|
154
|
-
}
|
|
155
|
-
buildDeleteIconSlot(item) {
|
|
156
|
-
return index.h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
|
|
157
|
-
}
|
|
158
|
-
buildInitViewWithDataSource() {
|
|
159
|
-
return index.h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
|
|
160
|
-
}
|
|
161
|
-
buildViewEmptyResults() {
|
|
162
|
-
return index.h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
|
|
163
|
-
}
|
|
164
|
-
scenarioToDisplay(view) {
|
|
165
|
-
const scenarios = {
|
|
166
|
-
[ViewScenarios.DATASOURCE_INIT]: () => this.buildInitViewWithDataSource(),
|
|
167
|
-
[ViewScenarios.DATASOURCE_RESULTS]: () => this.buildViewList(true),
|
|
168
|
-
[ViewScenarios.DATASOURCE_RESULTS_EMPTY]: () => this.buildViewEmptyResults(),
|
|
169
|
-
[ViewScenarios.OPTIONS_EMPTY]: () => this.buildViewEmptyResults(),
|
|
170
|
-
[ViewScenarios.OPTIONS]: () => this.buildViewList(false),
|
|
171
|
-
};
|
|
172
|
-
const scenarioBuilder = scenarios[view];
|
|
173
|
-
return scenarioBuilder ? scenarioBuilder() : undefined;
|
|
174
|
-
}
|
|
175
|
-
render() {
|
|
176
|
-
return (index.h(index.Host, null, index.h("div", { class: "multi-selection" }, this.useOptions ? (index.h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (index.h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this), isTextSearch: this.isTextSearch })), index.h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
|
|
177
|
-
}
|
|
178
|
-
static get watchers() { return {
|
|
179
|
-
"useOptions": ["onChangeUseOptions"],
|
|
180
|
-
"options": ["onChangeOptions"],
|
|
181
|
-
"filteredOptions": ["onChangeFilteredOptions"]
|
|
182
|
-
}; }
|
|
183
|
-
};
|
|
184
|
-
EzMuiltiSelectionList.style = ezMultiSelectionListCss;
|
|
185
6
|
|
|
186
7
|
/**
|
|
187
8
|
* Custom positioning reference element.
|
|
@@ -1398,9 +1219,9 @@ const computePosition = (reference, floating, options) => {
|
|
|
1398
1219
|
});
|
|
1399
1220
|
};
|
|
1400
1221
|
|
|
1401
|
-
const
|
|
1222
|
+
const ezPopoverCoreCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--most-visible, 4);position:relative;display:flex;user-select:none}.popover__overlay{display:none;position:fixed;padding:0;top:0px;left:0px;width:100%;height:100vh;box-sizing:border-box;z-index:var(--more-visible--2x, 3)}.popover__overlay--light{background-color:rgba(var(--rgb-background--overlay), var(--opacity--bright))}.popover__overlay--medium{background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.popover__box{display:none;position:fixed;top:0;left:0;z-index:var(--ez-popover__box--z-index);flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:calc(100% - 10px)}";
|
|
1402
1223
|
|
|
1403
|
-
const
|
|
1224
|
+
const EzPopoverCore = class {
|
|
1404
1225
|
constructor(hostRef) {
|
|
1405
1226
|
index.registerInstance(this, hostRef);
|
|
1406
1227
|
this.ezVisibilityChange = index.createEvent(this, "ezVisibilityChange", 7);
|
|
@@ -1413,16 +1234,16 @@ const EzPopoverPlus = class {
|
|
|
1413
1234
|
this.options = { horizontalGap: 0, verticalGap: 0, fromRight: false };
|
|
1414
1235
|
}
|
|
1415
1236
|
async observeOpened(newValue, oldValue) {
|
|
1416
|
-
if (newValue
|
|
1417
|
-
if (newValue) {
|
|
1418
|
-
this.openPopover();
|
|
1419
|
-
}
|
|
1420
|
-
else {
|
|
1421
|
-
this.hidePopover();
|
|
1422
|
-
}
|
|
1423
|
-
this.ezVisibilityChange.emit(newValue);
|
|
1237
|
+
if (newValue === oldValue)
|
|
1424
1238
|
return;
|
|
1239
|
+
if (newValue) {
|
|
1240
|
+
this.openPopover();
|
|
1425
1241
|
}
|
|
1242
|
+
else {
|
|
1243
|
+
this.hidePopover();
|
|
1244
|
+
}
|
|
1245
|
+
this.ezVisibilityChange.emit(newValue);
|
|
1246
|
+
return;
|
|
1426
1247
|
}
|
|
1427
1248
|
/**
|
|
1428
1249
|
* Atualiza a posição do popover.
|
|
@@ -1516,12 +1337,14 @@ const EzPopoverPlus = class {
|
|
|
1516
1337
|
if (!this._box) {
|
|
1517
1338
|
return;
|
|
1518
1339
|
}
|
|
1519
|
-
this.
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1340
|
+
if (this.opened) {
|
|
1341
|
+
this._box.style.display = 'flex';
|
|
1342
|
+
this._box.style.visibility = 'hidden';
|
|
1343
|
+
await this.updatePositionPopover();
|
|
1344
|
+
this.openOverlay();
|
|
1345
|
+
this.ezVisibilityChange.emit(true);
|
|
1346
|
+
this._box.style.visibility = 'visible';
|
|
1347
|
+
}
|
|
1525
1348
|
}
|
|
1526
1349
|
openOverlay() {
|
|
1527
1350
|
if (!this._overlay || !this._overlayIsActive) {
|
|
@@ -1561,6 +1384,7 @@ const EzPopoverPlus = class {
|
|
|
1561
1384
|
this._overlayIsActive = this.checkStatusOverlay();
|
|
1562
1385
|
this._resizeObserver = new ResizeObserver(this.updatePositionPopover.bind(this));
|
|
1563
1386
|
this._resizeObserver.observe(this._box);
|
|
1387
|
+
this.openPopover();
|
|
1564
1388
|
}
|
|
1565
1389
|
disconnectedCallback() {
|
|
1566
1390
|
window.removeEventListener('scroll', this.updatePositionDebounce.bind(this), true);
|
|
@@ -1579,7 +1403,102 @@ const EzPopoverPlus = class {
|
|
|
1579
1403
|
"opened": ["observeOpened"]
|
|
1580
1404
|
}; }
|
|
1581
1405
|
};
|
|
1406
|
+
EzPopoverCore.style = ezPopoverCoreCss;
|
|
1407
|
+
|
|
1408
|
+
const ezPopoverPlusCss = ":host{display:none}";
|
|
1409
|
+
|
|
1410
|
+
const EzPopoverPlus = class {
|
|
1411
|
+
constructor(hostRef) {
|
|
1412
|
+
index.registerInstance(this, hostRef);
|
|
1413
|
+
this.ezVisibilityChange = index.createEvent(this, "ezVisibilityChange", 7);
|
|
1414
|
+
this.autoClose = true;
|
|
1415
|
+
this.boxWidth = "fit-content";
|
|
1416
|
+
this.opened = false;
|
|
1417
|
+
this.overlayType = "light";
|
|
1418
|
+
this.anchorElement = undefined;
|
|
1419
|
+
this.options = { horizontalGap: 0, verticalGap: 0, fromRight: false };
|
|
1420
|
+
}
|
|
1421
|
+
listenerEzVisibilityChange({ detail }) {
|
|
1422
|
+
this.ezVisibilityChange.emit(detail);
|
|
1423
|
+
}
|
|
1424
|
+
async observeOpened(newValue) {
|
|
1425
|
+
if (newValue && !this._popOverCore) {
|
|
1426
|
+
this.renderPopoverCore();
|
|
1427
|
+
}
|
|
1428
|
+
this._popOverCore.opened = newValue;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Atualiza a posição do popover.
|
|
1432
|
+
*/
|
|
1433
|
+
async updatePosition(top, left) {
|
|
1434
|
+
var _a;
|
|
1435
|
+
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.updatePosition(top, left));
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Exibe o ez-popover.
|
|
1439
|
+
*/
|
|
1440
|
+
async show(top, left) {
|
|
1441
|
+
if (!this._popOverCore) {
|
|
1442
|
+
this.renderPopoverCore();
|
|
1443
|
+
}
|
|
1444
|
+
await this._popOverCore.show(top, left);
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Ancora a exibição do popOver a um elemento HTML.
|
|
1448
|
+
*/
|
|
1449
|
+
async showUnder(element, options) {
|
|
1450
|
+
if (!this._popOverCore) {
|
|
1451
|
+
this.renderPopoverCore();
|
|
1452
|
+
}
|
|
1453
|
+
await this._popOverCore.showUnder(element, options);
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Oculta o ez-popover.
|
|
1457
|
+
*/
|
|
1458
|
+
async hide() {
|
|
1459
|
+
var _a;
|
|
1460
|
+
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.hide());
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Altera as opções.
|
|
1464
|
+
*/
|
|
1465
|
+
async setOptions(options) {
|
|
1466
|
+
var _a;
|
|
1467
|
+
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.setOptions(options));
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Altera o elemento de ancoragem.
|
|
1471
|
+
*/
|
|
1472
|
+
async setAnchorElement(anchor) {
|
|
1473
|
+
var _a;
|
|
1474
|
+
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.setAnchorElement(anchor));
|
|
1475
|
+
}
|
|
1476
|
+
renderPopoverCore() {
|
|
1477
|
+
this._popOverCore = document.createElement('ez-popover-core');
|
|
1478
|
+
this._popOverCore.opened = this.opened;
|
|
1479
|
+
this._popOverCore.anchorElement = this.anchorElement;
|
|
1480
|
+
this._popOverCore.autoClose = this.autoClose;
|
|
1481
|
+
this._popOverCore.boxWidth = this.boxWidth;
|
|
1482
|
+
this._popOverCore.overlayType = this.overlayType;
|
|
1483
|
+
this._popOverCore.options = this.options;
|
|
1484
|
+
const firstChild = this._host.children.item(0);
|
|
1485
|
+
if (firstChild) {
|
|
1486
|
+
this._popOverCore.appendChild(firstChild);
|
|
1487
|
+
}
|
|
1488
|
+
else {
|
|
1489
|
+
console.warn('O slot do popover está vazio. Adicione conteúdo ao slot para exibição correta.');
|
|
1490
|
+
}
|
|
1491
|
+
document.body.appendChild(this._popOverCore);
|
|
1492
|
+
}
|
|
1493
|
+
render() {
|
|
1494
|
+
return (index.h(index.Host, null, index.h("slot", null)));
|
|
1495
|
+
}
|
|
1496
|
+
get _host() { return index.getElement(this); }
|
|
1497
|
+
static get watchers() { return {
|
|
1498
|
+
"opened": ["observeOpened"]
|
|
1499
|
+
}; }
|
|
1500
|
+
};
|
|
1582
1501
|
EzPopoverPlus.style = ezPopoverPlusCss;
|
|
1583
1502
|
|
|
1584
|
-
exports.
|
|
1503
|
+
exports.ez_popover_core = EzPopoverCore;
|
|
1585
1504
|
exports.ez_popover_plus = EzPopoverPlus;
|