@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-71072.0 → 0.0.0-bugfix-dev-KB-76362.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
- package/dist/cjs/index-f9e81701.js +8 -0
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +22 -25
- package/dist/cjs/snk-application.cjs.entry.js +2 -18
- package/dist/cjs/snk-config-options_3.cjs.entry.js +5 -17
- package/dist/cjs/snk-crud.cjs.entry.js +2 -8
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -9
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -10
- package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-eee43c8b.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -7
- package/dist/cjs/snk-taskbar.cjs.entry.js +37 -40
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
- package/dist/collection/components/snk-application/snk-application.js +1 -41
- package/dist/collection/components/snk-crud/snk-crud.js +2 -26
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +3 -3
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -5
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -20
- package/dist/collection/components/snk-form-config/snk-form-config.js +5 -17
- package/dist/collection/components/snk-grid/snk-grid.js +2 -28
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +4 -25
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -41
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +1 -7
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
- package/dist/components/SnkMessageBuilder.js +10 -0
- package/dist/components/filter-distinct-search.js +17 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input-distinct-search.d.ts +11 -0
- package/dist/components/input-distinct-search.js +6 -0
- package/dist/components/input-distinct-search2.js +264 -0
- package/dist/components/search-modal.d.ts +11 -0
- package/dist/components/search-modal.js +6 -0
- package/dist/components/search-modal2.js +264 -0
- package/dist/components/snk-actions-button2.js +26 -27
- package/dist/components/snk-application2.js +2 -19
- package/dist/components/snk-crud.js +2 -9
- package/dist/components/snk-data-exporter2.js +3 -3
- package/dist/components/snk-data-unit2.js +13 -25
- package/dist/components/snk-detail-view2.js +1 -1
- package/dist/components/snk-distinct-search.d.ts +11 -0
- package/dist/components/snk-distinct-search.js +163 -0
- package/dist/components/snk-filter-bar2.js +0 -6
- package/dist/components/snk-filter-item2.js +1 -5
- package/dist/components/snk-filter-text.js +1 -2
- package/dist/components/snk-form-config2.js +5 -17
- package/dist/components/snk-grid2.js +2 -11
- package/dist/components/snk-simple-crud2.js +4 -8
- package/dist/components/snk-taskbar2.js +38 -41
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
- package/dist/esm/index-a7d3d3f1.js +8 -0
- package/dist/esm/input-distinct-search_2.entry.js +466 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +23 -26
- package/dist/esm/snk-application.entry.js +3 -19
- package/dist/esm/snk-config-options_3.entry.js +5 -17
- package/dist/esm/snk-crud.entry.js +2 -8
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-distinct-search.entry.js +119 -0
- package/dist/esm/snk-filter-bar_4.entry.js +1 -10
- package/dist/esm/snk-filter-text.entry.js +1 -2
- package/dist/esm/snk-grid.entry.js +2 -10
- package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-e8ca764a.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +4 -7
- package/dist/esm/snk-taskbar.entry.js +38 -41
- package/dist/sankhyablocks/{p-483ef1fa.entry.js → p-00f9fe5c.entry.js} +1 -1
- package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
- package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
- package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
- package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +1 -0
- package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-4138da61.entry.js → p-42130213.entry.js} +1 -1
- package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
- package/dist/sankhyablocks/p-96a89d58.entry.js +1 -0
- package/dist/sankhyablocks/p-987c7328.entry.js +1 -0
- package/dist/sankhyablocks/{p-e390641b.entry.js → p-b389ed49.entry.js} +1 -1
- package/dist/sankhyablocks/p-c75fae8e.js +1 -0
- package/dist/sankhyablocks/p-d8665750.js +1 -0
- package/dist/sankhyablocks/{p-e97be1c8.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
- package/dist/types/components/snk-application/snk-application.d.ts +1 -6
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
- package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +0 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -2
- package/dist/types/components.d.ts +393 -31
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +0 -1
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -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/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +0 -8
- package/dist/sankhyablocks/p-0387d9d7.entry.js +0 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-1d3ce0d9.entry.js +0 -1
- package/dist/sankhyablocks/p-342eeb3b.js +0 -1
- package/dist/sankhyablocks/p-3728d2aa.entry.js +0 -11
- package/dist/sankhyablocks/p-4e1f992e.entry.js +0 -1
- package/dist/sankhyablocks/p-619aeac8.entry.js +0 -1
- package/dist/sankhyablocks/p-89c92727.entry.js +0 -1
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
- package/dist/sankhyablocks/p-ec43fcc8.entry.js +0 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +0 -7
- /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
2
|
+
import { Host, h } from '@stencil/core';
|
|
3
|
+
import { KeyboardManager } from '@sankhyalabs/core';
|
|
4
|
+
import { filterItems, getMatchOption, normalizeString } from '../../utils/filter-distinct-search';
|
|
5
|
+
export class SearchModal {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.debounceTimeout = null;
|
|
8
|
+
this.filteredItems = [];
|
|
9
|
+
this.searchFocus = false;
|
|
10
|
+
this.isLimited = false;
|
|
11
|
+
this.application = undefined;
|
|
12
|
+
this.listItens = [];
|
|
13
|
+
this.opened = false;
|
|
14
|
+
this.value = undefined;
|
|
15
|
+
this.canShowError = false;
|
|
16
|
+
this.emptyMessage = undefined;
|
|
17
|
+
this.debounceTime = 300;
|
|
18
|
+
this.maxItens = 100;
|
|
19
|
+
this.label = 'Pesquisar';
|
|
20
|
+
this.mode = 'regular';
|
|
21
|
+
this.restrict = undefined;
|
|
22
|
+
this.errorMessage = undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Método para adicionar a nova palavra e chamar o método closeModal() para fechar o modal
|
|
26
|
+
*/
|
|
27
|
+
addNewItem() {
|
|
28
|
+
this.closeModal();
|
|
29
|
+
this.changeValue.emit({ isNewItem: true, value: this.value });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Método para limpa o campo de entrada de pesquisa
|
|
33
|
+
*/
|
|
34
|
+
clearInput() {
|
|
35
|
+
this._refFilterInput.setValue("");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Método para fechar o modal
|
|
39
|
+
*/
|
|
40
|
+
closeModal() {
|
|
41
|
+
this._popupElement.opened = false;
|
|
42
|
+
this.popupClose.emit(false);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Método para abrir o modal
|
|
46
|
+
*/
|
|
47
|
+
openModal() {
|
|
48
|
+
this._popupElement.opened = true;
|
|
49
|
+
setTimeout(() => this.setFocus(), 100);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Retorna se o conteúdo é inválido.
|
|
53
|
+
*/
|
|
54
|
+
isInvalid() {
|
|
55
|
+
this._refFilterInput.isInvalid();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove o foco do campo
|
|
59
|
+
*/
|
|
60
|
+
setBlur() {
|
|
61
|
+
this._refFilterInput.setBlur();
|
|
62
|
+
this.searchFocus = false;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Aplica o foco do campo
|
|
66
|
+
*/
|
|
67
|
+
setFocus() {
|
|
68
|
+
this._refFilterInput.setFocus();
|
|
69
|
+
this.searchFocus = true;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Método para tratar a mensagem de erro
|
|
73
|
+
*/
|
|
74
|
+
watchPropErrorMessage() {
|
|
75
|
+
this._refFilterInput.errorMessage = this.errorMessage;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Método para tratar o value do input
|
|
79
|
+
*/
|
|
80
|
+
watchPropValue() {
|
|
81
|
+
this._refFilterInput.value = this.value;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Atualiza a lista de itens à medida que o usuário digita no campo de pesquisa.
|
|
85
|
+
*/
|
|
86
|
+
async handleInput(event) {
|
|
87
|
+
if (this.debounceTimeout) {
|
|
88
|
+
clearTimeout(this.debounceTimeout);
|
|
89
|
+
}
|
|
90
|
+
this.value = event.detail;
|
|
91
|
+
this.debounceTimeout = setTimeout(async () => {
|
|
92
|
+
var _a;
|
|
93
|
+
const { isLimited, items } = filterItems(event.detail, this.listItens, this.maxItens);
|
|
94
|
+
this.filteredItems = items;
|
|
95
|
+
this.isLimited = isLimited;
|
|
96
|
+
await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.removeSelection());
|
|
97
|
+
}, this.debounceTime);
|
|
98
|
+
}
|
|
99
|
+
initializeComponent() {
|
|
100
|
+
this.filteredItems = this.listItens;
|
|
101
|
+
}
|
|
102
|
+
getMessage(key) {
|
|
103
|
+
return this.application.messagesBuilder.getMessage(key, null);
|
|
104
|
+
}
|
|
105
|
+
componentWillLoad() {
|
|
106
|
+
this.initializeComponent();
|
|
107
|
+
}
|
|
108
|
+
componentDidLoad() {
|
|
109
|
+
this.bindKeyboardManager();
|
|
110
|
+
this._refFilterInput.value = this.value;
|
|
111
|
+
const { isLimited, items } = filterItems(this.value, this.listItens, this.maxItens);
|
|
112
|
+
this.filteredItems = items;
|
|
113
|
+
this.isLimited = isLimited;
|
|
114
|
+
}
|
|
115
|
+
disconnectedCallback() {
|
|
116
|
+
this.unbindKeyboardManager();
|
|
117
|
+
}
|
|
118
|
+
buildItems() {
|
|
119
|
+
var _a;
|
|
120
|
+
const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
|
|
121
|
+
label: item,
|
|
122
|
+
id: normalizeString(item),
|
|
123
|
+
}));
|
|
124
|
+
return items;
|
|
125
|
+
}
|
|
126
|
+
async tabSelect() {
|
|
127
|
+
var _a;
|
|
128
|
+
const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
129
|
+
if (this.searchFocus && this._refList) {
|
|
130
|
+
this.searchFocus = false;
|
|
131
|
+
this._refList.focus();
|
|
132
|
+
await this.selectFirstItem();
|
|
133
|
+
}
|
|
134
|
+
else if (selectedValue) {
|
|
135
|
+
await this._refList.removeSelection();
|
|
136
|
+
await this._refButton.setFocus();
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
await this._refButton.setBlur();
|
|
140
|
+
this.setFocus();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
bindKeyboardManager() {
|
|
144
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
145
|
+
this._keyboardManager
|
|
146
|
+
.bind("ArrowDown", () => { this.selectNextItem(); })
|
|
147
|
+
.bind("ArrowUp", () => { this.selectPreviousItem(); })
|
|
148
|
+
.bind("Enter", () => { this.setSelectedValue(); })
|
|
149
|
+
.bind("Tab", () => { this.tabSelect(); });
|
|
150
|
+
}
|
|
151
|
+
unbindKeyboardManager() {
|
|
152
|
+
this._keyboardManager
|
|
153
|
+
.unbind("ArrowDown")
|
|
154
|
+
.unbind("ArrowUp")
|
|
155
|
+
.unbind("Enter")
|
|
156
|
+
.unbind("Tab");
|
|
157
|
+
}
|
|
158
|
+
async setSelectedValue() {
|
|
159
|
+
var _a;
|
|
160
|
+
const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
161
|
+
if (selectedValue) {
|
|
162
|
+
this.changeValue.emit({ isNewItem: false, value: selectedValue.label });
|
|
163
|
+
this.closeModal();
|
|
164
|
+
}
|
|
165
|
+
else if (this.searchFocus && this.enabledButtonNewItem()) {
|
|
166
|
+
this.addNewItem();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async selectNextItem() {
|
|
170
|
+
var _a;
|
|
171
|
+
const itemSelected = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
172
|
+
if (this.searchFocus && !itemSelected) {
|
|
173
|
+
this.setBlur();
|
|
174
|
+
await this.selectFirstItem();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
;
|
|
178
|
+
await this._refList.selectNextItem();
|
|
179
|
+
}
|
|
180
|
+
async selectPreviousItem() {
|
|
181
|
+
const itemSelected = await this._refList.getSelection();
|
|
182
|
+
if (itemSelected === undefined)
|
|
183
|
+
return;
|
|
184
|
+
await this._refList.selectPreviousItem();
|
|
185
|
+
}
|
|
186
|
+
async selectFirstItem() {
|
|
187
|
+
if (!this.filteredItems.length) {
|
|
188
|
+
await this._refList.removeSelection();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const firstItem = this.filteredItems[0];
|
|
192
|
+
await this._refList.setSelection({
|
|
193
|
+
id: normalizeString(firstItem),
|
|
194
|
+
label: firstItem,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
enabledButtonNewItem() {
|
|
198
|
+
if (this.value === undefined)
|
|
199
|
+
return false;
|
|
200
|
+
if (getMatchOption(this.value, this.listItens))
|
|
201
|
+
return false;
|
|
202
|
+
return this.value.trim().length === 0 ? false : true;
|
|
203
|
+
}
|
|
204
|
+
buildMessage() {
|
|
205
|
+
if (this.isLimited) {
|
|
206
|
+
return this.getMessage("snkDistinctSearch.limitResult");
|
|
207
|
+
}
|
|
208
|
+
return `${this.filteredItems.length} ${this.filteredItems.length > 1 ? this.getMessage("snkDistinctSearch.availableResults") : this.getMessage("snkDistinctSearch.availableResult")}`;
|
|
209
|
+
}
|
|
210
|
+
render() {
|
|
211
|
+
var _a;
|
|
212
|
+
return (h(Host, null, h("ez-popup", { ref: (ref) => this._popupElement = ref, size: "x-small", "ez-title": this.label, onEzClosePopup: () => this.popupClose.emit(false), "height-mode": "auto" }, h("div", null, h("ez-filter-input", { ref: (ref) => this._refFilterInput = ref, label: "Pesquisar", onEzChange: this.handleInput.bind(this), onBlur: () => this.searchFocus = false, onEzFocusIn: () => this.searchFocus = true, errorMessage: this.errorMessage, canShowError: this.canShowError, mode: this.mode, value: this.value, restrict: this.restrict }), this.filteredItems.length === 0 ? (h("div", { class: "ez-content" }, h("div", { class: "ez-text--center search-modal-text" }, this.emptyMessage))) : (h("div", null, h("div", { class: "search-modal-text ez-padding-vertical--medium" }, this.buildMessage()), h("ez-scroller", { class: "search-modal-scroller", direction: EzScrollDirection.VERTICAL }, h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buildItems(), onEzClickItem: ({ label }) => this.setSelectedValue.bind(this)(label), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })))), h("div", { class: "ez-flex ez-flex--justify-end" }, h("ez-button", { ref: (ref) => this._refButton = ref, class: "ez-button--tertiary", enabled: this.enabledButtonNewItem(), label: `${this.getMessage("snkDistinctSearch.titleAdd")} ${(_a = this.label) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()}`, onClick: () => this.addNewItem() }))))));
|
|
213
|
+
}
|
|
214
|
+
static get is() { return "search-modal"; }
|
|
215
|
+
static get encapsulation() { return "scoped"; }
|
|
216
|
+
static get originalStyleUrls() {
|
|
217
|
+
return {
|
|
218
|
+
"$": ["search-modal.css"]
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
static get styleUrls() {
|
|
222
|
+
return {
|
|
223
|
+
"$": ["search-modal.css"]
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
static get properties() {
|
|
227
|
+
return {
|
|
228
|
+
"application": {
|
|
229
|
+
"type": "unknown",
|
|
230
|
+
"mutable": false,
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "SnkApplication",
|
|
233
|
+
"resolved": "SnkApplication",
|
|
234
|
+
"references": {
|
|
235
|
+
"SnkApplication": {
|
|
236
|
+
"location": "import",
|
|
237
|
+
"path": "../../../snk-application/snk-application"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"required": false,
|
|
242
|
+
"optional": false,
|
|
243
|
+
"docs": {
|
|
244
|
+
"tags": [],
|
|
245
|
+
"text": "SnkApplication"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"listItens": {
|
|
249
|
+
"type": "unknown",
|
|
250
|
+
"mutable": true,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "string[]",
|
|
253
|
+
"resolved": "string[]",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": false,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": "Lista de itens exibidas conforme o usu\u00E1rio digita."
|
|
261
|
+
},
|
|
262
|
+
"defaultValue": "[]"
|
|
263
|
+
},
|
|
264
|
+
"opened": {
|
|
265
|
+
"type": "boolean",
|
|
266
|
+
"mutable": true,
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "boolean",
|
|
269
|
+
"resolved": "boolean",
|
|
270
|
+
"references": {}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": false,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": "Define se o ez-popover est\u00E1 aberto."
|
|
277
|
+
},
|
|
278
|
+
"attribute": "opened",
|
|
279
|
+
"reflect": true,
|
|
280
|
+
"defaultValue": "false"
|
|
281
|
+
},
|
|
282
|
+
"value": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"mutable": false,
|
|
285
|
+
"complexType": {
|
|
286
|
+
"original": "string",
|
|
287
|
+
"resolved": "string",
|
|
288
|
+
"references": {}
|
|
289
|
+
},
|
|
290
|
+
"required": false,
|
|
291
|
+
"optional": false,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": "Define o valor do campo."
|
|
295
|
+
},
|
|
296
|
+
"attribute": "value",
|
|
297
|
+
"reflect": false,
|
|
298
|
+
"defaultValue": "undefined"
|
|
299
|
+
},
|
|
300
|
+
"canShowError": {
|
|
301
|
+
"type": "boolean",
|
|
302
|
+
"mutable": false,
|
|
303
|
+
"complexType": {
|
|
304
|
+
"original": "boolean",
|
|
305
|
+
"resolved": "boolean",
|
|
306
|
+
"references": {}
|
|
307
|
+
},
|
|
308
|
+
"required": false,
|
|
309
|
+
"optional": false,
|
|
310
|
+
"docs": {
|
|
311
|
+
"tags": [],
|
|
312
|
+
"text": "Se false deixa de exibir a mensagem de erro dentro do campo."
|
|
313
|
+
},
|
|
314
|
+
"attribute": "can-show-error",
|
|
315
|
+
"reflect": false,
|
|
316
|
+
"defaultValue": "false"
|
|
317
|
+
},
|
|
318
|
+
"emptyMessage": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"complexType": {
|
|
322
|
+
"original": "HTMLElement | string",
|
|
323
|
+
"resolved": "HTMLElement | string",
|
|
324
|
+
"references": {
|
|
325
|
+
"HTMLElement": {
|
|
326
|
+
"location": "global"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"required": false,
|
|
331
|
+
"optional": false,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": "Recebe a mensagem de vazio ou personalizada"
|
|
335
|
+
},
|
|
336
|
+
"attribute": "empty-message",
|
|
337
|
+
"reflect": false,
|
|
338
|
+
"defaultValue": "undefined"
|
|
339
|
+
},
|
|
340
|
+
"debounceTime": {
|
|
341
|
+
"type": "number",
|
|
342
|
+
"mutable": false,
|
|
343
|
+
"complexType": {
|
|
344
|
+
"original": "number",
|
|
345
|
+
"resolved": "number",
|
|
346
|
+
"references": {}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": false,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Tempo em milissegundos para debouncing das chamadas de busca de sugest\u00F5es."
|
|
353
|
+
},
|
|
354
|
+
"attribute": "debounce-time",
|
|
355
|
+
"reflect": false,
|
|
356
|
+
"defaultValue": "300"
|
|
357
|
+
},
|
|
358
|
+
"maxItens": {
|
|
359
|
+
"type": "number",
|
|
360
|
+
"mutable": false,
|
|
361
|
+
"complexType": {
|
|
362
|
+
"original": "number",
|
|
363
|
+
"resolved": "number",
|
|
364
|
+
"references": {}
|
|
365
|
+
},
|
|
366
|
+
"required": false,
|
|
367
|
+
"optional": false,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": "Limita a quantidade de registros apresentados na tela"
|
|
371
|
+
},
|
|
372
|
+
"attribute": "max-itens",
|
|
373
|
+
"reflect": false,
|
|
374
|
+
"defaultValue": "100"
|
|
375
|
+
},
|
|
376
|
+
"label": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"mutable": false,
|
|
379
|
+
"complexType": {
|
|
380
|
+
"original": "string",
|
|
381
|
+
"resolved": "string",
|
|
382
|
+
"references": {}
|
|
383
|
+
},
|
|
384
|
+
"required": false,
|
|
385
|
+
"optional": false,
|
|
386
|
+
"docs": {
|
|
387
|
+
"tags": [],
|
|
388
|
+
"text": "Texto exibido como placeholder no campo de pesquisa."
|
|
389
|
+
},
|
|
390
|
+
"attribute": "label",
|
|
391
|
+
"reflect": false,
|
|
392
|
+
"defaultValue": "'Pesquisar'"
|
|
393
|
+
},
|
|
394
|
+
"mode": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"mutable": false,
|
|
397
|
+
"complexType": {
|
|
398
|
+
"original": "'slim' | 'regular'",
|
|
399
|
+
"resolved": "\"regular\" | \"slim\"",
|
|
400
|
+
"references": {}
|
|
401
|
+
},
|
|
402
|
+
"required": false,
|
|
403
|
+
"optional": false,
|
|
404
|
+
"docs": {
|
|
405
|
+
"tags": [],
|
|
406
|
+
"text": "Define o tamanho do campo."
|
|
407
|
+
},
|
|
408
|
+
"attribute": "mode",
|
|
409
|
+
"reflect": false,
|
|
410
|
+
"defaultValue": "'regular'"
|
|
411
|
+
},
|
|
412
|
+
"restrict": {
|
|
413
|
+
"type": "string",
|
|
414
|
+
"mutable": false,
|
|
415
|
+
"complexType": {
|
|
416
|
+
"original": "string",
|
|
417
|
+
"resolved": "string",
|
|
418
|
+
"references": {}
|
|
419
|
+
},
|
|
420
|
+
"required": false,
|
|
421
|
+
"optional": false,
|
|
422
|
+
"docs": {
|
|
423
|
+
"tags": [],
|
|
424
|
+
"text": "Express\u00E3o que define os caracteres permitidos na entrada."
|
|
425
|
+
},
|
|
426
|
+
"attribute": "restrict",
|
|
427
|
+
"reflect": false,
|
|
428
|
+
"defaultValue": "undefined"
|
|
429
|
+
},
|
|
430
|
+
"errorMessage": {
|
|
431
|
+
"type": "string",
|
|
432
|
+
"mutable": false,
|
|
433
|
+
"complexType": {
|
|
434
|
+
"original": "string",
|
|
435
|
+
"resolved": "string",
|
|
436
|
+
"references": {}
|
|
437
|
+
},
|
|
438
|
+
"required": false,
|
|
439
|
+
"optional": false,
|
|
440
|
+
"docs": {
|
|
441
|
+
"tags": [],
|
|
442
|
+
"text": "Define uma mensagem de orienta\u00E7\u00E3o ao usu\u00E1rio, colocando o campo em modo inv\u00E1lido."
|
|
443
|
+
},
|
|
444
|
+
"attribute": "error-message",
|
|
445
|
+
"reflect": false,
|
|
446
|
+
"defaultValue": "undefined"
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
static get states() {
|
|
451
|
+
return {
|
|
452
|
+
"filteredItems": {},
|
|
453
|
+
"searchFocus": {},
|
|
454
|
+
"isLimited": {}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
static get events() {
|
|
458
|
+
return [{
|
|
459
|
+
"method": "popupClose",
|
|
460
|
+
"name": "popupClose",
|
|
461
|
+
"bubbles": true,
|
|
462
|
+
"cancelable": true,
|
|
463
|
+
"composed": true,
|
|
464
|
+
"docs": {
|
|
465
|
+
"tags": [],
|
|
466
|
+
"text": "Emitido ao fechar o popup"
|
|
467
|
+
},
|
|
468
|
+
"complexType": {
|
|
469
|
+
"original": "boolean",
|
|
470
|
+
"resolved": "boolean",
|
|
471
|
+
"references": {}
|
|
472
|
+
}
|
|
473
|
+
}, {
|
|
474
|
+
"method": "changeValue",
|
|
475
|
+
"name": "changeValue",
|
|
476
|
+
"bubbles": true,
|
|
477
|
+
"cancelable": true,
|
|
478
|
+
"composed": true,
|
|
479
|
+
"docs": {
|
|
480
|
+
"tags": [],
|
|
481
|
+
"text": "Emitido quando h\u00E1 uma altera\u00E7\u00E3o no valor do campo."
|
|
482
|
+
},
|
|
483
|
+
"complexType": {
|
|
484
|
+
"original": "IDistinctValue",
|
|
485
|
+
"resolved": "IDistinctValue",
|
|
486
|
+
"references": {
|
|
487
|
+
"IDistinctValue": {
|
|
488
|
+
"location": "import",
|
|
489
|
+
"path": "../../types"
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}];
|
|
494
|
+
}
|
|
495
|
+
static get methods() {
|
|
496
|
+
return {
|
|
497
|
+
"addNewItem": {
|
|
498
|
+
"complexType": {
|
|
499
|
+
"signature": "() => Promise<void>",
|
|
500
|
+
"parameters": [],
|
|
501
|
+
"references": {},
|
|
502
|
+
"return": "Promise<void>"
|
|
503
|
+
},
|
|
504
|
+
"docs": {
|
|
505
|
+
"text": "M\u00E9todo para adicionar a nova palavra e chamar o m\u00E9todo closeModal() para fechar o modal",
|
|
506
|
+
"tags": []
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
"clearInput": {
|
|
510
|
+
"complexType": {
|
|
511
|
+
"signature": "() => Promise<void>",
|
|
512
|
+
"parameters": [],
|
|
513
|
+
"references": {},
|
|
514
|
+
"return": "Promise<void>"
|
|
515
|
+
},
|
|
516
|
+
"docs": {
|
|
517
|
+
"text": "M\u00E9todo para limpa o campo de entrada de pesquisa",
|
|
518
|
+
"tags": []
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
"closeModal": {
|
|
522
|
+
"complexType": {
|
|
523
|
+
"signature": "() => Promise<void>",
|
|
524
|
+
"parameters": [],
|
|
525
|
+
"references": {},
|
|
526
|
+
"return": "Promise<void>"
|
|
527
|
+
},
|
|
528
|
+
"docs": {
|
|
529
|
+
"text": "M\u00E9todo para fechar o modal",
|
|
530
|
+
"tags": []
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
"openModal": {
|
|
534
|
+
"complexType": {
|
|
535
|
+
"signature": "() => Promise<void>",
|
|
536
|
+
"parameters": [],
|
|
537
|
+
"references": {},
|
|
538
|
+
"return": "Promise<void>"
|
|
539
|
+
},
|
|
540
|
+
"docs": {
|
|
541
|
+
"text": "M\u00E9todo para abrir o modal",
|
|
542
|
+
"tags": []
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
"isInvalid": {
|
|
546
|
+
"complexType": {
|
|
547
|
+
"signature": "() => Promise<void>",
|
|
548
|
+
"parameters": [],
|
|
549
|
+
"references": {},
|
|
550
|
+
"return": "Promise<void>"
|
|
551
|
+
},
|
|
552
|
+
"docs": {
|
|
553
|
+
"text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
|
|
554
|
+
"tags": []
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
"setBlur": {
|
|
558
|
+
"complexType": {
|
|
559
|
+
"signature": "() => Promise<void>",
|
|
560
|
+
"parameters": [],
|
|
561
|
+
"references": {},
|
|
562
|
+
"return": "Promise<void>"
|
|
563
|
+
},
|
|
564
|
+
"docs": {
|
|
565
|
+
"text": "Remove o foco do campo",
|
|
566
|
+
"tags": []
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
"setFocus": {
|
|
570
|
+
"complexType": {
|
|
571
|
+
"signature": "() => Promise<void>",
|
|
572
|
+
"parameters": [],
|
|
573
|
+
"references": {},
|
|
574
|
+
"return": "Promise<void>"
|
|
575
|
+
},
|
|
576
|
+
"docs": {
|
|
577
|
+
"text": "Aplica o foco do campo",
|
|
578
|
+
"tags": []
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
static get elementRef() { return "_element"; }
|
|
584
|
+
static get watchers() {
|
|
585
|
+
return [{
|
|
586
|
+
"propName": "errorMessage",
|
|
587
|
+
"methodName": "watchPropErrorMessage"
|
|
588
|
+
}, {
|
|
589
|
+
"propName": "value",
|
|
590
|
+
"methodName": "watchPropValue"
|
|
591
|
+
}];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function normalizeString(text = "") {
|
|
2
|
+
return text.normalize('NFD').replace(/[\u0300-\u036f/\s'"&.-]/g, "").toUpperCase();
|
|
3
|
+
}
|
|
4
|
+
export function filterItems(searchArgument, distinctItems, maxItems) {
|
|
5
|
+
const normalizedSearch = normalizeString(searchArgument);
|
|
6
|
+
const filteredDistincts = distinctItems.filter((item) => normalizeString(item).includes(normalizedSearch));
|
|
7
|
+
const isLimited = filteredDistincts.length > maxItems;
|
|
8
|
+
const items = filteredDistincts.slice(0, maxItems);
|
|
9
|
+
return { items, isLimited };
|
|
10
|
+
}
|
|
11
|
+
export function getMatchOption(value, distinctItems) {
|
|
12
|
+
const normalizedSearch = normalizeString(value);
|
|
13
|
+
const item = distinctItems.find((item) => normalizeString(item) === normalizedSearch);
|
|
14
|
+
return item;
|
|
15
|
+
}
|
|
@@ -18,11 +18,10 @@ export class SnkFilterText {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
var _a;
|
|
22
21
|
if (!this.config) {
|
|
23
22
|
return undefined;
|
|
24
23
|
}
|
|
25
|
-
return (h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value
|
|
24
|
+
return (h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
|
|
26
25
|
}
|
|
27
26
|
static get is() { return "snk-filter-text"; }
|
|
28
27
|
static get properties() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementIDUtils, FloatingManager, DateUtils
|
|
1
|
+
import { ElementIDUtils, FloatingManager, DateUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
3
|
import FilterItemType from './filter-item-type.enum';
|
|
4
4
|
import { FilterNumberVariation } from './editors/enum/filterNumberVariation';
|
|
@@ -211,10 +211,6 @@ export class SnkFilterItem {
|
|
|
211
211
|
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
if (this.config.mask) {
|
|
215
|
-
const _maskFormatter = new MaskFormatter(this.config.mask);
|
|
216
|
-
return `${label}: ${_maskFormatter.format(value)}`;
|
|
217
|
-
}
|
|
218
214
|
return `${label}: ${value}`;
|
|
219
215
|
}
|
|
220
216
|
return label;
|
|
@@ -38,7 +38,6 @@ export class SnkFilterBar {
|
|
|
38
38
|
this.disablePersonalizedFilter = undefined;
|
|
39
39
|
this.filterBarLegacyConfigName = undefined;
|
|
40
40
|
this.autoLoad = undefined;
|
|
41
|
-
this.afterApplyConfig = undefined;
|
|
42
41
|
this.allowDefault = undefined;
|
|
43
42
|
this.scrollerLocked = false;
|
|
44
43
|
this.showPersonalizedFilter = false;
|
|
@@ -175,7 +174,6 @@ export class SnkFilterBar {
|
|
|
175
174
|
return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
|
|
176
175
|
}
|
|
177
176
|
async processAfterUpdateConfig() {
|
|
178
|
-
var _a;
|
|
179
177
|
if (this._loadingPending) {
|
|
180
178
|
if (await this._application.isLoadedByPk() && !this._configUpdated)
|
|
181
179
|
return;
|
|
@@ -190,7 +188,6 @@ export class SnkFilterBar {
|
|
|
190
188
|
if (this._configUpdated) {
|
|
191
189
|
this._configUpdated = false;
|
|
192
190
|
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
|
|
193
|
-
(_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
194
191
|
}
|
|
195
192
|
}
|
|
196
193
|
async doLoadData(forceReload = false) {
|
|
@@ -395,9 +392,7 @@ export class SnkFilterBar {
|
|
|
395
392
|
*/
|
|
396
393
|
async showFilterModal() {
|
|
397
394
|
const callbackOnApplyFilter = (filters) => {
|
|
398
|
-
var _a;
|
|
399
395
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
|
400
|
-
(_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
401
396
|
};
|
|
402
397
|
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
|
403
398
|
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
|
@@ -694,21 +689,6 @@ export class SnkFilterBar {
|
|
|
694
689
|
},
|
|
695
690
|
"attribute": "auto-load",
|
|
696
691
|
"reflect": false
|
|
697
|
-
},
|
|
698
|
-
"afterApplyConfig": {
|
|
699
|
-
"type": "unknown",
|
|
700
|
-
"mutable": false,
|
|
701
|
-
"complexType": {
|
|
702
|
-
"original": "() => void",
|
|
703
|
-
"resolved": "() => void",
|
|
704
|
-
"references": {}
|
|
705
|
-
},
|
|
706
|
-
"required": false,
|
|
707
|
-
"optional": true,
|
|
708
|
-
"docs": {
|
|
709
|
-
"tags": [],
|
|
710
|
-
"text": "Fun\u00E7\u00E3o chamada depois de aplicar os filtros."
|
|
711
|
-
}
|
|
712
692
|
}
|
|
713
693
|
};
|
|
714
694
|
}
|