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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) 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 +140 -17
  10. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-crud.cjs.entry.js +5 -4
  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-filter-bar_4.cjs.entry.js +21 -7
  17. package/dist/cjs/snk-grid.cjs.entry.js +6 -5
  18. package/dist/cjs/{snk-guides-viewer-421555af.js → snk-guides-viewer-575596a2.js} +2 -2
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-pesquisa.cjs.entry.js +105 -31
  21. package/dist/cjs/snk-simple-crud.cjs.entry.js +6 -5
  22. package/dist/collection/collection-manifest.json +2 -0
  23. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +4 -3
  24. package/dist/collection/components/snk-application/snk-application.css +34 -0
  25. package/dist/collection/components/snk-application/snk-application.js +197 -14
  26. package/dist/collection/components/snk-crud/snk-crud.js +39 -20
  27. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +40 -8
  28. package/dist/collection/components/snk-grid/snk-grid.js +39 -20
  29. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +10 -0
  30. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +190 -0
  31. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +25 -0
  32. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +173 -0
  33. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +89 -0
  34. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +24 -5
  35. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +168 -32
  36. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +39 -20
  37. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +1 -1
  38. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +89 -3
  39. package/dist/components/ContinuousInsertUtils.js +1 -2
  40. package/dist/components/ISave.js +346 -1
  41. package/dist/components/dataunit-fetcher.js +1 -1
  42. package/dist/components/index.d.ts +2 -0
  43. package/dist/components/index.js +2 -0
  44. package/dist/components/pesquisa-grid.d.ts +11 -0
  45. package/dist/components/pesquisa-grid.js +6 -0
  46. package/dist/components/pesquisa-grid2.js +86 -0
  47. package/dist/components/pesquisa-tree.d.ts +11 -0
  48. package/dist/components/pesquisa-tree.js +6 -0
  49. package/dist/components/pesquisa-tree2.js +76 -0
  50. package/dist/components/snk-actions-button2.js +0 -1
  51. package/dist/components/snk-application2.js +159 -20
  52. package/dist/components/snk-attach2.js +0 -1
  53. package/dist/components/snk-crud.js +5 -4
  54. package/dist/components/snk-data-exporter2.js +1 -2
  55. package/dist/components/snk-detail-view2.js +0 -1
  56. package/dist/components/snk-filter-bar2.js +23 -8
  57. package/dist/components/snk-grid2.js +5 -4
  58. package/dist/components/snk-pesquisa2.js +118 -33
  59. package/dist/components/snk-simple-crud2.js +6 -5
  60. package/dist/components/snk-simple-form-config2.js +1 -2
  61. package/dist/components/teste-pesquisa.js +13 -1
  62. package/dist/esm/{ContinuousInsertUtils-bab45060.js → ContinuousInsertUtils-15b5f1da.js} +2 -2
  63. package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-481e159d.js} +1 -1
  64. package/dist/esm/index-a7d3d3f1.js +4 -0
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/{pesquisa-fetcher-24e5bba0.js → pesquisa-fetcher-c437c9b1.js} +176 -2
  67. package/dist/esm/pesquisa-grid_2.entry.js +122 -0
  68. package/dist/esm/sankhyablocks.js +1 -1
  69. package/dist/esm/snk-actions-button_5.entry.js +2 -2
  70. package/dist/esm/snk-application.entry.js +142 -19
  71. package/dist/esm/snk-attach.entry.js +2 -2
  72. package/dist/esm/snk-crud.entry.js +5 -4
  73. package/dist/esm/snk-data-exporter.entry.js +3 -3
  74. package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-d4ba54d7.js} +1 -1
  75. package/dist/esm/snk-data-unit.entry.js +2 -2
  76. package/dist/esm/snk-detail-view.entry.js +3 -3
  77. package/dist/esm/snk-filter-bar_4.entry.js +22 -8
  78. package/dist/esm/snk-grid.entry.js +6 -5
  79. package/dist/esm/{snk-guides-viewer-b740a1fe.js → snk-guides-viewer-3043422d.js} +2 -2
  80. package/dist/esm/snk-guides-viewer.entry.js +3 -3
  81. package/dist/esm/snk-pesquisa.entry.js +105 -31
  82. package/dist/esm/snk-simple-crud.entry.js +6 -5
  83. package/dist/sankhyablocks/{p-c629c07a.entry.js → p-08242e3f.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-342eeb3b.js → p-0f3b2a32.js} +1 -1
  85. package/dist/sankhyablocks/{p-72a451c8.js → p-229c3615.js} +1 -1
  86. package/dist/sankhyablocks/p-22d04eac.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-b619ee23.js → p-36598f95.js} +1 -1
  88. package/dist/sankhyablocks/p-4895f6e4.entry.js +1 -0
  89. package/dist/sankhyablocks/p-4be4cdac.js +6 -0
  90. package/dist/sankhyablocks/{p-47d24ac8.js → p-58fd3017.js} +1 -1
  91. package/dist/sankhyablocks/p-70cb4e36.entry.js +11 -0
  92. package/dist/sankhyablocks/{p-64ff0fb6.entry.js → p-73fc8ec5.entry.js} +1 -1
  93. package/dist/sankhyablocks/{p-50306605.entry.js → p-7d09f66c.entry.js} +1 -1
  94. package/dist/sankhyablocks/{p-53ae0296.entry.js → p-a33e803a.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-89da2953.entry.js → p-b299dc14.entry.js} +1 -1
  96. package/dist/sankhyablocks/p-badbd2ca.entry.js +1 -0
  97. package/dist/sankhyablocks/p-c9bd54e6.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-e2bd42c0.entry.js} +1 -1
  99. package/dist/sankhyablocks/p-e8512d4b.entry.js +1 -0
  100. package/dist/sankhyablocks/p-f71d043b.entry.js +1 -0
  101. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  102. package/dist/types/components/snk-application/snk-application.d.ts +22 -4
  103. package/dist/types/components/snk-crud/snk-crud.d.ts +8 -4
  104. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +6 -1
  105. package/dist/types/components/snk-grid/snk-grid.d.ts +8 -4
  106. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +38 -0
  107. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +28 -0
  108. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +19 -0
  109. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +35 -1
  110. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +8 -1
  111. package/dist/types/components.d.ts +206 -23
  112. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +10 -1
  113. package/package.json +1 -1
  114. package/react/components.d.ts +2 -0
  115. package/react/components.js +2 -0
  116. package/react/components.js.map +1 -1
  117. package/dist/components/pesquisa-fetcher.js +0 -172
  118. package/dist/sankhyablocks/p-0c55538b.entry.js +0 -1
  119. package/dist/sankhyablocks/p-65650e05.entry.js +0 -1
  120. package/dist/sankhyablocks/p-690b4311.entry.js +0 -1
  121. package/dist/sankhyablocks/p-8cf0a9fe.entry.js +0 -1
  122. package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
  123. package/dist/sankhyablocks/p-e6683406.js +0 -6
  124. package/dist/sankhyablocks/p-eda55eef.entry.js +0 -11
