@sankhyalabs/sankhyablocks 8.16.0-dev.64 → 8.16.0-dev.65

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 (106) hide show
  1. package/dist/cjs/{ContinuousInsertUtils-414b772c.js → ContinuousInsertUtils-a6139f3d.js} +2 -2
  2. package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-0121621c.js} +1 -1
  3. package/dist/cjs/index-f9e81701.js +4 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{pesquisa-fetcher-2ec4811b.js → pesquisa-fetcher-a85d6935.js} +175 -0
  6. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +127 -0
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-actions-button_5.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-application.cjs.entry.js +23 -8
  10. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  13. package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-c699179d.js} +1 -1
  14. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  16. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  17. package/dist/cjs/{snk-guides-viewer-421555af.js → snk-guides-viewer-575596a2.js} +2 -2
  18. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-pesquisa.cjs.entry.js +105 -31
  20. package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
  21. package/dist/collection/collection-manifest.json +2 -0
  22. package/dist/collection/components/snk-application/snk-application.js +25 -7
  23. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +10 -0
  24. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +190 -0
  25. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +25 -0
  26. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +173 -0
  27. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +89 -0
  28. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +24 -5
  29. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +168 -32
  30. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +1 -1
  31. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +89 -3
  32. package/dist/components/ContinuousInsertUtils.js +1 -2
  33. package/dist/components/ISave.js +346 -1
  34. package/dist/components/dataunit-fetcher.js +1 -1
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/index.js +2 -0
  37. package/dist/components/pesquisa-grid.d.ts +11 -0
  38. package/dist/components/pesquisa-grid.js +6 -0
  39. package/dist/components/pesquisa-grid2.js +86 -0
  40. package/dist/components/pesquisa-tree.d.ts +11 -0
  41. package/dist/components/pesquisa-tree.js +6 -0
  42. package/dist/components/pesquisa-tree2.js +76 -0
  43. package/dist/components/snk-actions-button2.js +0 -1
  44. package/dist/components/snk-application2.js +35 -8
  45. package/dist/components/snk-attach2.js +0 -1
  46. package/dist/components/snk-crud.js +0 -1
  47. package/dist/components/snk-data-exporter2.js +1 -2
  48. package/dist/components/snk-detail-view2.js +0 -1
  49. package/dist/components/snk-grid2.js +0 -1
  50. package/dist/components/snk-pesquisa2.js +118 -33
  51. package/dist/components/snk-simple-crud2.js +1 -2
  52. package/dist/components/snk-simple-form-config2.js +1 -2
  53. package/dist/components/teste-pesquisa.js +13 -1
  54. package/dist/esm/{ContinuousInsertUtils-bab45060.js → ContinuousInsertUtils-15b5f1da.js} +2 -2
  55. package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-481e159d.js} +1 -1
  56. package/dist/esm/index-a7d3d3f1.js +4 -0
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/esm/{pesquisa-fetcher-24e5bba0.js → pesquisa-fetcher-c437c9b1.js} +176 -2
  59. package/dist/esm/pesquisa-grid_2.entry.js +122 -0
  60. package/dist/esm/sankhyablocks.js +1 -1
  61. package/dist/esm/snk-actions-button_5.entry.js +2 -2
  62. package/dist/esm/snk-application.entry.js +23 -8
  63. package/dist/esm/snk-attach.entry.js +2 -2
  64. package/dist/esm/snk-crud.entry.js +2 -2
  65. package/dist/esm/snk-data-exporter.entry.js +3 -3
  66. package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-d4ba54d7.js} +1 -1
  67. package/dist/esm/snk-data-unit.entry.js +2 -2
  68. package/dist/esm/snk-detail-view.entry.js +3 -3
  69. package/dist/esm/snk-grid.entry.js +3 -3
  70. package/dist/esm/{snk-guides-viewer-b740a1fe.js → snk-guides-viewer-3043422d.js} +2 -2
  71. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  72. package/dist/esm/snk-pesquisa.entry.js +105 -31
  73. package/dist/esm/snk-simple-crud.entry.js +3 -3
  74. package/dist/sankhyablocks/{p-c629c07a.entry.js → p-08242e3f.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-342eeb3b.js → p-0f3b2a32.js} +1 -1
  76. package/dist/sankhyablocks/{p-72a451c8.js → p-229c3615.js} +1 -1
  77. package/dist/sankhyablocks/{p-b619ee23.js → p-36598f95.js} +1 -1
  78. package/dist/sankhyablocks/{p-098f8cfa.entry.js → p-4895f6e4.entry.js} +1 -1
  79. package/dist/sankhyablocks/p-4be4cdac.js +6 -0
  80. package/dist/sankhyablocks/{p-47d24ac8.js → p-58fd3017.js} +1 -1
  81. package/dist/sankhyablocks/p-70cb4e36.entry.js +11 -0
  82. package/dist/sankhyablocks/{p-64ff0fb6.entry.js → p-73fc8ec5.entry.js} +1 -1
  83. package/dist/sankhyablocks/{p-50306605.entry.js → p-7d09f66c.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-53ae0296.entry.js → p-a33e803a.entry.js} +1 -1
  85. package/dist/sankhyablocks/{p-89da2953.entry.js → p-b299dc14.entry.js} +1 -1
  86. package/dist/sankhyablocks/p-badbd2ca.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-9a9681d1.entry.js → p-c9bd54e6.entry.js} +1 -1
  88. package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-e2bd42c0.entry.js} +1 -1
  89. package/dist/sankhyablocks/p-e8512d4b.entry.js +1 -0
  90. package/dist/sankhyablocks/{p-2b7432e8.entry.js → p-f71d043b.entry.js} +1 -1
  91. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  92. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  93. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +38 -0
  94. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +28 -0
  95. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +19 -0
  96. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +35 -1
  97. package/dist/types/components.d.ts +148 -13
  98. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +10 -1
  99. package/package.json +1 -1
  100. package/react/components.d.ts +2 -0
  101. package/react/components.js +2 -0
  102. package/react/components.js.map +1 -1
  103. package/dist/components/pesquisa-fetcher.js +0 -172
  104. package/dist/sankhyablocks/p-442367ab.entry.js +0 -11
  105. package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
  106. package/dist/sankhyablocks/p-e6683406.js +0 -6
