@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-74224.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.
Files changed (185) hide show
  1. package/dist/cjs/{ConfigStorage-f079f5fd.js → ConfigStorage-ecc0ed20.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-29b65619.js} +20 -29
  3. package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-cadeef8e.js} +5 -7
  4. package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-f1c92f79.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-7691a2c1.js → SnkMessageBuilder-bae64d0d.js} +0 -10
  6. package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-d68841bc.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-f89461c1.js} +3 -3
  8. package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-ed497282.js} +1 -1
  9. package/dist/cjs/index-f9e81701.js +28 -16
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-ca89181c.js} +2 -7
  12. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  13. package/dist/cjs/snk-actions-button_4.cjs.entry.js +30 -27
  14. package/dist/cjs/snk-application.cjs.entry.js +60 -102
  15. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  16. package/dist/cjs/snk-config-options.cjs.entry.js +239 -0
  17. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
  19. package/dist/cjs/{snk-data-unit-7dbdad0e.js → snk-data-unit-668dc5e8.js} +2 -2
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
  22. package/dist/cjs/{snk-filter-bar_4.cjs.entry.js → snk-filter-bar.cjs.entry.js} +3 -688
  23. package/dist/cjs/snk-filter-item.cjs.entry.js +312 -0
  24. package/dist/cjs/snk-filter-list.cjs.entry.js +152 -0
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-filter-modal.cjs.entry.js +249 -0
  27. package/dist/cjs/{snk-config-options_3.cjs.entry.js → snk-form-config.cjs.entry.js} +3 -365
  28. package/dist/cjs/snk-form.cjs.entry.js +144 -0
  29. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  30. package/dist/cjs/{snk-guides-viewer-eee43c8b.js → snk-guides-viewer-4236cb9d.js} +5 -8
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  32. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -14
  34. package/dist/collection/collection-manifest.json +31 -14
  35. package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
  36. package/dist/collection/components/snk-application/snk-application.js +53 -3
  37. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +0 -3
  38. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +7 -7
  39. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -8
  40. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  41. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -6
  42. package/dist/collection/lib/message/SnkMessageBuilder.js +0 -2
  43. package/dist/collection/lib/utils/CrudUtils.js +16 -25
  44. package/dist/components/ContinuousInsertUtils.js +16 -25
  45. package/dist/components/DataFetcher.js +5 -7
  46. package/dist/components/SnkMessageBuilder.js +0 -10
  47. package/dist/components/dataunit-fetcher.js +2 -2
  48. package/dist/components/index.d.ts +0 -3
  49. package/dist/components/index.js +0 -3
  50. package/dist/components/pesquisa-fetcher.js +1 -6
  51. package/dist/components/snk-actions-button2.js +27 -26
  52. package/dist/components/snk-application2.js +53 -95
  53. package/dist/components/snk-detail-view2.js +0 -3
  54. package/dist/components/snk-simple-crud2.js +7 -7
  55. package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-7b36d041.js} +2 -2
  56. package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-30caa626.js} +20 -29
  57. package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-a9c598f2.js} +5 -7
  58. package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-139f09fa.js} +3 -3
  59. package/dist/esm/{SnkMessageBuilder-7ace6803.js → SnkMessageBuilder-6fff4a4c.js} +0 -10
  60. package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-749d880f.js} +1 -1
  61. package/dist/esm/{constants-7302ee87.js → constants-8457af36.js} +1 -1
  62. package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-c24c76c6.js} +3 -3
  63. package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-adbe5d34.js} +1 -1
  64. package/dist/esm/index-a7d3d3f1.js +28 -16
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-8edaa8cd.js} +2 -7
  67. package/dist/esm/sankhyablocks.js +1 -1
  68. package/dist/esm/snk-actions-button_4.entry.js +32 -29
  69. package/dist/esm/snk-application.entry.js +60 -102
  70. package/dist/esm/snk-attach.entry.js +6 -6
  71. package/dist/esm/snk-config-options.entry.js +235 -0
  72. package/dist/esm/snk-configurator.entry.js +1 -1
  73. package/dist/esm/snk-crud.entry.js +6 -6
  74. package/dist/esm/snk-data-exporter.entry.js +7 -7
  75. package/dist/esm/{snk-data-unit-7a579dbd.js → snk-data-unit-0fdfb6c2.js} +2 -2
  76. package/dist/esm/snk-data-unit.entry.js +4 -4
  77. package/dist/esm/snk-detail-view.entry.js +9 -9
  78. package/dist/esm/snk-field-config.entry.js +1 -1
  79. package/dist/esm/{snk-filter-bar_4.entry.js → snk-filter-bar.entry.js} +5 -687
  80. package/dist/esm/snk-filter-item.entry.js +308 -0
  81. package/dist/esm/snk-filter-list.entry.js +148 -0
  82. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  83. package/dist/esm/snk-filter-modal.entry.js +245 -0
  84. package/dist/esm/{snk-config-options_3.entry.js → snk-form-config.entry.js} +6 -366
  85. package/dist/esm/snk-form.entry.js +140 -0
  86. package/dist/esm/snk-grid.entry.js +6 -6
  87. package/dist/esm/{snk-guides-viewer-e8ca764a.js → snk-guides-viewer-8934c537.js} +6 -9
  88. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  89. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  90. package/dist/esm/snk-simple-crud.entry.js +15 -15
  91. package/dist/esm/snk-tab-config.entry.js +1 -1
  92. package/dist/sankhyablocks/p-01086ff7.entry.js +1 -0
  93. package/dist/sankhyablocks/{p-126c58ea.js → p-06421fdb.js} +1 -1
  94. package/dist/sankhyablocks/{p-e3a285a2.js → p-16869f77.js} +1 -1
  95. package/dist/sankhyablocks/p-17425c72.js +1 -0
  96. package/dist/sankhyablocks/{p-341465ce.js → p-1bf06cd3.js} +2 -2
  97. package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-212213d9.entry.js} +1 -1
  98. package/dist/sankhyablocks/p-2923c1b5.js +1 -0
  99. package/dist/sankhyablocks/p-3b60db06.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-00f9fe5c.entry.js → p-430e4d3c.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-9ffd9fc7.js → p-4d9549cf.js} +1 -1
  102. package/dist/sankhyablocks/{p-c75fae8e.js → p-5dd8cf4f.js} +1 -1
  103. package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
  104. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  105. package/dist/sankhyablocks/{p-41793e17.entry.js → p-7663f597.entry.js} +1 -1
  106. package/dist/sankhyablocks/{p-47d24ac8.js → p-7ac7932c.js} +2 -2
  107. package/dist/sankhyablocks/{p-2d3f9482.entry.js → p-8eb67fa4.entry.js} +1 -1
  108. package/dist/sankhyablocks/{p-f0aaad2b.entry.js → p-92eadb1c.entry.js} +1 -1
  109. package/dist/sankhyablocks/{p-8b4fc28f.entry.js → p-95df461f.entry.js} +1 -1
  110. package/dist/sankhyablocks/p-a42e7a1e.entry.js +11 -0
  111. package/dist/sankhyablocks/p-a724e798.entry.js +1 -0
  112. package/dist/sankhyablocks/{p-1dbd5c18.entry.js → p-a75d242d.entry.js} +1 -1
  113. package/dist/sankhyablocks/{p-0e206e62.js → p-afbb070d.js} +1 -1
  114. package/dist/sankhyablocks/{p-95ce311a.js → p-b0ef4383.js} +1 -1
  115. package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
  116. package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-b9c67e45.entry.js} +1 -1
  117. package/dist/sankhyablocks/{p-b389ed49.entry.js → p-be5d8fcb.entry.js} +1 -1
  118. package/dist/sankhyablocks/p-ca5ec380.js +1 -0
  119. package/dist/sankhyablocks/p-d3f53df2.entry.js +1 -0
  120. package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-dcead955.entry.js} +1 -1
  121. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  122. package/dist/sankhyablocks/{p-00278e07.js → p-f3434fc4.js} +1 -1
  123. package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-fb34e0cf.entry.js} +1 -1
  124. package/dist/sankhyablocks/p-fd8e631c.entry.js +1 -0
  125. package/dist/sankhyablocks/p-feba9d4b.entry.js +1 -0
  126. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  127. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
  128. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
  129. package/dist/types/components/snk-application/snk-application.d.ts +12 -3
  130. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
  131. package/dist/types/components.d.ts +1 -393
  132. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -1
  133. package/dist/types/lib/utils/CrudUtils.d.ts +0 -1
  134. package/package.json +2 -3
  135. package/react/components.d.ts +0 -3
  136. package/react/components.js +0 -3
  137. package/react/components.js.map +1 -1
  138. package/dist/cjs/input-distinct-search_2.cjs.entry.js +0 -471
  139. package/dist/cjs/snk-distinct-search.cjs.entry.js +0 -123
  140. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +0 -28
  141. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +0 -16
  142. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +0 -52
  143. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +0 -4
  144. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +0 -372
  145. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +0 -110
  146. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +0 -544
  147. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +0 -28
  148. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +0 -593
  149. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +0 -15
  150. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +0 -25
  151. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +0 -9
  152. package/dist/collection/sw.js +0 -46
  153. package/dist/components/filter-distinct-search.js +0 -17
  154. package/dist/components/input-distinct-search.d.ts +0 -11
  155. package/dist/components/input-distinct-search.js +0 -6
  156. package/dist/components/input-distinct-search2.js +0 -264
  157. package/dist/components/search-modal.d.ts +0 -11
  158. package/dist/components/search-modal.js +0 -6
  159. package/dist/components/search-modal2.js +0 -264
  160. package/dist/components/snk-distinct-search.d.ts +0 -11
  161. package/dist/components/snk-distinct-search.js +0 -163
  162. package/dist/esm/input-distinct-search_2.entry.js +0 -466
  163. package/dist/esm/snk-distinct-search.entry.js +0 -119
  164. package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
  165. package/dist/sankhyablocks/p-154aa2a6.entry.js +0 -11
  166. package/dist/sankhyablocks/p-18cb1acb.entry.js +0 -1
  167. package/dist/sankhyablocks/p-30ebcbe0.entry.js +0 -1
  168. package/dist/sankhyablocks/p-3755b46f.entry.js +0 -1
  169. package/dist/sankhyablocks/p-3858a2e4.entry.js +0 -1
  170. package/dist/sankhyablocks/p-42130213.entry.js +0 -1
  171. package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
  172. package/dist/sankhyablocks/p-aaf94476.js +0 -1
  173. package/dist/sankhyablocks/p-d8665750.js +0 -1
  174. package/dist/sankhyablocks/p-e4391e16.js +0 -1
  175. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +0 -11
  176. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +0 -12
  177. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +0 -13
  178. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +0 -83
  179. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +0 -105
  180. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +0 -127
  181. package/dist/types/components/snk-distinct-search/types/index.d.ts +0 -12
  182. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +0 -4
  183. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +0 -6
  184. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +0 -2
  185. /package/dist/collection/components/{snk-distinct-search/types → snk-actions-button/interfaces}/index.js +0 -0
