@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-74246.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 (86) hide show
  1. package/dist/cjs/{SnkFormConfigManager-bff848f1.js → SnkFormConfigManager-63369164.js} +3 -3
  2. package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
  3. package/dist/cjs/index-f9e81701.js +8 -0
  4. package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-config-options_3.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-3d4d0e2a.js → snk-data-unit-7dbdad0e.js} +1 -1
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  13. package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
  14. package/dist/cjs/{snk-guides-viewer-2b44c804.js → snk-guides-viewer-eee43c8b.js} +1 -1
  15. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-simple-crud.cjs.entry.js +1 -1
  17. package/dist/collection/collection-manifest.json +3 -0
  18. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
  19. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
  20. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
  21. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
  22. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
  23. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
  24. package/dist/collection/components/snk-distinct-search/types/index.js +1 -0
  25. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
  26. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
  27. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
  28. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  29. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
  30. package/dist/components/SnkFormConfigManager.js +3 -3
  31. package/dist/components/SnkMessageBuilder.js +10 -0
  32. package/dist/components/filter-distinct-search.js +17 -0
  33. package/dist/components/index.d.ts +3 -0
  34. package/dist/components/index.js +3 -0
  35. package/dist/components/input-distinct-search.d.ts +11 -0
  36. package/dist/components/input-distinct-search.js +6 -0
  37. package/dist/components/input-distinct-search2.js +264 -0
  38. package/dist/components/search-modal.d.ts +11 -0
  39. package/dist/components/search-modal.js +6 -0
  40. package/dist/components/search-modal2.js +264 -0
  41. package/dist/components/snk-distinct-search.d.ts +11 -0
  42. package/dist/components/snk-distinct-search.js +163 -0
  43. package/dist/esm/{SnkFormConfigManager-f0532f7d.js → SnkFormConfigManager-b409c745.js} +3 -3
  44. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
  45. package/dist/esm/index-a7d3d3f1.js +8 -0
  46. package/dist/esm/input-distinct-search_2.entry.js +466 -0
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm/sankhyablocks.js +1 -1
  49. package/dist/esm/snk-application.entry.js +1 -1
  50. package/dist/esm/snk-config-options_3.entry.js +1 -1
  51. package/dist/esm/snk-data-exporter.entry.js +2 -2
  52. package/dist/esm/{snk-data-unit-618e0b80.js → snk-data-unit-7a579dbd.js} +1 -1
  53. package/dist/esm/snk-data-unit.entry.js +2 -2
  54. package/dist/esm/snk-detail-view.entry.js +3 -3
  55. package/dist/esm/snk-distinct-search.entry.js +119 -0
  56. package/dist/esm/{snk-guides-viewer-15c916a3.js → snk-guides-viewer-e8ca764a.js} +1 -1
  57. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  58. package/dist/esm/snk-simple-crud.entry.js +1 -1
  59. package/dist/sankhyablocks/{p-9c3138f5.entry.js → p-00f9fe5c.entry.js} +1 -1
  60. package/dist/sankhyablocks/p-0e206e62.js +1 -0
  61. package/dist/sankhyablocks/{p-c88ad28e.entry.js → p-0e250436.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-da87e42c.entry.js → p-154aa2a6.entry.js} +1 -1
  63. package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
  64. package/dist/sankhyablocks/{p-bab79110.entry.js → p-30ebcbe0.entry.js} +1 -1
  65. package/dist/sankhyablocks/p-3755b46f.entry.js +1 -0
  66. package/dist/sankhyablocks/{p-d1da52e1.entry.js → p-42130213.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-e41bd8ee.entry.js → p-b389ed49.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-a75e9dcc.js → p-c75fae8e.js} +1 -1
  69. package/dist/sankhyablocks/p-d8665750.js +1 -0
  70. package/dist/sankhyablocks/{p-ae50d69f.js → p-e3a285a2.js} +1 -1
  71. package/dist/sankhyablocks/{p-c1adf0dd.entry.js → p-f4e221b2.entry.js} +1 -1
  72. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  73. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
  74. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
  75. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
  76. package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
  77. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
  78. package/dist/types/components.d.ts +393 -1
  79. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
  80. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
  81. package/package.json +1 -1
  82. package/react/components.d.ts +3 -0
  83. package/react/components.js +3 -0
  84. package/react/components.js.map +1 -1
  85. package/dist/sankhyablocks/p-17425c72.js +0 -1
  86. package/dist/sankhyablocks/p-a0ebd886.js +0 -1