@@ -5,8 +5,10 @@ import { C as ConfigStorage } from './ConfigStorage.js';
5
5
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
7
7
  import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher.js';
8
- import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
8
+ import { a as PesquisaFetcher } from './ISave.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
10
+ import { d as defineCustomElement$3 } from './pesquisa-grid2.js';
11
+ import { d as defineCustomElement$2 } from './pesquisa-tree2.js';
10
12
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
11
13
 
12
14
  class TotalsFetcher {
@@ -937,12 +939,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
937
939
  * Obtém as opções em componentes de pesquisa
938
940
  * Ex.: snk-config-options
939
941
  */
940
- async executeSearch(searchArgument, fieldName, dataUnit) {
942
+ async executeSearch(searchArgument, fieldName, dataUnit, ctxOptions) {
941
943
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
942
944
  if (!descriptor) ;
943
945
  else {
944
946
  const { mode, argument } = searchArgument;
945
- const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY } = descriptor.properties;
947
+ const { ENTITYNAME, CODEFIELD, DESCRIPTIONFIELD, ROOTENTITY, DESCRIPTIONENTITY, ISHIERARCHYENTITY } = descriptor.properties;
946
948
  const dependencies = descriptor.dependencies;
947
949
  let criteria;
948
950
  const searchOptions = {
@@ -972,7 +974,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
972
974
  }
973
975
  }
974
976
  });
975
- return this.executePreparedSearch(mode, argument, { entity: ENTITYNAME, entityDescription: DESCRIPTIONENTITY, criteria, searchOptions });
977
+ const allowsNonAnalytic = ctxOptions === null || ctxOptions === void 0 ? void 0 : ctxOptions.allowsNonAnalytic;
978
+ const options = {
979
+ entity: ENTITYNAME,
980
+ entityDescription: DESCRIPTIONENTITY,
981
+ isHierarchyEntity: ISHIERARCHYENTITY,
982
+ criteria,
983
+ searchOptions,
984
+ allowsNonAnalytic
985
+ };
986
+ return this.executePreparedSearch(mode, argument, options);
976
987
  }
977
988
  }
