@sankhyalabs/sankhyablocks 8.16.0-dev.9 → 8.16.0-rc.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-e49214c6.js} +2 -2
  2. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
  3. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  4. package/dist/cjs/{IExporterProvider-597949f9.js → IExporterProvider-8c030a7e.js} +5 -5
  5. package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-beebf47a.js} +2 -2
  6. package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-cceebbae.js} +1 -1
  7. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
  8. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-d4873076.js} +1 -1
  9. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-a1d0353f.js} +1 -1
  12. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  13. package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
  14. package/dist/cjs/snk-application.cjs.entry.js +7 -7
  15. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  16. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
  18. package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-c7dcfa19.js} +16 -8
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
  21. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -11
  23. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
  25. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  26. package/dist/cjs/snk-grid.cjs.entry.js +9 -9
  27. package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-69ec61af.js} +5 -5
  28. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  29. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  30. package/dist/cjs/snk-simple-crud.cjs.entry.js +9 -9
  31. package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
  32. package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
  33. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -1
  34. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  35. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  36. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  37. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  38. package/dist/collection/components/snk-data-unit/snk-data-unit.js +14 -6
  39. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +16 -8
  40. package/dist/collection/components/snk-grid/snk-grid.js +1 -1
  41. package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
  42. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +2 -2
  43. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
  44. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  45. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  46. package/dist/components/DataFetcher.js +8 -3
  47. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  48. package/dist/components/IExporterProvider.js +2 -2
  49. package/dist/components/SnkMessageBuilder.js +1 -1
  50. package/dist/components/snk-actions-button2.js +12 -9
  51. package/dist/components/snk-data-exporter2.js +2 -2
  52. package/dist/components/snk-data-unit2.js +16 -45
  53. package/dist/components/snk-detail-view2.js +1 -1
  54. package/dist/components/snk-exporter-email-sender2.js +1 -1
  55. package/dist/components/snk-filter-bar2.js +16 -8
  56. package/dist/components/snk-grid2.js +3 -3
  57. package/dist/components/snk-simple-crud2.js +3 -2
  58. package/dist/components/snk-taskbar2.js +24 -2
  59. package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-e476378d.js} +2 -2
  60. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
  61. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  62. package/dist/esm/{IExporterProvider-63a188b6.js → IExporterProvider-f86019db.js} +6 -6
  63. package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-298cd647.js} +2 -2
  64. package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-ae87b754.js} +1 -1
  65. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
  66. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-3d2ec959.js} +1 -1
  67. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
  68. package/dist/esm/loader.js +1 -1
  69. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-a87445a0.js} +1 -1
  70. package/dist/esm/sankhyablocks.js +1 -1
  71. package/dist/esm/snk-actions-button_4.entry.js +17 -14
  72. package/dist/esm/snk-application.entry.js +7 -7
  73. package/dist/esm/snk-attach.entry.js +5 -5
  74. package/dist/esm/snk-crud.entry.js +5 -5
  75. package/dist/esm/snk-data-exporter.entry.js +9 -9
  76. package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-3276e55e.js} +16 -8
  77. package/dist/esm/snk-data-unit.entry.js +5 -5
  78. package/dist/esm/snk-detail-view.entry.js +9 -9
  79. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  80. package/dist/esm/snk-filter-bar.entry.js +19 -11
  81. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  82. package/dist/esm/snk-form-config.entry.js +2 -2
  83. package/dist/esm/snk-form.entry.js +4 -4
  84. package/dist/esm/snk-grid.entry.js +9 -9
  85. package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-43f21b03.js} +5 -5
  86. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  87. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  88. package/dist/esm/snk-simple-crud.entry.js +9 -9
  89. package/dist/esm/snk-taskbar.entry.js +23 -1
  90. package/dist/sankhyablocks/{p-fe79f83a.js → p-091ce761.js} +1 -1
  91. package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
  92. package/dist/sankhyablocks/{p-7619bdb1.entry.js → p-162b9a59.entry.js} +2 -2
  93. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  94. package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
  95. package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
  96. package/dist/sankhyablocks/p-1a21b61a.entry.js +1 -0
  97. package/dist/sankhyablocks/p-1e596b15.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-fa4d8cb4.js → p-1f35c795.js} +1 -1
  99. package/dist/sankhyablocks/{p-af8efd95.js → p-25f1fc39.js} +1 -1
  100. package/dist/sankhyablocks/{p-62ba211a.entry.js → p-2e9c764c.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-52920496.js → p-3287a6cc.js} +1 -1
  102. package/dist/sankhyablocks/{p-7505da04.entry.js → p-42f7b05d.entry.js} +1 -1
  103. package/dist/sankhyablocks/p-4e1b47a4.js +1 -0
  104. package/dist/sankhyablocks/{p-b05d8893.entry.js → p-53412c1d.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-594bc21d.js +1 -0
  106. package/dist/sankhyablocks/p-5b26cc7c.entry.js +1 -0
  107. package/dist/sankhyablocks/{p-2a408684.js → p-5f016aed.js} +1 -1
  108. package/dist/sankhyablocks/p-6d55957a.js +1 -0
  109. package/dist/sankhyablocks/p-7b8f7242.entry.js +1 -0
  110. package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
  111. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  112. package/dist/sankhyablocks/p-92ed1d24.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-450c60e4.entry.js → p-939e15d3.entry.js} +1 -1
  114. package/dist/sankhyablocks/{p-47db7e88.entry.js → p-9dfda04a.entry.js} +1 -1
  115. package/dist/sankhyablocks/{p-80042dc6.entry.js → p-aa5b3b2c.entry.js} +1 -1
  116. package/dist/sankhyablocks/{p-7a85fd49.entry.js → p-aa6d510d.entry.js} +1 -1
  117. package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-bd008859.entry.js} +1 -1
  118. package/dist/sankhyablocks/{p-871aa14e.entry.js → p-fd8a58ff.entry.js} +1 -1
  119. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  120. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  121. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
  122. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
  123. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  124. package/dist/types/components.d.ts +8 -0
  125. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  126. package/package.json +2 -2
  127. package/dist/sankhyablocks/p-17def7cd.js +0 -1
  128. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  129. package/dist/sankhyablocks/p-3a212712.js +0 -1
  130. package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
  131. package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
  132. package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
  133. package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
  134. package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
  135. package/dist/sankhyablocks/p-9863d682.js +0 -1
  136. package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
  137. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  138. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  139. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -4,8 +4,8 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