@@ -4,8 +4,22 @@ 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-a85d6935.js');
8
+ require('./DataFetcher-e059eb72.js');
9
+ require('./index-1dfc7a6e.js');
10
+ require('./ISave-e91b70a7.js');
11
+ require('@sankhyalabs/ezui/dist/collection/utils/constants');
12
+ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
13
+ require('./dataunit-fetcher-0121621c.js');
14
+ require('./filter-item-type.enum-a7ffdaa6.js');
15
+ require('./form-config-fetcher-91fba2b1.js');
16
+ const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
17
+ require('./PrintUtils-bcaeb82f.js');
18
+ require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
19
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
20
+ require('./ResourceIDUtils-5ff86aa7.js');
7
21
 
8
- 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)}";
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)}";
9
23
 
10
24
  const SnkPesquisa = class {
11
25
  constructor(hostRef) {
@@ -19,11 +33,18 @@ const SnkPesquisa = class {
19
33
  this._changeDeboucingTimeout = null;
20
34
  this._limitCharsToSearch = 3;
21
35
  this._deboucingTime = 450;
36
+ this._gridDataSource = [];
37
+ this.pesquisaFetcher = new pesquisaFetcher.PesquisaFetcher();
22
38
  this._itemList = undefined;
23
39
  this._startLoading = false;
40
+ this._presentationMode = "list";
24
41
  this.searchLoader = undefined;
42
+ this.treeLoader = undefined;
25
43
  this.selectItem = undefined;
44
+ this.entityName = undefined;
26
45
  this.argument = undefined;
46
+ this.isHierarchyEntity = false;
47
+ this.allowsNonAnalytic = false;
27
48
  }
28
49
  observeArgument() {
29
50
  if (this._textInput) {
@@ -61,36 +82,42 @@ const SnkPesquisa = class {
61
82
  this._startLoading = true;
62
83
  this.searchLoader(argument)
63
84
  .then((resp) => {
85
+ if (!resp)
86
+ return;
87
+ this.processSearchResponse(resp);
88
+ }).finally(() => {
64
89
  this._startLoading = false;
65
- if (resp) {
66
- resp = core.ObjectUtils.stringToObject(resp.json.$);
67
- let descriptionField = resp.descriptionField;
68
- let pkField = resp.pkField;
69
- if (pkField) {
70
- let newItemList = [];
71
- resp.data.forEach((item) => {
72
- var _a;
73
- let fieldsMetadata = this.filterFieldsMetadata(resp, item);
74
- let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
75
- let exibitionItem = {
76
- key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
77
- title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : "",
78
- details: this.buildDetails(fields, item)
79
- };
80
- newItemList.push(exibitionItem);
81
- });
82
- this._itemList = newItemList;
83
- }
84
- }
85
- }).catch((error) => {
86
- this._startLoading = false;
87
- this._itemList = [];
88
- console.warn(error);
89
90
  });
90
91
  }
91
92
  }
93
+ processSearchResponse(resp) {
94
+ resp = core.ObjectUtils.stringToObject(resp.json.$);
95
+ let descriptionField = resp.descriptionField;
96
+ let pkField = resp.pkField;
97
+ if (!pkField)
98
+ return;
99
+ this._gridMetadata = pesquisaFetcher.buildGridMetadata(resp);
100
+ this._gridDataSource = [...resp.data];
101
+ this._pkField = pkField;
102
+ this._descriptionField = descriptionField;
103
+ this._itemList = this.buildCardItemList(resp, pkField, descriptionField);
104
+ }
105
+ buildCardItemList(resp, pkField, descriptionField) {
106
+ var _a;
107
+ let newItemList = (_a = resp.data) === null || _a === void 0 ? void 0 : _a.map((item) => {
108
+ var _a;
109
+ let fieldsMetadata = this.filterFieldsMetadata(resp, item);
110
+ let fields = this.buildFirstFields(item['__matchFields'], fieldsMetadata);
111
+ return {
112
+ key: this.highlightValue(item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
113
+ title: descriptionField ? this.highlightValue(item['__matchFields'], item[descriptionField], fields, true) : '',
114
+ details: this.buildDetails(fields, item),
115
+ };
116
+ });
117
+ return newItemList;
118
+ }
92
119
  filterFieldsMetadata(resp, item) {
93
- let fieldsMetadata = resp.fieldsMetadata.filter((field) => {
120
+ return resp.fieldsMetadata.filter((field) => {
94
121
  let accept = !core.StringUtils.isEmpty(item[field.fieldName]) &&
95
122
  field.visible !== false &&
96
123
  field.type !== 'B' &&
@@ -107,7 +134,6 @@ const SnkPesquisa = class {
107
134
  }
108
135
  return accept;
109
136
  });
110
- return fieldsMetadata;
111
137
  }
112
138
  removeAtIndex(array, index) {
113
139
  if (index >= 0 && index < array.length) {
@@ -265,6 +291,7 @@ const SnkPesquisa = class {
265
291
  this.selectItem(option);
266
292
  }
267
293
  onChangeValue(event) {
294
+ var _a;
268
295
  this.clearDeboucingTimeout();
269
296
  if (this._startLoading) {
270
297
  this._changeDeboucingTimeout = setTimeout(() => {
@@ -273,6 +300,10 @@ const SnkPesquisa = class {
273
300
  return;
274
301
  }
275
302
  this.argument = (event.detail || "").trim();
303
+ if (this.isHierarchyEntity && this._presentationMode === 'list') {
304
+ (_a = this._pesquisaTree) === null || _a === void 0 ? void 0 : _a.applyFilter();
305
+ return;
306
+ }
276
307
  const argumentNumber = this.getArgumentNumber();
277
308
  if (this.argument && (!isNaN(argumentNumber) || this.argument.length >= this._limitCharsToSearch)) {
278
309
  this._changeDeboucingTimeout = setTimeout(() => {
@@ -303,16 +334,59 @@ const SnkPesquisa = class {
303
334
  : 'Nenhum registro encontrado'
304
335
  : 'Os resultados de sua pesquisa aparecerão aqui...';
305
336
  }
306
- componentDidLoad() {
337
+ async componentWillLoad() {
338
+ const mode = await this.pesquisaFetcher.loadPresentationConfig(this.entityName);
339
+ this._presentationMode = mode === 'list' ? 'list' : 'table';
340
+ }
341
+ async componentDidLoad() {
307
342
  core.ElementIDUtils.addIDInfo(this._element);
308
343
  }
344
+ async onClickList() {
345
+ this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
346
+ await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
347
+ }
348
+ enableListButton() {
349
+ var _a;
350
+ return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
351
+ }
352
+ //Os limites de exibição são diferentes para lista e grade
353
+ hideLimitMessage() {
354
+ if (!this._itemList)
355
+ return true;
356
+ if (this._presentationMode === "list") {
357
+ if (this.isHierarchyEntity)
358
+ return true;
359
+ return this._itemList.length <= 100;
360
+ }
361
+ return this._itemList.length <= 150;
362
+ }
363
+ hideRecordsMessage() {
364
+ return (this._presentationMode === "list" && this.isHierarchyEntity);
365
+ }
366
+ renderContent() {
367
+ if (!this._itemList)
368
+ return;
369
+ if (this._presentationMode === 'list') {
370
+ return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
371
+ }
372
+ return this.renderPesquisaGrid();
373
+ }
374
+ renderTree() {
375
+ 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) }));
376
+ }
377
+ renderCards() {
378
+ return (index.h("ez-scroller", { direction: EzScrollDirection.EzScrollDirection.VERTICAL }, index.h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
379
+ return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
380
+ }))));
381
+ }
382
+ renderPesquisaGrid() {
383
+ 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) });
384
+ }
309
385
  render() {
310
386
  var _a;
311
387
  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)
312
388
  ? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
313
- : undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), index.h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), index.h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
314
- return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
315
- })))));
389
+ : 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._presentationMode === 'list' ? 'table' : 'list', title: this._presentationMode === 'list' ? 'Modo grade' : 'Modo lista', 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()))));
316
390
  }
