@sankhyalabs/sankhyablocks 10.1.0-dev.2 → 10.1.0-dev.3

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 (119) hide show
  1. package/dist/cjs/{ConfigStorage-5a73e979.js → ConfigStorage-b29e31be.js} +2 -2
  2. package/dist/cjs/{DataFetcher-eeb3b0b7.js → DataFetcher-ed9d97ea.js} +1 -1
  3. package/dist/cjs/{ISave-861e9d6d.js → ISave-81eb2fbc.js} +4 -4
  4. package/dist/cjs/{SnkFormConfigManager-8d4fded8.js → SnkFormConfigManager-6838389c.js} +2 -2
  5. package/dist/cjs/{SnkMultiSelectionListDataSource-3b93f6a6.js → SnkMultiSelectionListDataSource-1e804147.js} +4 -4
  6. package/dist/cjs/{auth-fetcher-8d8acd69.js → auth-fetcher-cc28d847.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-1cea0695.js → dataunit-fetcher-ab1cc071.js} +1 -1
  8. package/dist/cjs/{form-config-fetcher-f347f884.js → form-config-fetcher-f0897eb5.js} +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-application.cjs.entry.js +81 -69
  14. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  15. package/dist/cjs/snk-crud.cjs.entry.js +90 -6
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  17. package/dist/cjs/{snk-data-unit-de248308.js → snk-data-unit-68992932.js} +2 -2
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  20. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  22. package/dist/cjs/snk-form_2.cjs.entry.js +4 -4
  23. package/dist/cjs/snk-grid.cjs.entry.js +8 -7
  24. package/dist/cjs/{snk-guides-viewer-4ec3e7e1.js → snk-guides-viewer-8b841753.js} +6 -6
  25. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  27. package/dist/cjs/snk-pesquisa.cjs.entry.js +17 -5
  28. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +8 -4
  30. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-advaced-mode.js +27 -0
  31. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-plus.js +5 -25
  32. package/dist/collection/components/snk-application/snk-application.js +87 -44
  33. package/dist/collection/components/snk-crud/snk-crud.js +106 -2
  34. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +1 -1
  35. package/dist/collection/components/snk-grid/snk-grid.js +20 -1
  36. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +5 -1
  37. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +47 -0
  38. package/dist/collection/components/snk-taskbar/snk-taskbar.js +29 -4
  39. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +3 -3
  40. package/dist/collection/lib/message/resources/pt-br/snk-pesquisa.msg.js +1 -1
  41. package/dist/components/DataFetcher.js +1 -1
  42. package/dist/components/ISave.js +3 -3
  43. package/dist/components/snk-application2.js +76 -63
  44. package/dist/components/snk-crud.js +88 -1
  45. package/dist/components/snk-detail-view2.js +1 -1
  46. package/dist/components/snk-grid2.js +3 -1
  47. package/dist/components/snk-pesquisa2.js +15 -2
  48. package/dist/components/snk-taskbar2.js +9 -4
  49. package/dist/esm/{ConfigStorage-568dc227.js → ConfigStorage-13d80e36.js} +2 -2
  50. package/dist/esm/{DataFetcher-743feb3b.js → DataFetcher-f4ccd9f3.js} +1 -1
  51. package/dist/esm/{ISave-345481c1.js → ISave-288fa9df.js} +4 -4
  52. package/dist/esm/{SnkFormConfigManager-d61df0c8.js → SnkFormConfigManager-3ee2937b.js} +2 -2
  53. package/dist/esm/{SnkMultiSelectionListDataSource-ca8d7a09.js → SnkMultiSelectionListDataSource-5d3a93f2.js} +4 -4
  54. package/dist/esm/{auth-fetcher-c353127d.js → auth-fetcher-59ab0c67.js} +1 -1
  55. package/dist/esm/{dataunit-fetcher-7f2c61ca.js → dataunit-fetcher-c4f9f222.js} +1 -1
  56. package/dist/esm/{form-config-fetcher-898d2dd1.js → form-config-fetcher-6a00fe9e.js} +1 -1
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/esm/pesquisa-grid_2.entry.js +4 -4
  59. package/dist/esm/sankhyablocks.js +1 -1
  60. package/dist/esm/snk-actions-button_9.entry.js +5 -5
  61. package/dist/esm/snk-application.entry.js +81 -69
  62. package/dist/esm/snk-attach.entry.js +5 -5
  63. package/dist/esm/snk-crud.entry.js +90 -6
  64. package/dist/esm/snk-data-exporter.entry.js +5 -5
  65. package/dist/esm/{snk-data-unit-60b338c5.js → snk-data-unit-0edeb967.js} +2 -2
  66. package/dist/esm/snk-data-unit.entry.js +3 -3
  67. package/dist/esm/snk-detail-view.entry.js +7 -7
  68. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  69. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  70. package/dist/esm/snk-form_2.entry.js +4 -4
  71. package/dist/esm/snk-grid.entry.js +8 -7
  72. package/dist/esm/{snk-guides-viewer-339e10b3.js → snk-guides-viewer-9cd4d20f.js} +6 -6
  73. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  74. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  75. package/dist/esm/snk-pesquisa.entry.js +17 -5
  76. package/dist/esm/snk-simple-crud.entry.js +7 -7
  77. package/dist/esm/snk-taskbar.entry.js +8 -4
  78. package/dist/sankhyablocks/{p-9fe91526.js → p-0e279e7a.js} +1 -1
  79. package/dist/sankhyablocks/{p-164c822d.entry.js → p-1858c023.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-1d585081.js → p-1c2971e4.js} +1 -1
  81. package/dist/sankhyablocks/{p-27005fac.entry.js → p-26e0f63c.entry.js} +1 -1
  82. package/dist/sankhyablocks/{p-bb0de89c.entry.js → p-34df7eca.entry.js} +1 -1
  83. package/dist/sankhyablocks/p-34f447ba.entry.js +1 -0
  84. package/dist/sankhyablocks/{p-bd203e8d.entry.js → p-38e56b68.entry.js} +1 -1
  85. package/dist/sankhyablocks/{p-1649f51e.entry.js → p-3abeeefa.entry.js} +1 -1
  86. package/dist/sankhyablocks/{p-144da1d1.entry.js → p-3d021bef.entry.js} +1 -1
  87. package/dist/sankhyablocks/{p-e64958ba.entry.js → p-44939a0e.entry.js} +1 -1
  88. package/dist/sankhyablocks/{p-88ed2793.js → p-5304753a.js} +2 -2
  89. package/dist/sankhyablocks/{p-e8c49c12.js → p-53599b26.js} +2 -2
  90. package/dist/sankhyablocks/p-557368df.entry.js +1 -0
  91. package/dist/sankhyablocks/p-583151c5.entry.js +1 -0
  92. package/dist/sankhyablocks/{p-1f8cb438.entry.js → p-6180de07.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-1788d191.js → p-78ff8734.js} +1 -1
  94. package/dist/sankhyablocks/{p-e6b1c769.entry.js → p-80014119.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-af9d79e0.entry.js → p-8a88690f.entry.js} +1 -1
  96. package/dist/sankhyablocks/{p-7fc46290.js → p-9317942f.js} +1 -1
  97. package/dist/sankhyablocks/p-a2ed1ebd.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-0cf9aa38.js → p-a644a956.js} +1 -1
  99. package/dist/sankhyablocks/p-ae108ffd.entry.js +11 -0
  100. package/dist/sankhyablocks/{p-9f2cdaab.entry.js → p-b4322b87.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-6d241415.js → p-bb2f5f38.js} +1 -1
  102. package/dist/sankhyablocks/{p-626b7a17.js → p-d9c54991.js} +1 -1
  103. package/dist/sankhyablocks/{p-c90f337a.entry.js → p-e9021f79.entry.js} +1 -1
  104. package/dist/sankhyablocks/{p-59b8f277.js → p-f15478a1.js} +1 -1
  105. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  106. package/dist/types/components/snk-application/search-strategy/exec-prepared-search-advaced-mode.d.ts +5 -0
  107. package/dist/types/components/snk-application/snk-application.d.ts +9 -0
  108. package/dist/types/components/snk-crud/snk-crud.d.ts +12 -0
  109. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  110. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +9 -0
  111. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -1
  112. package/dist/types/components.d.ts +39 -0
  113. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
  114. package/package.json +1 -1
  115. package/dist/sankhyablocks/p-4759912d.entry.js +0 -1
  116. package/dist/sankhyablocks/p-56948f00.entry.js +0 -11
  117. package/dist/sankhyablocks/p-95c71f5e.entry.js +0 -1
  118. package/dist/sankhyablocks/p-aae4258d.entry.js +0 -1
  119. package/dist/sankhyablocks/p-f25c50f7.entry.js +0 -1
