@sankhyalabs/sankhyablocks 8.16.0-dev.2 → 8.16.0-dev.20

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 (151) hide show
  1. package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-e49214c6.js} +3 -2
  2. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
  3. package/dist/cjs/{IExporterProvider-9479f618.js → IExporterProvider-10b7fed5.js} +4 -4
  4. package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-beebf47a.js} +7 -9
  5. package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-cceebbae.js} +2 -2
  6. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-0c7106a0.js → dataunit-fetcher-d4873076.js} +8 -4
  8. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-a1d0353f.js} +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-application.cjs.entry.js +7 -7
  14. package/dist/cjs/snk-attach.cjs.entry.js +36 -25
  15. package/dist/cjs/snk-crud.cjs.entry.js +11 -6
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +8 -8
  17. package/dist/cjs/{snk-data-unit-16791a2f.js → snk-data-unit-11e31d8d.js} +23 -11
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +10 -11
  20. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -11
  22. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  23. package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  25. package/dist/cjs/snk-grid.cjs.entry.js +9 -9
  26. package/dist/cjs/{snk-guides-viewer-d82746e8.js → snk-guides-viewer-aafc3073.js} +12 -7
  27. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  28. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  29. package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -11
  30. package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
  31. package/dist/collection/components/snk-attach/snk-attach.js +24 -15
  32. package/dist/collection/components/snk-crud/snk-crud.js +57 -1
  33. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -3
  34. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +22 -2
  35. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  36. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  37. package/dist/collection/components/snk-data-unit/snk-data-unit.js +38 -9
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +16 -8
  39. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +5 -7
  40. package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
  41. package/dist/collection/components/snk-grid/snk-grid.css +2 -0
  42. package/dist/collection/components/snk-grid/snk-grid.js +2 -2
  43. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -4
  44. package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
  45. package/dist/collection/lib/configs/ConfigStorage.js +1 -0
  46. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
  47. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
  48. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  49. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
  50. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  51. package/dist/components/ConfigStorage.js +1 -0
  52. package/dist/components/DataFetcher.js +8 -3
  53. package/dist/components/SnkFormConfigManager.js +5 -7
  54. package/dist/components/SnkMessageBuilder.js +2 -2
  55. package/dist/components/dataunit-fetcher.js +7 -3
  56. package/dist/components/snk-attach2.js +31 -20
  57. package/dist/components/snk-crud.js +8 -1
  58. package/dist/components/snk-data-exporter2.js +2 -2
  59. package/dist/components/snk-data-unit2.js +22 -9
  60. package/dist/components/snk-detail-view2.js +10 -5
  61. package/dist/components/snk-exporter-email-sender2.js +1 -1
  62. package/dist/components/snk-filter-bar2.js +16 -8
  63. package/dist/components/snk-form-config2.js +1 -1
  64. package/dist/components/snk-grid2.js +3 -3
  65. package/dist/components/snk-simple-crud2.js +7 -4
  66. package/dist/components/snk-taskbar2.js +24 -2
  67. package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-e476378d.js} +3 -2
  68. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
  69. package/dist/esm/{IExporterProvider-5a858363.js → IExporterProvider-d597f27d.js} +4 -4
  70. package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-298cd647.js} +7 -9
  71. package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-ae87b754.js} +2 -2
  72. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
  73. package/dist/esm/{dataunit-fetcher-f7e0ffc0.js → dataunit-fetcher-3d2ec959.js} +8 -4
  74. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-a87445a0.js} +1 -1
  77. package/dist/esm/sankhyablocks.js +1 -1
  78. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  79. package/dist/esm/snk-application.entry.js +7 -7
  80. package/dist/esm/snk-attach.entry.js +36 -25
  81. package/dist/esm/snk-crud.entry.js +11 -6
  82. package/dist/esm/snk-data-exporter.entry.js +8 -8
  83. package/dist/esm/{snk-data-unit-a327d22c.js → snk-data-unit-29de836f.js} +23 -11
  84. package/dist/esm/snk-data-unit.entry.js +4 -4
  85. package/dist/esm/snk-detail-view.entry.js +10 -11
  86. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  87. package/dist/esm/snk-filter-bar.entry.js +19 -11
  88. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  89. package/dist/esm/snk-form-config.entry.js +3 -3
  90. package/dist/esm/snk-form.entry.js +4 -4
  91. package/dist/esm/snk-grid.entry.js +9 -9
  92. package/dist/esm/{snk-guides-viewer-874da66f.js → snk-guides-viewer-62124f3d.js} +12 -7
  93. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  94. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  95. package/dist/esm/snk-simple-crud.entry.js +13 -11
  96. package/dist/esm/snk-taskbar.entry.js +23 -1
  97. package/dist/sankhyablocks/p-08c28ddd.entry.js +1 -0
  98. package/dist/sankhyablocks/{p-6d4f4614.js → p-091ce761.js} +1 -1
  99. package/dist/sankhyablocks/{p-b8cde0d8.entry.js → p-094eebf6.entry.js} +1 -1
  100. package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
  101. package/dist/sankhyablocks/p-12f45f86.entry.js +1 -0
  102. package/dist/sankhyablocks/{p-60e46675.entry.js → p-162b9a59.entry.js} +2 -2
  103. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  104. package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
  105. package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-af8efd95.js → p-25f1fc39.js} +1 -1
  107. package/dist/sankhyablocks/{p-8fc470e5.entry.js → p-2e9c764c.entry.js} +1 -1
  108. package/dist/sankhyablocks/{p-aff76a53.js → p-3287a6cc.js} +2 -2
  109. package/dist/sankhyablocks/{p-b7c4feeb.entry.js → p-421bec84.entry.js} +1 -1
  110. package/dist/sankhyablocks/p-51999ab5.entry.js +1 -0
  111. package/dist/sankhyablocks/p-53949130.entry.js +1 -0
  112. package/dist/sankhyablocks/p-594bc21d.js +1 -0
  113. package/dist/sankhyablocks/p-5b26cc7c.entry.js +1 -0
  114. package/dist/sankhyablocks/p-5b9160c6.entry.js +1 -0
  115. package/dist/sankhyablocks/{p-7d9baaf4.entry.js → p-5e384af4.entry.js} +1 -1
  116. package/dist/sankhyablocks/p-5f016aed.js +1 -0
  117. package/dist/sankhyablocks/p-70001ac1.js +1 -0
  118. package/dist/sankhyablocks/{p-e6210aec.js → p-76a65660.js} +1 -1
  119. package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
  120. package/dist/sankhyablocks/p-8f4e743f.js +1 -0
  121. package/dist/sankhyablocks/p-939e15d3.entry.js +1 -0
  122. package/dist/sankhyablocks/{p-a1d72395.entry.js → p-9dfda04a.entry.js} +1 -1
  123. package/dist/sankhyablocks/{p-eae7a817.entry.js → p-bd008859.entry.js} +1 -1
  124. package/dist/sankhyablocks/p-d65d98ed.entry.js +1 -0
  125. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  126. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  127. package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
  128. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
  129. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +6 -1
  130. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
  131. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
  132. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  133. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  134. package/dist/types/components.d.ts +49 -0
  135. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  136. package/package.json +2 -2
  137. package/dist/sankhyablocks/p-0046959e.entry.js +0 -1
  138. package/dist/sankhyablocks/p-0e11ee18.entry.js +0 -1
  139. package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
  140. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  141. package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
  142. package/dist/sankhyablocks/p-6ded2076.entry.js +0 -1
  143. package/dist/sankhyablocks/p-7a337364.js +0 -1
  144. package/dist/sankhyablocks/p-829d4045.js +0 -1
  145. package/dist/sankhyablocks/p-8c6b44ea.entry.js +0 -1
  146. package/dist/sankhyablocks/p-a4b1f1eb.js +0 -1
  147. package/dist/sankhyablocks/p-c7cbad38.js +0 -1
  148. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  149. package/dist/sankhyablocks/p-e0b9f59a.entry.js +0 -1
  150. package/dist/sankhyablocks/p-e9bbc3d5.entry.js +0 -1
  151. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