317
391
  get _element() { return index.getElement(this); }
318
392
  static get watchers() { return {
@@ -8,13 +8,13 @@ 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-e059eb72.js');
11
- require('./pesquisa-fetcher-2ec4811b.js');
12
- const ContinuousInsertUtils = require('./ContinuousInsertUtils-414b772c.js');
11
+ require('./pesquisa-fetcher-a85d6935.js');
12
+ const ContinuousInsertUtils = require('./ContinuousInsertUtils-a6139f3d.js');
13
13
  const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
- const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
17
+ const dataunitFetcher = require('./dataunit-fetcher-0121621c.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
19
  const formConfigFetcher = require('./form-config-fetcher-91fba2b1.js');
20
20
  const fieldSearch = require('./field-search-68e34bf4.js');
@@ -114,13 +114,14 @@ const SnkSimpleCrud = class {
114
114
  this._config = undefined;
115
115
  this._fieldToGetFocus = undefined;
116
116
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${core.StringUtils.generateUUID()}`;
117
+ this.enableLockManagerLoadingComp = false;
118
+ this.enableLockManagerTaskbarClick = false;
117
119
  this.dataState = undefined;
118
120
  this.dataUnit = undefined;
119
121
  this.entityName = undefined;
120
122
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
121
123
  this.gridConfig = undefined;
122
124
  this.formConfig = undefined;
123
- this.enableLockManger = false;
124
125
  this._formFields = [];
125
126
  this._fieldsProps = new Map();
126
127
  this._enableContinuousInsert = true;
@@ -832,7 +833,7 @@ const SnkSimpleCrud = class {
832
833
  }
833
834
  return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section` }, index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
834
835
  ? undefined
835
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger, outlineMode: this.outlineMode }, this.renderTaskbarContent(), index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, this.renderTaskbarContent(), index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), index$1.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
836
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, this.renderTaskbarContent(), index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), index$1.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
836
837
  }