@@ -74,6 +74,7 @@ export class SnkGrid {
74
74
  this.canEdit = true;
75
75
  this.taskbarCustomContainerId = undefined;
76
76
  this.gridHeaderCustomSlotId = 'GRID_HEADER_CUSTOM_ELEMENTS';
77
+ this.gridHeaderDynamicSearchSlotId = 'GRID_HEADER_DYNAMIC_SEARCH';
77
78
  this.topTaskbarCustomSlotId = 'GRID_TASKBAR_CUSTOM_ELEMENTS';
78
79
  this.disablePersonalizedFilter = undefined;
79
80
  this.gridLegacyConfigName = undefined;
@@ -592,7 +593,7 @@ export class SnkGrid {
592
593
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large ez-box--no-outline", tabindex: "0" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
593
594
  h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, filterCustomConfig: this.filterCustomConfig, filterCustomConfigInterceptor: this.filterCustomConfigInterceptor }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium ez-padding-top--extra-small", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none', actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? 'snk-grid-container__without-shadow ' : '') + 'snk-grid__table', "data-element-id": "embedded", dataUnit: this._dataUnit, key: 'grid-' + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => {
594
595
  this.gridConfigChangeHandler(evt);
595
- }, onEzColumnFilterChanged: async () => await this.dataExporterProviderStore(), onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, useSearchColumn: this.useSearchColumn, suppressHorizontalScroll: this.suppressHorizontalScroll, paginationCounterMode: this.paginationCounterMode, suppressCheckboxColumn: this.suppressCheckboxColumn, suppressFilterColumn: this.suppressFilterColumn, compact: this.compact }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId, actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12 snk-grid-container__footer" }, h("slot", { name: "SnkGridFooter" })), h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, opened: this._popUpGridConfig, onEzClosePopup: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
596
+ }, onEzColumnFilterChanged: async () => await this.dataExporterProviderStore(), onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, useSearchColumn: this.useSearchColumn, suppressHorizontalScroll: this.suppressHorizontalScroll, paginationCounterMode: this.paginationCounterMode, suppressCheckboxColumn: this.suppressCheckboxColumn, suppressFilterColumn: this.suppressFilterColumn, compact: this.compact }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId, additionalSlotId: this.gridHeaderDynamicSearchSlotId, actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.gridHeaderCustomSlotId }), h("slot", { name: this.gridHeaderDynamicSearchSlotId }))), h("div", { class: "ez-col ez-col--sd-12 snk-grid-container__footer" }, h("slot", { name: "SnkGridFooter" })), h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, opened: this._popUpGridConfig, onEzClosePopup: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
596
597
  }
