@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-79202.0 → 0.0.0-bugfix-dev-KB-79901.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.
Files changed (43) hide show
  1. package/dist/cjs/ez-grid.cjs.entry.js +28 -15
  2. package/dist/cjs/ez-multi-selection-list_2.cjs.entry.js +1584 -0
  3. package/dist/cjs/ez-search.cjs.entry.js +2 -1
  4. package/dist/cjs/ezui.cjs.js +1 -1
  5. package/dist/cjs/filter-column.cjs.entry.js +2 -45
  6. package/dist/cjs/index-a7b0c73d.js +2 -2
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  10. package/dist/collection/components/ez-grid/ez-grid.css +37 -7
  11. package/dist/collection/components/ez-grid/ez-grid.js +26 -13
  12. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +2 -45
  13. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +1 -0
  14. package/dist/collection/components/ez-popover-plus/ez-popover-plus.css +67 -0
  15. package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +465 -0
  16. package/dist/collection/components/ez-search/ez-search.js +2 -1
  17. package/dist/custom-elements/index.d.ts +6 -0
  18. package/dist/custom-elements/index.js +1440 -68
  19. package/dist/esm/ez-grid.entry.js +28 -15
  20. package/dist/esm/ez-multi-selection-list_2.entry.js +1579 -0
  21. package/dist/esm/ez-search.entry.js +2 -1
  22. package/dist/esm/ezui.js +1 -1
  23. package/dist/esm/filter-column.entry.js +2 -45
  24. package/dist/esm/index-baa5e267.js +2 -2
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/ezui/ezui.esm.js +1 -1
  27. package/dist/ezui/p-0fa52b0f.entry.js +1 -0
  28. package/dist/ezui/{p-06136139.entry.js → p-a1c706a7.entry.js} +1 -1
  29. package/dist/ezui/p-b555cb24.entry.js +1 -0
  30. package/dist/ezui/p-f3c6410e.entry.js +1 -0
  31. package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
  32. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +0 -11
  33. package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +81 -0
  34. package/dist/types/components.d.ts +94 -0
  35. package/package.json +3 -3
  36. package/react/components.d.ts +1 -0
  37. package/react/components.js +1 -0
  38. package/react/components.js.map +1 -1
  39. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +0 -186
  40. package/dist/esm/ez-multi-selection-list.entry.js +0 -182
  41. package/dist/ezui/p-1ab96710.entry.js +0 -1
  42. package/dist/ezui/p-7a171eae.entry.js +0 -1
  43. package/dist/ezui/p-a6fe527a.entry.js +0 -1