@@ -0,0 +1,372 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import DistinctSearchFetcher from "../../lib/http/data-fetcher/fetchers/distinct-search-fetcher";
3
+ import { ApplicationContext } from '@sankhyalabs/core';
4
+ export class SnkDistinctSearch {
5
+ constructor() {
6
+ this.onIconClick = () => {
7
+ this._searchModalElement.value = this.value || "";
8
+ this._searchModalElement.openModal();
9
+ };
10
+ this.distinctItems = undefined;
11
+ this.value = "";
12
+ this.label = "";
13
+ this.configSearch = undefined;
14
+ this.maxItems = 100;
15
+ this.debounceTime = 300;
16
+ this.canShowError = false;
17
+ this.mode = 'regular';
18
+ this.restrict = undefined;
19
+ this.errorMessage = undefined;
20
+ }
21
+ /**
22
+ * Método para limpa o campo de entrada de pesquisa
23
+ */
24
+ clearInput() {
25
+ this._inputDistinctSearch.clearInput();
26
+ }
27
+ /**
28
+ * Retorna se o conteúdo é inválido.
29
+ */
30
+ isInvalid() {
31
+ return this._inputDistinctSearch.isInvalid();
32
+ }
33
+ /**
34
+ * Remove o foco do campo
35
+ */
36
+ setBlur() {
37
+ this._inputDistinctSearch.setBlur();
38
+ }
39
+ /**
40
+ * Aplica o foco do campo
41
+ */
42
+ setFocus() {
43
+ this._inputDistinctSearch.setFocus();
44
+ }
45
+ /**
46
+ * Método para fechar o modal
47
+ */
48
+ closeModal() {
49
+ this._searchModalElement.closeModal();
50
+ }
51
+ /**
52
+ * Método para abrir o modal
53
+ */
54
+ openModal() {
55
+ this._searchModalElement.openModal();
56
+ }
57
+ async componentWillLoad() {
58
+ await this.fetchDistinctItems();
59
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
60
+ }
61
+ async fetchDistinctItems() {
62
+ const distinctFetcher = new DistinctSearchFetcher();
63
+ const response = await distinctFetcher.fetchItens(this.configSearch.column, this.configSearch.instance);
64
+ this.distinctItems = [...response];
65
+ }
66
+ onChange(event) {
67
+ event.stopPropagation();
68
+ this.value = event.detail.value;
69
+ this._inputDistinctSearch.selectValue(event.detail.value, event.detail.isNewItem);
70
+ this.changeValue.emit(event.detail);
71
+ }
72
+ onPopupClose() {
73
+ this._inputDistinctSearch.setFocus();
74
+ }
75
+ getMessage(key) {
76
+ return this._application.messagesBuilder.getMessage(key, null);
77
+ }
78
+ renderEmptyMessage() {
79
+ return (h("span", { innerHTML: this.getMessage("snkDistinctSearch.emptyResult") }));
80
+ }
81
+ render() {
82
+ return (h(Host, null, h("input-distinct-search", { ref: (ref) => this._inputDistinctSearch = ref, application: this._application, label: this.label, distinctItems: this.distinctItems, onChangeValue: this.onChange.bind(this), debounceTime: this.debounceTime, value: this.value, onIconClick: this.onIconClick, maxItems: this.maxItems, canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage }), h("search-modal", { ref: (ref) => this._searchModalElement = ref, application: this._application, listItens: this.distinctItems, onChangeValue: this.onChange.bind(this), restrict: this.restrict, value: this.value, label: this.label, emptyMessage: this.renderEmptyMessage(), maxItens: this.maxItems, debounceTime: this.debounceTime, canShowError: this.canShowError, mode: this.mode, errorMessage: this.errorMessage, onPopupClose: this.onPopupClose.bind(this) })));
83
+ }
84
+ static get is() { return "snk-distinct-search"; }
85
+ static get encapsulation() { return "scoped"; }
86
+ static get originalStyleUrls() {
87
+ return {
88
+ "$": ["snk-distinct-search.css"]
89
+ };
90
+ }
91
+ static get styleUrls() {
92
+ return {
93
+ "$": ["snk-distinct-search.css"]
94
+ };
95
+ }
96
+ static get properties() {
97
+ return {
98
+ "value": {
99
+ "type": "string",
100
+ "mutable": true,
101
+ "complexType": {
102
+ "original": "string",
103
+ "resolved": "string",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": false,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": "Valor inicial do campo."
111
+ },
112
+ "attribute": "value",
113
+ "reflect": false,
114
+ "defaultValue": "\"\""
115
+ },
116
+ "label": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Label apresentada no input."
129
+ },
130
+ "attribute": "label",
131
+ "reflect": false,
132
+ "defaultValue": "\"\""
133
+ },
134
+ "configSearch": {
135
+ "type": "unknown",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "IConfigSearch",
139
+ "resolved": "IConfigSearch",
140
+ "references": {
141
+ "IConfigSearch": {
142
+ "location": "import",
143
+ "path": "./types"
144
+ }
145
+ }
146
+ },
147
+ "required": false,
148
+ "optional": false,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": "Dados para busca ao servi\u00E7o."
152
+ }
153
+ },
154
+ "maxItems": {
155
+ "type": "number",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "number",
159
+ "resolved": "number",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "N\u00FAmero m\u00E1ximo de itens na lista."
167
+ },
168
+ "attribute": "max-items",
169
+ "reflect": false,
170
+ "defaultValue": "100"
171
+ },
172
+ "debounceTime": {
173
+ "type": "number",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "number",
177
+ "resolved": "number",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Tempo em milissegundos para debouncing das chamadas de busca de sugest\u00F5es."
185
+ },
186
+ "attribute": "debounce-time",
187
+ "reflect": false,
188
+ "defaultValue": "300"
189
+ },
190
+ "canShowError": {
191
+ "type": "boolean",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "boolean",
195
+ "resolved": "boolean",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": "Se false deixa de exibir a mensagem de erro dentro do campo."
203
+ },
204
+ "attribute": "can-show-error",
205
+ "reflect": false,
206
+ "defaultValue": "false"
207
+ },
208
+ "mode": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "'slim' | 'regular'",
213
+ "resolved": "\"regular\" | \"slim\"",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "Define o tamanho do campo."
221
+ },
222
+ "attribute": "mode",
223
+ "reflect": false,
224
+ "defaultValue": "'regular'"
225
+ },
226
+ "restrict": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "string",
231
+ "resolved": "string",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Express\u00E3o que define os caracteres permitidos na entrada."
239
+ },
240
+ "attribute": "restrict",
241
+ "reflect": false,
242
+ "defaultValue": "undefined"
243
+ },
244
+ "errorMessage": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Define uma mensagem de orienta\u00E7\u00E3o ao usu\u00E1rio, colocando o campo em modo inv\u00E1lido."
257
+ },
258
+ "attribute": "error-message",
259
+ "reflect": false,
260
+ "defaultValue": "undefined"
261
+ }
262
+ };
263
+ }
264
+ static get states() {
265
+ return {
266
+ "distinctItems": {}
267
+ };
268
+ }
269
+ static get events() {
270
+ return [{
271
+ "method": "changeValue",
272
+ "name": "changeValue",
273
+ "bubbles": true,
274
+ "cancelable": true,
275
+ "composed": true,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": "Emitido quando h\u00E1 uma altera\u00E7\u00E3o no valor do campo."
279
+ },
280
+ "complexType": {
281
+ "original": "IDistinctValue",
282
+ "resolved": "IDistinctValue",
283
+ "references": {
284
+ "IDistinctValue": {
285
+ "location": "import",
286
+ "path": "./types"
287
+ }
288
+ }
289
+ }
290
+ }];
291
+ }
292
+ static get methods() {
293
+ return {
294
+ "clearInput": {
295
+ "complexType": {
296
+ "signature": "() => Promise<void>",
297
+ "parameters": [],
298
+ "references": {},
299
+ "return": "Promise<void>"
300
+ },
301
+ "docs": {
302
+ "text": "M\u00E9todo para limpa o campo de entrada de pesquisa",
303
+ "tags": []
304
+ }
305
+ },
306
+ "isInvalid": {
307
+ "complexType": {
308
+ "signature": "() => Promise<boolean>",
309
+ "parameters": [],
310
+ "references": {
311
+ "Promise": {
312
+ "location": "global"
313
+ }
314
+ },
315
+ "return": "Promise<boolean>"
316
+ },
317
+ "docs": {
318
+ "text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
319
+ "tags": []
320
+ }
321
+ },
322
+ "setBlur": {
323
+ "complexType": {
324
+ "signature": "() => Promise<void>",
325
+ "parameters": [],
326
+ "references": {},
327
+ "return": "Promise<void>"
328
+ },
329
+ "docs": {
330
+ "text": "Remove o foco do campo",
331
+ "tags": []
332
+ }
333
+ },
334
+ "setFocus": {
335
+ "complexType": {
336
+ "signature": "() => Promise<void>",
337
+ "parameters": [],
338
+ "references": {},
339
+ "return": "Promise<void>"
340
+ },
341
+ "docs": {
342
+ "text": "Aplica o foco do campo",
343
+ "tags": []
344
+ }
345
+ },
346
+ "closeModal": {
347
+ "complexType": {
348
+ "signature": "() => Promise<void>",
349
+ "parameters": [],
350
+ "references": {},
351
+ "return": "Promise<void>"
352
+ },
353
+ "docs": {
354
+ "text": "M\u00E9todo para fechar o modal",
355
+ "tags": []
356
+ }
357
+ },
358
+ "openModal": {
359
+ "complexType": {
360
+ "signature": "() => Promise<void>",
361
+ "parameters": [],
362
+ "references": {},
363
+ "return": "Promise<void>"
364
+ },
365
+ "docs": {
366
+ "text": "M\u00E9todo para abrir o modal",
367
+ "tags": []
368
+ }
369
+ }
370
+ };
371
+ }
372
+ }
@@ -0,0 +1,110 @@
1
+ :host {
2
+ /*@doc Define o tamanho máximo do popover.*/
3
+ --max-height-popover: 180px;
4
+
5
+ /* scrollbar */
6
+ /*@doc Define a cor da barra de rolagem do componente.*/
7
+ --scrollbar--color-default: var(--scrollbar--default, #626e82);
8
+ /*@doc Define a cor de fundo da barra de rolagem do componente.*/
9
+ --scrollbar--color-background: var(--scrollbar--background, #E5EAF0);
10
+ /*@doc Define a cor do hover na barra de rolagem do componente.*/
11
+ --scrollbar--color-hover: var(--scrollbar--hover, #2B3A54);
12
+ /*@doc Define a cor do active na barra de rolagem do componente.*/
13
+ --scrollbar--color-clicked: var(--scrollbar--clicked, #a2abb9);
14
+ /*@doc Define o raio da borda da barra de rolagem do componente.*/
15
+ --scrollbar--border-radius: var(--border--radius-small, 6px);
16
+ /*@doc Define a largura da barra de rolagem do componente.*/
17
+ --scrollbar--width: var(--space--medium, 12px);
18
+ }
19
+
20
+ .divider {
21
+ margin: var(--space--extra-small, 3px) 0;
22
+ border: var(--border--small, 1px solid) var(--color--disable-secondary, #F2F5F8);
23
+ }
24
+
25
+ .new-value {
26
+ color: var(--text--primary, #626e82);
27
+ padding: var(--space--2xs, 8px) var(--space--3xs, 4px);
28
+ font-size: var(--text--medium, 14px);
29
+ font-family: var(--font-pattern, Roboto);
30
+ cursor: pointer;
31
+ border-radius: var(--border--radius-small, 6px);
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
34
+ white-space: nowrap;
35
+ border: none;
36
+ background: none;
37
+ width: 100%;
38
+ display: flex;
39
+ min-height: max-content;
40
+ }
41
+
42
+ .new-value-selected {
43
+ background-color: var(--color--primary-300, #E2F4EF);
44
+ }
45
+
46
+ .new-value:hover {
47
+ background-color: var(--background--medium, #e0e0e0);
48
+ }
49
+
50
+ .popover-content {
51
+ margin: var(--space--small, 6px);
52
+ max-height: calc(var(--max-height-popover) - (2 * var(--space--small, 6px)));
53
+ display: flex;
54
+ flex-direction: column;
55
+ }
56
+
57
+ .list-container {
58
+ overflow: auto;
59
+ scrollbar-width: thin;
60
+ scrollbar-color: var(--scrollbar--color-clicked) var(--scrollbar--color-background);
61
+ padding-right: var(--space--small, 6px);
62
+ }
63
+
64
+ .list-container::-webkit-scrollbar {
65
+ background-color: var(--scrollbar--color-background);
66
+ width: var(--scrollbar--width);
67
+ max-width: var(--scrollbar--width);
68
+ min-width: var(--scrollbar--width);
69
+ }
70
+
71
+ .list-container::-webkit-scrollbar-track {
72
+ background-color: var(--scrollbar--color-background);
73
+ border-radius: var(--scrollbar--border-radius);
74
+ }
75
+
76
+ .list-container::-webkit-scrollbar-thumb {
77
+ background-color: var(--scrollbar--color-default);
78
+ border-radius: var(--scrollbar--border-radius);
79
+ }
80
+
81
+ .list-container::-webkit-scrollbar-thumb:vertical:hover,
82
+ .list-container::-webkit-scrollbar-thumb:horizontal:hover {
83
+ background-color: var(--scrollbar--color-hover);
84
+ }
85
+
86
+ .list-container::-webkit-scrollbar-thumb:vertical:active,
87
+ .list-container::-webkit-scrollbar-thumb:horizontal:active {
88
+ background-color: var(--scrollbar--color-clicked);
89
+ }
90
+
91
+ ez-popover {
92
+ --ez-popover__box--z-index: 15;
93
+ }
94
+
95
+ .space-error {
96
+ --ez-popover__margin: -19px 0 0 0;
97
+ }
98
+
99
+ ez-list {
100
+ --ez-list__item--margin: 0;
101
+ }
102
+
103
+ ez-text-input {
104
+ --ez-text-input__icon--margin: var(--space--xs, 12px);
105
+ }
106
+
107
+ .badge-primary {
108
+ --ez-badge--background-color: var(--color--primary-300);
109
+ --ez-badge--color: var(--color--primary);
110
+ }