@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-77074.0 → 0.0.0-bugfix-dev-KB-75047.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 (144) hide show
  1. package/dist/cjs/{SnkMessageBuilder-7691a2c1.js → SnkMessageBuilder-bae64d0d.js} +0 -10
  2. package/dist/cjs/index-f9e81701.js +0 -8
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  5. package/dist/cjs/snk-actions-button_4.cjs.entry.js +25 -22
  6. package/dist/cjs/snk-application.cjs.entry.js +18 -2
  7. package/dist/cjs/snk-config-options_3.cjs.entry.js +17 -5
  8. package/dist/cjs/snk-crud.cjs.entry.js +8 -2
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  10. package/dist/cjs/{snk-data-unit-7dbdad0e.js → snk-data-unit-3d9b6ed4.js} +26 -14
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +9 -0
  14. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -1
  15. package/dist/cjs/snk-grid.cjs.entry.js +10 -2
  16. package/dist/cjs/{snk-guides-viewer-eee43c8b.js → snk-guides-viewer-2139481c.js} +1 -1
  17. package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -4
  19. package/dist/cjs/snk-taskbar.cjs.entry.js +40 -37
  20. package/dist/collection/collection-manifest.json +0 -3
  21. package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
  22. package/dist/collection/components/snk-application/snk-application.js +41 -1
  23. package/dist/collection/components/snk-crud/snk-crud.js +26 -2
  24. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +1 -1
  25. package/dist/collection/components/snk-data-unit/snk-data-unit.js +25 -13
  26. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +2 -1
  27. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +8 -0
  28. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +5 -1
  29. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +20 -0
  30. package/dist/collection/components/snk-form-config/snk-form-config.js +17 -5
  31. package/dist/collection/components/snk-grid/snk-grid.js +28 -2
  32. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +25 -4
  33. package/dist/collection/components/snk-taskbar/snk-taskbar.js +41 -38
  34. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +7 -1
  35. package/dist/collection/lib/message/SnkMessageBuilder.js +0 -2
  36. package/dist/components/SnkMessageBuilder.js +0 -10
  37. package/dist/components/index.d.ts +0 -3
  38. package/dist/components/index.js +0 -3
  39. package/dist/components/snk-actions-button2.js +27 -26
  40. package/dist/components/snk-application2.js +19 -2
  41. package/dist/components/snk-crud.js +9 -2
  42. package/dist/components/snk-data-unit2.js +25 -13
  43. package/dist/components/snk-detail-view2.js +1 -1
  44. package/dist/components/snk-filter-bar2.js +6 -0
  45. package/dist/components/snk-filter-item2.js +5 -1
  46. package/dist/components/snk-filter-text.js +2 -1
  47. package/dist/components/snk-form-config2.js +17 -5
  48. package/dist/components/snk-grid2.js +11 -2
  49. package/dist/components/snk-simple-crud2.js +8 -4
  50. package/dist/components/snk-taskbar2.js +41 -38
  51. package/dist/esm/{SnkMessageBuilder-7ace6803.js → SnkMessageBuilder-6fff4a4c.js} +0 -10
  52. package/dist/esm/index-a7d3d3f1.js +0 -8
  53. package/dist/esm/loader.js +1 -1
  54. package/dist/esm/sankhyablocks.js +1 -1
  55. package/dist/esm/snk-actions-button_4.entry.js +26 -23
  56. package/dist/esm/snk-application.entry.js +19 -3
  57. package/dist/esm/snk-config-options_3.entry.js +17 -5
  58. package/dist/esm/snk-crud.entry.js +8 -2
  59. package/dist/esm/snk-data-exporter.entry.js +2 -2
  60. package/dist/esm/{snk-data-unit-7a579dbd.js → snk-data-unit-9fa7d2b9.js} +26 -14
  61. package/dist/esm/snk-data-unit.entry.js +2 -2
  62. package/dist/esm/snk-detail-view.entry.js +2 -2
  63. package/dist/esm/snk-filter-bar_4.entry.js +10 -1
  64. package/dist/esm/snk-filter-text.entry.js +2 -1
  65. package/dist/esm/snk-grid.entry.js +10 -2
  66. package/dist/esm/{snk-guides-viewer-e8ca764a.js → snk-guides-viewer-b7ed39eb.js} +1 -1
  67. package/dist/esm/snk-guides-viewer.entry.js +1 -1
  68. package/dist/esm/snk-simple-crud.entry.js +7 -4
  69. package/dist/esm/snk-taskbar.entry.js +41 -38
  70. package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-0d2a2e9e.entry.js} +1 -1
  71. package/dist/sankhyablocks/p-17425c72.js +1 -0
  72. package/dist/sankhyablocks/p-1d3ce0d9.entry.js +1 -0
  73. package/dist/sankhyablocks/p-342eeb3b.js +1 -0
  74. package/dist/sankhyablocks/p-3728d2aa.entry.js +11 -0
  75. package/dist/sankhyablocks/{p-42130213.entry.js → p-4138da61.entry.js} +1 -1
  76. package/dist/sankhyablocks/p-4e1f992e.entry.js +1 -0
  77. package/dist/sankhyablocks/p-619aeac8.entry.js +1 -0
  78. package/dist/sankhyablocks/{p-00f9fe5c.entry.js → p-7075b789.entry.js} +1 -1
  79. package/dist/sankhyablocks/p-83e71703.entry.js +1 -0
  80. package/dist/sankhyablocks/p-89c92727.entry.js +1 -0
  81. package/dist/sankhyablocks/p-a3fadd0b.entry.js +1 -0
  82. package/dist/sankhyablocks/p-af7f7b3e.entry.js +1 -0
  83. package/dist/sankhyablocks/{p-b389ed49.entry.js → p-e390641b.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-e3a285a2.js → p-e97be1c8.js} +1 -1
  85. package/dist/sankhyablocks/p-ec43fcc8.entry.js +1 -0
  86. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  87. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
  88. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
  89. package/dist/types/components/snk-application/snk-application.d.ts +6 -1
  90. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  91. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +7 -0
  92. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
  93. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  94. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  95. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -0
  96. package/dist/types/components.d.ts +31 -393
  97. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
  98. package/package.json +1 -1
  99. package/react/components.d.ts +0 -3
  100. package/react/components.js +0 -3
  101. package/react/components.js.map +1 -1
  102. package/dist/cjs/input-distinct-search_2.cjs.entry.js +0 -469
  103. package/dist/cjs/snk-distinct-search.cjs.entry.js +0 -123
  104. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +0 -4
  105. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +0 -372
  106. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +0 -109
  107. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +0 -542
  108. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +0 -27
  109. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +0 -600
  110. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +0 -13
  111. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +0 -25
  112. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +0 -9
  113. package/dist/components/filter-distinct-search.js +0 -15
  114. package/dist/components/input-distinct-search.d.ts +0 -11
  115. package/dist/components/input-distinct-search.js +0 -6
  116. package/dist/components/input-distinct-search2.js +0 -262
  117. package/dist/components/search-modal.d.ts +0 -11
  118. package/dist/components/search-modal.js +0 -6
  119. package/dist/components/search-modal2.js +0 -264
  120. package/dist/components/snk-distinct-search.d.ts +0 -11
  121. package/dist/components/snk-distinct-search.js +0 -163
  122. package/dist/esm/input-distinct-search_2.entry.js +0 -464
  123. package/dist/esm/snk-distinct-search.entry.js +0 -119
  124. package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
  125. package/dist/sankhyablocks/p-154aa2a6.entry.js +0 -11
  126. package/dist/sankhyablocks/p-18cb1acb.entry.js +0 -1
  127. package/dist/sankhyablocks/p-1dbd5c18.entry.js +0 -1
  128. package/dist/sankhyablocks/p-2aae03a1.entry.js +0 -1
  129. package/dist/sankhyablocks/p-30ebcbe0.entry.js +0 -1
  130. package/dist/sankhyablocks/p-37074cc3.entry.js +0 -1
  131. package/dist/sankhyablocks/p-3858a2e4.entry.js +0 -1
  132. package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
  133. package/dist/sankhyablocks/p-96a89d58.entry.js +0 -1
  134. package/dist/sankhyablocks/p-c75fae8e.js +0 -1
  135. package/dist/sankhyablocks/p-d8665750.js +0 -1
  136. package/dist/sankhyablocks/p-f0aaad2b.entry.js +0 -1
  137. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +0 -83
  138. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +0 -105
  139. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +0 -126
  140. package/dist/types/components/snk-distinct-search/types/index.d.ts +0 -8
  141. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +0 -3
  142. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +0 -6
  143. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +0 -2
  144. /package/dist/collection/components/{snk-distinct-search/types → snk-actions-button/interfaces}/index.js +0 -0
