@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-74224.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 (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-4f35399c.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-c75fae8e.js → p-5dd8cf4f.js} +1 -1
  104. package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
  105. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-41793e17.entry.js → p-7663f597.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-47d24ac8.js → p-7ac7932c.js} +2 -2
  108. package/dist/sankhyablocks/{p-2d3f9482.entry.js → p-8eb67fa4.entry.js} +1 -1
  109. package/dist/sankhyablocks/{p-f0aaad2b.entry.js → p-92eadb1c.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-8b4fc28f.entry.js → p-95df461f.entry.js} +1 -1
  111. package/dist/sankhyablocks/p-a42e7a1e.entry.js +11 -0
  112. package/dist/sankhyablocks/p-a724e798.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-1dbd5c18.entry.js → p-a75d242d.entry.js} +1 -1
  114. package/dist/sankhyablocks/{p-0e206e62.js → p-afbb070d.js} +1 -1
  115. package/dist/sankhyablocks/{p-95ce311a.js → p-b0ef4383.js} +1 -1
  116. package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
  117. package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-b9c67e45.entry.js} +1 -1
  118. package/dist/sankhyablocks/{p-b389ed49.entry.js → p-be5d8fcb.entry.js} +1 -1
  119. package/dist/sankhyablocks/p-ca5ec380.js +1 -0
  120. package/dist/sankhyablocks/p-d3f53df2.entry.js +1 -0
  121. package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-dcead955.entry.js} +1 -1
  122. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  123. package/dist/sankhyablocks/{p-00278e07.js → p-f3434fc4.js} +1 -1
  124. package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-fb34e0cf.entry.js} +1 -1
  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,471 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-f9e81701.js');
