@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-80932.1 → 0.0.0-bugfix-dev-KB-81146.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/cjs/{ContinuousInsertUtils-54d44192.js → ContinuousInsertUtils-6e536e37.js} +1 -1
  2. package/dist/cjs/{SnkFormConfigManager-ae3185b2.js → SnkFormConfigManager-07f747be.js} +6 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{pesquisa-fetcher-f3454c23.js → pesquisa-fetcher-3b86b6c4.js} +6 -1
  5. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +33 -11
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-actions-button_5.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +13 -15
  9. package/dist/cjs/snk-attach.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-config-options_3.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
  14. package/dist/cjs/snk-grid.cjs.entry.js +5 -2
  15. package/dist/cjs/{snk-guides-viewer-ea5d0907.js → snk-guides-viewer-84cb012b.js} +2 -2
  16. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-pesquisa.cjs.entry.js +20 -28
  18. package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
  19. package/dist/collection/components/snk-application/snk-application.js +12 -14
  20. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -4
  21. package/dist/collection/components/snk-grid/snk-grid.js +15 -0
  22. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +0 -1
  23. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +41 -5
  24. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +4 -1
  25. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +36 -7
  26. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +6 -0
  27. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +6 -0
  28. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +21 -28
  29. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +0 -1
  30. package/dist/components/ISave.js +7 -2
  31. package/dist/components/SnkFormConfigManager.js +6 -4
  32. package/dist/components/pesquisa-grid2.js +21 -6
  33. package/dist/components/pesquisa-tree2.js +15 -6
  34. package/dist/components/snk-application2.js +12 -14
  35. package/dist/components/snk-grid2.js +4 -0
  36. package/dist/components/snk-pesquisa2.js +22 -29
  37. package/dist/esm/{ContinuousInsertUtils-25e7bd9a.js → ContinuousInsertUtils-91011e01.js} +1 -1
  38. package/dist/esm/{SnkFormConfigManager-b65e6db0.js → SnkFormConfigManager-1ff928fa.js} +6 -4
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/{pesquisa-fetcher-0af41f09.js → pesquisa-fetcher-767abffa.js} +7 -2
  41. package/dist/esm/pesquisa-grid_2.entry.js +33 -11
  42. package/dist/esm/sankhyablocks.js +1 -1
  43. package/dist/esm/snk-actions-button_5.entry.js +1 -1
  44. package/dist/esm/snk-application.entry.js +13 -15
  45. package/dist/esm/snk-attach.entry.js +1 -1
  46. package/dist/esm/snk-config-options_3.entry.js +1 -1
  47. package/dist/esm/snk-crud.entry.js +1 -1
  48. package/dist/esm/snk-data-exporter.entry.js +1 -1
  49. package/dist/esm/snk-detail-view.entry.js +3 -3
  50. package/dist/esm/snk-grid.entry.js +5 -2
  51. package/dist/esm/{snk-guides-viewer-830f5fb9.js → snk-guides-viewer-45ee10ff.js} +2 -2
  52. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  53. package/dist/esm/snk-pesquisa.entry.js +20 -28
  54. package/dist/esm/snk-simple-crud.entry.js +3 -3
  55. package/dist/sankhyablocks/p-035c63df.entry.js +1 -0
  56. package/dist/sankhyablocks/{p-469384a2.entry.js → p-03e37897.entry.js} +1 -1
  57. package/dist/sankhyablocks/{p-f975370f.entry.js → p-0d86c004.entry.js} +1 -1
  58. package/dist/sankhyablocks/{p-54f5354a.entry.js → p-0e6874ca.entry.js} +1 -1
  59. package/dist/sankhyablocks/{p-f258690a.entry.js → p-1bab295e.entry.js} +1 -1
  60. package/dist/sankhyablocks/{p-d92d4f91.entry.js → p-1c2d8a9a.entry.js} +1 -1
  61. package/dist/sankhyablocks/p-4fe8bb73.js +6 -0
  62. package/dist/sankhyablocks/{p-171b7623.js → p-6cfa8913.js} +1 -1
  63. package/dist/sankhyablocks/{p-8bd86610.entry.js → p-6e0adddc.entry.js} +1 -1
  64. package/dist/sankhyablocks/{p-0cda2226.entry.js → p-853074f4.entry.js} +3 -3
  65. package/dist/sankhyablocks/p-8f6e3ebe.entry.js +1 -0
  66. package/dist/sankhyablocks/{p-254c59d2.entry.js → p-935aa4fa.entry.js} +1 -1
  67. package/dist/sankhyablocks/p-aaef93e8.js +1 -0
  68. package/dist/sankhyablocks/{p-09067bee.entry.js → p-dd7fb984.entry.js} +1 -1
  69. package/dist/sankhyablocks/p-e74eb86d.entry.js +1 -0
  70. package/dist/sankhyablocks/{p-8a1ee5b5.js → p-ee759111.js} +1 -1
  71. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  72. package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
  73. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +11 -5
  74. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +8 -4
  75. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +6 -1
  76. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +5 -6
  77. package/dist/types/components.d.ts +19 -2
  78. package/package.json +1 -1
  79. package/dist/sankhyablocks/p-05b6ff91.js +0 -1
  80. package/dist/sankhyablocks/p-422eb699.entry.js +0 -1
  81. package/dist/sankhyablocks/p-618a29ed.entry.js +0 -1
  82. package/dist/sankhyablocks/p-798386c7.js +0 -6
  83. package/dist/sankhyablocks/p-a3803d7c.entry.js +0 -1