837
838
  get _element() { return index$1.getElement(this); }
838
839
  static get watchers() { return {
@@ -48,6 +48,8 @@
48
48
  "./components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js",
49
49
  "./components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js",
50
50
  "./components/snk-pesquisa/snk-pesquisa.js",
51
+ "./components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js",
52
+ "./components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js",
51
53
  "./components/snk-simple-bar/snk-simple-bar.js",
52
54
  "./components/snk-simple-crud/snk-simple-crud.js",
53
55
  "./components/snk-simple-form-config/snk-simple-form-config.js",
@@ -16,11 +16,12 @@ class DebouncedRequestListener {
16
16
  }
17
17
  ;
18
18
  onRequestEnd(param) {
19
+ var _a, _b, _c;
19
20
  const timeoutId = this.requests.get(param.requestId);
20
21
  clearTimeout(timeoutId);
21
- if (this.requestsLoadingBar.includes(param.requestId)) {
22
- this.requestsLoadingBar = this.requestsLoadingBar.filter(id => id !== param.requestId);
23
- !this.requestsLoadingBar.length && this.ezLoadingBar.hide();
22
+ if ((_a = this.requestsLoadingBar) === null || _a === void 0 ? void 0 : _a.includes(param.requestId)) {
23
+ this.requestsLoadingBar = (_b = this.requestsLoadingBar) === null || _b === void 0 ? void 0 : _b.filter(id => id !== param.requestId);
24
+ !this.requestsLoadingBar.length && ((_c = this.ezLoadingBar) === null || _c === void 0 ? void 0 : _c.hide());
24
25
  }
25
26
  }
26
27
  ;
@@ -3,3 +3,37 @@
3
3
  flex-direction: column;
4
4
  height: 100%;
5
5
  }
6
+
7
+ :host > .loading-hidden {
8
+ display: none;
9
+ pointer-events: none;
10
+ }
11
+
12
+ .skeleton-content-left {
13
+ width: 300px;
14
+ padding-right: 5px;
15
+ }
16
+
17
+ .skeleton-content {
18
+ height: calc(100vh - 310px);
19
+ }
20
+
21
+ .spinner {
22
+ height: 100vh;
23
+ gap: 10px;
24
+ }
25
+ .spinner > .spin {
26
+ animation-name: spin;
27
+ animation-duration: 5000ms;
28
+ animation-iteration-count: infinite;
29
+ animation-timing-function: linear;
30
+ }
31
+
32
+ @keyframes spin {
33
+ from {
34
+ transform:rotate(0deg);
35
+ }
36
+ to {
37
+ transform:rotate(360deg);
38
+ }
39
+ }