597
598
  static get is() { return "snk-grid"; }
598
599
  static get encapsulation() { return "scoped"; }
@@ -974,6 +975,24 @@ export class SnkGrid {
974
975
  "reflect": false,
975
976
  "defaultValue": "'GRID_HEADER_CUSTOM_ELEMENTS'"
976
977
  },
978
+ "gridHeaderDynamicSearchSlotId": {
979
+ "type": "string",
980
+ "mutable": false,
981
+ "complexType": {
982
+ "original": "string",
983
+ "resolved": "string",
984
+ "references": {}
985
+ },
986
+ "required": false,
987
+ "optional": false,
988
+ "docs": {
989
+ "tags": [],
990
+ "text": "Define o nome do slot para a aba de pesquisa no cabe\u00E7alho da grade."
991
+ },
992
+ "attribute": "grid-header-dynamic-search-slot-id",
993
+ "reflect": false,
994
+ "defaultValue": "'GRID_HEADER_DYNAMIC_SEARCH'"
995
+ },
977
996
  "topTaskbarCustomSlotId": {
978
997
  "type": "string",
979
998
  "mutable": false,
@@ -43,6 +43,10 @@
43
43
  /*@doc Define a largura da barra de rolagem do componente.*/
44
44
  --snk-pesquisa__scrollbar--width: var(--space--small, 6px);
45
45
 
46
+ /*@doc Define o tamanho do conteúdo scrollável do popup */
47
+ --snk-pesquisa__scrollable-content--height: calc(100vh - 300px);
48
+
49
+
46
50
  height: 100%;
47
51
  display: flex;
48
52
  flex-direction: column;
@@ -79,7 +83,7 @@
79
83
  /*public*/
80
84
  scrollbar-color: var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);
81
85
  padding-right: var(--snk-pesquisa__content--padding-right);
82
- height: 100vh;
86
+ height: var(--snk-pesquisa__scrollable-content--height);
83
87
  }
84
88
 
85
89
  .snk-pesquisa__content::-webkit-scrollbar {
@@ -33,6 +33,18 @@ export class SnkPesquisa {
33
33
  this._textInput.value = this.argument;
34
34
  }
35
35
  }
36
+ /** * Executa uma pesquisa programaticamente.
37
+ * Útil para cenários onde a pesquisa precisa ser disparada sem interação do usuário.
38
+ *
39
+ * @param text Texto utilizado como argumento de pesquisa.
40
+ * @returns Promise<void>
41
+ * @example
42
+ * await pesquisaRef.executeSearch("Texto para pesquisa");
43
+ */
44
+ async executeSearch(text) {
45
+ this.argument = text;
46
+ this.onChangeValue({ detail: text });
47
+ }
36
48
  clearSearch() {
37
49
  this.argument = "";
38
50
  this._itemList = undefined;
@@ -606,6 +618,41 @@ export class SnkPesquisa {
606
618
  "_valideDataSource": {}
607
619
  };
608
620
  }
621
+ static get methods() {
622
+ return {
623
+ "executeSearch": {
624
+ "complexType": {
625
+ "signature": "(text: string) => Promise<void>",
626
+ "parameters": [{
627
+ "tags": [{
628
+ "name": "param",
629
+ "text": "text Texto utilizado como argumento de pesquisa."
630
+ }],
631
+ "text": "Texto utilizado como argumento de pesquisa."
632
+ }],
633
+ "references": {
634
+ "Promise": {
635
+ "location": "global"
636
+ }
637
+ },
638
+ "return": "Promise<void>"
639
+ },
640
+ "docs": {
641
+ "text": "* Executa uma pesquisa programaticamente.\n\u00DAtil para cen\u00E1rios onde a pesquisa precisa ser disparada sem intera\u00E7\u00E3o do usu\u00E1rio.",
642
+ "tags": [{
643
+ "name": "param",
644
+ "text": "text Texto utilizado como argumento de pesquisa."
645
+ }, {
646
+ "name": "returns",
647
+ "text": "Promise<void>"
648
+ }, {
649
+ "name": "example",
650
+ "text": "await pesquisaRef.executeSearch(\"Texto para pesquisa\");"
651
+ }]
652
+ }
653
+ }
654
+ };
655
+ }
609
656
  static get elementRef() { return "_element"; }