4
4
  import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
5
5
  import { DatasetStrategy } from '../../lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy';
6
6
  import { getRecordValue } from '../../lib/dataUnit/ValueFormatter';
7
- import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
8
7
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
8
+ import { getSelectedRecordsIDsInfo } from '../../lib/utils/GetSelectedRecordsIDsInfo';
9
9
  export class SnkDataUnit {
10
10
  constructor() {
11
11
  this._onDataUnitResolve = [];
@@ -110,7 +110,7 @@ export class SnkDataUnit {
110
110
  * @returns Retorna a lista de IDs dos registros selecionados.
111
111
  */
112
112
  async getSelectedRecordsIDsInfo() {
113
- return Promise.resolve(getSelectedIDs(this.dataUnit));
113
+ return getSelectedRecordsIDsInfo(this.dataUnit);
114
114
  }
115
115
  /**
116
116
  * Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
@@ -540,18 +540,26 @@ export class SnkDataUnit {
540
540
  return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
541
541
  }
542
542
  }
543
+ updateMetadataWithRMP() {
544
+ this.fillFieldsWithRmp(this.dataUnit.metadata);
545
+ this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
546
+ const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
547
+ this.dataUnit.metadata = dataUnitUpdatedMetadata;
548
+ }
543
549
  async loadDataUnit() {
544
- var _a;
550
+ var _a, _b;
545
551
  if (this.dataUnit == null && this._application && this.entityName) {
546
552
  this.dataUnit = await this.getDataUnitParentOrChild();
547
553
  }
548
554
  if (this.dataUnit) {
549
555
  this.dataUnit.pageSize = this.pageSize;
550
556
  this.dataUnit.unsubscribe(this._dataUnitObserver);
551
- this.dataUnit.addInterceptor(this);
552
557
  this.dataUnit.subscribe(this._dataUnitObserver);
553
- await this.dataUnit.loadMetadata();
554
- if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
558
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
559
+ this.updateMetadataWithRMP();
560
+ }
561
+ this.dataUnit.addInterceptor(this);
562
+ if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
555
563
  this.getMetadataByRow(this.dataUnit);
556
564
  }
557
565
  this.dataState = this.buildDataState();
@@ -15,13 +15,13 @@ export class SnkFilterBar {
15
15
  this._pendingVariables = false;
16
16
  this._customfiltersToBeUpdated = [];
17
17
  this._calculateSortIndex = (item) => {
18
- let index = item.hardFixed ? 1000000 : 0;
19
- //campos Hard Fixed não variam a ordem
20
- if (!item.hardFixed) {
21
- index += item.fixed ? 100000 : 0;
22
- index += item.value == undefined ? 0 : 10000;
23
- index += this._updateSequence.lastIndexOf(item.id) + 1;
24
- }
18
+ if (!item.visible)
19
+ return 0;
20
+ if (item.hardFixed)
21
+ return 1000000; //campos Hard Fixed não variam a ordem
22
+ let index = item.fixed ? 100000 : 0;
23
+ index += this.hasValidValue(item) ? 10000 : 0;
24
+ index += this._updateSequence.lastIndexOf(item.id) + 1;
25
25
  return index;
26
26
  };
27
27
  this._filtersComparator = (a, b) => {
@@ -42,6 +42,13 @@ export class SnkFilterBar {
42
42
  this.showPersonalizedFilter = false;
43
43
  this.personalizedFilterId = undefined;
44
44
  }
45
+ hasValidValue(item) {
46
+ if (item.value === undefined || item.value === null)
47
+ return false;
48
+ if (!Array.isArray(item.value))
49
+ return true;
50
+ return item.value.some(filterItem => filterItem.check === true);
51
+ }
45
52
  observeFilterConfig(newValue, oldValue) {
46
53
  if (ObjectUtils.equals(newValue, oldValue))
47
54
  return;
@@ -268,7 +275,7 @@ export class SnkFilterBar {
268
275
  getFilterItems() {
269
276
  const pinnedItems = [];
270
277
  const unpinnedItems = [];
271
- this.filterConfig
278
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
272
279
  .filter(this.filterActiveFilter)
273
280
  .forEach((item, index) => {
274
281
  item = ObjectUtils.copy(item);
@@ -338,6 +345,7 @@ export class SnkFilterBar {
338
345
  .then((filters) => {
339
346
  accept();
340
347
  this.filterConfig = filters.map(item => this.normalizeItem(item));
348
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
341
349
  })
342
350
  .catch(reason => {
343
351
  throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
@@ -309,7 +309,7 @@ export class SnkGrid {
309
309
  const disabledButtons = [];
310
310
  if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
311
311
  if (this._dataState.selectionInfo.length > 1) {
312
- disabledButtons.push(TaskbarElement.CLONE, "ATTACH");
312
+ disabledButtons.push(TaskbarElement.CLONE, "ATTACH", TaskbarElement.UPDATE);
313
313
  }
314
314
  if (this._dataState.selectionInfo.isAllRecords()) {
315
315
  disabledButtons.push("REMOVE");
@@ -29,6 +29,7 @@ export class SnkTaskbar {
29
29
  this.onSaveEvent = (action) => {
30
30
  switch (action.type) {
31
31
  case DUAction.FIELD_INVALIDATED:
32
+ case DUAction.INVALIDATE_CLEAN:
32
33
  case DUAction.DATA_SAVED:
33
34
  case DUAction.SAVING_ERROR:
34
35
  this._isWaitingForSave = false;
@@ -67,6 +68,16 @@ export class SnkTaskbar {
67
68
  this.getCustomElements(true);
68
69
  }
69
70
  }
71
+ handleTaskbarSaveLocker() {
72
+ if (this._isWaitingForSave !== true) {
73
+ this._isWaitingForSave = true;
74
+ }
75
+ }
76
+ handleTaskbarSaveUnlocker() {
77
+ if (this._isWaitingForSave === true) {
78
+ this._isWaitingForSave = false;
79
+ }
80
+ }
70
81
  hasToSearchCustomElements(event) {
71
82
  return this.customSlotId === event.detail && !this._slotContainer;
72
83
  }
@@ -85,6 +96,14 @@ export class SnkTaskbar {
85
96
  this._hasToUpdateOverFlow = true;
86
97
  }
87
98
  }
99
+ observeIsWaitingForSave(newValue, oldValue) {
100
+ if (newValue == true && oldValue == false) {
101
+ this.taskbarSaveLocker.emit();
102
+ }
103
+ if (newValue == false && oldValue == true) {
104
+ this.taskbarSaveUnlocker.emit();
105
+ }
106
+ }
88
107
  // Internal methods
89
108
  elementsFromString(strButtons) {
90
109
  const elements = [];
@@ -719,6 +738,36 @@ export class SnkTaskbar {
719
738
  "resolved": "string",
720
739
  "references": {}
721
740
  }
741
+ }, {
742
+ "method": "taskbarSaveLocker",
743
+ "name": "taskbarSaveLocker",
744
+ "bubbles": true,
745
+ "cancelable": true,
746
+ "composed": true,
747
+ "docs": {
748
+ "tags": [],
749
+ "text": "Emitido sempre que um save \u00E9 iniciado pela taskbar."
750
+ },
751
+ "complexType": {
752
+ "original": "void",
753
+ "resolved": "void",
754
+ "references": {}
755
+ }
756
+ }, {
757
+ "method": "taskbarSaveUnlocker",
758
+ "name": "taskbarSaveUnlocker",
759
+ "bubbles": true,
760
+ "cancelable": true,
761
+ "composed": true,
762
+ "docs": {
763
+ "tags": [],
764
+ "text": "Emitido sempre que o ocorre alguma action que libera o save."
765
+ },
766
+ "complexType": {
767
+ "original": "void",
768
+ "resolved": "void",
769
+ "references": {}
770
+ }
722
771
  }];
723
772
  }
724
773
  static get elementRef() { return "_element"; }
@@ -732,6 +781,9 @@ export class SnkTaskbar {
732
781
  }, {
733
782
  "propName": "_lastWidth",
734
783
  "methodName": "observeLastWidth"
784
+ }, {
785
+ "propName": "_isWaitingForSave",
786
+ "methodName": "observeIsWaitingForSave"
735
787
  }];
736
788
  }
737
789
  static get listeners() {
@@ -741,6 +793,18 @@ export class SnkTaskbar {
741
793
  "target": "window",
742
794
  "capture": false,
743
795
  "passive": false
796
+ }, {
797
+ "name": "taskbarSaveLocker",
798
+ "method": "handleTaskbarSaveLocker",
799
+ "target": "window",
800
+ "capture": false,
801
+ "passive": false
802
+ }, {
803
+ "name": "taskbarSaveUnlocker",
804
+ "method": "handleTaskbarSaveUnlocker",
805
+ "target": "window",
806
+ "capture": false,
807
+ "passive": false
744
808
  }];
745
809
  }
746
810
  }
@@ -1,4 +1,4 @@
1
- import { NumberUtils, ObjectUtils } from "@sankhyalabs/core";
1
+ import { NumberUtils, ObjectUtils, StringUtils } from "@sankhyalabs/core";
2
2
  export default class RmPrecisionCustomValueFormatter {
3
3
  setGrid(grid) {
4
4
  if (this._grid) {
@@ -16,7 +16,7 @@ export default class RmPrecisionCustomValueFormatter {
16
16
  }
17
17
  format(currentValue, column, recordId) {
18
18
  var _a;
19
- if (!currentValue) {
19
+ if (StringUtils.isEmpty(currentValue)) {
20
20
  return currentValue;
21
21
  }
22
22
  const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
6
6
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
7
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
8
8
  };
9
- import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
9
+ import { ApplicationContext, ErrorException, ServiceCanceledException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
10
10
  import { batchRequests } from 'graphql-request';
11
11
  import UrlUtils from "../../../lib/utils/urlutils";
12
12
  import { PrintUtils } from '../../utils/PrintUtils';
@@ -372,9 +372,14 @@ export class DataFetcher {
372
372
  resolve(false);
373
373
  })
374
374
  ]).then((data) => {
375
- var _a;
375
+ var _a, _b;
376
376
  if (!hasClientEvent || data === false) {
377
- (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
377
+ if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
378
+ (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
379
+ }
380
+ else {
381
+ (((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
382
+ }
378
383
  }
379
384
  });
380
385
  });
@@ -7,7 +7,7 @@ const snkExporterMessages = {
7
7
  emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
8
8
  emailSenderOptStep_lblFormat: "Formato:",
9
9
  emailSenderOptStep_formatPDF: "PDF (.pdf)",
10
- emailSenderOptStep_formatXLSX: "Planilha (.xlsx)",
10
+ emailSenderOptStep_formatXLS: "Planilha (.xls)",
11
11
  emailSenderOptStep_export: "Exportar:",
12
12
  emailSenderOptStep_allData: "Toda a grade",
13
13
  emailSenderOptStep_currentPage: "Somente a página atual",
@@ -1,29 +1,29 @@
1
1
  import { DataType, JSUtils } from "@sankhyalabs/core";
2
- export const getSelectedIDs = (dataUnit) => {
3
- const selectionInfo = dataUnit.getSelectionInfo();
2
+ export function getSelectedRecordsIDsInfo(dataUnit) {
3
+ const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
4
4
  if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
5
5
  return [];
6
6
  }
7
7
  const selectedRecordsIDsInfo = [];
8
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
8
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
9
9
  if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
10
- selectedRecords.forEach(recordId => {
11
- if (!dataUnit.isNewRecord(recordId)) {
10
+ selectedRecords.forEach(({ __record__id__ }) => {
11
+ if (!dataUnit.isNewRecord(__record__id__)) {
12
12
  /*
13
13
  Esse if foi necessário para tratar corretamente o ID
14
14
  do record quando está sendo utilizado no modo standAlone
15
15
  isso não faz a exportação da grid funcionar no modo standAlone
16
16
  mas deixa de causar erro nas oprações de CRUD.
17
17
  */
18
- if (!JSUtils.isBase64(recordId)) {
18
+ if (!JSUtils.isBase64(__record__id__)) {
19
19
  selectedRecordsIDsInfo.push({
20
20
  name: "__record__id__",
21
21
  type: DataType.TEXT,
22
- value: recordId
22
+ value: __record__id__
23
23
  });
24
24
  return;
25
25
  }
26
- const revertBase64ToObject = JSON.parse(window.atob(recordId));
26
+ const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
27
27
  Object.entries(revertBase64ToObject).forEach(([name, value]) => {
28
28
  const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
29
29
  if (metadataField == undefined) {
@@ -35,4 +35,4 @@ export const getSelectedIDs = (dataUnit) => {
35
35
  });
36
36
  }
37
37
  return selectedRecordsIDsInfo;
38
- };
38
+ }
@@ -1,4 +1,4 @@
1
- import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
1
+ import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, ServiceCanceledException } from '@sankhyalabs/core';
2
2
  import { P as PrintUtils } from './PrintUtils.js';
3
3
  import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
4
 
@@ -6883,9 +6883,14 @@ class DataFetcher {
6883
6883
  resolve(false);
6884
6884
  })
6885
6885
  ]).then((data) => {
6886
- var _a;
6886
+ var _a, _b;
6887
6887
  if (!hasClientEvent || data === false) {
6888
- (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
6888
+ if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
6889
+ (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
6890
+ }
6891
+ else {
6892
+ (((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
6893
+ }
6889
6894
  }
6890
6895
  });
6891
6896
  });
@@ -1,30 +1,30 @@
1
1
  import { JSUtils, DataType } from '@sankhyalabs/core';
2
2
 
3
- const getSelectedIDs = (dataUnit) => {
4
- const selectionInfo = dataUnit.getSelectionInfo();
3
+ function getSelectedRecordsIDsInfo(dataUnit) {
4
+ const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
5
5
  if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
6
6
  return [];
7
7
  }
8
8
  const selectedRecordsIDsInfo = [];
9
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
9
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
10
10
  if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
11
- selectedRecords.forEach(recordId => {
12
- if (!dataUnit.isNewRecord(recordId)) {
11
+ selectedRecords.forEach(({ __record__id__ }) => {
12
+ if (!dataUnit.isNewRecord(__record__id__)) {
13
13
  /*
14
14
  Esse if foi necessário para tratar corretamente o ID
15
15
  do record quando está sendo utilizado no modo standAlone
16
16
  isso não faz a exportação da grid funcionar no modo standAlone
17
17
  mas deixa de causar erro nas oprações de CRUD.
18
18
  */
19
- if (!JSUtils.isBase64(recordId)) {
19
+ if (!JSUtils.isBase64(__record__id__)) {
20
20
  selectedRecordsIDsInfo.push({
21
21
  name: "__record__id__",
22
22
  type: DataType.TEXT,
23
- value: recordId
23
+ value: __record__id__
24
24
  });
25
25
  return;
26
26
  }
27
- const revertBase64ToObject = JSON.parse(window.atob(recordId));
27
+ const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
28
28
  Object.entries(revertBase64ToObject).forEach(([name, value]) => {
29
29
  const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
30
30
  if (metadataField == undefined) {
@@ -36,6 +36,6 @@ const getSelectedIDs = (dataUnit) => {
36
36
  });
37
37
  }
38
38
  return selectedRecordsIDsInfo;
39
- };
39
+ }
40
40
 
41
- export { getSelectedIDs as g };
41
+ export { getSelectedRecordsIDsInfo as g };
@@ -1,6 +1,6 @@
1
1
  import { D as DataFetcher } from './DataFetcher.js';
2
2
  import './pesquisa-fetcher.js';
3
- import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
3
+ import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
4
4
  import './ISave.js';
5
5
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
6
6
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
@@ -225,7 +225,7 @@ class RmPrecisionCustomValueFormatter {
225
225
  }
226
226
  format(currentValue, column, recordId) {
227
227
  var _a;
228
- if (!currentValue) {
228
+ if (StringUtils.isEmpty(currentValue)) {
229
229
  return currentValue;
230
230
  }
231
231
  const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
@@ -122,7 +122,7 @@ const snkExporterMessages = {
122
122
  emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
123
123
  emailSenderOptStep_lblFormat: "Formato:",
124
124
  emailSenderOptStep_formatPDF: "PDF (.pdf)",
125
- emailSenderOptStep_formatXLSX: "Planilha (.xlsx)",
125
+ emailSenderOptStep_formatXLS: "Planilha (.xls)",
126
126
  emailSenderOptStep_export: "Exportar:",
127
127
  emailSenderOptStep_allData: "Toda a grade",
128
128
  emailSenderOptStep_currentPage: "Somente a página atual",
@@ -9,6 +9,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
9
9
  import './dataunit-fetcher.js';
10
10
  import './filter-item-type.enum.js';
11
11
  import './form-config-fetcher.js';
12
+ import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
12
13
  import { R as ResourceIDUtils } from './ResourceIDUtils.js';
13
14
 
14
15
  const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
@@ -161,7 +162,6 @@ var RefreshType;
161
162
 
162
163
  const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
163
164
  const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
164
- const NUFIN_COLUMN = 'NUFIN';
165
165
  const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
166
166
  class Actions {
167
167
  constructor(actionsExecuteInterface, dataUnit, appResourceId) {
@@ -173,6 +173,10 @@ class Actions {
173
173
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
174
174
  this._appResourceId = appResourceId;
175
175
  }
176
+ getPrimaryKeys() {
177
+ const ids = getSelectedRecordsIDsInfo(this._dataUnit);
178
+ return ids.map(({ name }) => name);
179
+ }
176
180
  apply(action, hasParamsToSave) {
177
181
  this._application.closePopUp();
178
182
  this._actionsExecuteInterface.execute(action, this._dataUnit)
@@ -441,6 +445,7 @@ class Actions {
441
445
  executeAction(execSource);
442
446
  }
443
447
  addRows(execSource) {
448
+ const primaryKeys = this.getPrimaryKeys();
444
449
  const rows = {
445
450
  row: []
446
451
  };
@@ -454,15 +459,13 @@ class Actions {
454
459
  delete sourceRow[MASTER_ROW_PROPERTY];
455
460
  delete sourceRow[ENTITY_NAME_PROPERTY];
456
461
  }
457
- for (const fieldName in sourceRow) {
458
- if (fieldName !== NUFIN_COLUMN)
459
- continue;
460
- if (!row.field) {
461
- row.field = [];
462
- }
462
+ if (!row.field) {
463
+ row.field = [];
464
+ }
465
+ for (const primaryKey of primaryKeys) {
463
466
  row.field.push({
464
- fieldName: fieldName,
465
- $: sourceRow[fieldName]
467
+ fieldName: primaryKey,
468
+ $: sourceRow[primaryKey]
466
469
  });
467
470
  }
468
471
  rows.row.push(row);
@@ -124,7 +124,7 @@ class ItemBuilder {
124
124
  getExportToXLS(groupName) {
125
125
  return {
126
126
  id: DataExporterOption.EXPORT_TO_XLS,
127
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,
127
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,
128
128
  group: groupName
129
129
  };
130
130
  }
@@ -167,7 +167,7 @@ class ItemBuilder {
167
167
  getExportPageToXLS() {
168
168
  return {
169
169
  id: DataExporterOption.EXPORT_PAGE_TO_XLS,
170
- label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
170
+ label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`
171
171
  };
172
172
  }
173
173
  /**
@@ -1,47 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
2
+ import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
5
5
  import { g as getRecordValue, d as DatasetStrategy } from './dataunit-fetcher.js';
6
6
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
7
-
8
- const getSelectedIDs = (dataUnit) => {
9
- const selectionInfo = dataUnit.getSelectionInfo();
10
- if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
11
- return [];
12
- }
13
- const selectedRecordsIDsInfo = [];
14
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
15
- if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
16
- selectedRecords.forEach(recordId => {
17
- if (!dataUnit.isNewRecord(recordId)) {
18
- /*
19
- Esse if foi necessário para tratar corretamente o ID
20
- do record quando está sendo utilizado no modo standAlone
21
- isso não faz a exportação da grid funcionar no modo standAlone
22
- mas deixa de causar erro nas oprações de CRUD.
23
- */
24
- if (!JSUtils.isBase64(recordId)) {
25
- selectedRecordsIDsInfo.push({
26
- name: "__record__id__",
27
- type: DataType.TEXT,
28
- value: recordId
29
- });
30
- return;
31
- }
32
- const revertBase64ToObject = JSON.parse(window.atob(recordId));
33
- Object.entries(revertBase64ToObject).forEach(([name, value]) => {
34
- const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
35
- if (metadataField == undefined) {
36
- return;
37
- }
38
- selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
39
- });
40
- }
41
- });
42
- }
43
- return selectedRecordsIDsInfo;
44
- };
7
+ import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
45
8
 
46
9
  const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
47
10
  constructor() {
@@ -153,7 +116,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
116
  * @returns Retorna a lista de IDs dos registros selecionados.
154
117
  */
155
118
  async getSelectedRecordsIDsInfo() {
156
- return Promise.resolve(getSelectedIDs(this.dataUnit));
119
+ return getSelectedRecordsIDsInfo(this.dataUnit);
157
120
  }
158
121
  /**
159
122
  * Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
@@ -583,18 +546,26 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
583
546
  return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
584
547
  }
585
548
  }
549
+ updateMetadataWithRMP() {
550
+ this.fillFieldsWithRmp(this.dataUnit.metadata);
551
+ this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
552
+ const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
553
+ this.dataUnit.metadata = dataUnitUpdatedMetadata;
554
+ }
586
555
  async loadDataUnit() {
587
- var _a;
556
+ var _a, _b;
588
557
  if (this.dataUnit == null && this._application && this.entityName) {
589
558
  this.dataUnit = await this.getDataUnitParentOrChild();
590
559
  }
591
560
  if (this.dataUnit) {
592
561
  this.dataUnit.pageSize = this.pageSize;
593
562
  this.dataUnit.unsubscribe(this._dataUnitObserver);
594
- this.dataUnit.addInterceptor(this);
595
563
  this.dataUnit.subscribe(this._dataUnitObserver);
596
- await this.dataUnit.loadMetadata();
597
- if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
564
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
565
+ this.updateMetadataWithRMP();
566
+ }
567
+ this.dataUnit.addInterceptor(this);
568
+ if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
598
569
  this.getMetadataByRow(this.dataUnit);
599
570
  }
600
571
  this.dataState = this.buildDataState();
@@ -755,4 +726,4 @@ function defineCustomElement() {
755
726
  } });
756
727
  }
757
728
 
758
- export { SnkDataUnit as S, defineCustomElement as d, getSelectedIDs as g };
729
+ export { SnkDataUnit as S, defineCustomElement as d };
@@ -978,7 +978,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
978
978
  this.emitSwitchEvent(VIEW_MODE.GRID);
979
979
  evt.stopPropagation();
980
980
  }
981
- if (evt.detail === TaskbarElement.FORM_MODE) {
981
+ if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE) {
982
982
  this.emitSwitchEvent(VIEW_MODE.FORM);
983
983
  evt.stopPropagation();
984
984
  }
@@ -16,7 +16,7 @@ const OptionsStep = ({ getMessage, changeInfo, data }) => {
16
16
  const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
17
17
  const formatOptions = [
18
18
  { label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
19
- { label: getMessage("snkExporter.emailSenderOptStep_formatXLSX"), value: "xlsx" }
19
+ { label: getMessage("snkExporter.emailSenderOptStep_formatXLS"), value: "xls" }
20
20
  ];
21
21
  const typeOptions = [
22
22
  { label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
@@ -267,13 +267,13 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
267
267
  this._pendingVariables = false;
268
268
  this._customfiltersToBeUpdated = [];
269
269
  this._calculateSortIndex = (item) => {
270
- let index = item.hardFixed ? 1000000 : 0;
271
- //campos Hard Fixed não variam a ordem
272
- if (!item.hardFixed) {
273
- index += item.fixed ? 100000 : 0;
274
- index += item.value == undefined ? 0 : 10000;
275
- index += this._updateSequence.lastIndexOf(item.id) + 1;
276
- }
270
+ if (!item.visible)
271
+ return 0;
272
+ if (item.hardFixed)
273
+ return 1000000; //campos Hard Fixed não variam a ordem
274
+ let index = item.fixed ? 100000 : 0;
275
+ index += this.hasValidValue(item) ? 10000 : 0;
276
+ index += this._updateSequence.lastIndexOf(item.id) + 1;
277
277
  return index;
278
278
  };
279
279
  this._filtersComparator = (a, b) => {
@@ -294,6 +294,13 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
294
294
  this.showPersonalizedFilter = false;
295
295
  this.personalizedFilterId = undefined;
296
296
  }
297
+ hasValidValue(item) {
298
+ if (item.value === undefined || item.value === null)
299
+ return false;
300
+ if (!Array.isArray(item.value))
301
+ return true;
302
+ return item.value.some(filterItem => filterItem.check === true);
303
+ }
297
304
  observeFilterConfig(newValue, oldValue) {
298
305
  if (ObjectUtils.equals(newValue, oldValue))
299
306
  return;
@@ -519,7 +526,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
519
526
  getFilterItems() {
520
527
  const pinnedItems = [];
521
528
  const unpinnedItems = [];
522
- this.filterConfig
529
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
523
530
  .filter(this.filterActiveFilter)
524
531
  .forEach((item, index) => {
525
532
  item = ObjectUtils.copy(item);
@@ -589,6 +596,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
589
596
  .then((filters) => {
590
597
  accept();
591
598
  this.filterConfig = filters.map(item => this.normalizeItem(item));
599
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
592
600
  })
593
601
  .catch(reason => {
594
602
  throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);