@@ -1,186 +0,0 @@
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);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;
@@ -1,182 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-baa5e267.js';
2
- import { ArrayUtils } from '@sankhyalabs/core';
3
-
4
- 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);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)}";
5
-
6
- var ViewScenarios;
7
- (function (ViewScenarios) {
8
- ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
9
- ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
10
- ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
11
- ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
12
- ViewScenarios["OPTIONS"] = "OPTIONS";
13
- })(ViewScenarios || (ViewScenarios = {}));
14
- const EzMuiltiSelectionList = class {
15
- constructor(hostRef) {
16
- registerInstance(this, hostRef);
17
- this.changeFilteredOptions = createEvent(this, "changeFilteredOptions", 7);
18
- this.columnName = undefined;
19
- this.dataSource = undefined;
20
- this.useOptions = false;
21
- this.options = undefined;
22
- this.isTextSearch = false;
23
- this.filteredOptions = undefined;
24
- this.displayOptions = undefined;
25
- this.viewScenario = undefined;
26
- this.displayOptionToCheckAllItems = true;
27
- }
28
- async clearFilteredOptions() {
29
- this.setInitialScenario();
30
- this.filteredOptions = [];
31
- if (this.searchInput) {
32
- this.searchInput.value = '';
33
- }
34
- if (this.filterInput) {
35
- this.filterInput.value = '';
36
- }
37
- }
38
- onChangeUseOptions() {
39
- this.setInitialScenario();
40
- }
41
- onChangeOptions() {
42
- if (this.options) {
43
- this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
44
- }
45
- this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
46
- this.setInitialScenario();
47
- }
48
- onChangeFilteredOptions(optionsListUpdated) {
49
- this.displayOptions = this.filteredOptions;
50
- this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
51
- this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
52
- this.changeFilteredOptions.emit(optionsListUpdated);
53
- }
54
- componentDidRender() {
55
- this.changeCheckAllValeuFromFilteredOptions();
56
- }
57
- ordenationByCheckStateAndAlphabetically(filteredOptions) {
58
- const listWithSelectChecked = [];
59
- const listWithNotSelectChecked = [];
60
- let emptyElement;
61
- filteredOptions.forEach(item => {
62
- if (item.value == undefined || item.label === "") {
63
- emptyElement = Object.assign(Object.assign({}, item), { label: "(Vazio)" });
64
- }
65
- else {
66
- (item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item));
67
- }
68
- });
69
- return (emptyElement == undefined ? [] : [emptyElement])
70
- .concat(this.dataSource == undefined ? ArrayUtils.sortAlphabetically(listWithSelectChecked) : this.dataSource.sortItems(this.columnName, listWithSelectChecked))
71
- .concat(this.dataSource == undefined ? ArrayUtils.sortAlphabetically(listWithNotSelectChecked) : this.dataSource.sortItems(this.columnName, listWithNotSelectChecked));
72
- }
73
- changeCheckAllValeuFromFilteredOptions() {
74
- var _a, _b, _c, _d;
75
- const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
76
- const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
77
- 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);
78
- if (this.checkInput && selectAll) {
79
- this.checkInput.indeterminate = false;
80
- this.checkInput.value = true;
81
- return;
82
- }
83
- if (this.checkInput && selectIndeterminated) {
84
- this.checkInput.indeterminate = true;
85
- this.checkInput.value = false;
86
- return;
87
- }
88
- if (this.checkInput && notSelectAll) {
89
- this.checkInput.indeterminate = false;
90
- this.checkInput.value = false;
91
- return;
92
- }
93
- }
94
- setInitialScenario() {
95
- if (this.useOptions) {
96
- this.viewScenario = ViewScenarios.OPTIONS;
97
- this.changeCheckAllValeuFromFilteredOptions();
98
- return;
99
- }
100
- this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
101
- }
102
- async searchWithDataSource(searchArgument, fieldName) {
103
- const { argument, mode } = searchArgument;
104
- if (mode !== 'PRELOAD' && fieldName) {
105
- return this.dataSource.fetchData(argument, fieldName);
106
- }
107
- }
108
- handleSearchOnDataSource(event) {
109
- var _a;
110
- const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
111
- if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
112
- this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
113
- }
114
- this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
115
- this.searchInput.value = "";
116
- }
117
- handleRemoveItemFromOptions(item) {
118
- this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
119
- if (this.filteredOptions.length === 0) {
120
- this.viewScenario = ViewScenarios.DATASOURCE_INIT;
121
- }
122
- if (this.searchInput) {
123
- this.searchInput.value = '';
124
- }
125
- }
126
- handleSearchOnOption(event) {
127
- if (event.detail) {
128
- this.displayOptions = ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
129
- this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
130
- return;
131
- }
132
- this.displayOptions = this.filteredOptions;
133
- this.viewScenario = ViewScenarios.OPTIONS;
134
- }
135
- handleChangeSelectAllItems(event) {
136
- this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
137
- ...this.filteredOptions.map(item => {
138
- item.check = !!event.detail;
139
- return item;
140
- }),
141
- ]);
142
- }
143
- handleChangeSelectedItem(event) {
144
- const { detail: itemCheckSelected } = event;
145
- const itemSelected = this.filteredOptions.find(item => item.label === itemCheckSelected.label);
146
- itemSelected.check = itemCheckSelected.check;
147
- }
148
- buildViewList(hasDelete) {
149
- return (h(Fragment, null, this.displayOptionToCheckAllItems && (h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), 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 })));
150
- }
151
- buildDeleteIconSlot(item) {
152
- return h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
153
- }
154
- buildInitViewWithDataSource() {
155
- return h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
156
- }
157
- buildViewEmptyResults() {
158
- return h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
159
- }
160
- scenarioToDisplay(view) {
161
- const scenarios = {
162
- [ViewScenarios.DATASOURCE_INIT]: () => this.buildInitViewWithDataSource(),
163
- [ViewScenarios.DATASOURCE_RESULTS]: () => this.buildViewList(true),
164
- [ViewScenarios.DATASOURCE_RESULTS_EMPTY]: () => this.buildViewEmptyResults(),
165
- [ViewScenarios.OPTIONS_EMPTY]: () => this.buildViewEmptyResults(),
166
- [ViewScenarios.OPTIONS]: () => this.buildViewList(false),
167
- };
168
- const scenarioBuilder = scenarios[view];
169
- return scenarioBuilder ? scenarioBuilder() : undefined;
170
- }
171
- render() {
172
- return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (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 })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
173
- }
174
- static get watchers() { return {
175
- "useOptions": ["onChangeUseOptions"],
176
- "options": ["onChangeOptions"],
177
- "filteredOptions": ["onChangeFilteredOptions"]
178
- }; }
179
- };
180
- EzMuiltiSelectionList.style = ezMultiSelectionListCss;
181
-
182
- export { EzMuiltiSelectionList as ez_multi_selection_list };
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s}from"./p-23a36bb6.js";import{UserInterface as e}from"@sankhyalabs/core";const o=window,l=new CustomEvent("onSubmitFilter",{detail:{showToast:!0}}),n=class{constructor(s){t(this,s),this.applyFilterColumnOptions=i(this,"applyFilterColumnOptions",7),this.TOP_POSITION="65",this.TOP_POSITION_HEADER_HIDDEN="18",this.TOP_POSITION_NO_TASKBAR="32",this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN="20",this.DEFAULT_HEIGHT=430,this.FIX_MARGIN=60,this.FILTER_COLUMN_WIDTH=330,this.opened=!0,this.columnName=void 0,this.columnLabel=void 0,this.gridHeaderHidden=!1,this.noHeaderTaskBar=!1,this.dataSource=void 0,this.dataUnit=void 0,this.options=void 0,this.selectedItems=void 0,this.fieldDescriptor=void 0,this.useOptions=!1,this.isTextSearch=!1}async hide(){await this.ezPopoverElement.hide(),await this.clearConfigs()}async show(t){this.canShow(t)&&(await this.hide(),this.fieldDescriptor=this.dataUnit.getField(t.columnName),this.buildIsTextSearch(),this.columnName=t.columnName,this.columnLabel=t.columnLabel,await this.setOptions(t.filteredOptions),await this.ezPopoverElement.show(this.calcTopPosition(),this.calculateLeftPosition(t)))}calculateLeftPosition({leftPosition:t,fromIcon:i}){const s=this.calcFilterColumnLeftPosition(t);if(!i)return`${s}px`;const e=s+16-this.ezPopoverElement.getBoundingClientRect().left;return`${e>0?e:0}px`}calcFilterColumnLeftPosition(t){var i,s;const e=null===(i=this.ezPopoverElement.closest("ez-grid").getBoundingClientRect())||void 0===i?void 0:i.right,o=null===(s=this.ezPopoverElement.getBoundingClientRect())||void 0===s?void 0:s.left,l=e-(this.FILTER_COLUMN_WIDTH+o),n=t-(this.FIX_MARGIN+o);return n>l?l:n}buildIsTextSearch(){var t,i;const s=null!==(i=null===(t=this.fieldDescriptor)||void 0===t?void 0:t.userInterface)&&void 0!==i?i:e.SHORTTEXT;this.isTextSearch=!(s===e.DECIMALNUMBER||s===e.INTEGERNUMBER)}calcTopPosition(){const t=this.buildReferenceTopPosition(),i=parseInt(t)+this.DEFAULT_HEIGHT,s=Math.round(this.ezPopoverElement.getBoundingClientRect().top)+i,e=window.innerHeight;return e>s?`${t}px`:e-s+"px"}buildReferenceTopPosition(){return this.noHeaderTaskBar?this.gridHeaderHidden?this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN:this.TOP_POSITION_NO_TASKBAR:this.gridHeaderHidden?this.TOP_POSITION_HEADER_HIDDEN:this.TOP_POSITION}async clearConfigs(){var t;await(null===(t=this.ezMultiSelectionList)||void 0===t?void 0:t.clearFilteredOptions()),this.options=null,this.columnName=null}canShow(t){return!this.ezPopoverElement.opened||t.columnName!==this.columnName}submit(){this.applyFilterColumnOptions.emit({field:this.columnName,values:this.selectedItems}),o.dispatchEvent(l),this.hide()}changeSelectedItems(t){this.selectedItems=t}hasToUseOptions(){return this.fieldDescriptor.userInterface===e.OPTIONSELECTOR||this.fieldDescriptor.userInterface===e.SWITCH||this.fieldDescriptor.userInterface===e.CHECKBOX}isCheckBoxOrSwitch(){return this.fieldDescriptor.userInterface===e.SWITCH||this.fieldDescriptor.userInterface===e.CHECKBOX}async setOptions(t){const i=this.hasToUseOptions();if(i)return this.useOptions=i,void(this.options=i?this.buildOptions(t):null!=t?t:null);const s=await this.dataSource.getStaticOptions(this.columnName);if(null!=s){const i=new Set((t||[]).filter((t=>t.check)).map((t=>t.label)));return this.useOptions=!0,void(this.options=0===i.size?s:s.map((t=>Object.assign(Object.assign({},t),{check:i.has(t.label)}))))}this.useOptions=!1,this.options=null}buildOptions(t){var i,s;if(t&&t.length>0)return t;if(this.isCheckBoxOrSwitch())return[{label:"Sim",value:"true",check:!0},{label:"Não",value:"false",check:!0}];const e=null===(s=null===(i=this.fieldDescriptor)||void 0===i?void 0:i.properties)||void 0===s?void 0:s.options;if(Array.isArray(e))return e.map((t=>({label:t.value,value:t.value,check:!0})));const o=JSON.parse(e);return Object.keys(o).map((t=>({label:o[t],value:t,check:!0})))}handleEzVisibilityChange(t){!1===t.detail&&this.clearConfigs()}render(){return s("ez-popover",{class:"filter-column__popover","overlay-type":"none",ref:t=>this.ezPopoverElement=t,autoClose:!0,onEzVisibilityChange:this.handleEzVisibilityChange.bind(this)},s("section",{class:"filter-column"},s("header",{class:"filter-column__header"},s("span",{class:"ez-text ez-text--medium filter-column__header-title"},"Filtro da coluna ",this.columnLabel),s("ez-button",{mode:"icon","icon-name":"close",class:"ez-button--tertiary",onClick:()=>this.hide()})),s("ez-multi-selection-list",{id:"filter-column-selection-list",columnName:this.columnName,dataSource:this.dataSource,options:this.options,useOptions:this.useOptions,ref:t=>this.ezMultiSelectionList=t,onChangeFilteredOptions:t=>this.changeSelectedItems(t.detail),isTextSearch:this.isTextSearch}),s("footer",{class:"filter-column__footer"},s("ez-button",{label:"Aplicar",class:"ez-button--primary",onClick:this.submit.bind(this)}))))}};n.style=".filter-column{padding:var(--space--2xs, 8px);position:relative}.filter-column__header{margin-bottom:var(--space--2xs, 8px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:var(--space--xl, 32px)}.filter-column__footer{position:relative;display:flex;flex-direction:row;justify-content:flex-end;align-items:center;width:100%;bottom:0;left:0;padding-top:var(--space--2xs, 8px);border-top:var(--border--medium) var(--color--disable-secondary)}.filter-column__popover{position:absolute}.filter-column__header-title{margin-left:8px}#filter-column-selection-list{--ez-multi-selection-default-height:unset}";export{n as filter_column}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,H as e,g as r}from"./p-23a36bb6.js";import{C as o}from"./p-ec7db713.js";import{ObjectUtils as a,StringUtils as h,FloatingManager as l,ElementIDUtils as n}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";import{R as d}from"./p-05e1f4e7.js";const u=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.contextProperties=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())&&this.errorMessage&&this.setInputValue())}getValue(t){return"object"==typeof t?null==t?void 0:t.value:t}validateNewValue(t,i){const s=this.getValue(t),e=this.getValue(i);return!("[object Object]"===s||s===e)}async observeValue(t,i){if(this._textInput&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(v.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var t;null!=this._floatingID&&((null===(t=this.listOptionsPosition)||void 0===t?void 0:t.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,fromBottom:s,fromRight:e,bottomLimit:r,hardPosition:o}=this.getListPosition();const a=this._listWrapper.getBoundingClientRect(),h=this._listContainer.getBoundingClientRect(),l=this._textInput.getBoundingClientRect(),n=r||window.innerHeight;!s&&(a.top<0||h.bottom+a.height>n)&&(s=!0),o||(t=t||0,i=i||0,s?t=window.innerHeight-l.top+t:t+=h.top,e?i=window.innerWidth-l.right+i:i+=h.left),null!=t&&(this._listWrapper.style[s?"bottom":"top"]=`${t}px`,this._listWrapper.style[s?"top":"bottom"]=""),null!=i&&(this._listWrapper.style[e?"right":"left"]=`${i}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(t,i){return a.objectToString(t||{})!==a.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=null==i?void 0:i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return this.replaceQuotes(i)}replaceQuotes(t){if(null!=t)return String(t).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t?Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}createOption(t){let{key:i,title:s}=t;const e=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");s=h.decodeHtmlEntities(s);const o={value:null==i?void 0:i.replace(e,"").replace(r,""),label:null==s?void 0:s.replace(e,"").replace(r,"")};this.selectOption(o)}buildItem(t,i){t.label=t.label||t.value;const e={key:t.value,title:t.label,details:t.details};return s("div",{style:{height:"100%"},class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.createOption(e),onMouseOver:()=>this._preSelection=i},s("ez-card-item",{item:e,compacted:!0,enableKey:this.showOptionValue}))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!1,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.isFloating(this._floatingID)}nextOption(){this.isOptionsVisible()&&(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(t){window.requestAnimationFrame((()=>{const i=(null==t?void 0:t.value)?this._optionsList.querySelector(`div#item_${t.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}replaceHighlight(t){const i=new RegExp(this._startHighlightTag,"g"),s=new RegExp(this._endHighlightTag,"g");return String(null!=t?t:"").replace(i,"").replace(s,"")}selectOption(t,i=!0){var s,e;const r=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}),a=Object.assign(Object.assign({},o),{value:this.replaceQuotes(null==o?void 0:o.value),label:this.replaceQuotes(null==o?void 0:o.label)});if((null===(s=null==r?void 0:r.value)||void 0===s?void 0:s.toString())!==(null===(e=null==a?void 0:a.value)||void 0===e?void 0:e.toString())||null==r&&null!=a&&"value"in a){const t=(null==a?void 0:a.value)?a:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i},this.contextProperties):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");let o=h.decodeHtmlEntities(e[0].label);const a={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(r,""),label:null==o?void 0:o.replace(i,"").replace(r,"")};this.selectOption(a,t)}}controlEmptySearch(t=!0){var i;(null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne(t):(this.clearSearch(),c.info(this._textEmptyList))}async loadDescriptionValue(t){var i,s;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const e={mode:v.PREDICTIVE,argument:t},r=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,e,this.contextProperties));null!=r&&(r instanceof Promise?r.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(r))}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:this.replaceHighlight(i.value),label:this.replaceHighlight(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=this.replaceQuotes(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),c.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(d,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let t=this.getFormattedText(this.value);t=this.replaceQuotes(t),this._textInput.value=t}componentWillLoad(){if(void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}componentDidRender(){var t;void 0===this._floatingID&&this._listWrapper.remove(),null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{n.addIDInfoIfNotExists(t,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{if(!Array.isArray(t)||!t.length)return;const{clientWidth:i}=this._listContainer;i>0&&this._listWrapper&&(this._listWrapper.style.width=`${i}px`)}))})),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t;null===(t=this._resizeObserver)||void 0===t||t.disconnect()}handlerIconClick(){this.loadOptions(v.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(v.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(v.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne(!1)}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&null==this._floatingID}render(){var t;return n.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("section",{class:"list-container",ref:t=>this._listContainer=t},s("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},s("ul",{class:"list-options",ref:t=>this._optionsList=t},!this._showLoading&&0===this._visibleOptions.length&&s("div",{class:"message"},s("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&s("div",{class:"message"},s("div",{class:"message__loading"})),s("span",{class:"item__value item__value--hidden",ref:t=>this._itemValueBasis=t}),this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var v;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(v||(v={})),u.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{u as ez_search}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,F as e,H as l}from"./p-23a36bb6.js";import{ArrayUtils as h}from"@sankhyalabs/core";var o;!function(t){t.DATASOURCE_RESULTS="DATASOURCE_RESULTS",t.DATASOURCE_RESULTS_EMPTY="DATASOURCE_RESULTS_EMPTY",t.DATASOURCE_INIT="DATASOURCE_INIT",t.OPTIONS_EMPTY="OPTIONS_EMPTY",t.OPTIONS="OPTIONS"}(o||(o={}));const n=class{constructor(s){t(this,s),this.changeFilteredOptions=i(this,"changeFilteredOptions",7),this.columnName=void 0,this.dataSource=void 0,this.useOptions=!1,this.options=void 0,this.isTextSearch=!1,this.filteredOptions=void 0,this.displayOptions=void 0,this.viewScenario=void 0,this.displayOptionToCheckAllItems=!0}async clearFilteredOptions(){this.setInitialScenario(),this.filteredOptions=[],this.searchInput&&(this.searchInput.value=""),this.filterInput&&(this.filterInput.value="")}onChangeUseOptions(){this.setInitialScenario()}onChangeOptions(){this.options&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.options)),this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.setInitialScenario()}onChangeFilteredOptions(t){this.displayOptions=this.filteredOptions,this.displayOptionToCheckAllItems=this.filteredOptions.length>1,this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.changeFilteredOptions.emit(t)}componentDidRender(){this.changeCheckAllValeuFromFilteredOptions()}ordenationByCheckStateAndAlphabetically(t){const i=[],s=[];let e;return t.forEach((t=>{null==t.value||""===t.label?e=Object.assign(Object.assign({},t),{label:"(Vazio)"}):t.check?i.push(t):s.push(t)})),(null==e?[]:[e]).concat(null==this.dataSource?h.sortAlphabetically(i):this.dataSource.sortItems(this.columnName,i)).concat(null==this.dataSource?h.sortAlphabetically(s):this.dataSource.sortItems(this.columnName,s))}changeCheckAllValeuFromFilteredOptions(){var t,i,s,e;const l=null===(t=this.filteredOptions)||void 0===t?void 0:t.every((t=>!0===t.check)),h=null===(i=this.filteredOptions)||void 0===i?void 0:i.every((t=>!1===t.check)),o=(null===(s=this.filteredOptions)||void 0===s?void 0:s.some((t=>!1===t.check)))&&(null===(e=this.filteredOptions)||void 0===e?void 0:e.some((t=>!0===t.check)))&&(!l||!h);return this.checkInput&&l?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!0)):this.checkInput&&o?(this.checkInput.indeterminate=!0,void(this.checkInput.value=!1)):this.checkInput&&h?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!1)):void 0}setInitialScenario(){if(this.useOptions)return this.viewScenario=o.OPTIONS,void this.changeCheckAllValeuFromFilteredOptions();this.viewScenario=this.options&&this.options.length>0?o.DATASOURCE_RESULTS:o.DATASOURCE_INIT}async searchWithDataSource(t,i){const{argument:s,mode:e}=t;if("PRELOAD"!==e&&i)return this.dataSource.fetchData(s,i)}handleSearchOnDataSource(t){var i;const s=null!==(i=this.filteredOptions)&&void 0!==i?i:[];t.detail&&!s.some((i=>i.value==t.detail.value))&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...s,t.detail])),this.viewScenario=o.DATASOURCE_RESULTS,this.searchInput.value=""}handleRemoveItemFromOptions(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter((i=>i.value!==t.value))),0===this.filteredOptions.length&&(this.viewScenario=o.DATASOURCE_INIT),this.searchInput&&(this.searchInput.value="")}handleSearchOnOption(t){if(t.detail)return this.displayOptions=h.applyStringFilter(t.detail,this.filteredOptions,!0),void(this.viewScenario=0===this.displayOptions.length?o.OPTIONS_EMPTY:o.OPTIONS);this.displayOptions=this.filteredOptions,this.viewScenario=o.OPTIONS}handleChangeSelectAllItems(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...this.filteredOptions.map((i=>(i.check=!!t.detail,i)))])}handleChangeSelectedItem(t){const{detail:i}=t;this.filteredOptions.find((t=>t.label===i.label)).check=i.check}buildViewList(t){return s(e,null,this.displayOptionToCheckAllItems&&s("ez-check",{ref:t=>this.checkInput=t,label:"Selecionar todos",class:"multi-selection__select-all",onEzChange:this.handleChangeSelectAllItems.bind(this)}),s("ez-list",{class:"multi-selection__list",dataSource:this.displayOptions,listMode:"check",hoverFeedback:!0,onEzCheckChange:this.handleChangeSelectedItem.bind(this),itemSlotBuilder:t?this.buildDeleteIconSlot.bind(this):null}))}buildDeleteIconSlot(t){return s("ez-icon",{style:{cursor:"pointer"},iconName:"delete",onClick:()=>this.handleRemoveItemFromOptions(t)})}buildInitViewWithDataSource(){return s("multi-selection-box-message",{message:"Selecione os valores a serem filtrados através do campo de busca."})}buildViewEmptyResults(){return s("multi-selection-box-message",{message:"Nenhum resultado encontrado."})}scenarioToDisplay(t){const i={[o.DATASOURCE_INIT]:()=>this.buildInitViewWithDataSource(),[o.DATASOURCE_RESULTS]:()=>this.buildViewList(!0),[o.DATASOURCE_RESULTS_EMPTY]:()=>this.buildViewEmptyResults(),[o.OPTIONS_EMPTY]:()=>this.buildViewEmptyResults(),[o.OPTIONS]:()=>this.buildViewList(!1)}[t];return i?i():void 0}render(){return s(l,null,s("div",{class:"multi-selection"},this.useOptions?s("ez-filter-input",{ref:t=>this.filterInput=t,label:"Buscar..",onEzChange:this.handleSearchOnOption.bind(this)}):s("ez-search",{class:"multi-selection__input",label:"Buscar...",ref:t=>this.searchInput=t,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,optionLoader:t=>this.searchWithDataSource(t,this.columnName),onEzChange:this.handleSearchOnDataSource.bind(this),isTextSearch:this.isTextSearch}),s("ez-scroll",{class:"multi-selection__content-options"},this.scenarioToDisplay(this.viewScenario))))}static get watchers(){return{useOptions:["onChangeUseOptions"],options:["onChangeOptions"],filteredOptions:["onChangeFilteredOptions"]}}};n.style=".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);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)}";export{n as ez_multi_selection_list}