610
657
  static get watchers() {
611
658
  return [{
@@ -7,9 +7,10 @@ export class SnkTaskbar {
7
7
  constructor() {
8
8
  this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
9
9
  this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME = 'taskbar-custom-elements-container';
10
- this.ACTIONS_BUTTON_TAG = 'TASKBAR-ACTIONS-BUTTON';
11
10
  this.NOT_OVERFLOW_ELEMENTS = ["moreOptions", "dataExporter_snkDataExporter", "actionsButton_snkActionsButton"];
12
11
  this.TASKBAR_CUSTOM_ELEMENTS = 'taskbar-custom-elements-container';
12
+ this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME = 'taskbar-additional-slot-container';
13
+ this.TASKBAR_ADDITIONAL_SLOT = 'taskbar-additional-slot-container';
13
14
  this._titleKeyByElement = {
14
15
  [TaskbarElement.UPDATE_MULTIPLE]: "snkTaskbar.titleUpdateMultiple",
15
16
  [TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
@@ -52,6 +53,7 @@ export class SnkTaskbar {
52
53
  this._isWaitingForSave = false;
53
54
  this.alignRigth = false;
54
55
  this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
56
+ this.additionalSlotId = "TASKBAR_ADDITIONAL_SLOT";
55
57
  this.customContainerId = undefined;
56
58
  this.overflowStrategy = 'hiddenItems';
57
59
  this.configName = undefined;
@@ -372,7 +374,8 @@ export class SnkTaskbar {
372
374
  return (_a = element.getAttribute('data-taskbar-label')) !== null && _a !== void 0 ? _a : "";
373
375
  }
374
376
  hasToIgnoreOverFlow(element) {
375
- return element.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME);
377
+ return element.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME) ||
378
+ element.classList.contains(this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME);
376
379
  }
377
380
  handleOverFlowStrategy() {
378
381
  if (this.overflowStrategy === 'hiddenItems') {
@@ -418,7 +421,7 @@ export class SnkTaskbar {
418
421
  this._slotContainer.appendChild(customElement);
419
422
  }
420
423
  render() {
421
- var _a;
424
+ var _a, _b;
422
425
  if (this._definitions === undefined) {
423
426
  return undefined;
424
427
  }
@@ -438,7 +441,8 @@ export class SnkTaskbar {
438
441
  (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.addNotOverFlowElement(elem);
439
442
  return h("slot", { name: elem });
440
443
  })), h("div", { id: this.TASKBAR_CUSTOM_ELEMENTS, class: this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME }, h("slot", { name: this.customSlotId }), (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 :
441
- _a.addNotOverFlowElement(this.TASKBAR_CUSTOM_ELEMENTS))));
444
+ _a.addNotOverFlowElement(this.TASKBAR_CUSTOM_ELEMENTS)), h("div", { id: this.TASKBAR_ADDITIONAL_SLOT, class: this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME }, h("slot", { name: this.additionalSlotId }), (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 :
445
+ _b.addNotOverFlowElement(this.TASKBAR_ADDITIONAL_SLOT))));
442
446
  }
443
447
  getHostClasses() {
444
448
  if (this.overflowStrategy !== 'hiddenItems')
@@ -501,6 +505,27 @@ export class SnkTaskbar {
501
505
  "reflect": false,
502
506
  "defaultValue": "\"TASKBAR_CUSTOM_ELEMENTS\""
503
507
  },
508
+ "additionalSlotId": {
509
+ "type": "string",
510
+ "mutable": false,
511
+ "complexType": {
512
+ "original": "string",
513
+ "resolved": "string",
514
+ "references": {}
515
+ },
516
+ "required": false,
517
+ "optional": false,
518
+ "docs": {
519
+ "tags": [{
520
+ "name": "description",
521
+ "text": "Define o identificador do slot adicional."
522
+ }],
523
+ "text": ""
524
+ },
525
+ "attribute": "additional-slot-id",
526
+ "reflect": false,
527
+ "defaultValue": "\"TASKBAR_ADDITIONAL_SLOT\""
528
+ },
504
529
  "customContainerId": {
505
530
  "type": "string",
506
531
  "mutable": false,
@@ -64,7 +64,7 @@ export class PesquisaFetcher {
64
64
  return result;
65
65
  }
66
66
  loadAdvancedSearch(entityName, argument, criteria, searchOptions, codeValue) {
67
- var _a, _b, _c, _d, _e;
67
+ var _a, _b, _c, _d, _e, _f;
68
68
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
69
69
  const values = {
70
70
  argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
@@ -103,11 +103,11 @@ export class PesquisaFetcher {
103
103
  };
104
104
  }
105
105
  const options = searchOptions != undefined
106
- ? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
106
+ ? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true, "limit": searchOptions.limit }) : undefined;
107
107
  const reqBody = {
108
108
  "serviceName": serviceName,
109
109
  "requestBody": {
110
- "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
110
+ "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": (_e = options === null || options === void 0 ? void 0 : options.limit) !== null && _e !== void 0 ? _e : this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_f = values.searchOptions) === null || _f === void 0 ? void 0 : _f.rootEntity }, { options }),
111
111
  "clientEventList": {
112
112
  "clientEvent": []
113
113
  }
@@ -8,7 +8,7 @@ export const snkPesquisaMessages = {
8
8
  initialMessage: "Os resultados de sua pesquisa aparecerão aqui...",
9
9
  resultsFoundSingular: "1 registro encontrado",
10
10
  resultsFoundPlural: "{{COUNT}} registros encontrados",
11
- limitMessage: "Essa pesquisa foi limitada, existem mais resultados."
11
+ limitMessage: "Esta pesquisa foi limitada, existem mais resultados."
12
12
  },
13
13
  viewMode: {
14
14
  tableMode: "Modo grade",
@@ -7257,7 +7257,7 @@ const snkPesquisaMessages$2 = {
7257
7257
  initialMessage: "Os resultados de sua pesquisa aparecerão aqui...",
7258
7258
  resultsFoundSingular: "1 registro encontrado",
7259
7259
  resultsFoundPlural: "{{COUNT}} registros encontrados",
7260
- limitMessage: "Essa pesquisa foi limitada, existem mais resultados."
7260
+ limitMessage: "Esta pesquisa foi limitada, existem mais resultados."
7261
7261
  },
7262
7262
  viewMode: {
7263
7263
  tableMode: "Modo grade",
@@ -162,7 +162,7 @@ class PesquisaFetcher {
162
162
  return result;
163
163
  }
164
164
  loadAdvancedSearch(entityName, argument, criteria, searchOptions, codeValue) {
165
- var _a, _b, _c, _d, _e;
165
+ var _a, _b, _c, _d, _e, _f;
166
166
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
167
167
  const values = {
168
168
  argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
@@ -201,11 +201,11 @@ class PesquisaFetcher {
201
201
  };
202
202
  }
203
203
  const options = searchOptions != undefined
204
- ? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
204
+ ? Object.assign(Object.assign({}, values === null || values === void 0 ? void 0 : values.searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true, "limit": searchOptions.limit }) : undefined;
205
205
  const reqBody = {
206
206
  "serviceName": serviceName,
207
207
  "requestBody": {
208
- "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_e = values.searchOptions) === null || _e === void 0 ? void 0 : _e.rootEntity }, { options }),
208
+ "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": (_d = options === null || options === void 0 ? void 0 : options.ignoreEntityCriteria) !== null && _d !== void 0 ? _d : false, "limit": (_e = options === null || options === void 0 ? void 0 : options.limit) !== null && _e !== void 0 ? _e : this._defaultPageSize, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_f = values.searchOptions) === null || _f === void 0 ? void 0 : _f.rootEntity }, { options }),
209
209
  "clientEventList": {
210
210
  "clientEvent": []
211
211
  }
@@ -385,32 +385,40 @@ class RequestListenerFactory {
385
385
  }
386
386
  }
387
387
 
388
+ const executeAdvancedModeSearch = async (argument, options, app, pesquisaFetcher) => {
389
+ const { entity, entityDescription, criteria, searchOptions, isHierarchyEntity, allowsNonAnalytic, executeOnOpen } = options;
390
+ return new Promise((accept, reject) => {
391
+ const pesquisaContent = document.createElement("snk-pesquisa");
392
+ pesquisaContent[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = `entity_${entity}`;
393
+ pesquisaContent.entityName = entity;
394
+ pesquisaContent.argument = argument;
395
+ pesquisaContent.searchLoader = (text) => pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
396
+ pesquisaContent.isHierarchyEntity = isHierarchyEntity;
397
+ if (isHierarchyEntity) {
398
+ pesquisaContent.treeLoader = (text) => pesquisaFetcher.loadTree(entity, text, criteria, searchOptions);
399
+ pesquisaContent.allowsNonAnalytic = allowsNonAnalytic;
400
+ }
401
+ pesquisaContent.selectItem = (option) => {
402
+ accept(option);
403
+ app.clearPopUpTitle();
404
+ app.closePopUp();
405
+ };
406
+ app.setPopUpTitle(entityDescription);
407
+ app.showPopUp(pesquisaContent, undefined, undefined, reject);
408
+ if (executeOnOpen) {
409
+ pesquisaContent.executeSearch(argument);
410
+ }
411
+ });
412
+ };
413
+
388
414
  const QTD_DETAIL_FIELDS_PREDICTIVE_SEARCH = 6;
389
415
  const INVALID_CONTENT_PATTERNS = ['<img', '<svg'];
390
416
  const executePreparedSearchPlus = async (mode, argument, options, app, pesquisaFetcher) => {
391
417
  var _a;
392
418
  const mdByName = {};
393
- const { entity, entityDescription, criteria, searchOptions, isHierarchyEntity, allowsNonAnalytic } = options;
419
+ const { entity, criteria, searchOptions } = options;
394
420
  if (mode === "ADVANCED") {
395
- return new Promise((accept, reject) => {
396
- const pesquisaContent = document.createElement("snk-pesquisa");
397
- pesquisaContent[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = `entity_${entity}`;
398
- pesquisaContent.entityName = entity;
399
- pesquisaContent.argument = argument;
400
- pesquisaContent.searchLoader = (text) => pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
401
- pesquisaContent.isHierarchyEntity = isHierarchyEntity;
402
- if (isHierarchyEntity) {
403
- pesquisaContent.treeLoader = (text) => pesquisaFetcher.loadTree(entity, text, criteria, searchOptions);
404
- pesquisaContent.allowsNonAnalytic = allowsNonAnalytic;
405
- }
406
- pesquisaContent.selectItem = (option) => {
407
- accept(option);
408
- app.clearPopUpTitle();
409
- app.closePopUp();
410
- };
411
- app.setPopUpTitle(entityDescription);
412
- app.showPopUp(pesquisaContent, undefined, undefined, reject);
413
- });
421
+ return executeAdvancedModeSearch(argument, options, app, pesquisaFetcher);
414
422
  }
415
423
  else if (mode === "LOAD_DESCRIPTION") {
416
424
  let result = await pesquisaFetcher.loadByCode(entity, argument, criteria, searchOptions);
@@ -447,14 +455,13 @@ const buildOptionItem = (argument, item, fields, descriptionField, pkField) => {
447
455
  const matchFields = item['__matchFields'];
448
456
  const descriptionValue = (_a = item[descriptionField]) !== null && _a !== void 0 ? _a : "";
449
457
  const pkValue = item[pkField];
450
- let searchOption = {
458
+ return {
451
459
  value: pkValue,
452
460
  label: descriptionValue,
453
461
  presentationValue: StringUtils.highlightValue(argument, matchFields, pkValue, fields, true),
454
462
  presentationLabel: descriptionField ? StringUtils.highlightValue(argument, matchFields, descriptionValue, fields, true) : "",
455
463
  details: SearchUtils.buildDetails(argument, fields, item)
456
464
  };
457
- return searchOption;
458
465
  };
459
466
  const filterInvalidFields = (resp, item, mdByName) => {
460
467
  let fieldsMetadata = resp.fieldsMetadata.filter((field) => {
@@ -890,7 +897,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
890
897
  if (this._featureFlagsCache.get(featureName) && now < this._featureFlagsCache.get(featureName).expires) {
891
898
  return Promise.resolve(this._featureFlagsCache.get(featureName).isActive);
892
899
  }
893
- //Caso ocorra um erro nessa chamada, o reject do error é feito automaticamente
900
+ //Caso ocorra um erro nessa chamada, o reject do error é feito automaticamente
894
901
  const result = await DataFetcher.get().callServiceBroker("SystemUtilsSP.featureIsActive", JSON.stringify(payload));
895
902
  const isActive = result.isActive;
896
903
  this._featureFlagsCache.set(featureName, {
@@ -1381,52 +1388,57 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1381
1388
  */
1382
1389
  async executePreparedSearch(mode, argument, options) {
1383
1390
  const mdByName = {};
1384
- const { entity, entityDescription, criteria, searchOptions, isHierarchyEntity, allowsNonAnalytic, useSearchPlus } = options;
1391
+ const { entity, criteria, searchOptions, useSearchPlus } = options;
1385
1392
  if (useSearchPlus) {
1386
1393
  return executePreparedSearchPlus(mode, argument, options, this, this.pesquisaFetcher);
1387
1394
  }
1388
1395
  if (mode === "ADVANCED") {
1389
- return new Promise((accept, reject) => {
1390
- const pesquisaContent = document.createElement("snk-pesquisa");
1391
- pesquisaContent[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = `entity_${entity}`;
1392
- pesquisaContent.entityName = entity;
1393
- pesquisaContent.argument = argument;
1394
- pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
1395
- pesquisaContent.isHierarchyEntity = isHierarchyEntity;
1396
- if (isHierarchyEntity) {
1397
- pesquisaContent.treeLoader = (text) => this.pesquisaFetcher.loadTree(entity, text, criteria, searchOptions);
1398
- pesquisaContent.allowsNonAnalytic = allowsNonAnalytic;
1399
- }
1400
- pesquisaContent.selectItem = (option) => {
1401
- accept(option);
1402
- this.clearPopUpTitle();
1403
- this.closePopUp();
1404
- };
1405
- this.setPopUpTitle(entityDescription);
1406
- this.showPopUp(pesquisaContent, undefined, undefined, reject);
1407
- });
1396
+ return executeAdvancedModeSearch(argument, options, this, this.pesquisaFetcher);
1408
1397
  }
1409
- else {
1410
- return new Promise((resolve, reject) => {
1411
- this.pesquisaFetcher.loadAdvancedSearch(entity, argument, criteria, searchOptions)
1412
- .then(result => {
1413
- result = ObjectUtils.stringToObject(result.json.$);
1414
- let descriptionField = result.descriptionField;
1415
- let pkField = result.pkField;
1416
- const list = [];
1417
- result.data.forEach((item) => {
1418
- let fieldsMetadata = this.filterInvalidFields(result, item, mdByName);
1419
- let qtyFields = 6;
1420
- let fields = this.filterMathFields(item['__matchFields'], fieldsMetadata, qtyFields, mdByName);
1421
- list.push(this.builOptionItem(argument, item, fields, descriptionField, pkField));
1422
- });
1423
- resolve(list);
1424
- })
1425
- .catch(error => {
1426
- reject(error);
1427
- });
1398
+ return new Promise((resolve, reject) => {
1399
+ this.pesquisaFetcher.loadAdvancedSearch(entity, argument, criteria, searchOptions)
1400
+ .then(result => {
1401
+ result = ObjectUtils.stringToObject(result.json.$);
1402
+ resolve(this.buildSearchResultList(result, mdByName, argument));
1403
+ })
1404
+ .catch(error => {
1405
+ reject(error);
1428
1406
  });
1429
- }
1407
+ });
1408
+ }
1409
+ /**
1410
+ * Obtém as opções em componentes de pesquisa além dos metadados como showMore e entityPk.
1411
+ * @param {string} argument - O argumento da pesquisa.
1412
+ * @param {any} options - Opções preparadas para a pesquisa.
1413
+ * @returns {Promise<Array<IOption> | IOption>} Uma lista de opções ou uma única opção.
1414
+ * @async
1415
+ */
1416
+ async executePreparedSearchWithFullResponse(argument, options) {
1417
+ const mdByName = {};
1418
+ const { entity, criteria, searchOptions } = options;
1419
+ return new Promise((resolve, reject) => {
1420
+ this.pesquisaFetcher.loadAdvancedSearch(entity, argument, criteria, searchOptions)
1421
+ .then(result => {
1422
+ result = ObjectUtils.stringToObject(result.json.$);
1423
+ result.data = this.buildSearchResultList(result, mdByName, argument);
1424
+ resolve(result);
1425
+ })
1426
+ .catch(error => {
1427
+ reject(error);
1428
+ });
1429
+ });
1430
+ }
1431
+ buildSearchResultList(result, mdByName, argument) {
1432
+ let descriptionField = result.descriptionField;
1433
+ let pkField = result.pkField;
1434
+ const list = [];
1435
+ result.data.forEach((item) => {
1436
+ let fieldsMetadata = this.filterInvalidFields(result, item, mdByName);
1437
+ let qtyFields = 6;
1438
+ let fields = this.filterMathFields(item['__matchFields'], fieldsMetadata, qtyFields, mdByName);
1439
+ list.push(this.builOptionItem(argument, item, fields, descriptionField, pkField));
1440
+ });
1441
+ return list;
1430
1442
  }
1431
1443
  /**
1432
1444
  * Obtém `true` caso a tela esteja em modo de debug.
@@ -1979,6 +1991,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1979
1991
  "executeSearch": [64],
1980
1992
  "executePreparedSearchPlus": [64],
1981
1993
  "executePreparedSearch": [64],
1994
+ "executePreparedSearchWithFullResponse": [64],
1982
1995
  "isDebugMode": [64],
1983
1996
  "getAppLabel": [64],
1984
1997
  "addSearchListener": [64],
@@ -67,6 +67,38 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
67
67
  this._viewHistory = [];
68
68
  this._customEditors = new Map();
69
69
  this._customRenders = new Map();
70
+ this.loadEntitySuggestions = async (argument) => {
71
+ var _a;
72
+ const value = (_a = argument === null || argument === void 0 ? void 0 : argument.argument) !== null && _a !== void 0 ? _a : '';
73
+ const mode = (argument === null || argument === void 0 ? void 0 : argument.mode) || "PREDICTIVE";
74
+ if (!value || value.trim().length === 0) {
75
+ return [];
76
+ }
77
+ try {
78
+ this._showMoreOnSearch = false;
79
+ const entityName = this._snkDataUnit.entityName;
80
+ if (mode === "PREDICTIVE") {
81
+ return await this.handlePredictiveSearch(value, entityName);
82
+ }
83
+ return await this._application.executePreparedSearch(mode, value, this.buildSearchOptions(entityName));
84
+ }
85
+ catch (error) {
86
+ console.error('Erro ao carregar sugestões de entidades:', error);
87
+ return [];
88
+ }
89
+ };
90
+ this.searchEntitySelect = async (item) => {
91
+ if (!this._entityPKField || !item) {
92
+ return;
93
+ }
94
+ try {
95
+ const pk = [{ name: this._entityPKField, value: item.value }];
96
+ await this.refreshDataUnitByPk(pk);
97
+ }
98
+ catch (error) {
99
+ console.error('Erro ao selecionar entidade:', error);
100
+ }
101
+ };
70
102
  this.dataUnitInterceptor = {
71
103
  interceptAction: (action) => {
72
104
  if (action.type === Action.DATA_SAVED) {
@@ -83,6 +115,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
115
  this._resourceID = undefined;
84
116
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
85
117
  this.numberingConfig = undefined;
118
+ this._showMoreOnSearch = false;
119
+ this._entityPKField = undefined;
86
120
  this.enableLockManagerLoadingComp = false;
87
121
  this.enableLockManagerTaskbarClick = false;
88
122
  this.configName = undefined;
@@ -111,6 +145,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
111
145
  this.layoutFormConfig = true;
112
146
  this.multipleEditionEnabled = true;
113
147
  this.paginationCounterMode = 'auto';
148
+ this.showEntitySearch = true;
114
149
  this.disableNumberingConfig = false;
115
150
  }
116
151
  /**
@@ -406,6 +441,49 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
406
441
  var _a;
407
442
  (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
408
443
  }
444
+ async handlePredictiveSearch(argument, entityName) {
445
+ var _a, _b;
446
+ const response = await this._application.executePreparedSearchWithFullResponse(argument, this.buildSearchOptions(entityName, 5));
447
+ this._showMoreOnSearch = (_a = response === null || response === void 0 ? void 0 : response.hasMore) !== null && _a !== void 0 ? _a : false;
448
+ this._entityPKField = response === null || response === void 0 ? void 0 : response.pkField;
449
+ return (_b = response === null || response === void 0 ? void 0 : response.data) !== null && _b !== void 0 ? _b : [];
450
+ }
451
+ async refreshDataUnitByPk(pks) {
452
+ try {
453
+ const pkField = pks[0].name;
454
+ const pkValue = pks[0].value;
455
+ // Criar filtro para a busca específica
456
+ const quickFilter = {
457
+ term: '',
458
+ filter: {
459
+ name: '',
460
+ params: [],
461
+ expression: `(${pkField} = ${pkValue})`
462
+ }
463
+ };
464
+ // Carregar dados com o filtro aplicado diretamente
465
+ await this._dataUnit.loadData(quickFilter);
466
+ // Navegar para o formulário se houver apenas um registro
467
+ if (this._dataUnit.records.length === 1) {
468
+ this._dataUnit.selectFirst();
469
+ this.gridToForm(true);
470
+ }
471
+ }
472
+ catch (error) {
473
+ console.error('Erro ao atualizar dataset:', error);
474
+ }
475
+ }
476
+ buildSearchOptions(entityName, limit) {
477
+ return {
478
+ entity: entityName,
479
+ entityDescription: entityName,
480
+ executeOnOpen: true,
481
+ searchOptions: {
482
+ localEntityName: entityName,
483
+ limit,
484
+ }
485
+ };
486
+ }
409
487
  async toggleView() {
410
488
  const currentView = await this._viewStack.getSelectedIndex();
411
489
  this.setViewMode(VIEW_MODE.GRID === currentView ? VIEW_MODE.FORM : VIEW_MODE.GRID);
@@ -512,12 +590,18 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
512
590
  }
513
591
  this.configuratorCancel.emit();
514
592
  }
593
+ renderDynamicSearch(slotName) {
594
+ var _a;
595
+ if (!this.showEntitySearch || ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) === true)
596
+ return;
597
+ return (h("div", { slot: slotName, class: "entity-search-container", style: { position: 'relative', display: 'inline-block', marginLeft: '10px', minWidth: '200px' } }, h("ez-search", { label: "Buscar registros", optionLoader: this.loadEntitySuggestions, onEzChange: (evt) => this.searchEntitySelect(evt.detail), mode: "slim", showMore: this._showMoreOnSearch, suppressEmptyOption: true, suppressInputPersist: true })));
598
+ }
515
599
  render() {
516
600
  if (this._resourceID == undefined) {
517
601
  return;
518
602
  }
519
603
  this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
520
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled, paginationCounterMode: this.paginationCounterMode }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", { tabIndex: "0" }, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, entityName: this._snkDataUnit.entityName, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId, layoutFormConfig: this.layoutFormConfig })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
604
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled, paginationCounterMode: this.paginationCounterMode }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }), this.renderDynamicSearch("GRID_HEADER_DYNAMIC_SEARCH"))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), this.renderDynamicSearch("GUIDES_VIEWER_DYNAMIC_SEARCH"), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", { tabIndex: "0" }, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, entityName: this._snkDataUnit.entityName, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId, layoutFormConfig: this.layoutFormConfig })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
521
605
  }
522
606
  get _element() { return this; }
523
607
  static get watchers() { return {
@@ -553,6 +637,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
553
637
  "layoutFormConfig": [4, "layout-form-config"],
554
638
  "multipleEditionEnabled": [4, "multiple-edition-enabled"],
555
639
  "paginationCounterMode": [1, "pagination-counter-mode"],
640
+ "showEntitySearch": [4, "show-entity-search"],
556
641
  "disableNumberingConfig": [4, "disable-numbering-config"],
557
642
  "_dataUnit": [32],
558
643
  "_dataState": [32],
@@ -562,6 +647,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
562
647
  "_resourceID": [32],
563
648
  "customContainerId": [32],
564
649
  "numberingConfig": [32],
650
+ "_showMoreOnSearch": [32],
651
+ "_entityPKField": [32],
565
652
  "goToView": [64],
566
653
  "openConfigurator": [64],
567
654
  "closeConfigurator": [64],
@@ -512,7 +512,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
512
512
  }
513
513
  buildTaskBar() {
514
514
  var _a;
515
- return h("div", { class: `snk-guides-viewer__header-taskbar ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.getActionsList(), actionsSettingsList: this.getSettingsListForm(), messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? TaskbarElement.SAVE : TaskbarElement.INSERT, "data-taskbar-owner": "master", dataUnit: this.dataUnit, resourceID: this.resourceID, customSlotId: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS", alignRigth: true }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" })));
515
+ return h("div", { class: `snk-guides-viewer__header-taskbar ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.getActionsList(), actionsSettingsList: this.getSettingsListForm(), messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? TaskbarElement.SAVE : TaskbarElement.INSERT, "data-taskbar-owner": "master", dataUnit: this.dataUnit, resourceID: this.resourceID, customSlotId: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS", additionalSlotId: "GUIDES_VIEWER_DYNAMIC_SEARCH", alignRigth: true }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GUIDES_VIEWER_DYNAMIC_SEARCH" })));
516
516
  }
517
517
  async dataUnitActionHandler(action) {
518
518
  var _a;