978
989
  filterInvalidFields(resp, item, mdByName) {
@@ -1022,13 +1033,19 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1022
1033
  */
1023
1034
  async executePreparedSearch(mode, argument, options) {
1024
1035
  const mdByName = {};
1025
- const { entity, entityDescription, criteria, searchOptions } = options;
1036
+ const { entity, entityDescription, criteria, searchOptions, isHierarchyEntity, allowsNonAnalytic } = options;
1026
1037
  if (mode === "ADVANCED") {
1027
1038
  return new Promise((accept, reject) => {
1028
1039
  const pesquisaContent = document.createElement("snk-pesquisa");
1029
1040
  pesquisaContent[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME] = `entity_${entity}`;
1041
+ pesquisaContent.entityName = entity;
1030
1042
  pesquisaContent.argument = argument;
1031
1043
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(entity, text, criteria, searchOptions);
1044
+ pesquisaContent.isHierarchyEntity = isHierarchyEntity;
1045
+ if (isHierarchyEntity) {
1046
+ pesquisaContent.treeLoader = (text) => this.pesquisaFetcher.loadTree(entity, text, criteria, searchOptions);
1047
+ pesquisaContent.allowsNonAnalytic = allowsNonAnalytic;
1048
+ }
1032
1049
  pesquisaContent.selectItem = (option) => {
1033
1050
  accept(option);
1034
1051
  this.clearPopUpTitle();
@@ -1336,8 +1353,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1336
1353
  this._errorHandler = new SnkErrorHandler(this);
1337
1354
  this.messagesBuilder = new SnkMessageBuilder();
1338
1355
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
1339
- ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
1340
- return this.executeSearch(searchArgument, fieldName, dataUnit);
1356
+ ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit, ctxOptions) => {
1357
+ return this.executeSearch(searchArgument, fieldName, dataUnit, ctxOptions);
1341
1358
  });
1342
1359
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
1343
1360
  this.registerPkChangeListener();
@@ -1558,13 +1575,23 @@ function defineCustomElement() {
1558
1575
  if (typeof customElements === "undefined") {
1559
1576
  return;
1560
1577
  }
1561
- const components = ["snk-application", "snk-pesquisa"];
1578
+ const components = ["snk-application", "pesquisa-grid", "pesquisa-tree", "snk-pesquisa"];
1562
1579
  components.forEach(tagName => { switch (tagName) {
1563
1580
  case "snk-application":
1564
1581
  if (!customElements.get(tagName)) {
1565
1582
  customElements.define(tagName, SnkApplication);
1566
1583
  }
1567
1584
  break;
1585
+ case "pesquisa-grid":
1586
+ if (!customElements.get(tagName)) {
1587
+ defineCustomElement$3();
1588
+ }
1589
+ break;
1590
+ case "pesquisa-tree":
1591
+ if (!customElements.get(tagName)) {
1592
+ defineCustomElement$2();
1593
+ }
1594
+ break;
1568
1595
  case "snk-pesquisa":
1569
1596
  if (!customElements.get(tagName)) {
1570
1597
  defineCustomElement$1();
@@ -1,7 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
3
  import { D as DataFetcher } from './DataFetcher.js';
4
- import './pesquisa-fetcher.js';
5
4
  import { S as SaveErrorsEnum } from './ISave.js';
6
5
  import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher.js';
7
6
  import './filter-item-type.enum.js';
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
4
4
  import './DataFetcher.js';
5
- import './pesquisa-fetcher.js';
6
5
  import { P as PresentationMode } from './ISave.js';
7
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
7
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -1,11 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './ISave.js';
4
+ import { D as DataExporterOption, b as DataExporterType, c as DataExporterFormat } from './ISave.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
6
6
  import { D as DataFetcher } from './DataFetcher.js';
7
7
  import { S as SnkDataUnit } from './snk-data-unit2.js';
8
- import './pesquisa-fetcher.js';
9
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
10
  import './dataunit-fetcher.js';
@@ -3,7 +3,6 @@ import { Action, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
4
4
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
5
  import './DataFetcher.js';
6
- import './pesquisa-fetcher.js';
7
6
  import { P as PresentationMode } from './ISave.js';
8
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -7,7 +7,6 @@ import { C as CommonsExporter, T as TaskbarProcessor, S as SnkMultiSelectionList
7
7
  import { s as store } from './index2.js';
8
8
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
9
9
  import './DataFetcher.js';
10
- import './pesquisa-fetcher.js';
11
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
12
  import './dataunit-fetcher.js';
@@ -1,7 +1,17 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ObjectUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { a as PesquisaFetcher, d as buildGridMetadata } from './ISave.js';
4
+ import './DataFetcher.js';
5
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
6
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
7
+ import './dataunit-fetcher.js';
8
+ import './filter-item-type.enum.js';
9
+ import './form-config-fetcher.js';
10
+ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
11
+ import { d as defineCustomElement$2 } from './pesquisa-grid2.js';
12
+ import { d as defineCustomElement$1 } from './pesquisa-tree2.js';
3
13
 
4
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
14
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--color-secondary:var(--text--secondary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--medium, 12px);height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records-label.sc-snk-pesquisa{display:flex;flex-direction:row;justify-content:space-between;font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__records.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color)}.snk-pesquisa__records-limit.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color-secondary)}.snk-pesquisa__records-limit.hidden.sc-snk-pesquisa,.snk-pesquisa__records.hidden.sc-snk-pesquisa{visibility:hidden}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
5
15
 
6
16
  const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
17
  constructor() {
@@ -16,11 +26,18 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
26
  this._changeDeboucingTimeout = null;
17
27
  this._limitCharsToSearch = 3;
18
28
  this._deboucingTime = 450;
29
+ this._gridDataSource = [];
30
+ this.pesquisaFetcher = new PesquisaFetcher();
19
31
  this._itemList = undefined;
20
32
  this._startLoading = false;
33
+ this._presentationMode = "list";
21
34
  this.searchLoader = undefined;
35
+ this.treeLoader = undefined;
22
36
  this.selectItem = undefined;
37
+ this.entityName = undefined;
23
38
  this.argument = undefined;
39
+ this.isHierarchyEntity = false;
40
+ this.allowsNonAnalytic = false;
24
41
  }
25
42
  observeArgument() {
26
43
  if (this._textInput) {
@@ -58,36 +75,42 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
58
75
  this._startLoading = true;
59
76
  this.searchLoader(argument)
60
77
  .then((resp) => {
78
+ if (!resp)
79
+ return;
80
+ this.processSearchResponse(resp);
81
+ }).finally(() => {
61
82
  this._startLoading = false;
62
- if (resp) {
63
- resp = ObjectUtils.stringToObject(resp.json.$);
64
- let descriptionField = resp.descriptionField;
65
- let pkField = resp.pkField;
66
- if (pkField) {
67
- let newItemList = [];
68
- resp.data.forEach((item) => {
69
- var _a;
70
- let fieldsMetadata = this.filterFieldsMetadata(resp, item);
71
- let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
72
- let exibitionItem = {
73
- key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
74
- title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : "",
75
- details: this.buildDetails(fields, item)
76
- };
77
- newItemList.push(exibitionItem);
78
- });
79
- this._itemList = newItemList;
80
- }
81
- }
82
- }).catch((error) => {
83
- this._startLoading = false;
84
- this._itemList = [];
85
- console.warn(error);
86
83
  });
87
84
  }
88
85
  }
86
+ processSearchResponse(resp) {
87
+ resp = ObjectUtils.stringToObject(resp.json.$);
88
+ let descriptionField = resp.descriptionField;
89
+ let pkField = resp.pkField;
90
+ if (!pkField)
91
+ return;
92
+ this._gridMetadata = buildGridMetadata(resp);
93
+ this._gridDataSource = [...resp.data];
94
+ this._pkField = pkField;
95
+ this._descriptionField = descriptionField;
96
+ this._itemList = this.buildCardItemList(resp, pkField, descriptionField);
97
+ }
98
+ buildCardItemList(resp, pkField, descriptionField) {
99
+ var _a;
100
+ let newItemList = (_a = resp.data) === null || _a === void 0 ? void 0 : _a.map((item) => {
101
+ var _a;
102
+ let fieldsMetadata = this.filterFieldsMetadata(resp, item);
103
+ let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
104
+ return {
105
+ key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
106
+ title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : '',
107
+ details: this.buildDetails(fields, item),
108
+ };
109
+ });
110
+ return newItemList;
111
+ }
89
112
  filterFieldsMetadata(resp, item) {
90
- let fieldsMetadata = resp.fieldsMetadata.filter((field) => {
113
+ return resp.fieldsMetadata.filter((field) => {
91
114
  let accept = !StringUtils.isEmpty(item[field.fieldName]) &&
92
115
  field.visible !== false &&
93
116
  field.type !== 'B' &&
@@ -104,7 +127,6 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
104
127
  }
105
128
  return accept;
106
129
  });
107
- return fieldsMetadata;
108
130
  }
109
131
  removeAtIndex(array, index) {
110
132
  if (index >= 0 && index < array.length) {
@@ -262,6 +284,7 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
262
284
  this.selectItem(option);
263
285
  }
264
286
  onChangeValue(event) {
287
+ var _a;
265
288
  this.clearDeboucingTimeout();
266
289
  if (this._startLoading) {
267
290
  this._changeDeboucingTimeout = setTimeout(() => {
@@ -270,6 +293,10 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
270
293
  return;
271
294
  }
272
295
  this.argument = (event.detail || "").trim();
296
+ if (this.isHierarchyEntity && this._presentationMode === 'list') {
297
+ (_a = this._pesquisaTree) === null || _a === void 0 ? void 0 : _a.applyFilter();
298
+ return;
299
+ }
273
300
  const argumentNumber = this.getArgumentNumber();
274
301
  if (this.argument && (!isNaN(argumentNumber) || this.argument.length >= this._limitCharsToSearch)) {
275
302
  this._changeDeboucingTimeout = setTimeout(() => {
@@ -300,16 +327,59 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
300
327
  : 'Nenhum registro encontrado'
301
328
  : 'Os resultados de sua pesquisa aparecerão aqui...';
302
329
  }
303
- componentDidLoad() {
330
+ async componentWillLoad() {
331
+ const mode = await this.pesquisaFetcher.loadPresentationConfig(this.entityName);
332
+ this._presentationMode = mode === 'list' ? 'list' : 'table';
333
+ }
334
+ async componentDidLoad() {
304
335
  ElementIDUtils.addIDInfo(this._element);
305
336
  }
337
+ async onClickList() {
338
+ this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
339
+ await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
340
+ }
341
+ enableListButton() {
342
+ var _a;
343
+ return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
344
+ }
345
+ //Os limites de exibição são diferentes para lista e grade
346
+ hideLimitMessage() {
347
+ if (!this._itemList)
348
+ return true;
349
+ if (this._presentationMode === "list") {
350
+ if (this.isHierarchyEntity)
351
+ return true;
352
+ return this._itemList.length <= 100;
353
+ }
354
+ return this._itemList.length <= 150;
355
+ }
356
+ hideRecordsMessage() {
357
+ return (this._presentationMode === "list" && this.isHierarchyEntity);
358
+ }
359
+ renderContent() {
360
+ if (!this._itemList)
361
+ return;
362
+ if (this._presentationMode === 'list') {
363
+ return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
364
+ }
365
+ return this.renderPesquisaGrid();
366
+ }
367
+ renderTree() {
368
+ return h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
369
+ }
370
+ renderCards() {
371
+ return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
372
+ return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
373
+ }))));
374
+ }
375
+ renderPesquisaGrid() {
376
+ return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
377
+ }
306
378
  render() {
307
379
  var _a;
308
380
  return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument, "data-element-id": "searchInput" }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
309
381
  ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
310
- : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
311
- return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
312
- })))));
382
+ : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this._presentationMode === 'list' ? 'table' : 'list', title: this._presentationMode === 'list' ? 'Modo grade' : 'Modo lista', onClick: async () => await this.onClickList(), enabled: this.enableListButton() })), h("div", { class: "snk-pesquisa__records-label" }, h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), h("div", { class: "snk-pesquisa__content" }, this.renderContent()))));
313
383
  }
