@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-kb-74339.1 → 0.0.0-bugfix-dev-KB-76362.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 (152) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-29b65619.js → ContinuousInsertUtils-64e47516.js} +29 -20
  3. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
  4. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
  6. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
  8. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  9. package/dist/cjs/index-f9e81701.js +8 -0
  10. package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  15. package/dist/cjs/snk-application.cjs.entry.js +102 -60
  16. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
  18. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
  20. package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-7dbdad0e.js} +2 -2
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
  23. package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
  24. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  27. package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-eee43c8b.js} +8 -5
  28. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  29. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  30. package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -8
  31. package/dist/collection/collection-manifest.json +3 -0
  32. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  33. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  34. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  35. package/dist/collection/components/snk-application/snk-application.js +3 -53
  36. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
  37. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
  38. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
  39. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
  40. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
  41. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
  42. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
  43. package/dist/collection/components/snk-distinct-search/types/index.js +1 -0
  44. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
  45. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +3 -1
  46. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  47. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  48. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
  49. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
  50. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  51. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
  52. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  53. package/dist/components/ContinuousInsertUtils.js +25 -16
  54. package/dist/components/DataFetcher.js +7 -5
  55. package/dist/components/SnkMessageBuilder.js +10 -0
  56. package/dist/components/dataunit-fetcher.js +2 -2
  57. package/dist/components/filter-distinct-search.js +17 -0
  58. package/dist/components/index.d.ts +3 -0
  59. package/dist/components/index.js +3 -0
  60. package/dist/components/input-distinct-search.d.ts +11 -0
  61. package/dist/components/input-distinct-search.js +6 -0
  62. package/dist/components/input-distinct-search2.js +264 -0
  63. package/dist/components/pesquisa-fetcher.js +6 -1
  64. package/dist/components/search-modal.d.ts +11 -0
  65. package/dist/components/search-modal.js +6 -0
  66. package/dist/components/search-modal2.js +264 -0
  67. package/dist/components/snk-application2.js +95 -53
  68. package/dist/components/snk-detail-view2.js +3 -0
  69. package/dist/components/snk-distinct-search.d.ts +11 -0
  70. package/dist/components/snk-distinct-search.js +163 -0
  71. package/dist/components/snk-simple-crud2.js +3 -1
  72. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  73. package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
  74. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  75. package/dist/esm/{SnkFormConfigManager-f1a0fc92.js → SnkFormConfigManager-b409c745.js} +2 -2
  76. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
  77. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  78. package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
  79. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  80. package/dist/esm/index-a7d3d3f1.js +8 -0
  81. package/dist/esm/input-distinct-search_2.entry.js +466 -0
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
  84. package/dist/esm/sankhyablocks.js +1 -1
  85. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  86. package/dist/esm/snk-application.entry.js +102 -60
  87. package/dist/esm/snk-attach.entry.js +5 -5
  88. package/dist/esm/snk-config-options_3.entry.js +4 -4
  89. package/dist/esm/snk-crud.entry.js +5 -5
  90. package/dist/esm/snk-data-exporter.entry.js +6 -6
  91. package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-7a579dbd.js} +2 -2
  92. package/dist/esm/snk-data-unit.entry.js +4 -4
  93. package/dist/esm/snk-detail-view.entry.js +8 -8
  94. package/dist/esm/snk-distinct-search.entry.js +119 -0
  95. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  96. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  97. package/dist/esm/snk-grid.entry.js +6 -6
  98. package/dist/esm/{snk-guides-viewer-8fa1321a.js → snk-guides-viewer-e8ca764a.js} +8 -5
  99. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  100. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  101. package/dist/esm/snk-simple-crud.entry.js +10 -8
  102. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  103. package/dist/sankhyablocks/{p-49b01ec2.entry.js → p-00f9fe5c.entry.js} +1 -1
  104. package/dist/sankhyablocks/{p-fadc8339.js → p-0e206e62.js} +1 -1
  105. package/dist/sankhyablocks/{p-ab05d5f2.entry.js → p-0e250436.entry.js} +1 -1
  106. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  107. package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
  108. package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
  109. package/dist/sankhyablocks/{p-a75d242d.entry.js → p-1dbd5c18.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-fa6c5826.entry.js → p-30ebcbe0.entry.js} +1 -1
  111. package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
  112. package/dist/sankhyablocks/p-3755b46f.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-052213ba.entry.js → p-3858a2e4.entry.js} +1 -1
  114. package/dist/sankhyablocks/p-42130213.entry.js +1 -0
  115. package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
  116. package/dist/sankhyablocks/{p-8dfc2ba9.entry.js → p-563b7c28.entry.js} +1 -1
  117. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  118. package/dist/sankhyablocks/{p-c2e4ac99.entry.js → p-a2c790ac.entry.js} +1 -1
  119. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  120. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  121. package/dist/sankhyablocks/{p-2ef45894.entry.js → p-b389ed49.entry.js} +1 -1
  122. package/dist/sankhyablocks/{p-5dd8cf4f.js → p-c75fae8e.js} +1 -1
  123. package/dist/sankhyablocks/p-d8665750.js +1 -0
  124. package/dist/sankhyablocks/{p-ee7023c4.js → p-e3a285a2.js} +1 -1
  125. package/dist/sankhyablocks/p-e4391e16.js +1 -0
  126. package/dist/sankhyablocks/{p-42288374.entry.js → p-f0aaad2b.entry.js} +1 -1
  127. package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-f4e221b2.entry.js} +1 -1
  128. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  129. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  130. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  131. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  132. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  133. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  134. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
  135. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
  136. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
  137. package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
  138. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
  139. package/dist/types/components.d.ts +393 -1
  140. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  141. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
  142. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
  143. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  144. package/package.json +1 -1
  145. package/react/components.d.ts +3 -0
  146. package/react/components.js +3 -0
  147. package/react/components.js.map +1 -1
  148. package/dist/sankhyablocks/p-17425c72.js +0 -1
  149. package/dist/sankhyablocks/p-2923c1b5.js +0 -1
  150. package/dist/sankhyablocks/p-7281cdab.entry.js +0 -1
  151. package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
  152. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
