@sankhyalabs/sankhyablocks 8.7.0 → 8.8.0-dev.2

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 (141) hide show
  1. package/dist/cjs/{ConfigStorage-1097ff27.js → ConfigStorage-a97ca159.js} +2 -2
  2. package/dist/cjs/{DataFetcher-a00bc007.js → DataFetcher-2a99283c.js} +19 -10
  3. package/dist/cjs/{SnkFormConfigManager-a4b4d852.js → SnkFormConfigManager-f641f502.js} +2 -2
  4. package/dist/cjs/{SnkMultiSelectionListDataSource-804ff4c7.js → SnkMultiSelectionListDataSource-4e3de426.js} +11 -0
  5. package/dist/cjs/{auth-fetcher-92f3040b.js → auth-fetcher-78231356.js} +1 -1
  6. package/dist/cjs/dataunit-fetcher-a4e8352b.js +906 -0
  7. package/dist/cjs/{form-config-fetcher-60fbeb94.js → form-config-fetcher-a322a522.js} +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-b2ed9767.js → pesquisa-fetcher-7ef61508.js} +1 -1
  9. package/dist/cjs/snk-actions-button.cjs.entry.js +4 -3
  10. package/dist/cjs/snk-application.cjs.entry.js +17 -8
  11. package/dist/cjs/snk-attach.cjs.entry.js +16 -3
  12. package/dist/cjs/snk-crud.cjs.entry.js +6 -4
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  14. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
  15. package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
  16. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
  18. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  19. package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-grid.cjs.entry.js +25 -14
  21. package/dist/cjs/{snk-guides-viewer-eab0ec84.js → snk-guides-viewer-c540f4c5.js} +5 -4
  22. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
  23. package/dist/cjs/snk-personalized-filter.cjs.entry.js +19 -9
  24. package/dist/cjs/snk-simple-crud.cjs.entry.js +8 -92
  25. package/dist/collection/components/snk-application/snk-application.js +11 -3
  26. package/dist/collection/components/snk-attach/snk-attach.js +14 -2
  27. package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +11 -0
  28. package/dist/collection/components/snk-grid/snk-grid.js +24 -14
  29. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +16 -6
  30. package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -2
  31. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +19 -10
  32. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +113 -0
  33. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +77 -0
  34. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +179 -0
  35. package/dist/collection/lib/http/data-fetcher/fetchers/{dataunit-fetcher.js → data-unit/dataunit-fetcher.js} +48 -100
  36. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.js +1 -0
  37. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.js +1 -0
  38. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.js +1 -0
  39. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.js +1 -0
  40. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.js +1 -0
  41. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.js +68 -0
  42. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +131 -0
  43. package/dist/collection/lib/index.js +1 -1
  44. package/dist/components/DataFetcher.js +19 -10
  45. package/dist/components/SnkMultiSelectionListDataSource.js +11 -0
  46. package/dist/components/dataunit-fetcher.js +809 -100
  47. package/dist/components/snk-actions-button2.js +1 -1
  48. package/dist/components/snk-application2.js +11 -4
  49. package/dist/components/snk-attach2.js +13 -1
  50. package/dist/components/snk-crud.js +1 -1
  51. package/dist/components/snk-detail-view2.js +1 -1
  52. package/dist/components/snk-grid2.js +19 -11
  53. package/dist/components/snk-personalized-filter2.js +16 -6
  54. package/dist/components/snk-simple-crud2.js +2 -88
  55. package/dist/esm/{ConfigStorage-4d30a649.js → ConfigStorage-26f89143.js} +2 -2
  56. package/dist/esm/{DataFetcher-487d6aad.js → DataFetcher-90e91631.js} +19 -10
  57. package/dist/esm/{SnkFormConfigManager-da594f63.js → SnkFormConfigManager-18948123.js} +2 -2
  58. package/dist/esm/{SnkMultiSelectionListDataSource-892f37f9.js → SnkMultiSelectionListDataSource-36887f31.js} +11 -0
  59. package/dist/esm/{auth-fetcher-5c3ae75b.js → auth-fetcher-a8c8ee7e.js} +1 -1
  60. package/dist/esm/dataunit-fetcher-c22b889c.js +902 -0
  61. package/dist/esm/{form-config-fetcher-cd3fa459.js → form-config-fetcher-7c3b6273.js} +1 -1
  62. package/dist/{components/pesquisa-fetcher.js → esm/pesquisa-fetcher-90d6853b.js} +1 -1
  63. package/dist/esm/snk-actions-button.entry.js +4 -3
  64. package/dist/esm/snk-application.entry.js +17 -8
  65. package/dist/esm/snk-attach.entry.js +16 -3
  66. package/dist/esm/snk-crud.entry.js +6 -4
  67. package/dist/esm/snk-data-exporter.entry.js +1 -1
  68. package/dist/esm/snk-detail-view.entry.js +8 -6
  69. package/dist/esm/snk-filter-bar.entry.js +3 -3
  70. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  71. package/dist/esm/snk-form-config.entry.js +2 -2
  72. package/dist/esm/snk-form.entry.js +4 -4
  73. package/dist/esm/snk-grid-config.entry.js +3 -3
  74. package/dist/esm/snk-grid.entry.js +26 -15
  75. package/dist/esm/{snk-guides-viewer-cff5e95d.js → snk-guides-viewer-e87b77d5.js} +5 -4
  76. package/dist/esm/snk-guides-viewer.entry.js +8 -6
  77. package/dist/esm/snk-personalized-filter.entry.js +19 -9
  78. package/dist/esm/snk-simple-crud.entry.js +7 -91
  79. package/dist/sankhyablocks/p-182246c9.entry.js +1 -0
  80. package/dist/sankhyablocks/{p-ee57d9f5.js → p-240f5892.js} +1 -1
  81. package/dist/sankhyablocks/p-42de2707.entry.js +1 -0
  82. package/dist/sankhyablocks/p-5356efdd.entry.js +1 -0
  83. package/dist/sankhyablocks/{p-c9fa27ce.entry.js → p-57550ddc.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-e2160bdd.js → p-5d51bff4.js} +1 -1
  85. package/dist/sankhyablocks/{p-ebd9f2b1.entry.js → p-5dd52ec5.entry.js} +1 -1
  86. package/dist/sankhyablocks/p-6541f0df.js +1 -0
  87. package/dist/sankhyablocks/p-68fbd480.entry.js +1 -0
  88. package/dist/sankhyablocks/{p-5e5816ed.entry.js → p-8652f90b.entry.js} +1 -1
  89. package/dist/sankhyablocks/{p-358e8f7b.js → p-910af03c.js} +1 -1
  90. package/dist/sankhyablocks/p-992a9d0f.js +1 -0
  91. package/dist/sankhyablocks/p-9e705c91.entry.js +1 -0
  92. package/dist/sankhyablocks/p-a046a2e1.js +1 -0
  93. package/dist/sankhyablocks/p-a221bc67.js +1 -0
  94. package/dist/sankhyablocks/{p-54f01129.entry.js → p-b3cd0dd1.entry.js} +3 -3
  95. package/dist/sankhyablocks/p-b7798801.entry.js +1 -0
  96. package/dist/sankhyablocks/p-bcc2b79d.js +59 -0
  97. package/dist/sankhyablocks/p-d07651cc.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-33745612.js → p-d47bbee3.js} +1 -1
  99. package/dist/sankhyablocks/{p-86d00468.entry.js → p-d563e451.entry.js} +1 -1
  100. package/dist/sankhyablocks/{p-6cd36947.entry.js → p-e74e2153.entry.js} +1 -1
  101. package/dist/sankhyablocks/p-eab2c97d.entry.js +1 -0
  102. package/dist/sankhyablocks/{p-d109914d.entry.js → p-ebfa6460.entry.js} +1 -1
  103. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  104. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  105. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  106. package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +1 -0
  107. package/dist/types/components/snk-grid/snk-grid.d.ts +3 -4
  108. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +3 -1
  109. package/dist/types/components.d.ts +3 -2
  110. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  111. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  112. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +13 -0
  113. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +19 -0
  114. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +25 -0
  115. package/dist/types/lib/http/data-fetcher/fetchers/{dataunit-fetcher.d.ts → data-unit/dataunit-fetcher.d.ts} +5 -3
  116. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataResult.d.ts +6 -0
  117. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadDataStrategy.d.ts +7 -0
  118. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +8 -0
  119. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRecordField.d.ts +4 -0
  120. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IResponseRecord.d.ts +6 -0
  121. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DataUnitStrategy.d.ts +9 -0
  122. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +15 -0
  123. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +1 -1
  124. package/dist/types/lib/index.d.ts +1 -1
  125. package/package.json +3 -3
  126. package/dist/cjs/dataunit-fetcher-32bb845f.js +0 -356
  127. package/dist/esm/dataunit-fetcher-d3033a06.js +0 -354
  128. package/dist/esm/pesquisa-fetcher-615da3ca.js +0 -165
  129. package/dist/sankhyablocks/p-0abc880c.entry.js +0 -1
  130. package/dist/sankhyablocks/p-1284f14a.entry.js +0 -1
  131. package/dist/sankhyablocks/p-162161ae.entry.js +0 -1
  132. package/dist/sankhyablocks/p-329f7520.entry.js +0 -1
  133. package/dist/sankhyablocks/p-401da0a5.entry.js +0 -1
  134. package/dist/sankhyablocks/p-5d62a74e.js +0 -1
  135. package/dist/sankhyablocks/p-5e63571e.entry.js +0 -1
  136. package/dist/sankhyablocks/p-6b2ee5b5.entry.js +0 -1
  137. package/dist/sankhyablocks/p-719c246f.js +0 -1
  138. package/dist/sankhyablocks/p-89b3df4c.js +0 -1
  139. package/dist/sankhyablocks/p-90946802.js +0 -76
  140. package/dist/sankhyablocks/p-b417c608.entry.js +0 -1
  141. package/dist/sankhyablocks/p-fa9d3f73.js +0 -1
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
2
2
  import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { D as DataFetcher } from './DataFetcher.js';