@@ -2,13 +2,13 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-ae3185b2.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-07f747be.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-68e34bf4.js');
8
8
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
9
9
  const constants = require('./constants-35ddd366.js');
10
10
  require('./DataFetcher-65879b2c.js');
11
- require('./pesquisa-fetcher-f3454c23.js');
11
+ require('./pesquisa-fetcher-3b86b6c4.js');
12
12
  const index$1 = require('./index-1dfc7a6e.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-ea5d0907.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-84cb012b.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-ae3185b2.js');
8
+ require('./SnkFormConfigManager-07f747be.js');
9
9
  require('./ConfigStorage-d024aec8.js');
10
10
  require('./form-config-fetcher-90126e4c.js');
11
11
  require('./DataFetcher-65879b2c.js');
@@ -18,7 +18,7 @@ require('./field-search-68e34bf4.js');
18
18
  require('./taskbar-elements-9ad1f9c0.js');
19
19
  require('./index-1dfc7a6e.js');
20
20
  require('./index-102ba62d.js');
21
- require('./pesquisa-fetcher-f3454c23.js');
21
+ require('./pesquisa-fetcher-3b86b6c4.js');
22
22
  require('./ISave-e91b70a7.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
24
24
  require('./dataunit-fetcher-8ea97d88.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const pesquisaFetcher = require('./pesquisa-fetcher-f3454c23.js');
7
+ const pesquisaFetcher = require('./pesquisa-fetcher-3b86b6c4.js');
8
8
  require('./DataFetcher-65879b2c.js');
9
9
  require('./index-1dfc7a6e.js');
10
10
  require('./ISave-e91b70a7.js');
@@ -13,13 +13,12 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
13
13
  require('./dataunit-fetcher-8ea97d88.js');
14
14
  require('./filter-item-type.enum-a7ffdaa6.js');
15
15
  require('./form-config-fetcher-90126e4c.js');
16
- const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
17
16
  require('./PrintUtils-bcaeb82f.js');
18
17
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
19
18
  require('@sankhyalabs/core/dist/utils/SortingUtils');
20
19
  require('./ResourceIDUtils-5ff86aa7.js');
21
20
 
22
- 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)}";
21
+ 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);height:100vh}.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)}.snk-pesquisa__cards-container.sc-snk-pesquisa{height:100%;overflow-y:auto}";
23
22
 