@@ -54,6 +54,7 @@ export class SnkDataUnit {
54
54
  this.ignoreSaveMessage = undefined;
55
55
  this.configName = undefined;
56
56
  this.resourceID = undefined;
57
+ this.domainMessagesBuilder = undefined;
57
58
  }
58
59
  observePageSize() {
59
60
  if (this.dataUnit) {
@@ -470,7 +471,8 @@ export class SnkDataUnit {
470
471
  if (this.ignoreSaveMessage) {
471
472
  return;
472
473
  }
473
- const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
474
+ const saveOperation = action.payload.changes[0]._operation.toLowerCase();
475
+ const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
474
476
  if (msg != undefined) {
475
477
  this.showSuccessMessage(msg);
476
478
  }
@@ -501,10 +503,13 @@ export class SnkDataUnit {
501
503
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
502
504
  * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
503
505
  */
504
- getMessage(key, params = undefined) {
506
+ getMessage(key, params = undefined, customOperation) {
505
507
  if (!params) {
506
508
  params = this.getMessageParams();
507
509
  }
510
+ if (customOperation) {
511
+ this.messagesBuilder.currentOperation = customOperation;
512
+ }
508
513
  return this.messagesBuilder.getMessage(key, params);
509
514
  }
510
515
  getMessageParams() {
@@ -535,7 +540,7 @@ export class SnkDataUnit {
535
540
  return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
536
541
  }
537
542
  }
538
- async loadDataUnit() {
543
+ async loadDataUnit(forceMetadataLoad = true) {
539
544
  var _a;
540
545
  if (this.dataUnit == null && this._application && this.entityName) {
541
546
  this.dataUnit = await this.getDataUnitParentOrChild();
@@ -545,9 +550,11 @@ export class SnkDataUnit {
545
550
  this.dataUnit.unsubscribe(this._dataUnitObserver);
546
551
  this.dataUnit.addInterceptor(this);
547
552
  this.dataUnit.subscribe(this._dataUnitObserver);
548
- await this.dataUnit.loadMetadata();
553
+ if (forceMetadataLoad || !this.dataUnit.metadata)
554
+ await this.dataUnit.loadMetadata();
549
555
  if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
550
- this.getMetadataByRow(this.dataUnit);
556
+ const { records } = this.getMetadataByRow(this.dataUnit);
557
+ this.dataUnit.records = records;
551
558
  }
552
559
  this.dataState = this.buildDataState();
553
560
  let resolver;
@@ -611,6 +618,13 @@ export class SnkDataUnit {
611
618
  parent = parent.parentElement;
612
619
  }
613
620
  }
621
+ instanceMessagesBuilder() {
622
+ var _a;
623
+ if (this.messagesBuilder) {
624
+ return;
625
+ }
626
+ this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
627
+ }
614
628
  //---------------------------------------------
615
629
  // Lifecycle web component
616
630
  //---------------------------------------------
@@ -618,9 +632,7 @@ export class SnkDataUnit {
618
632
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
619
633
  this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
620
634
  this._parentSnkDataUnit = this.getParentSnkDataUnit();
621
- if (this.messagesBuilder == undefined) {
622
- this.messagesBuilder = new SnkMessageBuilder(this.entityName);
623
- }
635
+ this.instanceMessagesBuilder();
624
636
  }
625
637
  disconnectedCallback() {
626
638
  if (this.dataUnit) {
@@ -628,7 +640,7 @@ export class SnkDataUnit {
628
640
  }
629
641
  }
630
642
  async componentDidLoad() {
631
- await this.loadDataUnit();
643
+ await this.loadDataUnit(false);
632
644
  this.handlerLinkFields();
633
645
  }
634
646
  render() {
@@ -860,6 +872,23 @@ export class SnkDataUnit {
860
872
  },
861
873
  "attribute": "resource-i-d",
862
874
  "reflect": false
875
+ },
876
+ "domainMessagesBuilder": {
877
+ "type": "string",
878
+ "mutable": false,
879
+ "complexType": {
880
+ "original": "string",
881
+ "resolved": "string",
882
+ "references": {}
883
+ },
884
+ "required": false,
885
+ "optional": false,
886
+ "docs": {
887
+ "tags": [],
888
+ "text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
889
+ },
890
+ "attribute": "domain-messages-builder",
891
+ "reflect": false
863
892
  }
864
893
  };
865
894
  }
@@ -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);
@@ -73,10 +73,8 @@ export class SnkFormConfigManager {
73
73
  if (fields != undefined && fields.length > 0) {
74
74
  return fields.map(({ label, name, readOnly, visible, required }) => {
75
75
  if (label == undefined) {
76
- return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
77
- readOnly,
78
- visible,
79
- required });
76
+ const currentField = dataUnit.getField(name);
77
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
80
78
  }
81
79
  return { name, label, readOnly, visible, required };
82
80
  })
@@ -100,7 +98,7 @@ export class SnkFormConfigManager {
100
98
  const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
101
99
  return normalizedText.includes(normalizedFilter);
102
100
  }
103
- getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
101
+ getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
104
102
  let fields = this.getFieldsList(dataUnit);
105
103
  if (ignoreReadOnlyFormFields) {
106
104
  fields = fields.filter(field => {
@@ -132,8 +130,8 @@ export class SnkFormConfigManager {
132
130
  this._onConfigChange(Object.assign({}, this._config));
133
131
  }
134
132
  }
135
- getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
136
- return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
133
+ getConfig(dataUnit, ignoreReadOnlyFormFields) {
134
+ return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
137
135
  }
138
136
  getFormConfigFetcher() {
139
137
  if (this._formConfigFetcher == undefined) {
@@ -67,7 +67,7 @@ export class SnkFormConfig {
67
67
  }
68
68
  }
69
69
  getConfig() {
70
- let config = this.configManager.getConfig(false, this.dataUnit);
70
+ let config = this.configManager.getConfig(this.dataUnit);
71
71
  if (config.fields && config.fields.length === 0) {
72
72
  config = undefined;
73
73
  }
@@ -1,11 +1,13 @@
1
1
  :host {
2
2
  --snk-grid-min-height: 300px;
3
+ --snk-grid-padding: var(--space--lg);
3
4
  }
4
5
 
5
6
  .snk-grid__container {
6
7
  display: flex;
7
8
  height: 100%;
8
9
  width: 100%;
10
+ padding: var(--snk-grid-padding);
9
11
  }
10
12
 
11
13
  .snk-grid__header {
@@ -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");
@@ -415,7 +415,7 @@ export class SnkGrid {
415
415
  if (!this._dataUnit) {
416
416
  return undefined;
417
417
  }
418
- 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" }, this._showSnkFilterBar &&
418
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
419
419
  h(Fragment, null, 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 }), 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, overflowStrategy: 'none' }, 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: (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 }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, 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 }, 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
420
420
  }
421
421
  static get is() { return "snk-grid"; }
@@ -56,6 +56,7 @@ export class SnkSimpleCrud {
56
56
  this.formLegacyConfigName = undefined;
57
57
  this.ignoreReadOnlyFormFields = false;
58
58
  this.autoFocus = true;
59
+ this.domainMessagesBuilder = undefined;
59
60
  this.autoLoad = undefined;
60
61
  }
61
62
  /**
@@ -672,8 +673,8 @@ export class SnkSimpleCrud {
672
673
  return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
673
674
  }
674
675
  getFormConfig() {
675
- var _a, _b;
676
- const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields);
676
+ var _a;
677
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
677
678
  if (!this.configName && !configFromManager) {
678
679
  return this.formConfig;
679
680
  }
@@ -693,9 +694,10 @@ export class SnkSimpleCrud {
693
694
  if (this.dataUnit == undefined) {
694
695
  return;
695
696
  }
696
- return (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.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", 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: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, 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(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
697
+ const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--medium", 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: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
698
+ return (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.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, 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(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
697
699
  ? undefined
698
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && 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 })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
700
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && 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 })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
699
701
  }
700
702
  static get is() { return "snk-simple-crud"; }
701
703
  static get encapsulation() { return "scoped"; }
@@ -1086,6 +1088,23 @@ export class SnkSimpleCrud {
1086
1088
  "reflect": false,
1087
1089
  "defaultValue": "true"
1088
1090
  },
1091
+ "domainMessagesBuilder": {
1092
+ "type": "string",
1093
+ "mutable": false,
1094
+ "complexType": {
1095
+ "original": "string",
1096
+ "resolved": "string",
1097
+ "references": {}
1098
+ },
1099
+ "required": false,
1100
+ "optional": false,
1101
+ "docs": {
1102
+ "tags": [],
1103
+ "text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
1104
+ },
1105
+ "attribute": "domain-messages-builder",
1106
+ "reflect": false
1107
+ },
1089
1108
  "autoLoad": {
1090
1109
  "type": "boolean",
1091
1110
  "mutable": false,
@@ -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
  }
@@ -71,6 +71,7 @@ export class ConfigStorage {
71
71
  if (config == undefined) {
72
72
  return;
73
73
  }
74
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
74
75
  await this.deleteGridConfigCache(name, resourceID);
75
76
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
76
77
  }
@@ -22,12 +22,16 @@ export function applySorting(records, dataUnit, sorting) {
22
22
  return records.sort(sortingFunction);
23
23
  }
24
24
  export function buildPaginationInfo(records, offset = 0, limit = 0) {
25
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
25
+ if (records === undefined) {
26
+ return undefined;
27
+ }
28
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
29
+ const lastRecord = Math.min(offset + limit, total);
26
30
  return {
27
31
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
28
32
  firstRecord: offset,
29
33
  lastRecord: lastRecord,
30
- total: records === null || records === void 0 ? void 0 : records.length,
31
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
34
+ total: total,
35
+ hasMore: !!(total - lastRecord),
32
36
  };
33
37
  }
@@ -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
  });
@@ -6,21 +6,23 @@ const SERVICE = {
6
6
  download: "AnexoSistemaSP.baixar",
7
7
  };
8
8
  export class AnexoSistemaFetcher {
9
- constructor(entityName, registerKey, dataUnitName) {
9
+ constructor(entityName, dataUnitName) {
10
10
  var _a;
11
11
  this.entityName = entityName;
12
- this.registerKey = registerKey;
13
12
  this.dataUnitName = dataUnitName;
14
13
  this.validateFields = (fields) => {
15
14
  if (!!fields.LINK && !!fields.NOMEARQUIVO)
16
15
  throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
17
16
  if (!fields.LINK && !fields.NOMEARQUIVO)
18
17
  throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
19
- if (!this.registerKey)
18
+ if (!this._registerKey)
20
19
  throw new Error('Register key can not be null');
21
20
  };
22
21
  this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
23
22
  }
23
+ set registerKey(registerKey) {
24
+ this._registerKey = registerKey;
25
+ }
24
26
  async save(change) {
25
27
  var _a, _b;
26
28
  let { updatingFields: fields } = change;
@@ -39,7 +41,7 @@ export class AnexoSistemaFetcher {
39
41
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
40
42
  link: fields.LINK,
41
43
  nameEntity: this.entityName,
42
- pkEntity: this.registerKey,
44
+ pkEntity: this._registerKey,
43
45
  typeAcess: fields.TIPOACESSO,
44
46
  typeApres: fields.TIPOAPRES,
45
47
  }
@@ -79,7 +81,7 @@ export class AnexoSistemaFetcher {
79
81
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
80
82
  link: fields.LINK,
81
83
  nameEntity: this.entityName,
82
- pkEntity: this.registerKey,
84
+ pkEntity: this._registerKey,
83
85
  typeAcess: fields.TIPOACESSO,
84
86
  typeApres: fields.TIPOAPRES,
85
87
  }
@@ -6,7 +6,7 @@ const snkDataUnitMessages = {
6
6
  },
7
7
  cancelInfo: {
8
8
  clone: "Duplicação descartada!",
9
- insert: "A inclusão descartada!",
9
+ insert: "A inclusão foi descartada!",
10
10
  update: "A edição foi descartada!"
11
11
  },
12
12
  confirm: {
@@ -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",
@@ -423,6 +423,7 @@ class ConfigStorage {
423
423
  if (config == undefined) {
424
424
  return;
425
425
  }
426
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
426
427
  await this.deleteGridConfigCache(name, resourceID);
427
428
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
428
429
  }
@@ -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
  });
@@ -74,10 +74,8 @@ class SnkFormConfigManager {
74
74
  if (fields != undefined && fields.length > 0) {
75
75
  return fields.map(({ label, name, readOnly, visible, required }) => {
76
76
  if (label == undefined) {
77
- return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
78
- readOnly,
79
- visible,
80
- required });
77
+ const currentField = dataUnit.getField(name);
78
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
81
79
  }
82
80
  return { name, label, readOnly, visible, required };
83
81
  })
@@ -101,7 +99,7 @@ class SnkFormConfigManager {
101
99
  const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
102
100
  return normalizedText.includes(normalizedFilter);
103
101
  }
104
- getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
102
+ getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
105
103
  let fields = this.getFieldsList(dataUnit);
106
104
  if (ignoreReadOnlyFormFields) {
107
105
  fields = fields.filter(field => {
@@ -133,8 +131,8 @@ class SnkFormConfigManager {
133
131
  this._onConfigChange(Object.assign({}, this._config));
134
132
  }
135
133
  }
136
- getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
137
- return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
134
+ getConfig(dataUnit, ignoreReadOnlyFormFields) {
135
+ return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
138
136
  }
139
137
  getFormConfigFetcher() {
140
138
  if (this._formConfigFetcher == undefined) {
@@ -8,7 +8,7 @@ const snkDataUnitMessages = {
8
8
  },
9
9
  cancelInfo: {
10
10
  clone: "Duplicação descartada!",
11
- insert: "A inclusão descartada!",
11
+ insert: "A inclusão foi descartada!",
12
12
  update: "A edição foi descartada!"
13
13
  },
14
14
  confirm: {
@@ -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",
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
246
246
  return records.sort(sortingFunction);
247
247
  }
248
248
  function buildPaginationInfo(records, offset = 0, limit = 0) {
249
- const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
249
+ if (records === undefined) {
250
+ return undefined;
251
+ }
252
+ const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
253
+ const lastRecord = Math.min(offset + limit, total);
250
254
  return {
251
255
  currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
252
256
  firstRecord: offset,
253
257
  lastRecord: lastRecord,
254
- total: records === null || records === void 0 ? void 0 : records.length,
255
- hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
258
+ total: total,
259
+ hasMore: !!(total - lastRecord),
256
260
  };
257
261
  }
258
262