@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,17 +0,0 @@
1
- function normalizeString(text = "") {
2
- return text.normalize('NFD').replace(/[\u0300-\u036f/\s'"&.-]/g, "").toUpperCase();
3
- }
4
- 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
- function getMatchOption(value, distinctItems) {
12
- const normalizedSearch = normalizeString(value);
13
- const item = distinctItems.find((item) => normalizeString(item) === normalizedSearch);
14
- return item;
15
- }
16
-
17
- export { filterItems as f, getMatchOption as g, normalizeString as n };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface InputDistinctSearch extends Components.InputDistinctSearch, HTMLElement {}
4
- export const InputDistinctSearch: {
5
- prototype: InputDistinctSearch;
6
- new (): InputDistinctSearch;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,6 +0,0 @@
1
- import { I as InputDistinctSearch$1, d as defineCustomElement$1 } from './input-distinct-search2.js';
2
-
3
- const InputDistinctSearch = InputDistinctSearch$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { InputDistinctSearch, defineCustomElement };
@@ -1,264 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
2
- import { KeyboardManager } from '@sankhyalabs/core';
3
- import { f as filterItems, n as normalizeString, g as getMatchOption } from './filter-distinct-search.js';
4
-
5
- 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)}";
6
-
7
- const InputDistinctSearch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
- constructor() {
9
- super();
10
- this.__registerHost();
11
- this.__attachShadow();
12
- this.changeValue = createEvent(this, "changeValue", 7);
13
- this.iconClick = createEvent(this, "iconClick", 7);
14
- this.textValue = "";
15
- this.isNewItem = false;
16
- this.filteredItems = [];
17
- this.isNewItemSelected = false;
18
- this.application = undefined;
19
- this.distinctItems = [];
20
- this.label = "";
21
- this.value = "";
22
- this.maxItems = 100;
23
- this.debounceTime = 300;
24
- this.canShowError = false;
25
- this.mode = 'regular';
26
- this.restrict = undefined;
27
- this.errorMessage = undefined;
28
- }
29
- async observerValue(newValue) {
30
- await this.selectedNewItem(newValue, true);
31
- }
32
- /**
33
- * Seleciona um item
34
- */
35
- async selectValue(value, isNewItem = false) {
36
- this.isNewItem = isNewItem;
37
- this.textValue = value;
38
- await this._refFilterInput.setValue(value);
39
- }
40
- /**
41
- * Método para limpa o campo de entrada de pesquisa
42
- */
43
- clearInput() {
44
- this._refFilterInput.setValue("");
45
- }
46
- /**
47
- * Retorna se o conteúdo é inválido.
48
- */
49
- isInvalid() {
50
- return this._refFilterInput.isInvalid();
51
- }
52
- /**
53
- * Remove o foco do campo
54
- */
55
- setBlur() {
56
- this._refFilterInput.setBlur();
57
- }
58
- /**
59
- * Aplica o foco do campo
60
- */
61
- setFocus() {
62
- this._refFilterInput.setFocus();
63
- }
64
- getMessage(key) {
65
- return this.application.messagesBuilder.getMessage(key, null);
66
- }
67
- async optionLoader(searchArgument) {
68
- return new Promise((resolve) => {
69
- if (this._debounceTimeout) {
70
- clearTimeout(this._debounceTimeout);
71
- }
72
- this._debounceTimeout = setTimeout(() => {
73
- const { items } = filterItems(searchArgument, this.distinctItems, this.maxItems);
74
- this.filteredItems = items;
75
- resolve();
76
- }, this.debounceTime);
77
- });
78
- }
79
- async openPopOver() {
80
- var _a;
81
- await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.showUnder(this._refFilterInput));
82
- }
83
- async closePopOver() {
84
- var _a;
85
- this.isNewItemSelected = false;
86
- await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.hide());
87
- await this._refList.removeSelection();
88
- }
89
- async onTextChange(event) {
90
- this.textValue = event.detail;
91
- await this.optionLoader(event.detail);
92
- await this.selectFirstItem();
93
- }
94
- onIconClick() {
95
- this.iconClick.emit();
96
- }
97
- buidItems() {
98
- var _a;
99
- const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
100
- label: item,
101
- id: normalizeString(item),
102
- }));
103
- return items;
104
- }
105
- async setValue(value, isNewItem = false, preventEventEmit = false) {
106
- this.isNewItem = isNewItem;
107
- this.textValue = value;
108
- await this._refFilterInput.setValue(value);
109
- await this.closePopOver();
110
- if (!preventEventEmit) {
111
- this.changeValue.emit({
112
- value,
113
- isNewItem,
114
- });
115
- }
116
- }
117
- async selectedNewItem(value, preventEventEmit = false) {
118
- if (!this.textValue && !value) {
119
- await this.setValue("", false, preventEventEmit);
120
- return;
121
- }
122
- const item = getMatchOption(value !== null && value !== void 0 ? value : this.textValue, this.distinctItems);
123
- if (item) {
124
- await this.setValue(item, false, preventEventEmit);
125
- return;
126
- }
127
- await this.setValue(this.textValue || value, true, preventEventEmit);
128
- }
129
- async setSelectedValue() {
130
- const selectedValue = await this._refList.getSelection();
131
- await this.selectedNewItem((selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) || this.textValue, true);
132
- await this._refFilterInput.setBlur();
133
- this._element.focus();
134
- }
135
- async selectNextItem() {
136
- if (this.isNewItemSelected) {
137
- return;
138
- }
139
- const itemSelected = await this._refList.getSelection();
140
- const itemsAmount = this.filteredItems.length;
141
- const indexSelected = this.filteredItems.findIndex((item) => item === (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.label));
142
- const isLastItemSelected = indexSelected === (itemsAmount - 1);
143
- const optionNewItemIsAvailable = !!this.textValue;
144
- if (!isLastItemSelected || !optionNewItemIsAvailable) {
145
- this.isNewItemSelected = false;
146
- await this._refList.selectNextItem();
147
- return;
148
- }
149
- this.isNewItemSelected = true;
150
- await this._refList.removeSelection();
151
- }
152
- async selectPreviousItem() {
153
- const itemsAmount = this.filteredItems.length;
154
- const lastItem = this.filteredItems[itemsAmount - 1];
155
- if (this.isNewItemSelected && lastItem) {
156
- this.isNewItemSelected = false;
157
- await this._refList.setSelection({
158
- id: normalizeString(lastItem),
159
- label: lastItem
160
- });
161
- return;
162
- }
163
- await this._refList.selectPreviousItem();
164
- }
165
- bindKeyboardManager() {
166
- this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
167
- this._keyboardManager
168
- .bind("ArrowDown", () => { this.selectNextItem(); })
169
- .bind("ArrowUp", () => { this.selectPreviousItem(); })
170
- .bind("Enter", () => { this.setSelectedValue(); })
171
- .bind("Tab", () => { this.setSelectedValue(); });
172
- }
173
- unbindKeyboardManager() {
174
- this._keyboardManager
175
- .unbind("ArrowDown")
176
- .unbind("ArrowUp")
177
- .unbind("Enter")
178
- .unbind("Tab");
179
- }
180
- async selectFirstItem() {
181
- if (!this.filteredItems.length) {
182
- await this._refList.removeSelection();
183
- this.isNewItemSelected = true;
184
- return;
185
- }
186
- const firstItem = this.filteredItems[0];
187
- this.isNewItemSelected = false;
188
- await this._refList.setSelection({
189
- id: normalizeString(firstItem),
190
- label: firstItem,
191
- });
192
- }
193
- initializeComponent() {
194
- const { items } = filterItems("", this.distinctItems, this.maxItems);
195
- this.filteredItems = items;
196
- }
197
- componentWillLoad() {
198
- this.initializeComponent();
199
- }
200
- async componentDidLoad() {
201
- this.bindKeyboardManager();
202
- this.selectFirstItem();
203
- await this.selectedNewItem(this.value, true);
204
- }
205
- disconnectedCallback() {
206
- this.unbindKeyboardManager();
207
- }
208
- buildNewItemOption() {
209
- if (!this.textValue) {
210
- return;
211
- }
212
- return (h(Fragment, null, !!this.filteredItems.length &&
213
- h("hr", { class: "divider" }), h("button", { slot: "bottomSlot", class: {
214
- "new-value": true,
215
- "new-value-selected": this.isNewItemSelected,
216
- }, title: `${this.getMessage("snkDistinctSearch.titleAdd")} '${this.textValue}'`, onClick: () => this.selectedNewItem.bind(this)(undefined, true) }, this.getMessage("snkDistinctSearch.titleAdd"), " '", this.textValue, "'")));
217
- }
218
- render() {
219
- return (h(Host, { onBlur: () => this.selectedNewItem.bind(this)() }, 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 &&
220
- h("ez-badge", { slot: "right", label: this.getMessage("snkDistinctSearch.titleBadgeNew"), size: "small-medium", class: "badge-primary" })), h("ez-popover", { ref: (ref) => this._refPopOver = ref, boxWidth: "full-width", autoClose: false, overlayType: "none", class: {
221
- 'space-error': this.canShowError,
222
- } }, h("div", { class: "popover-content" }, h("section", { class: "list-container" }, 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()))));
223
- }
224
- get _element() { return this; }
225
- static get watchers() { return {
226
- "value": ["observerValue"]
227
- }; }
228
- static get style() { return inputDistinctSearchCss; }
229
- }, [1, "input-distinct-search", {
230
- "application": [16],
231
- "distinctItems": [16],
232
- "label": [1],
233
- "value": [1],
234
- "maxItems": [2, "max-items"],
235
- "debounceTime": [2, "debounce-time"],
236
- "canShowError": [4, "can-show-error"],
237
- "mode": [1],
238
- "restrict": [1],
239
- "errorMessage": [1, "error-message"],
240
- "textValue": [32],
241
- "isNewItem": [32],
242
- "filteredItems": [32],
243
- "isNewItemSelected": [32],
244
- "selectValue": [64],
245
- "clearInput": [64],
246
- "isInvalid": [64],
247
- "setBlur": [64],
248
- "setFocus": [64]
249
- }]);
250
- function defineCustomElement() {
251
- if (typeof customElements === "undefined") {
252
- return;
253
- }
254
- const components = ["input-distinct-search"];
255
- components.forEach(tagName => { switch (tagName) {
256
- case "input-distinct-search":
257
- if (!customElements.get(tagName)) {
258
- customElements.define(tagName, InputDistinctSearch);
259
- }
260
- break;
261
- } });
262
- }
263
-
264
- export { InputDistinctSearch as I, defineCustomElement as d };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface SearchModal extends Components.SearchModal, HTMLElement {}
4
- export const SearchModal: {
5
- prototype: SearchModal;
6
- new (): SearchModal;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,6 +0,0 @@
1
- import { S as SearchModal$1, d as defineCustomElement$1 } from './search-modal2.js';
2
-
3
- const SearchModal = SearchModal$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { SearchModal, defineCustomElement };
@@ -1,264 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
3
- import { KeyboardManager } from '@sankhyalabs/core';
4
- import { f as filterItems, n as normalizeString, g as getMatchOption } from './filter-distinct-search.js';
5
-
6
- 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}";
7
-
8
- const SearchModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
- constructor() {
10
- super();
11
- this.__registerHost();
12
- this.popupClose = createEvent(this, "popupClose", 7);
13
- this.changeValue = createEvent(this, "changeValue", 7);
14
- this.debounceTimeout = null;
15
- this.filteredItems = [];
16
- this.searchFocus = false;
17
- this.isLimited = false;
18
- this.application = undefined;
19
- this.listItens = [];
20
- this.opened = false;
21
- this.value = undefined;
22
- this.canShowError = false;
23
- this.emptyMessage = undefined;
24
- this.debounceTime = 300;
25
- this.maxItens = 100;
26
- this.label = 'Pesquisar';
27
- this.mode = 'regular';
28
- this.restrict = undefined;
29
- this.errorMessage = undefined;
30
- }
31
- /**
32
- * Método para adicionar a nova palavra e chamar o método closeModal() para fechar o modal
33
- */
34
- addNewItem() {
35
- this.closeModal();
36
- this.changeValue.emit({ isNewItem: true, value: this.value });
37
- }
38
- /**
39
- * Método para limpa o campo de entrada de pesquisa
40
- */
41
- clearInput() {
42
- this._refFilterInput.setValue("");
43
- }
44
- /**
45
- * Método para fechar o modal
46
- */
47
- closeModal() {
48
- this._popupElement.opened = false;
49
- this.popupClose.emit(false);
50
- }
51
- /**
52
- * Método para abrir o modal
53
- */
54
- openModal() {
55
- this._popupElement.opened = true;
56
- setTimeout(() => this.setFocus(), 100);
57
- }
58
- /**
59
- * Retorna se o conteúdo é inválido.
60
- */
61
- isInvalid() {
62
- this._refFilterInput.isInvalid();
63
- }
64
- /**
65
- * Remove o foco do campo
66
- */
67
- setBlur() {
68
- this._refFilterInput.setBlur();
69
- this.searchFocus = false;
70
- }
71
- /**
72
- * Aplica o foco do campo
73
- */
74
- setFocus() {
75
- this._refFilterInput.setFocus();
76
- this.searchFocus = true;
77
- }
78
- /**
79
- * Método para tratar a mensagem de erro
80
- */
81
- watchPropErrorMessage() {
82
- this._refFilterInput.errorMessage = this.errorMessage;
83
- }
84
- /**
85
- * Método para tratar o value do input
86
- */
87
- watchPropValue() {
88
- this._refFilterInput.value = this.value;
89
- }
90
- /**
91
- * Atualiza a lista de itens à medida que o usuário digita no campo de pesquisa.
92
- */
93
- async handleInput(event) {
94
- if (this.debounceTimeout) {
95
- clearTimeout(this.debounceTimeout);
96
- }
97
- this.value = event.detail;
98
- this.debounceTimeout = setTimeout(async () => {
99
- var _a;
100
- const { isLimited, items } = filterItems(event.detail, this.listItens, this.maxItens);
101
- this.filteredItems = items;
102
- this.isLimited = isLimited;
103
- await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.removeSelection());
104
- }, this.debounceTime);
105
- }
106
- initializeComponent() {
107
- this.filteredItems = this.listItens;
108
- }
109
- getMessage(key) {
110
- return this.application.messagesBuilder.getMessage(key, null);
111
- }
112
- componentWillLoad() {
113
- this.initializeComponent();
114
- }
115
- componentDidLoad() {
116
- this.bindKeyboardManager();
117
- this._refFilterInput.value = this.value;
118
- const { isLimited, items } = filterItems(this.value, this.listItens, this.maxItens);
119
- this.filteredItems = items;
120
- this.isLimited = isLimited;
121
- }
122
- disconnectedCallback() {
123
- this.unbindKeyboardManager();
124
- }
125
- buildItems() {
126
- var _a;
127
- const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
128
- label: item,
129
- id: normalizeString(item),
130
- }));
131
- return items;
132
- }
133
- async tabSelect() {
134
- var _a;
135
- const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
136
- if (this.searchFocus && this._refList) {
137
- this.searchFocus = false;
138
- this._refList.focus();
139
- await this.selectFirstItem();
140
- }
141
- else if (selectedValue) {
142
- await this._refList.removeSelection();
143
- await this._refButton.setFocus();
144
- }
145
- else {
146
- await this._refButton.setBlur();
147
- this.setFocus();
148
- }
149
- }
150
- bindKeyboardManager() {
151
- this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
152
- this._keyboardManager
153
- .bind("ArrowDown", () => { this.selectNextItem(); })
154
- .bind("ArrowUp", () => { this.selectPreviousItem(); })
155
- .bind("Enter", () => { this.setSelectedValue(); })
156
- .bind("Tab", () => { this.tabSelect(); });
157
- }
158
- unbindKeyboardManager() {
159
- this._keyboardManager
160
- .unbind("ArrowDown")
161
- .unbind("ArrowUp")
162
- .unbind("Enter")
163
- .unbind("Tab");
164
- }
165
- async setSelectedValue() {
166
- var _a;
167
- const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
168
- if (selectedValue) {
169
- this.changeValue.emit({ isNewItem: false, value: selectedValue.label });
170
- this.closeModal();
171
- }
172
- else if (this.searchFocus && this.enabledButtonNewItem()) {
173
- this.addNewItem();
174
- }
175
- }
176
- async selectNextItem() {
177
- var _a;
178
- const itemSelected = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
179
- if (this.searchFocus && !itemSelected) {
180
- this.setBlur();
181
- await this.selectFirstItem();
182
- return;
183
- }
184
- await this._refList.selectNextItem();
185
- }
186
- async selectPreviousItem() {
187
- const itemSelected = await this._refList.getSelection();
188
- if (itemSelected === undefined)
189
- return;
190
- await this._refList.selectPreviousItem();
191
- }
192
- async selectFirstItem() {
193
- if (!this.filteredItems.length) {
194
- await this._refList.removeSelection();
195
- return;
196
- }
197
- const firstItem = this.filteredItems[0];
198
- await this._refList.setSelection({
199
- id: normalizeString(firstItem),
200
- label: firstItem,
201
- });
202
- }
203
- enabledButtonNewItem() {
204
- if (this.value === undefined)
205
- return false;
206
- if (getMatchOption(this.value, this.listItens))
207
- return false;
208
- return this.value.trim().length === 0 ? false : true;
209
- }
210
- buildMessage() {
211
- if (this.isLimited) {
212
- return this.getMessage("snkDistinctSearch.limitResult");
213
- }
214
- return `${this.filteredItems.length} ${this.filteredItems.length > 1 ? this.getMessage("snkDistinctSearch.availableResults") : this.getMessage("snkDistinctSearch.availableResult")}`;
215
- }
216
- render() {
217
- var _a;
218
- 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() }))))));
219
- }
220
- get _element() { return this; }
221
- static get watchers() { return {
222
- "errorMessage": ["watchPropErrorMessage"],
223
- "value": ["watchPropValue"]
224
- }; }
225
- static get style() { return searchModalCss; }
226
- }, [2, "search-modal", {
227
- "application": [16],
228
- "listItens": [1040],
229
- "opened": [1540],
230
- "value": [1],
231
- "canShowError": [4, "can-show-error"],
232
- "emptyMessage": [1, "empty-message"],
233
- "debounceTime": [2, "debounce-time"],
234
- "maxItens": [2, "max-itens"],
235
- "label": [1],
236
- "mode": [1],
237
- "restrict": [1],
238
- "errorMessage": [1, "error-message"],
239
- "filteredItems": [32],
240
- "searchFocus": [32],
241
- "isLimited": [32],
242
- "addNewItem": [64],
243
- "clearInput": [64],
244
- "closeModal": [64],
245
- "openModal": [64],
246
- "isInvalid": [64],
247
- "setBlur": [64],
248
- "setFocus": [64]
249
- }]);
250
- function defineCustomElement() {
251
- if (typeof customElements === "undefined") {
252
- return;
253
- }
254
- const components = ["search-modal"];
255
- components.forEach(tagName => { switch (tagName) {
256
- case "search-modal":
257
- if (!customElements.get(tagName)) {
258
- customElements.define(tagName, SearchModal);
259
- }
260
- break;
261
- } });
262
- }
263
-
264
- export { SearchModal as S, defineCustomElement as d };
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface SnkDistinctSearch extends Components.SnkDistinctSearch, HTMLElement {}
4
- export const SnkDistinctSearch: {
5
- prototype: SnkDistinctSearch;
6
- new (): SnkDistinctSearch;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;