24
23
  const SnkPesquisa = class {
25
24
  constructor(hostRef) {
@@ -38,6 +37,7 @@ const SnkPesquisa = class {
38
37
  this._itemList = undefined;
39
38
  this._startLoading = false;
40
39
  this._presentationMode = "list";
40
+ this._currentView = undefined;
41
41
  this.searchLoader = undefined;
42
42
  this.treeLoader = undefined;
43
43
  this.selectItem = undefined;
@@ -340,14 +340,23 @@ const SnkPesquisa = class {
340
340
  }
341
341
  async componentDidLoad() {
342
342
  core.ElementIDUtils.addIDInfo(this._element);
343
+ await this.chooseViewMode();
343
344
  }
344
- async onClickList() {
345
+ async handleChangeViewMode() {
345
346
  this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
347
+ await this.chooseViewMode();
346
348
  await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
347
349
  }
348
- enableListButton() {
349
- var _a;
350
- return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
350
+ async chooseViewMode() {
351
+ var _a, _b;
352
+ if (this._presentationMode !== 'list') {
353
+ await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(pesquisaFetcher.PESQUISA_VIEW_MODE.GRID));
354
+ this._currentView = pesquisaFetcher.PESQUISA_VIEW_MODE.GRID;
355
+ return;
356
+ }
357
+ const view = this.isHierarchyEntity ? pesquisaFetcher.PESQUISA_VIEW_MODE.TREE : pesquisaFetcher.PESQUISA_VIEW_MODE.CARDS;
358
+ await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
359
+ this._currentView = view;
351
360
  }
352
361
  //Os limites de exibição são diferentes para lista e grade
353
362
  hideLimitMessage() {
@@ -381,30 +390,13 @@ const SnkPesquisa = class {
381
390
  title: 'Modo lista',
382
391
  };
383
392
  }
384
- renderContent() {
385
- if (!this._itemList)
386
- return;
387
- if (this._presentationMode === 'list') {
388
- return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
389
- }
390
- return this.renderPesquisaGrid();
391
- }
392
- renderTree() {
393
- return index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
394
- }
395
- renderCards() {
396
- return (index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
397
- return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
398
- }))));
399
- }
400
- renderPesquisaGrid() {
401
- return index.h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
402
- }
403
393
  render() {
404
- var _a;
394
+ var _a, _b;
405
395
  return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.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" }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
406
396
  ? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
407
- : undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), index.h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.onClickList(), enabled: this.enableListButton() })), index.h("div", { class: "snk-pesquisa__records-label" }, index.h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), index.h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), index.h("div", { class: "snk-pesquisa__content" }, this.renderContent()))));
397
+ : undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), index.h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.handleChangeViewMode() })), index.h("div", { class: "snk-pesquisa__records-label" }, index.h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), index.h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), index.h("div", { class: "snk-pesquisa__content" }, index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === pesquisaFetcher.PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), index.h("stack-item", null, index.h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
398
+ return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
399
+ }))), index.h("stack-item", null, index.h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === pesquisaFetcher.PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
408
400
  }
409
401
  get _element() { return index.getElement(this); }