@@ -1,593 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
1
- import { DataFetcher } from "../DataFetcher";
2
- export default class DistinctSearchFetcher {
3
- constructor() {
4
- this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
5
- }
6
- buildRequestBody(coluna, instancia) {
7
- return {
8
- selectDistinct: {
9
- instancia,
10
- coluna,
11
- }
12
- };
13
- }
14
- parseResponseBody(response) {
15
- var _a, _b, _c;
16
- const ocorrencias = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.ocorrencias) === null || _a === void 0 ? void 0 : _a.ocorrencia) === null || _b === void 0 ? void 0 : _b.map(({ $ }) => $)) !== null && _c !== void 0 ? _c : [];
17
- return ocorrencias;
18
- }
19
- async fetchItens(coluna, instancia) {
20
- const requestBody = this.buildRequestBody(coluna, instancia);
21
- const response = await DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
22
- const parsedResponse = this.parseResponseBody(response);
23
- return parsedResponse;
24
- }
25
- }
@@ -1,9 +0,0 @@
1
- const snkDistinctSearchMessages = {
2
- titleBadgeNew: "novo",
3
- titleAdd: "Adicionar",
4
- availableResults: "resultados disponíveis",
5
- availableResult: "resultado disponível",
6
- limitResult: "Esta pesquisa foi limitada, existem mais resultados",
7
- emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
8
- };
9
- export default snkDistinctSearchMessages;
@@ -1,46 +0,0 @@
1
- import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
2
- import { registerRoute } from 'workbox-routing';
3
- import { StaleWhileRevalidate, CacheFirst } from 'workbox-strategies';
4
- import { CacheableResponsePlugin } from 'workbox-cacheable-response';
5
- import { ExpirationPlugin } from 'workbox-expiration';
6
-
7
- // Placeholder for Workbox to inject the precache manifest
8
- precacheAndRoute([]);
9
-
10
- // Additional custom logic follows...
11
- registerRoute(
12
- ({ url }) =>
13
- url.pathname.endsWith('/service.sbr') &&
14
- url.searchParams.has('serviceName'),
15
- new StaleWhileRevalidate({
16
- cacheName: 'api-cache',
17
- plugins: [new CacheableResponsePlugin({ statuses: [200] })],
18
- })
19
- );
20
-
21
- registerRoute(
22
- ({ request }) =>
23
- ['image', 'font', 'style'].includes(request.destination),
24
- new CacheFirst({
25
- cacheName: 'assets-cache',
26
- plugins: [
27
- new CacheableResponsePlugin({ statuses: [0, 200] }),
28
- new ExpirationPlugin({ maxEntries: 50, maxAgeSeconds: 30 * 24 * 60 * 60 }),
29
- ],
30
- })
31
- );
32
-
33
- registerRoute(
34
- ({ request }) => request.mode === 'navigate',
35
- createHandlerBoundToURL('/index.html')
36
- );
37
-
38
- self.addEventListener('install', (event) => {
39
- console.log('Service Worker installing.');
40
- self.skipWaiting();
41
- });
42
-
43
- self.addEventListener('activate', (event) => {
44
- console.log('Service Worker activating.');
45
- clients.claim();
46
- });