@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
@@ -172,15 +172,6 @@ const snkAttachMessages$1 = {
172
172
  }
173
173
  };
174
174
 
175
- const snkDistinctSearchMessages = {
176
- titleBadgeNew: "novo",
177
- titleAdd: "Adicionar",
178
- availableResults: "resultados disponíveis",
179
- availableResult: "resultado disponível",
180
- limitResult: "Esta pesquisa foi limitada, existem mais resultados",
181
- emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
182
- };
183
-
184
175
  const snkConfigOptionsMessages = {
185
176
  label: {
186
177
  nameField: "Nome do Campo *",
@@ -561,7 +552,6 @@ class SnkMessageBuilder {
561
552
  snkEntityList: snkEntityListMessages,
562
553
  snkActionsButton: snkActionsButtonMessages,
563
554
  snkPrintSelector: snkPrintSelectorMessages,
564
- snkDistinctSearch: snkDistinctSearchMessages,
565
555
  };
566
556
  this._currentOperation = OperationMap.CLEAN;
567
557
  this._domainName = domainName;
@@ -1,6 +1,4 @@
1
1
  /* sankhyablocks custom elements */
2
- export { InputDistinctSearch as InputDistinctSearch } from '../types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search';
3
- export { SearchModal as SearchModal } from '../types/components/snk-distinct-search/subcomponents/search-modal/search-modal';
4
2
  export { SnkActionsButton as SnkActionsButton } from '../types/components/snk-actions-button/snk-actions-button';
5
3
  export { SnkActionsForm as SnkActionsForm } from '../types/components/snk-actions-button/subcomponents/snk-actions-form';
6
4
  export { SnkApplication as SnkApplication } from '../types/components/snk-application/snk-application';
@@ -13,7 +11,6 @@ export { SnkCustomSlotElements as SnkCustomSlotElements } from '../types/compone
13
11
  export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
14
12
  export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
15
13
  export { SnkDetailView as SnkDetailView } from '../types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view';
16
- export { SnkDistinctSearch as SnkDistinctSearch } from '../types/components/snk-distinct-search/snk-distinct-search';
17
14
  export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-list/snk-entity-list';
18
15
  export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
19
16
  export { SnkExpressionGroup as SnkExpressionGroup } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group';
@@ -1,6 +1,4 @@
1
1
  export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
- export { InputDistinctSearch, defineCustomElement as defineCustomElementInputDistinctSearch } from './input-distinct-search.js';
3
- export { SearchModal, defineCustomElement as defineCustomElementSearchModal } from './search-modal.js';
4
2
  export { SnkActionsButton, defineCustomElement as defineCustomElementSnkActionsButton } from './snk-actions-button.js';
5
3
  export { SnkActionsForm, defineCustomElement as defineCustomElementSnkActionsForm } from './snk-actions-form.js';
6
4
  export { SnkApplication, defineCustomElement as defineCustomElementSnkApplication } from './snk-application.js';
@@ -13,7 +11,6 @@ export { SnkCustomSlotElements, defineCustomElement as defineCustomElementSnkCus
13
11
  export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
14
12
  export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
15
13
  export { SnkDetailView, defineCustomElement as defineCustomElementSnkDetailView } from './snk-detail-view.js';
16
- export { SnkDistinctSearch, defineCustomElement as defineCustomElementSnkDistinctSearch } from './snk-distinct-search.js';
17
14
  export { SnkEntityList, defineCustomElement as defineCustomElementSnkEntityList } from './snk-entity-list.js';
18
15
  export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
19
16
  export { SnkExpressionGroup, defineCustomElement as defineCustomElementSnkExpressionGroup } from './snk-expression-group.js';
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ServiceUtils, StorageType, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { D as DataFetcher } from './DataFetcher.js';
4
4
  import { P as ParamType } from './ParamType.js';
5
5
  import './pesquisa-fetcher.js';
@@ -598,6 +598,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
598
598
  super();
599
599
  this.__registerHost();
600
600
  this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
601
+ this._actions = [];
601
602
  this.handleClick = (evt) => {
602
603
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
603
604
  const executor = new ExecutorFactory(selectedAction.type).executor;
@@ -607,27 +608,22 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
607
608
  };
608
609
  this._items = [];
609
610
  this._showDropdown = false;
610
- this._actions = [];
611
- this._isOrderActions = false;
612
611
  }
613
612
  async getActions() {
614
- let param = {
615
- param: {
616
- entityName: this._entityName,
617
- resourceID: this._resourceID
618
- }
619
- };
620
- return DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param).then((result) => {
613
+ const actions = await ServiceUtils.useCacheWithService(`SnkActionsButton_${this._entityName}-${this._resourceID}`, async () => {
621
614
  var _a;
622
- if (!((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action))
623
- return;
624
- if (this._isOrderActions) {
625
- this._actions = ArrayUtils.sortAlphabetically(result.actions.action, 'description');
626
- }
627
- else {
628
- this._actions = result.actions.action;
629
- }
630
- });
615
+ const param = {
616
+ param: {
617
+ entityName: this._entityName,
618
+ resourceID: this._resourceID,
619
+ },
620
+ };
621
+ const result = await DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param);
622
+ return ((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action) || [];
623
+ }, StorageType.IN_MEMORY_CACHE);
624
+ this._actions = SnkActionsButton.parameters.isOrderActions
625
+ ? ArrayUtils.sortAlphabetically(actions, 'description')
626
+ : actions;
631
627
  }
632
628
  controlDropdown() {
633
629
  this._showDropdown = !this._showDropdown;
@@ -660,7 +656,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
660
656
  }
661
657
  async componentWillLoad() {
662
658
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
663
- this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
659
+ await this.loadParameters();
664
660
  const snkDataUnit = this._element.parentElement;
665
661
  this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
666
662
  this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
@@ -669,9 +665,8 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
669
665
  this._resourceID = await ResourceIDUtils.getResourceID();
670
666
  }
671
667
  this.setEvents();
672
- this.getActions().then(() => {
673
- this.loadItems();
674
- });
668
+ await this.getActions();
669
+ this.loadItems();
675
670
  }
676
671
  async componentDidLoad() {
677
672
  if (!this._element)
@@ -698,6 +693,11 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
698
693
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
699
694
  };
700
695
  }