4
4
  import { P as ParamType } from './ParamType.js';
5
- import './pesquisa-fetcher.js';
5
+ import './dataunit-fetcher.js';
6
6
  import './index2.js';
7
7
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -4,8 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  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
- import { D as DataUnitFetcher } from './dataunit-fetcher.js';
8
- import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
7
+ import { D as DataUnitFetcher, P as PesquisaFetcher } from './dataunit-fetcher.js';
9
8
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
10
9
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
11
10
 
@@ -1152,8 +1151,16 @@ class RequestListenerLoadingBar {
1152
1151
  }
1153
1152
  ;
1154
1153
  isIgnoreLoadingOnRequest(param) {
1155
- var _a;
1156
- if (((_a = param === null || param === void 0 ? void 0 : param.requestBody) === null || _a === void 0 ? void 0 : _a.length) == 1) {
1154
+ if (param == undefined) {
1155
+ return false;
1156
+ }
1157
+ if (param.url.includes("quietMode=true")) {
1158
+ return true;
1159
+ }
1160
+ if (param.requestBody == undefined) {
1161
+ return false;
1162
+ }
1163
+ if (param.requestBody.length == 1) {
1157
1164
  const { name } = param.requestBody[0].variables;
1158
1165
  if (name) {
1159
1166
  const nameParts = name.split(":");
@@ -417,13 +417,25 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
417
417
  dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
418
418
  dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
419
419
  this.dataUnit = dataUnit;
420
- this.dataUnit.loadData();
420
+ this.dataUnit.loadData().then(() => {
421
+ this.disableEditFieldsNotInForm();
422
+ });
421
423
  return this.dataUnit;
422
424
  }
423
425
  catch (error) {
424
426
  throw new Error('There was an error while creating the data unit');
425
427
  }
426
428
  }
429
+ disableEditFieldsNotInForm() {
430
+ var _a;
431
+ (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
432
+ var _a;
433
+ const fieldName = column.name;
434
+ if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
435
+ this.dataUnit.disableField(fieldName);
436
+ }
437
+ });
438
+ }
427
439
  componentWillLoad() {
428
440
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
429
441
  this.loadAttachmentDataUnit();
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
4
4
  import './DataFetcher.js';
5
- import './pesquisa-fetcher.js';
5
+ import './dataunit-fetcher.js';
6
6
  import { P as PresentationMode } from './index2.js';
7
7
  import { d as defineCustomElement$v } from './snk-actions-button2.js';
8
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, forceUpdate,
2
2
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
3
3
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
4
4
  import './DataFetcher.js';
5
- import './pesquisa-fetcher.js';
5
+ import './dataunit-fetcher.js';
6
6
  import { ElementIDUtils } from '@sankhyalabs/core';
7
7
  import { P as PresentationMode } from './index2.js';
8
8
  import { d as defineCustomElement$t } from './snk-actions-button2.js';
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
2
+ import { SortMode, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
3
3
  import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
4
  import { d as defineCustomElement$1, T as TaskbarElement } from './snk-taskbar2.js';
5
5
  import { C as ConfigStorage } from './ConfigStorage.js';
@@ -110,6 +110,18 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
110
110
  }
111
111
  setGridConfig(config) {
112
112
  this._gridConfig = config;
113
+ this.assertDefaultSorting();
114
+ }
115
+ assertDefaultSorting() {
116
+ if (this._gridConfig && this._dataUnit) {
117
+ this._dataUnit.defaultSorting = this._gridConfig
118
+ .columns
119
+ .sort((colA, colB) => colA.orderIndex - colB.orderIndex)
120
+ .map(({ name: field, ascending }) => {
121
+ const { dataType } = this._dataUnit.getField(field);
122
+ return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
123
+ });
124
+ }
113
125
  }
114
126
  loadConfig() {
115
127
  ConfigStorage.loadGridConfig(this.configName, this.resourceID)
@@ -235,11 +247,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
235
247
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
236
248
  }
237
249
  finshLoading() {
238
- var _a, _b;
239
- this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
250
+ this.assertDefaultSorting();
240
251
  this.addElementID();
241
- (_a = this.columnFilterDataSource) === null || _a === void 0 ? void 0 : _a.setApplication(this._application);
242
- (_b = this.columnFilterDataSource) === null || _b === void 0 ? void 0 : _b.setDataUnit(this._dataUnit);
252
+ if (this.columnFilterDataSource != undefined) {
253
+ this.columnFilterDataSource.setApplication(this._application);
254
+ this.columnFilterDataSource.setDataUnit(this._dataUnit);
255
+ }
243
256
  }
244
257
  componentWillLoad() {
245
258
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -320,18 +333,13 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
320
333
  getPrimaryButton() {
321
334
  return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
322
335
  }
323
- onEzGridReady() {
324
- var _a;
325
- (_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
326
- this._dataUnitLoadLockerResolver = undefined;
327
- }
328
336
  render() {
329
337
  var _a, _b;
330
338
  if (!this._dataUnit) {
331
339
  return undefined;
332
340
  }
333
341
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
334
- h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, onComponentReady: () => this.onEzGridReady(), columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
342
+ h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
335
343
  }
336
344
  get _element() { return this; }
337
345
  static get style() { return snkGridCss; }
@@ -83,7 +83,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
83
83
  }
84
84
  ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
85
85
  .then((resp) => {
86
- const personalizedFilter = this.addLabelToItems(resp);
86
+ const personalizedFilter = this.applyDefaultValues(resp);
87
87
  this._filterAssistent = personalizedFilter;
88
88
  this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
89
89
  this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
@@ -194,20 +194,30 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
194
194
  this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { name });
195
195
  this._elButtonSave.enabled = !this.hasChangesToSave();
196
196
  }
197
- addLabelToItems(resp) {
197
+ applyDefaultValues(personalizedFilter) {
198
+ this.addLabelToItems(personalizedFilter);
199
+ this.addFilterGroupCondition(personalizedFilter);
200
+ return personalizedFilter;
201
+ }
202
+ addFilterGroupCondition(personalizedFilter) {
203
+ if (!personalizedFilter.assistent.operand) {
204
+ personalizedFilter.assistent.operand = FilterGroupCondition.AND;
205
+ }
206
+ }
207
+ ;
208
+ addLabelToItems(personalizedFilter) {
198
209
  //Workaround: Alguns filtros foram salvos sem o fieldLabel. Para evitar transtornos
199
210
  //tentamos usar o fieldLabel que pode estar informado no parametro.
200
- if (resp.assistent && resp.assistent.items && resp.assistent.items.length > 0) {
201
- resp.assistent.items.forEach(item => {
211
+ if (personalizedFilter.assistent && personalizedFilter.assistent.items && personalizedFilter.assistent.items.length > 0) {
212
+ personalizedFilter.assistent.items.forEach(item => {
202
213
  if (item.fieldLabel == undefined) {
203
- const param = (resp.parameters || []).find(param => param.fieldName === item.fieldName);
214
+ const param = (personalizedFilter.parameters || []).find(param => param.fieldName === item.fieldName);
204
215
  if (param) {
205
216
  item.fieldLabel = param.label;
206
217
  }
207
218
  }
208
219
  });
209
220
  }
210
- return resp;
211
221
  }
212
222
  handleExpressionChangeAdvancedMode(expression) {
213
223
  this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
@@ -1,9 +1,9 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { DataUnit, defaultDataLoader, StringUtils, ChangeOperation, ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
2
+ import { ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
3
3
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
4
4
  import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
5
5
  import './DataFetcher.js';
6
- import './pesquisa-fetcher.js';
6
+ import { I as InMemoryLoader } from './dataunit-fetcher.js';
7
7
  import { P as PresentationMode } from './index2.js';
8
8
  import { d as defineCustomElement$5 } from './snk-actions-button2.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
@@ -15,92 +15,6 @@ import { d as defineCustomElement$4 } from './snk-data-exporter2.js';
15
15
  import { d as defineCustomElement$3 } from './snk-data-unit2.js';
16
16
  import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
17
17
 
18
- class InMemoryLoader {
19
- constructor(metadata, records) {
20
- this.records = records;
21
- this.metadata = metadata;
22
- this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
23
- this._dataUnit.metadataLoader = () => this.metadaLoader();
24
- this._dataUnit.dataLoader = (dataUnit, request) => defaultDataLoader(dataUnit, request, this.getRecordsToLoad());
25
- this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
26
- this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
27
- this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
28
- }
29
- getRecordsToLoad() {
30
- if (this._initialRecords) {
31
- try {
32
- return this._initialRecords;
33
- }
34
- finally {
35
- this._initialRecords = undefined;
36
- }
37
- }
38
- return this.dataUnit.records;
39
- }
40
- get dataUnit() {
41
- return this._dataUnit;
42
- }
43
- get records() {
44
- return this.dataUnit.records;
45
- }
46
- set records(records) {
47
- const newRecords = records === null || records === void 0 ? void 0 : records.map(record => {
48
- if (!record["__record__id__"]) {
49
- record["__record__id__"] = this.generateUniqueId();
50
- }
51
- return record;
52
- });
53
- if (this._dataUnit) {
54
- this._dataUnit.records = newRecords;
55
- }
56
- else {
57
- this._initialRecords = newRecords;
58
- }
59
- }
60
- get metadata() {
61
- return this._metadata;
62
- }
63
- set metadata(metadata) {
64
- this._metadata = metadata;
65
- if (this._dataUnit) {
66
- this._dataUnit.metadata = this._metadata;
67
- }
68
- }
69
- generateUniqueId() {
70
- return StringUtils.generateUUID();
71
- }
72
- metadaLoader() {
73
- return Promise.resolve(this._metadata);
74
- }
75
- saveLoader(_dataUnit, changes) {
76
- return new Promise((resolve) => {
77
- let dataUnitRecords = [];
78
- changes.forEach(change => {
79
- let { record, updatingFields, operation } = change;
80
- const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
81
- if (operation === ChangeOperation.INSERT ||
82
- operation === ChangeOperation.COPY) {
83
- changedRecord["__old__id__"] = record["__record__id__"];
84
- changedRecord["__record__id__"] = this.generateUniqueId();
85
- this.records.push(changedRecord);
86
- }
87
- else {
88
- const recordIndex = this.records.findIndex(r => r["__record__id__"] == changedRecord["__record__id__"]);
89
- this.records[recordIndex] = changedRecord;
90
- }
91
- dataUnitRecords.push(changedRecord);
92
- });
93
- resolve(dataUnitRecords);
94
- });
95
- }
96
- removeLoader(_dataUnit, recordIds) {
97
- return new Promise((resolve) => {
98
- resolve(recordIds);
99
- });
100
- }
101
- }
102
- InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
103
-
104
18
  const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:max-content;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";
105
19
 
106
20
  const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -1,7 +1,7 @@
1
- import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-cd3fa459.js';
1
+ import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-7c3b6273.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
3
3
  import { ObjectUtils } from '@sankhyalabs/core';
4
- import { d as dist, D as DataFetcher } from './DataFetcher-487d6aad.js';
4
+ import { d as dist, D as DataFetcher } from './DataFetcher-90e91631.js';
5
5
 
6
6
  class GridConfigFetcher extends ResourceFetcher {
7
7
  constructor() {
@@ -6541,11 +6541,10 @@ class DataFetcher {
6541
6541
  }
6542
6542
  }
6543
6543
  this.instance.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
6544
- this.instance.graphqlPath = `/${this.instance.application.getModuleName()}/graphql`;
6545
6544
  return this.instance;
6546
6545
  }
6547
6546
  static getGraphQLPath() {
6548
- if (StringUtils.isEmpty(this.instance.graphqlPath)) {
6547
+ if (StringUtils.isEmpty(this.instance.graphqlPath) && this.instance.application != undefined) {
6549
6548
  this.instance.graphqlPath = `/${this.instance.application.getModuleName()}/graphql`;
6550
6549
  }
6551
6550
  return this.instance.graphqlPath;
@@ -6599,7 +6598,7 @@ class DataFetcher {
6599
6598
  }
6600
6599
  return new ErrorException(title, statusMessage, tsErrorCode);
6601
6600
  }
6602
- async callGraphQL(req) {
6601
+ async callGraphQL(req, quietMode = false) {
6603
6602
  var _a;
6604
6603
  if (this.ready) {
6605
6604
  this.pause();
@@ -6617,7 +6616,7 @@ class DataFetcher {
6617
6616
  if (this.ready) {
6618
6617
  return new Promise(async (resolve, reject) => {
6619
6618
  let query = this.getQueryTemplate(req);
6620
- const res = await this.fecthGrapql([{ document: query, variables: req.values }]);
6619
+ const res = await this.fecthGrapql([{ document: query, variables: req.values }], quietMode);
6621
6620
  if (res.errors.length > 0) {
6622
6621
  if (!this.proccesGraphQLClientEvents(res === null || res === void 0 ? void 0 : res.extensions, req, resolve, reject)) {
6623
6622
  const error = this.processGraphQlErrorInfo(res.errors);
@@ -6632,7 +6631,7 @@ class DataFetcher {
6632
6631
  }
6633
6632
  else {
6634
6633
  if (!this.watingRequestsById.has(reqKey)) {
6635
- this.watingRequestsById.set(reqKey, new WaitingRequest(req));
6634
+ this.watingRequestsById.set(reqKey, new WaitingRequest(req, quietMode));
6636
6635
  }
6637
6636
  return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6638
6637
  }
@@ -6848,14 +6847,16 @@ class DataFetcher {
6848
6847
  }
6849
6848
  async executePendingRequest(watingRequestsById) {
6850
6849
  const requestsBatch = [];
6850
+ let quietMode = true;
6851
6851
  watingRequestsById.forEach(async (waitingReq) => {
6852
6852
  let query = this.getQueryTemplate(waitingReq.request);
6853
6853
  requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6854
+ quietMode = quietMode && waitingReq.quietMode;
6854
6855
  });
6855
6856
  let res = undefined;
6856
6857
  let dataResponse = [];
6857
6858
  let errorsResponse = [];
6858
- res = await this.fecthGrapql(requestsBatch);
6859
+ res = await this.fecthGrapql(requestsBatch, quietMode);
6859
6860
  dataResponse = res.data;
6860
6861
  errorsResponse = res.errors;
6861
6862
  //Reject promises with errors from query
@@ -6873,14 +6874,18 @@ class DataFetcher {
6873
6874
  });
6874
6875
  });
6875
6876
  }
6876
- async fecthGrapql(request) {
6877
+ async fecthGrapql(request, quietMode) {
6877
6878
  let res = undefined;
6878
6879
  let dataResponse = [];
6879
6880
  let errorsResponse = [];
6880
6881
  let url = `${this.resolveURL() + DataFetcher.getGraphQLPath()}`;
6881
6882
  const responseExtensions = [];
6882
- if (window['mgeSession']) {
6883
- url += `?mgeSession=${window['mgeSession']}`;
6883
+ const mgeSession = window["mgeSession"];
6884
+ if (mgeSession != undefined) {
6885
+ url += `?mgeSession=${mgeSession}`;
6886
+ }
6887
+ if (quietMode) {
6888
+ url += `${url.indexOf("?") > -1 ? "&" : "?"}quietMode=true`;
6884
6889
  }
6885
6890
  DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: request }));
6886
6891
  try {
@@ -6966,7 +6971,7 @@ DataFetcher.SERVICE_BROKER_STATUS = {
6966
6971
  };
6967
6972
  DataFetcher.clientEventsByID = new Map();
6968
6973
  class WaitingRequest {
6969
- constructor(req) {
6974
+ constructor(req, quietMode) {
6970
6975
  this._resolve = () => { };
6971
6976
  this._reject = () => { };
6972
6977
  this._request = undefined;
@@ -6975,6 +6980,7 @@ class WaitingRequest {
6975
6980
  this._resolve = resolve;
6976
6981
  this._reject = reject;
6977
6982
  });
6983
+ this._quietMode = quietMode;
6978
6984
  }
6979
6985
  get resolve() {
6980
6986
  return this._resolve;
@@ -6988,6 +6994,9 @@ class WaitingRequest {
6988
6994
  get request() {
6989
6995
  return this._request;
6990
6996
  }
6997
+ get quietMode() {
6998
+ return this._quietMode;
6999
+ }
6991
7000
  }
6992
7001
 
6993
7002
  export { DataFetcher as D, UrlUtils as U, dist as d };
@@ -1,6 +1,6 @@
1
- import { C as ConfigStorage } from './ConfigStorage-4d30a649.js';
1
+ import { C as ConfigStorage } from './ConfigStorage-26f89143.js';
2
2
  import { ObjectUtils } from '@sankhyalabs/core';
3
- import { F as FormConfigFetcher } from './form-config-fetcher-cd3fa459.js';
3
+ import { F as FormConfigFetcher } from './form-config-fetcher-7c3b6273.js';
4
4
 
5
5
  class SnkFormConfigManager {
6
6
  constructor(configName, resourceID, onConfigChange) {
@@ -1,4 +1,5 @@
1
1
  import { UserInterface, DateUtils } from '@sankhyalabs/core';
2
+ import { P as PreloadManager } from './dataunit-fetcher-c22b889c.js';
2
3
 
3
4
  class SnkMultiSelectionListDataSource {
4
5
  setDataUnit(dataUnit) {
@@ -14,6 +15,16 @@ class SnkMultiSelectionListDataSource {
14
15
  }
15
16
  return String(this._dataUnit.getFormattedValue(fieldName, value));
16
17
  }
18
+ async getStaticOptions(fieldName) {
19
+ if (fieldName == undefined) {
20
+ return Promise.resolve(undefined);
21
+ }
22
+ const result = await PreloadManager.getDistinct(this._dataUnit, fieldName);
23
+ if (result == undefined) {
24
+ return Promise.resolve(undefined);
25
+ }
26
+ return Promise.resolve(Array.from(result.entries()).map(([label, value]) => ({ label: String(label), value, check: true })));
27
+ }
17
28
  fetchData(filterTerm, fieldName) {
18
29
  return new Promise(resolve => {
19
30
  this._application.executeSelectDistinct(this._dataUnit, fieldName, filterTerm).then(result => {
@@ -1,5 +1,5 @@
1
1
  import { ObjectUtils } from '@sankhyalabs/core';
2
- import { R as ResourceFetcher } from './form-config-fetcher-cd3fa459.js';
2
+ import { R as ResourceFetcher } from './form-config-fetcher-7c3b6273.js';
3
3
 
4
4
  class AuthFetcher extends ResourceFetcher {
5
5
  getData(resourceID) {