410
402
  static get watchers() { return {
@@ -8,8 +8,8 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
10
  require('./DataFetcher-65879b2c.js');
11
- require('./pesquisa-fetcher-f3454c23.js');
12
- const ContinuousInsertUtils = require('./ContinuousInsertUtils-54d44192.js');
11
+ require('./pesquisa-fetcher-3b86b6c4.js');
12
+ const ContinuousInsertUtils = require('./ContinuousInsertUtils-6e536e37.js');
13
13
  const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
@@ -19,7 +19,7 @@ require('./filter-item-type.enum-a7ffdaa6.js');
19
19
  const formConfigFetcher = require('./form-config-fetcher-90126e4c.js');
20
20
  const fieldSearch = require('./field-search-68e34bf4.js');
21
21
  const ConfigStorage = require('./ConfigStorage-d024aec8.js');
22
- const SnkFormConfigManager = require('./SnkFormConfigManager-ae3185b2.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-07f747be.js');
23
23
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
24
24
  const index$2 = require('./index-102ba62d.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
@@ -1063,7 +1063,7 @@ export class SnkApplication {
1063
1063
  try {
1064
1064
  await this.checkTimeoutLimitLockManager();
1065
1065
  await LockManager.whenHasLock(this._element, LockManagerOperation.APP_LOADING);
1066
- await LockManager.whenResolve(this._element, LockManagerOperation.APP_LOADING, 1200);
1066
+ await LockManager.whenResolve(this._element, LockManagerOperation.APP_LOADING, 200);
1067
1067
  await LockManager.resetLocks(this._element, LockManagerOperation.APP_LOADING);
1068
1068
  this._applicationReady = true;
1069
1069
  }
@@ -1103,19 +1103,17 @@ export class SnkApplication {
1103
1103
  }
1104
1104
  // TODO: Etapa 2 - implementar template de loading
1105
1105
  renderLoadingSkeleton(template) {
1106
- if (this.enableLockManagerLoadingApp) {
1107
- if (!this._isBrowserTypeElectron) {
1108
- switch (template) {
1109
- case TEMPLATES_LOADING_SKELETON.APPLICATION:
1110
- case TEMPLATES_LOADING_SKELETON.GRID:
1111
- return this.getSkeletonTemplateApplication();
1112
- default:
1113
- return this.getSkeletonTemplateApplication();
1114
- }
1115
- }
1116
- else {
1117
- return this.getSpinnerLoadingDefault();
1118
- }
1106
+ if (!this.enableLockManagerLoadingApp)
1107
+ return;
1108
+ if (this._isBrowserTypeElectron) {
1109
+ return this.getSpinnerLoadingDefault();
1110
+ }
1111
+ switch (template) {
1112
+ case TEMPLATES_LOADING_SKELETON.APPLICATION:
1113
+ case TEMPLATES_LOADING_SKELETON.GRID:
1114
+ return this.getSkeletonTemplateApplication();
1115
+ default:
1116
+ return this.getSkeletonTemplateApplication();
1119
1117
  }
1120
1118
  }
1121
1119
  getLoadingVisibilityStyle() {
@@ -87,13 +87,15 @@ export class SnkFormConfigManager {
87
87
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
88
88
  const hasConfig = this.hasConfig();
89
89
  if (hasConfig && !forceEmptyConfig) {
90
- return fields.map(({ label, name, readOnly, visible, required, tab }) => {
90
+ return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
91
91
  var _a;
92
92
  if (label == undefined) {
93
93
  const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
94
- return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
94
+ if (!currentField)
95
+ return;
96
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
95
97
  }
96
- return { name, label, readOnly, visible, required, tab };
98
+ return { name, label, readOnly, visible, required, tab, group };
97
99
  })
98
100
  .filter(field => this.isFieldVisible(field, descriptionFilter));
99
101
  }
@@ -106,7 +108,7 @@ export class SnkFormConfigManager {
106
108
  return filteredFields;
107
109
  }
108
110
  isFieldVisible(field, descriptionFilter) {
109
- if (field.visible === false) {
111
+ if (field === undefined || field.visible === false) {
110
112
  return false;
111
113
  }
112
114
  if (descriptionFilter == undefined) {
@@ -77,6 +77,9 @@ export class SnkGrid {
77
77
  this.enableGridInsert = false;
78
78
  this.outlineMode = false;
79
79
  }
80
+ reloadConfig() {
81
+ this.loadConfig();
82
+ }
80
83
  /**
81
84
  * Exibe a janela de configurações da grade.
82
85
  */
@@ -1030,6 +1033,18 @@ export class SnkGrid {
1030
1033
  }
1031
1034
  static get methods() {
1032
1035
  return {
1036
+ "reloadConfig": {
1037
+ "complexType": {
1038
+ "signature": "() => Promise<void>",
1039
+ "parameters": [],
1040
+ "references": {},
1041
+ "return": "Promise<void>"
1042
+ },
1043
+ "docs": {
1044
+ "text": "",
1045
+ "tags": []
1046
+ }
1047
+ },
1033
1048
  "showConfig": {
1034
1049
  "complexType": {
1035
1050
  "signature": "() => Promise<void>",
@@ -1,5 +1,4 @@
1
1
  :host {
2
- height: 100vh;
3
2
  background: var(--background--xlight, #FFF);
4
3
  overflow-x: auto;
5
4
  }
@@ -9,21 +9,31 @@ export class PesquisaGrid {
9
9
  this.pkField = undefined;
10
10
  this.descriptionField = undefined;
11
11
  this.entityName = undefined;
12
+ this.shouldLoadConfig = false;
13
+ this._gridConfig = undefined;
12
14
  this._inMemoryLoader = undefined;
13
15
  this._dataunit = undefined;
14
- this._gridConfig = undefined;
15
16
  }
16
17
  observeDataSource(newValue) {
17
18
  if (!this._inMemoryLoader || !this._dataunit || !newValue)
18
19
  return;
19
20
  this._inMemoryLoader.records = [...newValue];
20
21
  }
21
- async componentWillLoad() {
22
+ observeMetadata() {
22
23
  this.initializeDataUnit();
24
+ }
25
+ async observeShouldLoadConfig(newValue) {
26
+ if (!newValue || this._gridConfig)
27
+ return;
28
+ await this.loadGridConfig();
29
+ }
30
+ async loadGridConfig() {
23
31
  this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
24
32
  }
25
33
  initializeDataUnit() {
26
34
  var _a;
35
+ if (!this.metadata)
36
+ return;
27
37
  this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
28
38
  this._dataunit = this._inMemoryLoader.dataUnit;
29
39
  this._dataunit.pageSize = 0;
@@ -41,6 +51,8 @@ export class PesquisaGrid {
41
51
  await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
42
52
  }
43
53
  render() {
54
+ if (!this.metadata || !this._dataunit)
55
+ return;
44
56
  return (h(Host, null, h("ez-grid", { dataUnit: this._dataunit, config: this._gridConfig, canEdit: false, suppressCheckboxColumn: true, compact: true, autoFocus: false, onEzDoubleClick: ({ detail }) => this.handleDbClick(detail), onConfigChange: async (event) => this.handleConfigChanged(event) })));
45
57
  }
46
58
  static get is() { return "pesquisa-grid"; }
@@ -148,14 +160,32 @@ export class PesquisaGrid {
148
160
  },
149
161
  "attribute": "entity-name",
150
162
  "reflect": false
163
+ },
164
+ "shouldLoadConfig": {
165
+ "type": "boolean",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "boolean",
169
+ "resolved": "boolean",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "Define se deve carregar configura\u00E7\u00F5es da grade"
177
+ },
178
+ "attribute": "should-load-config",
179
+ "reflect": false,
180
+ "defaultValue": "false"
151
181
  }
152
182
  };
153
183
  }
154
184
  static get states() {
155
185
  return {
186
+ "_gridConfig": {},
156
187
  "_inMemoryLoader": {},
157
- "_dataunit": {},
158
- "_gridConfig": {}
188
+ "_dataunit": {}
159
189
  };
160
190
  }
161
191
  static get events() {
@@ -175,7 +205,7 @@ export class PesquisaGrid {
175
205
  "references": {
176
206
  "IOption": {
177
207
  "location": "import",
178
- "path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-combo-box/ez-combo-box"
208
+ "path": "@sankhyalabs/ezui/src/components/ez-search/ez-search"
179
209
  }
180
210
  }
181
211
  }
@@ -185,6 +215,12 @@ export class PesquisaGrid {
185
215
  return [{
186
216
  "propName": "dataSource",
187
217
  "methodName": "observeDataSource"
218
+ }, {
219
+ "propName": "metadata",
220
+ "methodName": "observeMetadata"
221
+ }, {
222
+ "propName": "shouldLoadConfig",
223
+ "methodName": "observeShouldLoadConfig"
188
224
  }];
189
225
  }
190
226
  }
@@ -8,8 +8,11 @@
8
8
 
9
9
  background: var(--background--xlight, #FFF);
10
10
  position: relative;
11
- display: inline-block;
12
11
  min-height: var(--snk-pesquisa--tree__min-height);
12
+
13
+ height: 100%;
14
+ display: block;
15
+ overflow-y: auto;
13
16
  }
14
17
 
15
18
  :host:hover .actions-container{
@@ -5,12 +5,20 @@ export class PesquisaTree {
5
5
  this.treeLoader = undefined;
6
6
  this.argument = undefined;
7
7
  this.allowsNonAnalytic = false;
8
+ this.shouldLoadTree = false;
8
9
  this.items = [];
9
10
  }
10
11
  async applyFilter() {
11
12
  await this._tree.applyFilter(this.argument);
12
13
  }
14
+ async observeShouldLoadTree(newValue) {
15
+ if (!newValue || this.items.length > 0)
16
+ return;
17
+ await this.loadTree();
18
+ }
13
19
  async loadTree() {
20
+ if (!this.shouldLoadTree)
21
+ return;
14
22
  if (!this.treeLoader || typeof this.treeLoader !== 'function')
15
23
  return;
16
24
  const response = await this.treeLoader((this.argument || '').trim());
@@ -39,16 +47,13 @@ export class PesquisaTree {
39
47
  };
40
48
  this.pesquisaTreeSelectItem.emit(option);
41
49
  }
42
- async componentWillLoad() {
43
- await this.loadTree();
44
- }
45
- renderEmptyMessate() {
50
+ renderEmptyMessage() {
46
51
  return (h("div", { class: "ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary" }, h("span", null, "Nenhum registro encontrado...")));
47
52
  }
48
53
  render() {
49
54
  var _a;
50
55
  return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
51
- this.renderEmptyMessate() :
56
+ this.renderEmptyMessage() :
52
57
  h(Fragment, null, h("div", { class: 'actions-container' }, h("ez-button", { size: 'small', mode: 'icon', class: 'ez-margin-right--small', iconName: 'show-list', title: "Expandir", onClick: () => this.handleExpandAll() }), h("ez-button", { size: 'small', mode: 'icon', iconName: 'hide-list', title: "Recolher", onClick: () => this.handleCloseAll() })), h("ez-tree", { ref: (element) => this._tree = element, onEzDbClickItem: ({ detail }) => this.handleDbClick(detail), items: this.items }))));
53
58
  }
54
59
  static get is() { return "pesquisa-tree"; }
@@ -80,7 +85,7 @@ export class PesquisaTree {
80
85
  },
81
86
  "ITreeItem": {
82
87
  "location": "import",
83
- "path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-tree/interfaces/ITreeItem"
88
+ "path": "@sankhyalabs/ezui/src/components/ez-tree/interfaces/ITreeItem"
84
89
  }
85
90
  }
86
91
  },
@@ -125,6 +130,24 @@ export class PesquisaTree {
125
130
  "attribute": "allows-non-analytic",
126
131
  "reflect": false,
127
132
  "defaultValue": "false"
133
+ },
134
+ "shouldLoadTree": {
135
+ "type": "boolean",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "boolean",
139
+ "resolved": "boolean",
140
+ "references": {}
141
+ },
142
+ "required": false,
143
+ "optional": false,
144
+ "docs": {
145
+ "tags": [],
146
+ "text": "Informa se a \u00E1rvore hier\u00E1rquica deve ou n\u00E3o ser carregada."
147
+ },
148
+ "attribute": "should-load-tree",
149
+ "reflect": false,
150
+ "defaultValue": "false"
128
151
  }
129
152
  };
130
153
  }
@@ -150,7 +173,7 @@ export class PesquisaTree {
150
173
  "references": {
151
174
  "IOption": {
152
175
  "location": "import",
153
- "path": "@sankhyalabs/ezui/.diststorybook/types/components/ez-combo-box/ez-combo-box"
176
+ "path": "@sankhyalabs/ezui/src/components/ez-search/ez-search"
154
177
  }
155
178
  }
156
179
  }
@@ -176,4 +199,10 @@ export class PesquisaTree {
176
199
  }
177
200
  };
178
201
  }
202
+ static get watchers() {
203
+ return [{
204
+ "propName": "shouldLoadTree",
205
+ "methodName": "observeShouldLoadTree"
206
+ }];
207
+ }
179
208
  }
@@ -87,3 +87,9 @@ export function parseGridConfig(rawConfig) {
87
87
  return undefined;
88
88
  return { columns };
89
89
  }
90
+ export var PESQUISA_VIEW_MODE;
91
+ (function (PESQUISA_VIEW_MODE) {
92
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
93
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
94
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
95
+ })(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
@@ -79,6 +79,7 @@
79
79
  /*public*/
80
80
  scrollbar-color: var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);
81
81
  padding-right: var(--snk-pesquisa__content--padding-right);
82
+ height: 100vh;
82
83
  }
83
84
 
84
85
  .snk-pesquisa__content::-webkit-scrollbar {
@@ -166,3 +167,8 @@
166
167
  /*public*/
167
168
  color: var(--snk-pesquisa__btn-hover--color);
168
169
  }
170
+
171
+ .snk-pesquisa__cards-container{
172
+ height: 100%;
173
+ overflow-y: auto;
174
+ }
@@ -1,8 +1,7 @@
1
1
  import { ElementIDUtils, ObjectUtils, StringUtils } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
- import { buildGridMetadata } from './pesquisaHelper';
3
+ import { buildGridMetadata, PESQUISA_VIEW_MODE } from './pesquisaHelper';
4
4
  import { PesquisaFetcher } from '../../lib';
5
- import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
6
5
  export class SnkPesquisa {
7
6
  constructor() {
8
7
  this._mdByName = {};
@@ -19,6 +18,7 @@ export class SnkPesquisa {
19
18
  this._itemList = undefined;
20
19
  this._startLoading = false;
21
20
  this._presentationMode = "list";
21
+ this._currentView = undefined;
22
22
  this.searchLoader = undefined;
23
23
  this.treeLoader = undefined;
24
24
  this.selectItem = undefined;
@@ -321,14 +321,23 @@ export class SnkPesquisa {
321
321
  }
322
322
  async componentDidLoad() {
323
323
  ElementIDUtils.addIDInfo(this._element);
324
+ await this.chooseViewMode();
324
325
  }
325
- async onClickList() {
326
+ async handleChangeViewMode() {
326
327
  this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
328
+ await this.chooseViewMode();
327
329
  await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
328
330
  }
329
- enableListButton() {
330
- var _a;
331
- return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
331
+ async chooseViewMode() {
332
+ var _a, _b;
333
+ if (this._presentationMode !== 'list') {
334
+ await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(PESQUISA_VIEW_MODE.GRID));
335
+ this._currentView = PESQUISA_VIEW_MODE.GRID;
336
+ return;
337
+ }
338
+ const view = this.isHierarchyEntity ? PESQUISA_VIEW_MODE.TREE : PESQUISA_VIEW_MODE.CARDS;
339
+ await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
340
+ this._currentView = view;
332
341
  }
333
342
  //Os limites de exibição são diferentes para lista e grade
334
343
  hideLimitMessage() {
@@ -362,30 +371,13 @@ export class SnkPesquisa {
362
371
  title: 'Modo lista',
363
372
  };
364
373
  }
365
- renderContent() {
366
- if (!this._itemList)
367
- return;
368
- if (this._presentationMode === 'list') {
369
- return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
370
- }
371
- return this.renderPesquisaGrid();
372
- }
373
- renderTree() {
374
- 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) }));
375
- }
376
- renderCards() {
377
- return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
378
- return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
379
- }))));
380
- }
381
- renderPesquisaGrid() {
382
- return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
383
- }
384
374
  render() {
385
- var _a;
375
+ var _a, _b;
386
376
  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)