696
+ async loadParameters() {
697
+ if (SnkActionsButton.parameters.isOrderActions != null)
698
+ return;
699
+ SnkActionsButton.parameters.isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
700
+ }
701
701
  render() {
702
702
  return (h(Host, null, (this._actions && this._actions.length > 0) &&
703
703
  (h("div", { class: `ez-padding-left--medium snk-actions-button
@@ -713,10 +713,11 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
713
713
  static get style() { return snkActionsButtonCss; }
714
714
  }, [2, "snk-actions-button", {
715
715
  "_items": [32],
716
- "_showDropdown": [32],
717
- "_actions": [32],
718
- "_isOrderActions": [32]
716
+ "_showDropdown": [32]
719
717
  }]);
718
+ SnkActionsButton.parameters = {
719
+ isOrderActions: null
720
+ };
720
721
  function defineCustomElement() {
721
722
  if (typeof customElements === "undefined") {
722
723
  return;
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
5
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
6
6
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
7
- import { D as DataUnitFetcher } from './dataunit-fetcher.js';
7
+ import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher.js';
8
8
  import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
10
10
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
@@ -74,6 +74,7 @@ class TotalsFetcher {
74
74
  class ParametersFetcher {
75
75
  constructor() {
76
76
  this._embeddedParams = new Map();
77
+ this._cachedParams = new Map();
77
78
  this.templateByQuery = new Map();
78
79
  try {
79
80
  if (window["MGE_PARAMS"] != undefined) {
@@ -103,11 +104,16 @@ class ParametersFetcher {
103
104
  if (this._embeddedParams.has(name)) {
104
105
  return Promise.resolve(this._embeddedParams.get(name));
105
106
  }
107
+ if (this._cachedParams.has(name)) {
108
+ return this._cachedParams.get(name);
109
+ }
106
110
  const completPath = `param://application?params=${name}`;
107
- return DataFetcher.get().callGraphQL({
111
+ const param = await DataFetcher.get().callGraphQL({
108
112
  values: { name: completPath },
109
113
  query: this.templateByQuery.get("fetchParam"),
110
114
  });
115
+ this._cachedParams.set(name, param);
116
+ return param;
111
117
  }
112
118
  async asString(name) {
113
119
  const paramArr = await this.getParam(name);
@@ -869,6 +875,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
869
875
  async isLoadedByPk() {
870
876
  return Promise.resolve(this._isLoadedByPk);
871
877
  }
878
+ /**
879
+ * Remove registro do cache do PreLoader do dataunit.
880
+ * Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
881
+ */
882
+ async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
883
+ const records = recordsIDs.map(id => {
884
+ return { "__record__id__": id };
885
+ });
886
+ PreloadManager.removeRecords(dataUnit, records);
887
+ }
872
888
  async getAuthList(auth) {
873
889
  return await (new MGEAuthorization()).parseFromJSON(auth);
874
890
  }
@@ -1407,6 +1423,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1407
1423
  "info": [64],
1408
1424
  "loadTotals": [64],
1409
1425
  "isLoadedByPk": [64],
1426
+ "preloadMangerRemoveRecord": [64],
1410
1427
  "executeSearch": [64],
1411
1428
  "executePreparedSearch": [64],
1412
1429
  "isDebugMode": [64],
@@ -83,6 +83,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
83
  this.enableGridInsert = false;
84
84
  this.domainMessagesBuilder = undefined;
85
85
  this.ignoreReadOnlyFormFields = undefined;
86
+ this.enableLockManger = false;
86
87
  this.setCustomFormTitle = undefined;
87
88
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
88
89
  }
@@ -323,11 +324,16 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
323
324
  if (!isDocumentBody)
324
325
  element.focus();
325
326
  }
327
+ async function handleAddRecord() {
328
+ if (!dataUnit.hasNewRecord()) {
329
+ dataUnit.addRecord();
330
+ }
331
+ }
326
332
  keyboardManager
327
333
  .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
328
334
  .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
329
335
  .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
330
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
336
+ .bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
331
337
  .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
332
338
  .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
333
339
  .bind("ctrl + .", () => {
@@ -424,7 +430,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
424
430
  return;
425
431
  }
426
432
  this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
427
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
433
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
428
434
  }
429
435
  get _element() { return this; }
430
436
  static get watchers() { return {
@@ -453,6 +459,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
453
459
  "enableGridInsert": [4, "enable-grid-insert"],
454
460
  "domainMessagesBuilder": [1, "domain-messages-builder"],
455
461
  "ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
462
+ "enableLockManger": [4, "enable-lock-manger"],
456
463
  "setCustomFormTitle": [16],
457
464
  "_dataUnit": [32],
458
465
  "_dataState": [32],
@@ -24,7 +24,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
24
24
  this._rowMetadataCache = new Map();
25
25
  this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
26
26
  this._dataUnitObserver = async (action) => {
27
- const duState = this.buildDataState(action.type);
27
+ const duState = await this.buildDataState(action.type);
28
28
  this.dataState = duState;
29
29
  this.messagesBuilder.currentOperation = this.getMessageOperation();
30
30
  switch (action.type) {
@@ -136,14 +136,22 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
136
136
  async getRowMetadata(record) {
137
137
  return this.doGetRowMetadata(record);
138
138
  }
139
- doGetRowMetadata(record) {
139
+ async doGetRowMetadata(record) {
140
140
  const selectedRecord = this.dataUnit.getSelectedRecord();
141
141
  if (!record && !selectedRecord) {
142
142
  return;
143
143
  }
144
144
  const currentRecord = record || selectedRecord;
145
145
  const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
146
- const rowMetadata = this._metadataByRow.get(recordId);
146
+ let rowMetadata = this._metadataByRow.get(recordId);
147
+ /*
148
+ Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
149
+ muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
150
+ corretos nao confiando apenas no _metadataByRow
151
+ */
152
+ if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
153
+ rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
154
+ }
147
155
  if (!rowMetadata) {
148
156
  return;
149
157
  }
@@ -337,7 +345,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
337
345
  case Action.RECORDS_COPIED:
338
346
  return this.interceptRecordsCopied(action);
339
347
  case Action.DATA_CHANGED:
340
- await this.handleLoadRowMetadata(action);
348
+ await this.handleLoadRowMetadata(action.payload);
341
349
  return await this.interceptDataChange(action);
342
350
  case Action.CHANGING_DATA:
343
351
  return await this.interceptDataChange(action);
@@ -357,8 +365,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
357
365
  return action;
358
366
  }
359
367
  }
360
- async handleLoadRowMetadata(action) {
361
- const record = action.type === Action.DATA_CHANGED ? action.payload : action.payload.changes[0].record;
368
+ async handleLoadRowMetadata(record) {
369
+ if (!record)
370
+ return;
362
371
  const keysPayload = Object.keys(record);
363
372
  const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
364
373
  if (rmpField) {
@@ -437,7 +446,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
437
446
  isAllowed(flag) {
438
447
  return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
439
448
  }
440
- buildDataState(actionType) {
449
+ async buildDataState(actionType) {
441
450
  var _a;
442
451
  const selectionInfo = this.dataUnit.getSelectionInfo();
443
452
  const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
@@ -445,7 +454,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
445
454
  let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
446
455
  const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
447
456
  if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
448
- rowMetadata = this.doGetRowMetadata(selectedRecord);
457
+ rowMetadata = await this.doGetRowMetadata(selectedRecord);
449
458
  }
450
459
  else if (rowMetadata) {
451
460
  rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
@@ -467,17 +476,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
467
476
  });
468
477
  }
469
478
  async handleDataSaved(action) {
470
- const newRowMetadata = await this.handleLoadRowMetadata(action);
479
+ var _a, _b, _c;
480
+ 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);
471
481
  if (newRowMetadata) {
472
482
  newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
473
483
  }
474
484
  const recordId = action.payload.records[0].__record__id__;
475
485
  this._metadataByRow.set(recordId, newRowMetadata);
476
- this.dataState = this.buildDataState();
477
- if (this.ignoreSaveMessage) {
486
+ this.dataState = await this.buildDataState();
487
+ let saveOperation = action.payload.changes[0]._operation.toLowerCase();
488
+ if (saveOperation == 'copy')
489
+ saveOperation = OperationMap.CLONE;
490
+ if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
478
491
  return;
479
492
  }
480
- const saveOperation = action.payload.changes[0]._operation.toLowerCase();
481
493
  const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
482
494
  if (msg != undefined) {
483
495
  this.showSuccessMessage(msg);
@@ -570,7 +582,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
570
582
  const { records } = this.getMetadataByRow(this.dataUnit);
571
583
  this.dataUnit.records = records;
572
584
  }
573
- this.dataState = this.buildDataState();
585
+ this.dataState = await this.buildDataState();
574
586
  let resolver;
575
587
  while (resolver = this._onDataUnitResolve.pop()) {
576
588
  resolver(this.dataUnit);
@@ -483,7 +483,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
483
483
  await this.openGuideNavigator(guideName);
484
484
  }
485
485
  if (action.type === Action.METADATA_LOADED) {
486
- this.loadGuides(false);
486
+ this.loadGuides(this.noGuideSelected());
487
487
  }
488
488
  }
489
489
  async addErrorBadgeToGuide(guideName) {
@@ -290,6 +290,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
425
426
  return this.filterConfig.find(item => item.type === 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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
439
441
  if (this._configUpdated) {
440
442
  this._configUpdated = false;
441
443
  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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
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 = ObjectUtils.copy(this.filterConfig);
649
654
  filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
@@ -735,6 +740,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
735
740
  "disablePersonalizedFilter": [4, "disable-personalized-filter"],
736
741
  "filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
737
742
  "autoLoad": [4, "auto-load"],
743
+ "afterApplyConfig": [16],
738
744
  "allowDefault": [32],
739
745
  "scrollerLocked": [32],
740
746
  "showPersonalizedFilter": [32],
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { FloatingManager, DateUtils, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { FloatingManager, DateUtils, MaskFormatter, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum.js';
4
4
  import { F as FilterNumberVariation } from './filterNumberVariation.js';
5
5
  import { d as defineCustomElement$1 } from './snk-filter-detail2.js';
@@ -217,6 +217,10 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
217
217
  return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
218
218
  }
219
219
  }
220
+ if (this.config.mask) {
221
+ const _maskFormatter = new MaskFormatter(this.config.mask);
222
+ return `${label}: ${_maskFormatter.format(value)}`;
223
+ }
220
224
  return `${label}: ${value}`;
221
225
  }
222
226
  return label;
@@ -22,10 +22,11 @@ const SnkFilterText$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
22
22
  }
23
23
  }
24
24
  render() {
25
+ var _a;
25
26
  if (!this.config) {
26
27
  return undefined;
27
28
  }
28
- return (h("ez-text-input", { id: this.config.id, ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
29
+ return (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 }));
29
30
  }
30
31
  get _element() { return this; }
31
32
  }, [0, "snk-filter-text", {
@@ -685,7 +685,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
685
685
  }
686
686
  }
687
687
  getLayoutFormConfig() {
688
- var _a, _b;
688
+ var _a, _b, _c;
689
689
  if (((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields) == undefined) {
690
690
  return;
691
691
  }
@@ -698,7 +698,11 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
698
698
  if (hasField == undefined) {
699
699
  fields.push(field);
700
700
  const fieldMD = this.dataUnit.getField(field.name);
701
- if (fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.visible) {
701
+ /**
702
+ * Quando um campo é ocultado pelo dev, mas queremos manter ele na config precisamos fazer essa tratativa.
703
+ */
704
+ const visibleOnConfig = ((_b = fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.properties) === null || _b === void 0 ? void 0 : _b.visibleOnConfig) === true && (fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.visible) === false;
705
+ if ((fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.visible) || visibleOnConfig) {
702
706
  if (field.label == undefined || field.label === "") {
703
707
  field.label = fieldMD.label;
704
708
  }
@@ -714,7 +718,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
714
718
  visible = configTabs[0].visible;
715
719
  }
716
720
  }
717
- const tabLabel = ((_b = field.tab) === null || _b === void 0 ? void 0 : _b.label) || field.tab;
721
+ const tabLabel = ((_c = field.tab) === null || _c === void 0 ? void 0 : _c.label) || field.tab;
718
722
  if (visible !== null) {
719
723
  tab = { tab: tabLabel, groups: [], visible };
720
724
  }
@@ -799,8 +803,16 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
799
803
  for (const field of this._formConfig.fields) {
800
804
  fieldsFormConfig.push(field);
801
805
  }
802
- const listFieldsAvailable = fieldsMetadata.filter(({ name: _nameFieldMetadado, visible: _visibleMetadado }) => _visibleMetadado === true
803
- && fieldsFormConfig.some(({ name: _nameFieldForm }) => _nameFieldForm === _nameFieldMetadado) === false);
806
+ const listFieldsAvailable = fieldsMetadata.filter(({ name: _nameFieldMetadado, visible: _visibleMetadado, properties }) => {
807
+ const hasCfg = fieldsFormConfig.some(({ name: _nameFieldForm }) => _nameFieldForm === _nameFieldMetadado);
808
+ /**
809
+ * Quando a visibilidade de um campo é alterada pelo dataunit, mas o desenvolvedor deseja que o mesmo continue
810
+ * sendo apresentado no configurador, precisamos fazer essa tratativa, verificando se o campo não tem configuração
811
+ */
812
+ if (!hasCfg && properties.visibleOnConfig === true && !_visibleMetadado)
813
+ return properties.visibleOnConfig;
814
+ return _visibleMetadado === true && hasCfg === false;
815
+ });
804
816
  this._fieldsAvailable = listFieldsAvailable;
805
817
  this._listEnabledFields = listFieldsAvailable;
806
818
  if (((_b = this._filterFieldsAvailable) === null || _b === void 0 ? void 0 : _b.value) != undefined) {
@@ -153,6 +153,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
153
  this.autoLoad = undefined;
154
154
  this.autoFocus = true;
155
155
  this.enableGridInsert = false;
156
+ this.enableLockManger = false;
156
157
  }
157
158
  /**
158
159
  * Exibe a janela de configurações da grade.
@@ -240,10 +241,17 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
240
241
  this._grid.setFocus();
241
242
  }
242
243
  async handleClick(event) {
244
+ var _a;
243
245
  if (this.hasToBlockEvent(event)) {
244
246
  event.preventDefault();
245
247
  event.stopPropagation();
246
- await this._dataUnit.cancelEdition();
248
+ if (!await this._dataUnit.cancelEdition())
249
+ return;
250
+ const newEvent = new event.constructor(event.type, event);
251
+ (_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
252
+ }
253
+ if (this._grid && !this._grid.contains(event.target)) {
254
+ this._grid.stopEdit();
247
255
  }
248
256
  }
249
257
  hasToBlockEvent(event) {
@@ -534,7 +542,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
534
542
  return undefined;
535
543
  }
536
544
  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--extra-small" }, this._showSnkFilterBar &&
537
- 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, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, 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 }, 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 }))));
545
+ 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, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, 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 }, 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 }))));
538
546
  }
539
547
  get _element() { return this; }
540
548
  static get watchers() { return {
@@ -566,6 +574,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
566
574
  "autoLoad": [4, "auto-load"],
567
575
  "autoFocus": [4, "auto-focus"],
568
576
  "enableGridInsert": [4, "enable-grid-insert"],
577
+ "enableLockManger": [4, "enable-lock-manger"],
569
578
  "_dataUnit": [32],
570
579
  "_dataState": [32],
571
580
  "_gridConfig": [32],
@@ -123,6 +123,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
123
123
  this.mode = SIMPLE_CRUD_MODE.SERVER;
124
124
  this.gridConfig = undefined;
125
125
  this.formConfig = undefined;
126
+ this.enableLockManger = false;
126
127
  this._formFields = [];
127
128
  this._fieldsProps = new Map();
128
129
  this._enableContinuousInsert = true;
@@ -807,16 +808,18 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
807
808
  return;
808
809
  this.goToView(VIEW_MODE.FORM);
809
810
  }
811
+ renderTaskbarContent() {
812
+ var _a;
813
+ return (h("snk-taskbar", { class: this._currentViewMode === 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: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
814
+ }
810
815
  /* istanbul ignore next */
811
816
  render() {
812
- var _a;
813
817
  if (this.dataUnit == undefined) {
814
818
  return;
815
819
  }
816
- const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === 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: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
817
- 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.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert, 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)
820
+ 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.handleDataUnitOnInsertionMode.bind(this), 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" }, 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)
818
821
  ? undefined
819
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, 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() }))));
822
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), 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() }))));
820
823
  }
821
824
  get _element() { return this; }
822
825
  static get watchers() { return {
@@ -835,6 +838,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
835
838
  "mode": [2],
836
839
  "gridConfig": [1040],
837
840
  "formConfig": [1040],
841
+ "enableLockManger": [4, "enable-lock-manger"],
838
842
  "multipleSelection": [4, "multiple-selection"],
839
843
  "useCancelConfirm": [4, "use-cancel-confirm"],
840
844
  "pageSize": [2, "page-size"],