6
- const core = require('@sankhyalabs/core');
7
- const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
8
-
9
- function normalizeString(text = "") {
10
- return text.normalize('NFD').replace(/[\u0300-\u036f/\s'"&.-]/g, "").toUpperCase();
11
- }
12
- function filterItems(searchArgument, distinctItems, maxItems) {
13
- const normalizedSearch = normalizeString(searchArgument);
14
- const filteredDistincts = distinctItems.filter((item) => normalizeString(item).includes(normalizedSearch));
15
- const isLimited = filteredDistincts.length > maxItems;
16
- const items = filteredDistincts.slice(0, maxItems);
17
- return { items, isLimited };
18
- }
19
- function getMatchOption(value, distinctItems) {
20
- const normalizedSearch = normalizeString(value);
21
- const item = distinctItems.find((item) => normalizeString(item) === normalizedSearch);
22
- return item;
23
- }
24
-
25
- const inputDistinctSearchCss = ":host{--max-height-popover:180px;--scrollbar--color-default:var(--scrollbar--default, #626e82);--scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--scrollbar--border-radius:var(--border--radius-small, 6px);--scrollbar--width:var(--space--medium, 12px)}.divider{margin:var(--space--extra-small, 3px) 0;border:var(--border--small, 1px solid) var(--color--disable-secondary, #F2F5F8)}.new-value{color:var(--text--primary, #626e82);padding:var(--space--2xs, 8px) var(--space--3xs, 4px);font-size:var(--text--medium, 14px);font-family:var(--font-pattern, Roboto);cursor:pointer;border-radius:var(--border--radius-small, 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:none;background:none;width:100%;display:flex;min-height:max-content}.new-value-selected{background-color:var(--color--primary-300, #E2F4EF)}.new-value:hover{background-color:var(--background--medium, #e0e0e0)}.popover-content{margin:var(--space--small, 6px);max-height:calc(var(--max-height-popover) - (2 * var(--space--small, 6px)));display:flex;flex-direction:column}.list-container{overflow:auto;scrollbar-width:thin;scrollbar-color:var(--scrollbar--color-clicked) var(--scrollbar--color-background);padding-right:var(--space--small, 6px)}.list-container::-webkit-scrollbar{background-color:var(--scrollbar--color-background);width:var(--scrollbar--width);max-width:var(--scrollbar--width);min-width:var(--scrollbar--width)}.list-container::-webkit-scrollbar-track{background-color:var(--scrollbar--color-background);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb{background-color:var(--scrollbar--color-default);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb:vertical:hover,.list-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--scrollbar--color-hover)}.list-container::-webkit-scrollbar-thumb:vertical:active,.list-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--scrollbar--color-clicked)}ez-popover{--ez-popover__box--z-index:15}.space-error{--ez-popover__margin:-19px 0 0 0}ez-list{--ez-list__item--margin:0}ez-text-input{--ez-text-input__icon--margin:var(--space--xs, 12px)}.badge-primary{--ez-badge--background-color:var(--color--primary-300);--ez-badge--color:var(--color--primary)}";
26
-
27
- const InputDistinctSearch = class {
28
- constructor(hostRef) {
29
- index.registerInstance(this, hostRef);
30
- this.changeValue = index.createEvent(this, "changeValue", 7);
31
- this.iconClick = index.createEvent(this, "iconClick", 7);
32
- this.textValue = "";
33
- this.isNewItem = false;
34
- this.filteredItems = [];
35
- this.isNewItemSelected = false;
36
- this.application = undefined;
37
- this.distinctItems = [];
38
- this.label = "";
39
- this.value = "";
40
- this.maxItems = 100;
41
- this.debounceTime = 300;
42
- this.canShowError = false;
43
- this.mode = 'regular';
44
- this.restrict = undefined;
45
- this.errorMessage = undefined;
46
- }
47
- async observerValue(newValue) {
48
- await this.selectedNewItem(newValue, true);
49
- }
50
- /**
51
- * Seleciona um item
52
- */
53
- async selectValue(value, isNewItem = false) {
54
- this.isNewItem = isNewItem;
55
- this.textValue = value;
56
- await this._refFilterInput.setValue(value);
57
- }
58
- /**
59
- * Método para limpa o campo de entrada de pesquisa
60
- */
61
- clearInput() {
62
- this._refFilterInput.setValue("");
63
- }
64
- /**
65
- * Retorna se o conteúdo é inválido.
66
- */
67
- isInvalid() {
68
- return this._refFilterInput.isInvalid();
69
- }
70
- /**
71
- * Remove o foco do campo
72
- */
73
- setBlur() {
74
- this._refFilterInput.setBlur();
75
- }
76
- /**
77
- * Aplica o foco do campo
78
- */
79
- setFocus() {
80
- this._refFilterInput.setFocus();
81
- }
82
- getMessage(key) {
83
- return this.application.messagesBuilder.getMessage(key, null);
84
- }
85
- async optionLoader(searchArgument) {
86
- return new Promise((resolve) => {
87
- if (this._debounceTimeout) {
88
- clearTimeout(this._debounceTimeout);
89
- }
90
- this._debounceTimeout = setTimeout(() => {
91
- const { items } = filterItems(searchArgument, this.distinctItems, this.maxItems);
92
- this.filteredItems = items;
93
- resolve();
94
- }, this.debounceTime);
95
- });
96
- }
97
- async openPopOver() {
98
- var _a;
99
- await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.showUnder(this._refFilterInput));
100
- }
101
- async closePopOver() {
102
- var _a;
103
- this.isNewItemSelected = false;
104
- await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.hide());
105
- await this._refList.removeSelection();
106
- }
107
- async onTextChange(event) {
108
- this.textValue = event.detail;
109
- await this.optionLoader(event.detail);
110
- await this.selectFirstItem();
111
- }
112
- onIconClick() {
113
- this.iconClick.emit();
114
- }
115
- buidItems() {
116
- var _a;
117
- const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
118
- label: item,
119
- id: normalizeString(item),
120
- }));
121
- return items;
122
- }
123
- async setValue(value, isNewItem = false, preventEventEmit = false) {
124
- this.isNewItem = isNewItem;
125
- this.textValue = value;
126
- await this._refFilterInput.setValue(value);
127
- await this.closePopOver();
128
- if (!preventEventEmit) {
129
- this.changeValue.emit({
130
- value,
131
- isNewItem,
132
- });
133
- }
134
- }
135
- async selectedNewItem(value, preventEventEmit = false) {
136
- if (!this.textValue && !value) {
137
- await this.setValue("", false, preventEventEmit);
138
- return;
139
- }
140
- const item = getMatchOption(value !== null && value !== void 0 ? value : this.textValue, this.distinctItems);
141
- if (item) {
142
- await this.setValue(item, false, preventEventEmit);
143
- return;
144
- }
145
- await this.setValue(this.textValue || value, true, preventEventEmit);
146
- }
147
- async setSelectedValue() {
148
- const selectedValue = await this._refList.getSelection();
149
- await this.selectedNewItem((selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) || this.textValue, true);
150
- await this._refFilterInput.setBlur();
151
- this._element.focus();
152
- }
153
- async selectNextItem() {
154
- if (this.isNewItemSelected) {
155
- return;
156
- }
157
- const itemSelected = await this._refList.getSelection();
158
- const itemsAmount = this.filteredItems.length;
159
- const indexSelected = this.filteredItems.findIndex((item) => item === (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.label));
160
- const isLastItemSelected = indexSelected === (itemsAmount - 1);
161
- const optionNewItemIsAvailable = !!this.textValue;
162
- if (!isLastItemSelected || !optionNewItemIsAvailable) {
163
- this.isNewItemSelected = false;
164
- await this._refList.selectNextItem();
165
- return;
166
- }
167
- this.isNewItemSelected = true;
168
- await this._refList.removeSelection();
169
- }
170
- async selectPreviousItem() {
171
- const itemsAmount = this.filteredItems.length;
172
- const lastItem = this.filteredItems[itemsAmount - 1];
173
- if (this.isNewItemSelected && lastItem) {
174
- this.isNewItemSelected = false;
175
- await this._refList.setSelection({
176
- id: normalizeString(lastItem),
177
- label: lastItem
178
- });
179
- return;
180
- }
181
- await this._refList.selectPreviousItem();
182
- }
183
- bindKeyboardManager() {
184
- this._keyboardManager = new core.KeyboardManager({ propagate: false, element: this._element });
185
- this._keyboardManager
186
- .bind("ArrowDown", () => { this.selectNextItem(); })
187
- .bind("ArrowUp", () => { this.selectPreviousItem(); })
188
- .bind("Enter", () => { this.setSelectedValue(); })
189
- .bind("Tab", () => { this.setSelectedValue(); });
190
- }
191
- unbindKeyboardManager() {
192
- this._keyboardManager
193
- .unbind("ArrowDown")
194
- .unbind("ArrowUp")
195
- .unbind("Enter")
196
- .unbind("Tab");
197
- }
198
- async selectFirstItem() {
199
- if (!this.filteredItems.length) {
200
- await this._refList.removeSelection();
201
- this.isNewItemSelected = true;
202
- return;
203
- }
204
- const firstItem = this.filteredItems[0];
205
- this.isNewItemSelected = false;
206
- await this._refList.setSelection({
207
- id: normalizeString(firstItem),
208
- label: firstItem,
209
- });
210
- }
211
- initializeComponent() {
212
- const { items } = filterItems("", this.distinctItems, this.maxItems);
213
- this.filteredItems = items;
214
- }
215
- componentWillLoad() {
216
- this.initializeComponent();
217
- }
218
- async componentDidLoad() {
219
- this.bindKeyboardManager();
220
- this.selectFirstItem();
221
- await this.selectedNewItem(this.value, true);
222
- }
223
- disconnectedCallback() {
224
- this.unbindKeyboardManager();
225
- }
226
- buildNewItemOption() {
227
- if (!this.textValue) {
228
- return;
229
- }
230
- return (index.h(index.Fragment, null, !!this.filteredItems.length &&
231
- index.h("hr", { class: "divider" }), index.h("button", { slot: "bottomSlot", class: {
232
- "new-value": true,
233
- "new-value-selected": this.isNewItemSelected,
234
- }, title: `${this.getMessage("snkDistinctSearch.titleAdd")} '${this.textValue}'`, onClick: () => this.selectedNewItem.bind(this)(undefined, true) }, this.getMessage("snkDistinctSearch.titleAdd"), " '", this.textValue, "'")));
235
- }
236
- render() {
237
- return (index.h(index.Host, { onBlur: () => this.selectedNewItem.bind(this)() }, index.h("ez-filter-input", { ref: (ref) => this._refFilterInput = ref, label: this.label, value: this.textValue, onEzChange: this.onTextChange.bind(this), onEzIconClick: this.onIconClick.bind(this), onEzFocusIn: this.openPopOver.bind(this), canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage, enabledIconClick: true }, this.isNewItem &&
238
- index.h("ez-badge", { slot: "right", label: this.getMessage("snkDistinctSearch.titleBadgeNew"), size: "small-medium", class: "badge-primary" })), index.h("ez-popover", { ref: (ref) => this._refPopOver = ref, boxWidth: "full-width", autoClose: false, overlayType: "none", class: {
239
- 'space-error': this.canShowError,
240
- } }, index.h("div", { class: "popover-content" }, index.h("section", { class: "list-container" }, index.h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buidItems(), onEzClickItem: ({ detail }) => this.setValue.bind(this)(detail.label, false, true), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })), this.buildNewItemOption()))));
241
- }
242
- get _element() { return index.getElement(this); }
243
- static get watchers() { return {
244
- "value": ["observerValue"]
245
- }; }
246
- };
247
- InputDistinctSearch.style = inputDistinctSearchCss;
248
-
249
- const searchModalCss = ".sc-search-modal-h{display:block}ez-popup.sc-search-modal{--ez-popup__title--font-size:var(--title--large, 20px);--ez-popup__container--height:380px}.search-modal-scroller.sc-search-modal{height:174px}.search-modal-text.sc-search-modal{font-family:var(--font-pattern);color:var(--text--primary);font-size:var(--text--medium)}ez-filter-input.sc-search-modal>input.sc-search-modal{text-overflow:ellipsis}.ez-content.sc-search-modal{height:190px;display:flex;align-items:center;justify-content:center}";
250
-
251
- const SearchModal = class {
252
- constructor(hostRef) {
253
- index.registerInstance(this, hostRef);
254
- this.popupClose = index.createEvent(this, "popupClose", 7);
255
- this.changeValue = index.createEvent(this, "changeValue", 7);
256
- this.debounceTimeout = null;
257
- this.filteredItems = [];
258
- this.searchFocus = false;
259
- this.isLimited = false;
260
- this.application = undefined;
261
- this.listItens = [];
262
- this.opened = false;
263
- this.value = undefined;
264
- this.canShowError = false;
265
- this.emptyMessage = undefined;
266
- this.debounceTime = 300;
267
- this.maxItens = 100;
268
- this.label = 'Pesquisar';
269
- this.mode = 'regular';
270
- this.restrict = undefined;
271
- this.errorMessage = undefined;
272
- }
273
- /**
274
- * Método para adicionar a nova palavra e chamar o método closeModal() para fechar o modal
275
- */
276
- addNewItem() {
277
- this.closeModal();
278
- this.changeValue.emit({ isNewItem: true, value: this.value });
279
- }
280
- /**
281
- * Método para limpa o campo de entrada de pesquisa
282
- */
283
- clearInput() {
284
- this._refFilterInput.setValue("");
285
- }
286
- /**
287
- * Método para fechar o modal
288
- */
289
- closeModal() {
290
- this._popupElement.opened = false;
291
- this.popupClose.emit(false);
292
- }
293
- /**
294
- * Método para abrir o modal
295
- */
296
- openModal() {
297
- this._popupElement.opened = true;
298
- setTimeout(() => this.setFocus(), 100);
299
- }
300
- /**
301
- * Retorna se o conteúdo é inválido.
302
- */
303
- isInvalid() {
304
- this._refFilterInput.isInvalid();
305
- }
306
- /**
307
- * Remove o foco do campo
308
- */
309
- setBlur() {
310
- this._refFilterInput.setBlur();
311
- this.searchFocus = false;
312
- }
313
- /**
314
- * Aplica o foco do campo
315
- */
316
- setFocus() {
317
- this._refFilterInput.setFocus();
318
- this.searchFocus = true;
319
- }
320
- /**
321
- * Método para tratar a mensagem de erro
322
- */
323
- watchPropErrorMessage() {
324
- this._refFilterInput.errorMessage = this.errorMessage;
325
- }
326
- /**
327
- * Método para tratar o value do input
328
- */
329
- watchPropValue() {
330
- this._refFilterInput.value = this.value;
331
- }
332
- /**
333
- * Atualiza a lista de itens à medida que o usuário digita no campo de pesquisa.
334
- */
335
- async handleInput(event) {
336
- if (this.debounceTimeout) {
337
- clearTimeout(this.debounceTimeout);
338
- }
339
- this.value = event.detail;
340
- this.debounceTimeout = setTimeout(async () => {
341
- var _a;
342
- const { isLimited, items } = filterItems(event.detail, this.listItens, this.maxItens);
343
- this.filteredItems = items;
344
- this.isLimited = isLimited;
345
- await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.removeSelection());
346
- }, this.debounceTime);
347
- }
348
- initializeComponent() {
349
- this.filteredItems = this.listItens;
350
- }
351
- getMessage(key) {
352
- return this.application.messagesBuilder.getMessage(key, null);
353
- }
354
- componentWillLoad() {
355
- this.initializeComponent();
356
- }
357
- componentDidLoad() {
358
- this.bindKeyboardManager();
359
- this._refFilterInput.value = this.value;
360
- const { isLimited, items } = filterItems(this.value, this.listItens, this.maxItens);
361
- this.filteredItems = items;
362
- this.isLimited = isLimited;
363
- }
364
- disconnectedCallback() {
365
- this.unbindKeyboardManager();
366
- }
367
- buildItems() {
368
- var _a;
369
- const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
370
- label: item,
371
- id: normalizeString(item),
372
- }));
373
- return items;
374
- }
375
- async tabSelect() {
376
- var _a;
377
- const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
378
- if (this.searchFocus && this._refList) {
379
- this.searchFocus = false;
380
- this._refList.focus();
381
- await this.selectFirstItem();
382
- }
383
- else if (selectedValue) {
384
- await this._refList.removeSelection();
385
- await this._refButton.setFocus();
386
- }
387
- else {
388
- await this._refButton.setBlur();
389
- this.setFocus();
390
- }
391
- }
392
- bindKeyboardManager() {
393
- this._keyboardManager = new core.KeyboardManager({ propagate: false, element: this._element });
394
- this._keyboardManager
395
- .bind("ArrowDown", () => { this.selectNextItem(); })
396
- .bind("ArrowUp", () => { this.selectPreviousItem(); })
397
- .bind("Enter", () => { this.setSelectedValue(); })
398
- .bind("Tab", () => { this.tabSelect(); });
399
- }
400
- unbindKeyboardManager() {
401
- this._keyboardManager
402
- .unbind("ArrowDown")
403
- .unbind("ArrowUp")
404
- .unbind("Enter")
405
- .unbind("Tab");
406
- }
407
- async setSelectedValue() {
408
- var _a;
409
- const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
410
- if (selectedValue) {
411
- this.changeValue.emit({ isNewItem: false, value: selectedValue.label });
412
- this.closeModal();
413
- }
414
- else if (this.searchFocus && this.enabledButtonNewItem()) {
415
- this.addNewItem();
416
- }
417
- }
418
- async selectNextItem() {
419
- var _a;
420
- const itemSelected = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
421
- if (this.searchFocus && !itemSelected) {
422
- this.setBlur();
423
- await this.selectFirstItem();
424
- return;
425
- }
426
- await this._refList.selectNextItem();
427
- }
428
- async selectPreviousItem() {
429
- const itemSelected = await this._refList.getSelection();
430
- if (itemSelected === undefined)
431
- return;
432
- await this._refList.selectPreviousItem();
433
- }
434
- async selectFirstItem() {
435
- if (!this.filteredItems.length) {
436
- await this._refList.removeSelection();
437
- return;
438
- }
439
- const firstItem = this.filteredItems[0];
440
- await this._refList.setSelection({
441
- id: normalizeString(firstItem),
442
- label: firstItem,
443
- });
444
- }
445
- enabledButtonNewItem() {
446
- if (this.value === undefined)
447
- return false;
448
- if (getMatchOption(this.value, this.listItens))
449
- return false;
450
- return this.value.trim().length === 0 ? false : true;
451
- }
452
- buildMessage() {
453
- if (this.isLimited) {
454
- return this.getMessage("snkDistinctSearch.limitResult");
455
- }
456
- return `${this.filteredItems.length} ${this.filteredItems.length > 1 ? this.getMessage("snkDistinctSearch.availableResults") : this.getMessage("snkDistinctSearch.availableResult")}`;
457
- }
458
- render() {
459
- var _a;
460
- return (index.h(index.Host, null, index.h("ez-popup", { ref: (ref) => this._popupElement = ref, size: "400px", "ez-title": this.label, onEzClosePopup: () => this.popupClose.emit(false), "height-mode": "full" }, index.h("div", null, index.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 ? (index.h("div", { class: "ez-content" }, index.h("div", { class: "ez-text--center search-modal-text" }, this.emptyMessage))) : (index.h("div", null, index.h("div", { class: "search-modal-text ez-padding-vertical--medium" }, this.buildMessage()), index.h("ez-scroller", { class: "search-modal-scroller", direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buildItems(), onEzClickItem: ({ label }) => this.setSelectedValue.bind(this)(label), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })))), index.h("div", { class: "ez-flex ez-flex--justify-end" }, index.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() }))))));
461
- }
462
- get _element() { return index.getElement(this); }
463
- static get watchers() { return {
464
- "errorMessage": ["watchPropErrorMessage"],
465
- "value": ["watchPropValue"]
466
- }; }
467
- };
468
- SearchModal.style = searchModalCss;
469
-
470
- exports.input_distinct_search = InputDistinctSearch;
471
- exports.search_modal = SearchModal;
@@ -1,123 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-f9e81701.js');
6
- const DataFetcher = require('./DataFetcher-e059eb72.js');
7
- const core = require('@sankhyalabs/core');
8
- require('./PrintUtils-bcaeb82f.js');
9
- require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
10
-
11
- class DistinctSearchFetcher {
12
- constructor() {
13
- this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
14
- }
15
- buildRequestBody(coluna, instancia) {
16
- return {
17
- selectDistinct: {
18
- instancia,
19
- coluna,
20
- }
21
- };
22
- }
23
- parseResponseBody(response) {
24
- var _a, _b, _c;
25
- 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 : [];
26
- return ocorrencias;
27
- }
28
- async fetchItens(coluna, instancia) {
29
- const requestBody = this.buildRequestBody(coluna, instancia);
30
- const response = await DataFetcher.DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
31
- const parsedResponse = this.parseResponseBody(response);
32
- return parsedResponse;
33
- }
34
- }
35
-
36
- const snkDistinctSearchCss = ".sc-snk-distinct-search-h{display:block;width:100%}";
37
-
38
- const SnkDistinctSearch = class {
39
- constructor(hostRef) {
40
- index.registerInstance(this, hostRef);
41
- this.changeValue = index.createEvent(this, "changeValue", 7);
42
- this.onIconClick = () => {
43
- this._searchModalElement.value = this.value || "";
44
- this._searchModalElement.openModal();
45
- };
46
- this.distinctItems = undefined;
47
- this.value = "";
48
- this.label = "";
49
- this.configSearch = undefined;
50
- this.maxItems = 100;
51
- this.debounceTime = 300;
52
- this.canShowError = false;
53
- this.mode = 'regular';
54
- this.restrict = undefined;
55
- this.errorMessage = undefined;
56
- }
57
- /**
58
- * Método para limpa o campo de entrada de pesquisa
59
- */
60
- clearInput() {
61
- this._inputDistinctSearch.clearInput();
62
- }
63
- /**
64
- * Retorna se o conteúdo é inválido.
65
- */
66
- isInvalid() {
67
- return this._inputDistinctSearch.isInvalid();
68
- }
69
- /**
70
- * Remove o foco do campo
71
- */
72
- setBlur() {
73
- this._inputDistinctSearch.setBlur();
74
- }
75
- /**
76
- * Aplica o foco do campo
77
- */
78
- setFocus() {
79
- this._inputDistinctSearch.setFocus();
80
- }
81
- /**
82
- * Método para fechar o modal
83
- */
84
- closeModal() {
85
- this._searchModalElement.closeModal();
86
- }
87
- /**
88
- * Método para abrir o modal
89
- */
90
- openModal() {
91
- this._searchModalElement.openModal();
92
- }
93
- async componentWillLoad() {
94
- await this.fetchDistinctItems();
95
- this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
96
- }
97
- async fetchDistinctItems() {
98
- const distinctFetcher = new DistinctSearchFetcher();
99
- const response = await distinctFetcher.fetchItens(this.configSearch.column, this.configSearch.instance);
100
- this.distinctItems = [...response];
101
- }
102
- onChange(event) {
103
- event.stopPropagation();
104
- this.value = event.detail.value;
105
- this._inputDistinctSearch.selectValue(event.detail.value, event.detail.isNewItem);
106
- this.changeValue.emit(event.detail);
107
- }
108
- onPopupClose() {
109
- this._inputDistinctSearch.setFocus();
110
- }
111
- getMessage(key) {
112
- return this._application.messagesBuilder.getMessage(key, null);
113
- }
114
- renderEmptyMessage() {
115
- return (index.h("span", { innerHTML: this.getMessage("snkDistinctSearch.emptyResult") }));
116
- }
117
- render() {
118
- return (index.h(index.Host, null, index.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 }), index.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) })));
119
- }
120
- };
121
- SnkDistinctSearch.style = snkDistinctSearchCss;
122
-
123
- exports.snk_distinct_search = SnkDistinctSearch;
@@ -1,28 +0,0 @@
1
- class DebouncedRequestListener {
2
- constructor() {
3
- this._debounceTime = 1500;
4
- this.requests = new Map();
5
- this.requestsLoadingBar = [];
6
- }
7
- onRequestStart(param) {
8
- if (param.url.includes("quietMode=true")) {
9
- return;
10
- }
11
- this.requestsLoadingBar.push(param.requestId);
12
- const timeout = setTimeout(() => {
13
- this.ezLoadingBar.show();
14
- }, this._debounceTime);
15
- this.requests.set(param.requestId, timeout);
16
- }
17
- ;
18
- onRequestEnd(param) {
19
- const timeoutId = this.requests.get(param.requestId);
20
- clearTimeout(timeoutId);
21
- if (this.requestsLoadingBar.includes(param.requestId)) {
22
- this.requestsLoadingBar = this.requestsLoadingBar.filter(id => id !== param.requestId);
23
- !this.requestsLoadingBar.length && this.ezLoadingBar.hide();
24
- }
25
- }
26
- ;
27
- }
28
- export default DebouncedRequestListener;
@@ -1,16 +0,0 @@
1
- import DebouncedRequestListener from "./DebouncedRequestListener";
2
- import RequestListenerLoadingBar from "./RequestListenerLoadingBar";
3
- class RequestListenerFactory {
4
- static create({ strategy }) {
5
- switch (strategy) {
6
- case 'request_name':
7
- return new RequestListenerLoadingBar();
8
- case 'request_time':
9
- return new DebouncedRequestListener();
10
- default:
11
- throw new Error('Strategy not found');
12
- }
13
- ;
14
- }
15
- }
16
- export default RequestListenerFactory;
@@ -1,52 +0,0 @@
1
- class RequestListenerLoadingBar {
2
- constructor() {
3
- this._debounceTime = 1000;
4
- this._ignoredNameTypes = ["totals"];
5
- this._countRequest = 0;
6
- }
7
- onRequestStart(param) {
8
- if (this.isIgnoreLoadingOnRequest(param)) {
9
- return;
10
- }
11
- this._countRequest++;
12
- this.ezLoadingBar.show();
13
- if (this._timerLoading) {
14
- clearTimeout(this._timerLoading);
15
- }
16
- }
17
- ;
18
- onRequestEnd(param) {
19
- if (this.isIgnoreLoadingOnRequest(param)) {
20
- return;
21
- }
22
- this._countRequest--;
23
- this._timerLoading = setTimeout(() => {
24
- if (this._countRequest <= 0) {
25
- this.ezLoadingBar.hide();
26
- }
27
- }, this._debounceTime);
28
- }
29
- ;
30
- isIgnoreLoadingOnRequest(param) {
31
- if (param == undefined) {
32
- return false;
33
- }
34
- if (param.url.includes("quietMode=true")) {
35
- return true;
36
- }
37
- if (param.requestBody == undefined) {
38
- return false;
39
- }
40
- if (param.requestBody.length == 1) {
41
- const { name } = param.requestBody[0].variables;
42
- if (name) {
43
- const nameParts = name.split(":");
44
- const nameType = nameParts[0];
45
- return this._ignoredNameTypes.indexOf(nameType) >= 0;
46
- }
47
- }
48
- return false;
49
- }
50
- ;
51
- }
52
- export default RequestListenerLoadingBar;