387
377
  ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
388
- : 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.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, 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()))));
378
+ : 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.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.handleChangeViewMode() })), 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" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), h("stack-item", null, h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
379
+ return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
380
+ }))), h("stack-item", null, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
389
381
  }
390
382
  static get is() { return "snk-pesquisa"; }
391
383
  static get encapsulation() { return "scoped"; }
@@ -535,7 +527,8 @@ export class SnkPesquisa {
535
527
  return {
536
528
  "_itemList": {},
537
529
  "_startLoading": {},
538
- "_presentationMode": {}
530
+ "_presentationMode": {},
531
+ "_currentView": {}
539
532
  };
540
533
  }
541
534
  static get elementRef() { return "_element"; }
@@ -178,7 +178,6 @@ export class PesquisaFetcher {
178
178
  buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
179
179
  var _a, _b, _c;
180
180
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
181
- console.log("criteria: ", criteria);
182
181
  const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
183
182
  const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
184
183
  const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
@@ -89,6 +89,12 @@ function parseGridConfig(rawConfig) {
89
89
  return undefined;
90
90
  return { columns };
91
91
  }
92
+ var PESQUISA_VIEW_MODE;
93
+ (function (PESQUISA_VIEW_MODE) {
94
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
95
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
96
+ PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
97
+ })(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
92
98
 
93
99
  class PesquisaFetcher {
94
100
  constructor() {
@@ -266,7 +272,6 @@ class PesquisaFetcher {
266
272
  buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
267
273
  var _a, _b, _c;
268
274
  const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
269
- console.log("criteria: ", criteria);
270
275
  const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
271
276
  const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
272
277
  const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
@@ -389,4 +394,4 @@ var SaveErrorsEnum;
389
394
  SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
390
395
  })(SaveErrorsEnum || (SaveErrorsEnum = {}));
391
396
 
392
- export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d };
397
+ export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d, PESQUISA_VIEW_MODE as e };