@@ -3,7 +3,7 @@
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
5
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
6
- const SnkMessageBuilder = require('./SnkMessageBuilder-7691a2c1.js');
6
+ const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
7
7
  const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
8
8
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
9
9
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
@@ -25,7 +25,7 @@ const SnkDataUnit = class {
25
25
  this._rowMetadataCache = new Map();
26
26
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
27
27
  this._dataUnitObserver = async (action) => {
28
- const duState = this.buildDataState(action.type);
28
+ const duState = await this.buildDataState(action.type);
29
29
  this.dataState = duState;
30
30
  this.messagesBuilder.currentOperation = this.getMessageOperation();
31
31
  switch (action.type) {
@@ -137,14 +137,22 @@ const SnkDataUnit = class {
137
137
  async getRowMetadata(record) {
138
138
  return this.doGetRowMetadata(record);
139
139
  }
140
- doGetRowMetadata(record) {
140
+ async doGetRowMetadata(record) {
141
141
  const selectedRecord = this.dataUnit.getSelectedRecord();
142
142
  if (!record && !selectedRecord) {
143
143
  return;
144
144
  }
145
145
  const currentRecord = record || selectedRecord;
146
146
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
147
- const rowMetadata = this._metadataByRow.get(recordId);
147
+ let rowMetadata = this._metadataByRow.get(recordId);
148
+ /*
149
+ Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
150
+ muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
151
+ corretos nao confiando apenas no _metadataByRow
152
+ */
153
+ if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
154
+ rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
155
+ }
148
156
  if (!rowMetadata) {
149
157
  return;
150
158
  }
@@ -338,7 +346,7 @@ const SnkDataUnit = class {
338
346
  case core.Action.RECORDS_COPIED:
339
347
  return this.interceptRecordsCopied(action);
340
348
  case core.Action.DATA_CHANGED:
341
- await this.handleLoadRowMetadata(action);
349
+ await this.handleLoadRowMetadata(action.payload);
342
350
  return await this.interceptDataChange(action);
343
351
  case core.Action.CHANGING_DATA:
344
352
  return await this.interceptDataChange(action);
@@ -358,8 +366,9 @@ const SnkDataUnit = class {
358
366
  return action;
359
367
  }
360
368
  }
361
- async handleLoadRowMetadata(action) {
362
- const record = action.type === core.Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
369
+ async handleLoadRowMetadata(record) {
370
+ if (!record)
371
+ return;
363
372
  const keysPayload = Object.keys(record);
364
373
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
365
374
  if (rmpField) {
@@ -438,7 +447,7 @@ const SnkDataUnit = class {
438
447
  isAllowed(flag) {
439
448
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
440
449
  }
441
- buildDataState(actionType) {
450
+ async buildDataState(actionType) {
442
451
  var _a;
443
452
  const selectionInfo = this.dataUnit.getSelectionInfo();
444
453
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -446,7 +455,7 @@ const SnkDataUnit = class {
446
455
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
447
456
  const allowedOverwrite = [core.Action.SELECTION_CHANGED, core.Action.EDITION_CANCELED, core.Action.NEXT_SELECTED, core.Action.PREVIOUS_SELECTED];
448
457
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
449
- rowMetadata = this.doGetRowMetadata(selectedRecord);
458
+ rowMetadata = await this.doGetRowMetadata(selectedRecord);
450
459
  }
451
460
  else if (rowMetadata) {
452
461
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -468,17 +477,20 @@ const SnkDataUnit = class {
468
477
  });
469
478
  }
470
479
  async handleDataSaved(action) {
471
- const newRowMetadata = await this.handleLoadRowMetadata(action);
480
+ var _a, _b, _c;
481
+ const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
472
482
  if (newRowMetadata) {
473
483
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
474
484
  }
475
485
  const recordId = action.payload.records[0].__record__id__;
476
486
  this._metadataByRow.set(recordId, newRowMetadata);
477
- this.dataState = this.buildDataState();
478
- if (this.ignoreSaveMessage) {
487
+ this.dataState = await this.buildDataState();
488
+ let saveOperation = action.payload.changes[0]._operation.toLowerCase();
489
+ if (saveOperation == 'copy')
490
+ saveOperation = SnkMessageBuilder.OperationMap.CLONE;
491
+ if (this.ignoreSaveMessage && ![SnkMessageBuilder.OperationMap.CLONE, SnkMessageBuilder.OperationMap.INSERT].includes(saveOperation)) {
479
492
  return;
480
493
  }
481
- const saveOperation = action.payload.changes[0]._operation.toLowerCase();
482
494
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
483
495
  if (msg != undefined) {
484
496
  this.showSuccessMessage(msg);
@@ -571,7 +583,7 @@ const SnkDataUnit = class {
571
583
  const { records } = this.getMetadataByRow(this.dataUnit);
572
584
  this.dataUnit.records = records;
573
585
  }
574
- this.dataState = this.buildDataState();
586
+ this.dataState = await this.buildDataState();
575
587
  let resolver;
576
588
  while (resolver = this._onDataUnitResolve.pop()) {
577
589
  resolver(this.dataUnit);
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkDataUnit = require('./snk-data-unit-7dbdad0e.js');
5
+ const snkDataUnit = require('./snk-data-unit-3d9b6ed4.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('@sankhyalabs/ezui/dist/collection/utils');
9
- require('./SnkMessageBuilder-7691a2c1.js');
9
+ require('./SnkMessageBuilder-bae64d0d.js');
10
10
  require('./dataunit-fetcher-228016f4.js');
11
11
  require('./DataFetcher-e059eb72.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
@@ -17,8 +17,8 @@ require('./filter-item-type.enum-a7ffdaa6.js');
17
17
  require('./form-config-fetcher-39397ac5.js');
18
18
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
19
19
  const constants = require('./constants-35ddd366.js');
20
- const snkGuidesViewer = require('./snk-guides-viewer-eee43c8b.js');
21
- const SnkMessageBuilder = require('./SnkMessageBuilder-7691a2c1.js');
20
+ const snkGuidesViewer = require('./snk-guides-viewer-2139481c.js');
21
+ const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
22
22
  require('./ConfigStorage-f079f5fd.js');
23
23
  require('./PrintUtils-bcaeb82f.js');
24
24
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
@@ -290,6 +290,7 @@ const SnkFilterBar = class {
290
290
  this.disablePersonalizedFilter = undefined;
291
291
  this.filterBarLegacyConfigName = undefined;
292
292
  this.autoLoad = undefined;
293
+ this.afterApplyConfig = undefined;
293
294
  this.allowDefault = undefined;
294
295
  this.scrollerLocked = false;
295
296
  this.showPersonalizedFilter = false;
@@ -425,6 +426,7 @@ const SnkFilterBar = class {
425
426
  return this.filterConfig.find(item => item.type === filterItemType_enum.FilterItemType.PERSONALIZED);
426
427
  }
427
428
  async processAfterUpdateConfig() {
429
+ var _a;
428
430
  if (this._loadingPending) {
429
431
  if (await this._application.isLoadedByPk() && !this._configUpdated)
430
432
  return;
@@ -439,6 +441,7 @@ const SnkFilterBar = class {
439
441
  if (this._configUpdated) {
440
442
  this._configUpdated = false;
441
443
  ConfigStorage.ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
444
+ (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
442
445
  }
443
446
  }
444
447
  async doLoadData(forceReload = false) {
@@ -643,7 +646,9 @@ const SnkFilterBar = class {
643
646
  */
644
647
  async showFilterModal() {
645
648
  const callbackOnApplyFilter = (filters) => {
649
+ var _a;
646
650
  this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
651
+ (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
647
652
  };
648
653
  let filtersConfigCopy = core.ObjectUtils.copy(this.filterConfig);
649
654
  filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
@@ -937,6 +942,10 @@ const SnkFilterItem = class {
937
942
  return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
938
943
  }
939
944
  }
945
+ if (this.config.mask) {
946
+ const _maskFormatter = new core.MaskFormatter(this.config.mask);
947
+ return `${label}: ${_maskFormatter.format(value)}`;
948
+ }
940
949
  return `${label}: ${value}`;
941
950
  }
942
951
  return label;
@@ -25,10 +25,11 @@ const SnkFilterText = class {
25
25
  }
26
26
  }
27
27
  render() {
28
+ var _a;
28
29
  if (!this.config) {
29
30
  return undefined;
30
31
  }
31
- return (index.h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
32
+ return (index.h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value, mask: (_a = this.config) === null || _a === void 0 ? void 0 : _a.mask, cleanValueMask: true }));
32
33
  }
33
34
  get _element() { return index.getElement(this); }
34
35
  };
@@ -146,6 +146,7 @@ const SnkGrid = class {
146
146
  this.autoLoad = undefined;
147
147
  this.autoFocus = true;
148
148
  this.enableGridInsert = false;
149
+ this.enableLockManger = false;
149
150
  }
150
151
  /**
151
152
  * Exibe a janela de configurações da grade.
@@ -233,10 +234,17 @@ const SnkGrid = class {
233
234
  this._grid.setFocus();
234
235
  }
235
236
  async handleClick(event) {
237
+ var _a;
236
238
  if (this.hasToBlockEvent(event)) {
237
239
  event.preventDefault();
238
240
  event.stopPropagation();
239
- await this._dataUnit.cancelEdition();
241
+ if (!await this._dataUnit.cancelEdition())
242
+ return;
243
+ const newEvent = new event.constructor(event.type, event);
244
+ (_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
245
+ }
246
+ if (this._grid && !this._grid.contains(event.target)) {
247
+ this._grid.stopEdit();
240
248
  }
241
249
  }
242
250
  hasToBlockEvent(event) {
@@ -527,7 +535,7 @@ const SnkGrid = class {
527
535
  return undefined;
528
536
  }
529
537
  return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
530
- index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.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, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.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.resourceID }))));
538
+ index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), index.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, overflowStrategy: 'none' }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.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.resourceID }))));
531
539
  }
532
540
  get _element() { return index.getElement(this); }
533
541
  static get watchers() { return {
@@ -456,7 +456,7 @@ const SnkGuidesViewer = class {
456
456
  await this.openGuideNavigator(guideName);
457
457
  }
458
458
  if (action.type === core.Action.METADATA_LOADED) {
459
- this.loadGuides(false);
459
+ this.loadGuides(this.noGuideSelected());
460
460
  }
461
461
  }
462
462
  async addErrorBadgeToGuide(guideName) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-eee43c8b.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-2139481c.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('./SnkFormConfigManager-63369164.js');
@@ -121,6 +121,7 @@ const SnkSimpleCrud = class {
121
121
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
122
122
  this.gridConfig = undefined;
123
123
  this.formConfig = undefined;
124
+ this.enableLockManger = false;
124
125
  this._formFields = [];
125
126
  this._fieldsProps = new Map();
126
127
  this._enableContinuousInsert = true;
@@ -805,16 +806,18 @@ const SnkSimpleCrud = class {
805
806
  return;
806
807
  this.goToView(constants.VIEW_MODE.FORM);
807
808
  }
809
+ renderTaskbarContent() {
810
+ var _a;
811
+ return (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
812
+ }
808
813
  /* istanbul ignore next */
809
814
  render() {
810
- var _a;
811
815
  if (this.dataUnit == undefined) {
812
816
  return;
813
817
  }
814
- const taskbarContent = (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
815
- 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 && !this.enableGridInsert, 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 ez-box--shadow simple-crud__container-section" }, this._currentViewMode === constants.VIEW_MODE.FORM && taskbarContent, 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)
818
+ 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 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)
816
819
  ? undefined
817
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === constants.VIEW_MODE.GRID && taskbarContent, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), 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() }))));
820
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, 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 ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), 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() }))));
818
821
  }
819
822
  get _element() { return index$1.getElement(this); }
820
823
  static get watchers() { return {
@@ -160,42 +160,44 @@ const SnkTaskbar = class {
160
160
  return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
161
161
  }
162
162
  elementClick(elem) {
163
- if (this.dataUnit) {
164
- switch (elem) {
165
- case taskbarElements.TaskbarElement.PREVIOUS:
166
- this.dataUnit.previousRecord();
167
- break;
168
- case taskbarElements.TaskbarElement.NEXT:
169
- this.dataUnit.nextRecord();
170
- break;
171
- case taskbarElements.TaskbarElement.REFRESH:
172
- this.dataUnit.loadData();
173
- break;
174
- case taskbarElements.TaskbarElement.CLONE:
175
- this.dataUnit.copySelected();
176
- break;
177
- case taskbarElements.TaskbarElement.REMOVE:
178
- this.dataUnit.removeSelectedRecords();
179
- break;
180
- case taskbarElements.TaskbarElement.INSERT:
181
- this.dataUnit.addRecord();
182
- break;
183
- case taskbarElements.TaskbarElement.CANCEL:
184
- this.dataUnit.cancelEdition();
185
- break;
186
- case taskbarElements.TaskbarElement.SAVE:
187
- if (!this._isWaitingForSave) {
188
- this._isWaitingForSave = true;
189
- this.dataUnit.saveData()
190
- .finally(() => {
191
- this._isWaitingForSave = false;
192
- });
193
- }
194
- break;
163
+ core.LockManager.whenResolve(this._element, core.LockManagerOperation.TASKBAR_CLICK).then(() => {
164
+ if (this.dataUnit) {
165
+ switch (elem) {
166
+ case taskbarElements.TaskbarElement.PREVIOUS:
167
+ this.dataUnit.previousRecord();
168
+ break;
169
+ case taskbarElements.TaskbarElement.NEXT:
170
+ this.dataUnit.nextRecord();
171
+ break;
172
+ case taskbarElements.TaskbarElement.REFRESH:
173
+ this.dataUnit.loadData();
174
+ break;
175
+ case taskbarElements.TaskbarElement.CLONE:
176
+ this.dataUnit.copySelected();
177
+ break;
178
+ case taskbarElements.TaskbarElement.REMOVE:
179
+ this.dataUnit.removeSelectedRecords();
180
+ break;
181
+ case taskbarElements.TaskbarElement.INSERT:
182
+ this.dataUnit.addRecord();
183
+ break;
184
+ case taskbarElements.TaskbarElement.CANCEL:
185
+ this.dataUnit.cancelEdition();
186
+ break;
187
+ case taskbarElements.TaskbarElement.SAVE:
188
+ if (!this._isWaitingForSave) {
189
+ this._isWaitingForSave = true;
190
+ this.dataUnit.saveData()
191
+ .finally(() => {
192
+ this._isWaitingForSave = false;
193
+ });
194
+ }
195
+ break;
196
+ }
195
197
  }
196
- }
197
- if (this.isEnabled(elem))
198
- this.actionClick.emit(elem);
198
+ if (this.isEnabled(elem))
199
+ this.actionClick.emit(elem);
200
+ });
199
201
  }
200
202
  isEnabled(elem) {
201
203
  if (!this.isAllowed(elem)) {
@@ -399,9 +401,10 @@ const SnkTaskbar = class {
399
401
  this._lastWidth = this._element.getBoundingClientRect().width;
400
402
  }
401
403
  disconnectedCallback() {
402
- var _a;
404
+ var _a, _b;
405
+ (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.unsubscribe(this.onSaveEvent);
403
406
  this.unlinkAllCustomElements();
404
- (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
407
+ (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.destroy();
405
408
  }
406
409
  unlinkAllCustomElements() {
407
410
  var _a;
@@ -19,9 +19,6 @@
19
19
  "./components/snk-custom-slot-elements/snk-custom-slot-elements.js",
20
20
  "./components/snk-data-exporter/snk-data-exporter.js",
21
21
  "./components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js",
22
- "./components/snk-distinct-search/snk-distinct-search.js",
23
- "./components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js",
24
- "./components/snk-distinct-search/subcomponents/search-modal/search-modal.js",
25
22
  "./components/snk-entity-list/snk-entity-list.js",
26
23
  "./components/snk-filter-bar/snk-filter-bar.js",
27
24
  "./components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js",
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { ApplicationContext, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { ApplicationContext, ArrayUtils, ElementIDUtils, ServiceUtils, StorageType } from '@sankhyalabs/core';
3
3
  import { DataFetcher } from '../../lib/http/data-fetcher/DataFetcher';
4
4
  import ExecutorFactory from './actions/factory/executor.factory';
5
5
  import Actions from './actions';
@@ -8,6 +8,7 @@ import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
8
8
  export class SnkActionsButton {
9
9
  constructor() {
10
10
  this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
11
+ this._actions = [];
11
12
  this.handleClick = (evt) => {
12
13
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
13
14
  const executor = new ExecutorFactory(selectedAction.type).executor;
@@ -17,27 +18,22 @@ export class SnkActionsButton {
17
18
  };
18
19
  this._items = [];
19
20
  this._showDropdown = false;
20
- this._actions = [];
21
- this._isOrderActions = false;
22
21
  }
23
22
  async getActions() {
24
- let param = {
25
- param: {
26
- entityName: this._entityName,
27
- resourceID: this._resourceID
28
- }
29
- };
30
- return DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param).then((result) => {
23
+ const actions = await ServiceUtils.useCacheWithService(`SnkActionsButton_${this._entityName}-${this._resourceID}`, async () => {
31
24
  var _a;
32
- if (!((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action))
33
- return;
34
- if (this._isOrderActions) {
35
- this._actions = ArrayUtils.sortAlphabetically(result.actions.action, 'description');
36
- }
37
- else {
38
- this._actions = result.actions.action;
39
- }
40
- });
25
+ const param = {
26
+ param: {
27
+ entityName: this._entityName,
28
+ resourceID: this._resourceID,
29
+ },
30
+ };
31
+ const result = await DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param);
32
+ return ((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action) || [];
33
+ }, StorageType.IN_MEMORY_CACHE);
34
+ this._actions = SnkActionsButton.parameters.isOrderActions
35
+ ? ArrayUtils.sortAlphabetically(actions, 'description')
36
+ : actions;
41
37
  }
42
38
  controlDropdown() {
43
39
  this._showDropdown = !this._showDropdown;
@@ -70,7 +66,7 @@ export class SnkActionsButton {
70
66
  }
71
67
  async componentWillLoad() {
72
68
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
73
- this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
69
+ await this.loadParameters();
74
70
  const snkDataUnit = this._element.parentElement;
75
71
  this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
76
72
  this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
@@ -79,9 +75,8 @@ export class SnkActionsButton {
79
75
  this._resourceID = await ResourceIDUtils.getResourceID();
80
76
  }
81
77
  this.setEvents();
82
- this.getActions().then(() => {
83
- this.loadItems();
84
- });
78
+ await this.getActions();
79
+ this.loadItems();
85
80
  }
86
81
  async componentDidLoad() {
87
82
  if (!this._element)
@@ -108,6 +103,11 @@ export class SnkActionsButton {
108
103
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
109
104
  };
110
105
  }
106
+ async loadParameters() {
107
+ if (SnkActionsButton.parameters.isOrderActions != null)
108
+ return;
109
+ SnkActionsButton.parameters.isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
110
+ }
111
111
  render() {
112
112
  return (h(Host, null, (this._actions && this._actions.length > 0) &&
113
113
  (h("div", { class: `ez-padding-left--medium snk-actions-button
@@ -134,10 +134,11 @@ export class SnkActionsButton {
134
134
  static get states() {
135
135
  return {
136
136
  "_items": {},
137
- "_showDropdown": {},
138
- "_actions": {},
139
- "_isOrderActions": {}
137
+ "_showDropdown": {}
140
138
  };
141
139
  }
142
140
  static get elementRef() { return "_element"; }
143
141
  }
142
+ SnkActionsButton.parameters = {
143
+ isOrderActions: null
144
+ };
@@ -16,6 +16,7 @@ import UrlUtils from "../../lib/utils/urlutils";
16
16
  import Workspace from "../../lib/workspace/workspace";
17
17
  import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
18
18
  import RequestListenerFactory from "./request-listener/RequestListenerFactory";
19
+ import PreloadManager from "../../lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager";
19
20
  /**
20
21
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
21
22
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -517,6 +518,16 @@ export class SnkApplication {
517
518
  async isLoadedByPk() {
518
519
  return Promise.resolve(this._isLoadedByPk);
519
520
  }
521
+ /**
522
+ * Remove registro do cache do PreLoader do dataunit.
523
+ * Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
524
+ */
525
+ async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
526
+ const records = recordsIDs.map(id => {
527
+ return { "__record__id__": id };
528
+ });
529
+ PreloadManager.removeRecords(dataUnit, records);
530
+ }
520
531
  async getAuthList(auth) {
521
532
  return await (new MGEAuthorization()).parseFromJSON(auth);
522
533
  }
@@ -1097,7 +1108,7 @@ export class SnkApplication {
1097
1108
  "mutable": false,
1098
1109
  "complexType": {
1099
1110
  "original": "LoadByPkHandler",
1100
- "resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
1111
+ "resolved": "(objPK: { pk: any; }, redirectFrom?: string) => void",
1101
1112
  "references": {
1102
1113
  "LoadByPkHandler": {
1103
1114
  "location": "global"
@@ -2201,6 +2212,35 @@ export class SnkApplication {
2201
2212
  }]
2202
2213
  }
2203
2214
  },
2215
+ "preloadMangerRemoveRecord": {
2216
+ "complexType": {
2217
+ "signature": "(dataUnit: DataUnit, recordsIDs: Array<string>) => Promise<void>",
2218
+ "parameters": [{
2219
+ "tags": [],
2220
+ "text": ""
2221
+ }, {
2222
+ "tags": [],
2223
+ "text": ""
2224
+ }],
2225
+ "references": {
2226
+ "Promise": {
2227
+ "location": "global"
2228
+ },
2229
+ "DataUnit": {
2230
+ "location": "import",
2231
+ "path": "@sankhyalabs/core"
2232
+ },
2233
+ "Array": {
2234
+ "location": "global"
2235
+ }
2236
+ },
2237
+ "return": "Promise<void>"
2238
+ },
2239
+ "docs": {
2240
+ "text": "Remove registro do cache do PreLoader do dataunit.\nDeve ser usado quando existe um dataunit usando loader do application, mas o removeLoader est\u00E1 sendo sobrescrito.",
2241
+ "tags": []
2242
+ }
2243
+ },
2204
2244
  "executeSearch": {
2205
2245
  "complexType": {
2206
2246
  "signature": "(searchArgument: ISearchArgument, fieldName: string, dataUnit: DataUnit) => Promise<Array<IOption> | IOption>",