@@ -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: "400px", "ez-title": this.label, onEzClosePopup: () => this.popupClose.emit(false), "height-mode": "full" }, 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
+ }
@@ -644,9 +644,11 @@ export class SnkSimpleCrud {
644
644
  window.removeEventListener("keydown", this._keyDownHandler);
645
645
  }
646
646
  gridConfigChangeHandler(evt) {
647
+ evt.stopPropagation();
648
+ if (!this.configName)
649
+ return;
647
650
  const config = evt.detail;
648
651
  ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
649
- evt.stopPropagation();
650
652
  }
651
653
  modalConfigChangeHandler(evt) {
652
654
  const config = evt.detail;
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
6
6
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
7
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
8
8
  };
9
- import { ApplicationContext, ErrorException, ServiceCanceledException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
9
+ import { ApplicationContext, ErrorException, ObjectUtils, ServiceCanceledException, StringUtils, WarningException } from '@sankhyalabs/core';
10
10
  import { batchRequests } from 'graphql-request';
11
11
  import UrlUtils from "../../../lib/utils/urlutils";
12
12
  import { PrintUtils } from '../../utils/PrintUtils';
@@ -266,7 +266,8 @@ export class DataFetcher {
266
266
  }
267
267
  payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
268
268
  }
269
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
269
+ const requestId = StringUtils.generateUUID();
270
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
270
271
  http.open("POST", url, true);
271
272
  http.withCredentials = true;
272
273
  http.send(ObjectUtils.objectToString(payloadJson));
@@ -306,7 +307,7 @@ export class DataFetcher {
306
307
  else if (http.readyState == 4 && http.status != 200) {
307
308
  reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
308
309
  }
309
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
310
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
310
311
  };
311
312
  });
312
313
  }
@@ -411,7 +412,8 @@ export class DataFetcher {
411
412
  const errorsResponse = [];
412
413
  const responseExtensions = [];
413
414
  const url = this.buildGraphQlURL(quietMode);
414
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
415
+ const requestId = StringUtils.generateUUID();
416
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
415
417
  try {
416
418
  const response = await batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
417
419
  response.forEach((resItem, index) => {
@@ -445,11 +447,11 @@ export class DataFetcher {
445
447
  });
446
448
  }
447
449
  else {
448
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
450
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
449
451
  throw new ErrorException("Falha de comunicação", err.message);
450
452
  }
451
453
  }
452
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
454
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
453
455
  return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
454
456
  }
455
457
  isHttpError(err) {
@@ -73,7 +73,7 @@ export default class DataUnitDataLoader {
73
73
  }
74
74
  const count = loadingInfo.count;
75
75
  if (loadingInfo.loadingInProgress) {
76
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
76
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
77
77
  return;
78
78
  }
79
79
  if (loadingInfo.needReload) {
@@ -81,7 +81,7 @@ export default class DataUnitDataLoader {
81
81
  dataUnit.gotoPage(0);
82
82
  return;
83
83
  }
84
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
84
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
85
85
  }
86
86
  static registryLoading(dataUnit, loadingInfo) {
87
87
  if (loadingInfo == undefined) {