314
384
  get _element() { return this; }
315
385
  static get watchers() { return {
@@ -318,22 +388,37 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
318
388
  static get style() { return snkPesquisaCss; }
319
389
  }, [2, "snk-pesquisa", {
320
390
  "searchLoader": [16],
391
+ "treeLoader": [16],
321
392
  "selectItem": [16],
393
+ "entityName": [1, "entity-name"],
322
394
  "argument": [1025],
395
+ "isHierarchyEntity": [4, "is-hierarchy-entity"],
396
+ "allowsNonAnalytic": [4, "allows-non-analytic"],
323
397
  "_itemList": [32],
324
- "_startLoading": [32]
398
+ "_startLoading": [32],
399
+ "_presentationMode": [32]
325
400
  }]);
326
401
  function defineCustomElement() {
327
402
  if (typeof customElements === "undefined") {
328
403
  return;
329
404
  }
330
- const components = ["snk-pesquisa"];
405
+ const components = ["snk-pesquisa", "pesquisa-grid", "pesquisa-tree"];
331
406
  components.forEach(tagName => { switch (tagName) {
332
407
  case "snk-pesquisa":
333
408
  if (!customElements.get(tagName)) {
334
409
  customElements.define(tagName, SnkPesquisa);
335
410
  }
336
411
  break;
412
+ case "pesquisa-grid":
413
+ if (!customElements.get(tagName)) {
414
+ defineCustomElement$2();
415
+ }
416
+ break;
417
+ case "pesquisa-tree":
418
+ if (!customElements.get(tagName)) {
419
+ defineCustomElement$1();
420
+ }
421
+ break;
337
422
  } });
338
423
  }
339
424
 
@@ -4,9 +4,8 @@ import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
5
5
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
6
6
  import './DataFetcher.js';
7
- import './pesquisa-fetcher.js';
8
- import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, c as ContinuousInsertUtils, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './ContinuousInsertUtils.js';
9
7
  import { D as DataExporterOption, P as PresentationMode } from './ISave.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, c as ContinuousInsertUtils, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './ContinuousInsertUtils.js';
10
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
11
  import { I as InMemoryLoader } from './dataunit-fetcher.js';
@@ -1,8 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import './DataFetcher.js';
3
- import './pesquisa-fetcher.js';
4
- import '@sankhyalabs/core';
5
3
  import './ISave.js';
4
+ import '@sankhyalabs/core';
6
5
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
6
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
7
  import './dataunit-fetcher.js';
@@ -1,5 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
3
+ import { d as defineCustomElement$5 } from './pesquisa-grid2.js';
4
+ import { d as defineCustomElement$4 } from './pesquisa-tree2.js';
3
5
  import { d as defineCustomElement$3 } from './snk-application2.js';
4
6
  import { d as defineCustomElement$2 } from './snk-pesquisa2.js';
5
7
 
@@ -37,13 +39,23 @@ function defineCustomElement$1() {
37
39
  if (typeof customElements === "undefined") {
38
40
  return;
39
41
  }
40
- const components = ["teste-pesquisa", "snk-application", "snk-pesquisa"];
42
+ const components = ["teste-pesquisa", "pesquisa-grid", "pesquisa-tree", "snk-application", "snk-pesquisa"];
41
43
  components.forEach(tagName => { switch (tagName) {
42
44
  case "teste-pesquisa":
43
45
  if (!customElements.get(tagName)) {
44
46
  customElements.define(tagName, TestePesquisa$1);
45
47
  }
46
48
  break;
49
+ case "pesquisa-grid":
50
+ if (!customElements.get(tagName)) {
51
+ defineCustomElement$5();
52
+ }
53
+ break;
54
+ case "pesquisa-tree":
55
+ if (!customElements.get(tagName)) {
56
+ defineCustomElement$4();
57
+ }
58
+ break;
47
59
  case "snk-application":
48
60
  if (!customElements.get(tagName)) {
49
61
  defineCustomElement$3();
@@ -1,11 +1,11 @@
1
1
  import { D as DataFetcher } from './DataFetcher-5034df59.js';
2
- import './pesquisa-fetcher-24e5bba0.js';
2
+ import './pesquisa-fetcher-c437c9b1.js';
3
3
  import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
4
4
  import './index-3aa4977a.js';
5
5
  import './ISave-d8c8bc59.js';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
7
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
- import { P as PreloadManager } from './dataunit-fetcher-56cb648b.js';
8
+ import { P as PreloadManager } from './dataunit-fetcher-481e159d.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
10
  import './form-config-fetcher-0c2620ef.js';
11
11
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
@@ -247,7 +247,7 @@ function buildLoadDataResponse(recordsIn, dataUnit, request) {
247
247
  };
248
248
  return Promise.resolve({
249
249
  records: getPagesByRecords(records, offset, limit),
250
- paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
250
+ paginationInfo: dataUnit.pageSize ? buildPaginationInfo(paginationInfoBuilderParams) : undefined,
251
251
  });
252
252
  }
253
253
  function applySorting(records, dataUnit, sorting) {
@@ -2158,6 +2158,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2158
2158
  return import(
2159
2159
  /* webpackMode: "lazy" */
2160
2160
  './snk-filter-modal-item.entry.js').then(processMod, consoleError);
2161
+ case 'pesquisa-grid_2':
2162
+ return import(
2163
+ /* webpackMode: "lazy" */
2164
+ './pesquisa-grid_2.entry.js').then(processMod, consoleError);
2161
2165
  case 'snk-attach':
2162
2166
  return import(
2163
2167
  /* webpackMode: "lazy" */