@sankhyalabs/sankhyablocks 8.4.0-dev.3 → 8.4.0-dev.4

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 (86) hide show
  1. package/dist/cjs/{ConfigStorage-0e4275f5.js → ConfigStorage-fb53e5ef.js} +2 -2
  2. package/dist/cjs/{DataFetcher-bd3d53a8.js → DataFetcher-3f9e6ee2.js} +10 -4
  3. package/dist/cjs/{SnkFormConfigManager-5b485cd4.js → SnkFormConfigManager-eb7d2863.js} +2 -2
  4. package/dist/cjs/{auth-fetcher-1583fe43.js → auth-fetcher-8ba4a15e.js} +1 -1
  5. package/dist/cjs/{dataunit-fetcher-910be4ce.js → dataunit-fetcher-f4023df4.js} +1 -1
  6. package/dist/cjs/{form-config-fetcher-f6cb55e6.js → form-config-fetcher-037d16de.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-3356b3df.js → pesquisa-fetcher-b5b42098.js} +1 -1
  9. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  10. package/dist/cjs/snk-actions-button.cjs.entry.js +3 -3
  11. package/dist/cjs/snk-application.cjs.entry.js +231 -132
  12. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-crud.cjs.entry.js +4 -4
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-detail-view.cjs.entry.js +6 -6
  16. package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -3
  17. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  18. package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
  19. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  20. package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  22. package/dist/cjs/{snk-guides-viewer-5e22097d.js → snk-guides-viewer-d1ad91bc.js} +4 -4
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -6
  24. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  25. package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
  26. package/dist/collection/components/snk-application/snk-application.js +155 -72
  27. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +2 -0
  28. package/dist/collection/lib/utils/urlutils.js +10 -4
  29. package/dist/components/DataFetcher.js +10 -4
  30. package/dist/components/snk-application2.js +146 -45
  31. package/dist/components/snk-filter-bar2.js +2 -0
  32. package/dist/esm/{ConfigStorage-f359573c.js → ConfigStorage-2e1bc7e8.js} +2 -2
  33. package/dist/esm/{DataFetcher-8daff9ad.js → DataFetcher-bc95bc22.js} +10 -4
  34. package/dist/esm/{SnkFormConfigManager-35876bad.js → SnkFormConfigManager-dfec39b7.js} +2 -2
  35. package/dist/esm/{auth-fetcher-299fed55.js → auth-fetcher-c76146d0.js} +1 -1
  36. package/dist/esm/{dataunit-fetcher-bd8f9572.js → dataunit-fetcher-b64f839d.js} +1 -1
  37. package/dist/esm/{form-config-fetcher-8ef7be16.js → form-config-fetcher-5df96b19.js} +1 -1
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/{pesquisa-fetcher-27819123.js → pesquisa-fetcher-7e282f7e.js} +1 -1
  40. package/dist/esm/sankhyablocks.js +1 -1
  41. package/dist/esm/snk-actions-button.entry.js +3 -3
  42. package/dist/esm/snk-application.entry.js +232 -133
  43. package/dist/esm/snk-attach.entry.js +2 -2
  44. package/dist/esm/snk-crud.entry.js +4 -4
  45. package/dist/esm/snk-data-exporter.entry.js +1 -1
  46. package/dist/esm/snk-detail-view.entry.js +6 -6
  47. package/dist/esm/snk-filter-bar.entry.js +5 -3
  48. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  49. package/dist/esm/snk-form-config.entry.js +2 -2
  50. package/dist/esm/snk-form.entry.js +4 -4
  51. package/dist/esm/snk-grid-config.entry.js +3 -3
  52. package/dist/esm/snk-grid.entry.js +3 -3
  53. package/dist/esm/{snk-guides-viewer-b0e32a7d.js → snk-guides-viewer-0ddda0e3.js} +4 -4
  54. package/dist/esm/snk-guides-viewer.entry.js +6 -6
  55. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  56. package/dist/esm/snk-simple-crud.entry.js +3 -3
  57. package/dist/sankhyablocks/{p-e19014a9.entry.js → p-01997cbe.entry.js} +1 -1
  58. package/dist/sankhyablocks/{p-ac0556a3.js → p-1386c7f8.js} +1 -1
  59. package/dist/sankhyablocks/{p-de76b8a8.js → p-1d63beb6.js} +1 -1
  60. package/dist/sankhyablocks/{p-d708b4ab.entry.js → p-2299d7ab.entry.js} +1 -1
  61. package/dist/sankhyablocks/p-2693e46d.entry.js +1 -0
  62. package/dist/sankhyablocks/{p-fd15aaac.entry.js → p-2f06d6b3.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-ebf8c5df.entry.js → p-35ae5f31.entry.js} +1 -1
  64. package/dist/sankhyablocks/p-363917d8.entry.js +11 -0
  65. package/dist/sankhyablocks/{p-d84bc5c1.js → p-42ec116e.js} +1 -1
  66. package/dist/sankhyablocks/{p-c870b530.js → p-5bff3564.js} +1 -1
  67. package/dist/sankhyablocks/{p-8014cc25.entry.js → p-5fc1c8c2.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-a7ee0e6f.entry.js → p-6020355f.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-7bd5aea7.js → p-60d44a52.js} +1 -1
  70. package/dist/sankhyablocks/{p-fb1ecd0b.entry.js → p-7554931d.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-6a38bda5.entry.js → p-82fea73a.entry.js} +1 -1
  72. package/dist/sankhyablocks/{p-7bcd2f89.js → p-a28eb16d.js} +1 -1
  73. package/dist/sankhyablocks/{p-f94b999e.entry.js → p-a78a4c71.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-bba91710.entry.js → p-af528a79.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-b13cb8b5.js → p-c5cb4981.js} +2 -2
  76. package/dist/sankhyablocks/{p-e9b53a9a.entry.js → p-ccffe6f0.entry.js} +1 -1
  77. package/dist/sankhyablocks/{p-b244640b.js → p-d567e5ce.js} +1 -1
  78. package/dist/sankhyablocks/{p-928efcaa.entry.js → p-dcd8addc.entry.js} +1 -1
  79. package/dist/sankhyablocks/p-fd2a9a9d.entry.js +1 -0
  80. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  81. package/dist/types/components/snk-application/snk-application.d.ts +39 -12
  82. package/dist/types/components.d.ts +14 -1
  83. package/package.json +1 -1
  84. package/dist/sankhyablocks/p-0df2ead8.entry.js +0 -11
  85. package/dist/sankhyablocks/p-ed5f1204.entry.js +0 -1
  86. package/dist/sankhyablocks/p-fcd09423.entry.js +0 -1
@@ -2,19 +2,19 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-5b485cd4.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-eb7d2863.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
8
8
  const taskbarElements = require('./taskbar-elements-39949c7a.js');
9
9
  const constants = require('./constants-d187e03e.js');
10
- require('./DataFetcher-bd3d53a8.js');
11
- require('./pesquisa-fetcher-3356b3df.js');
10
+ require('./DataFetcher-3f9e6ee2.js');
11
+ require('./pesquisa-fetcher-b5b42098.js');
12
12
  const index$1 = require('./index-0e663819.js');
13
13
  require('./ISave-d68ce3cd.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
16
  require('./filter-item-type.enum-aa823a00.js');
17
- require('./form-config-fetcher-f6cb55e6.js');
17
+ require('./form-config-fetcher-037d16de.js');
18
18
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
19
19
 
20
20
  const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-5e22097d.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-d1ad91bc.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-5b485cd4.js');
9
- require('./ConfigStorage-0e4275f5.js');
10
- require('./form-config-fetcher-f6cb55e6.js');
11
- require('./DataFetcher-bd3d53a8.js');
8
+ require('./SnkFormConfigManager-eb7d2863.js');
9
+ require('./ConfigStorage-fb53e5ef.js');
10
+ require('./form-config-fetcher-037d16de.js');
11
+ require('./DataFetcher-3f9e6ee2.js');
12
12
  require('./_commonjsHelpers-537d719a.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
14
  require('./PrintUtils-bcaeb82f.js');
@@ -19,7 +19,7 @@ require('./taskbar-elements-39949c7a.js');
19
19
  require('./index-0e663819.js');
20
20
  require('./index-102ba62d.js');
21
21
  require('./constants-d187e03e.js');
22
- require('./pesquisa-fetcher-3356b3df.js');
22
+ require('./pesquisa-fetcher-b5b42098.js');
23
23
  require('./ISave-d68ce3cd.js');
24
24
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
25
25
  require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-1aeb625d.js');
8
- const ConfigStorage = require('./ConfigStorage-0e4275f5.js');
8
+ const ConfigStorage = require('./ConfigStorage-fb53e5ef.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
12
  require('./filter-item-type.enum-aa823a00.js');
13
- require('./form-config-fetcher-f6cb55e6.js');
14
- require('./DataFetcher-bd3d53a8.js');
13
+ require('./form-config-fetcher-037d16de.js');
14
+ require('./DataFetcher-3f9e6ee2.js');
15
15
  require('./_commonjsHelpers-537d719a.js');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
17
  require('./PrintUtils-bcaeb82f.js');
@@ -6,14 +6,14 @@ const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const constants = require('./constants-d187e03e.js');
8
8
  const taskbarElements = require('./taskbar-elements-39949c7a.js');
9
- require('./DataFetcher-bd3d53a8.js');
10
- require('./pesquisa-fetcher-3356b3df.js');
9
+ require('./DataFetcher-3f9e6ee2.js');
10
+ require('./pesquisa-fetcher-b5b42098.js');
11
11
  const index$1 = require('./index-0e663819.js');
12
12
  require('./ISave-d68ce3cd.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
15
  require('./filter-item-type.enum-aa823a00.js');
16
- require('./form-config-fetcher-f6cb55e6.js');
16
+ require('./form-config-fetcher-037d16de.js');
17
17
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
18
18
  const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-804ff4c7.js');
19
19
  require('./index-102ba62d.js');
@@ -1,20 +1,20 @@
1
+ import { ApplicationContext, DataType, DependencyType, ElementIDUtils, ErrorTracking, OnboardingUtils, StringUtils } from "@sankhyalabs/core";
2
+ import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
1
3
  import { h } from "@stencil/core";
2
- import { DataType, ErrorTracking, DependencyType, ApplicationContext, ElementIDUtils, OnboardingUtils } from "@sankhyalabs/core";
4
+ import AppletCaller from "../../lib/applet-caller/applet-caller";
5
+ import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
6
+ import { ConfigStorage } from "../../lib/configs/ConfigStorage";
3
7
  import { DataFetcher } from "../../lib/http/data-fetcher/DataFetcher";
4
- import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
5
- import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
8
+ import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
9
+ import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
10
+ import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
6
11
  import { PesquisaFetcher } from "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher";
7
- import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
8
12
  import { TotalsFetcher } from "../../lib/http/data-fetcher/fetchers/totals-fetcher";
9
- import { ConfigStorage } from "../../lib/configs/ConfigStorage";
10
- import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
13
+ import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
14
+ import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
11
15
  import UrlUtils from "../../lib/utils/urlutils";
12
16
  import Workspace from "../../lib/workspace/workspace";
13
- import AppletCaller from "../../lib/applet-caller/applet-caller";
14
- import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
15
- import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
16
- import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
17
- import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
17
+ import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
18
18
  /**
19
19
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
20
20
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -26,8 +26,10 @@ export class SnkApplication {
26
26
  this._duCache = new Map();
27
27
  this._duPromises = new Map();
28
28
  this._requestListener = new RequestListenerLoadingBar();
29
+ this._isLoadedByPk = false;
29
30
  this.messagesBuilder = undefined;
30
31
  this.configName = undefined;
32
+ this.loadByPK = undefined;
31
33
  }
32
34
  get parameters() {
33
35
  if (!this._parameters) {
@@ -385,16 +387,6 @@ export class SnkApplication {
385
387
  resolve(DataFetcher.hasClientEvent(eventID));
386
388
  });
387
389
  }
388
- /**
389
- * Realiza a chamada ao Service Broker conforme o nome do serviço.
390
- *
391
- * @param serviceName - Nome do serviço
392
- * @param payload - Dados que serão processados na ação
393
- * @param options - Parâmetros de URL
394
- */
395
- async callServiceBroker(serviceName, payload, options) {
396
- return DataFetcher.get().callServiceBroker(serviceName, payload, options);
397
- }
398
390
  get applicationResourceID() {
399
391
  if (!this._applicationResourceID) {
400
392
  this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
@@ -458,6 +450,13 @@ export class SnkApplication {
458
450
  async loadTotals(name, resourceID, filters) {
459
451
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
460
452
  }
453
+ /**
454
+ * Obtém a informação se o último carregamento do dataunit foi feito através de um loadByPk
455
+ * @returns boolean
456
+ */
457
+ async isLoadedByPk() {
458
+ return Promise.resolve(this._isLoadedByPk);
459
+ }
461
460
  async getAuthList(auth) {
462
461
  return await (new MGEAuthorization()).parseFromJSON(auth);
463
462
  }
@@ -643,6 +642,102 @@ export class SnkApplication {
643
642
  setPopUpTitle(title) {
644
643
  this._popUp.ezTitle = title;
645
644
  }
645
+ async pkChangeListener() {
646
+ const pkHash = top.window.location.hash.split('/')[2];
647
+ if (this._currentPkParameter === pkHash)
648
+ return;
649
+ const resourceIDfromUrl = this.getResourceIdFromToken();
650
+ const pkObject = UrlUtils.getPkObjectFromUrlToken(top.window.location.hash);
651
+ if (pkObject == undefined || resourceIDfromUrl !== this.applicationResourceID)
652
+ return;
653
+ const pkParam = { pk: pkObject };
654
+ this._isLoadedByPk = true;
655
+ if (this.loadByPK) {
656
+ this.loadByPK(pkParam);
657
+ this._currentPkParameter = pkHash;
658
+ return;
659
+ }
660
+ if (this.defaultLoadByPK(pkParam)) {
661
+ this._currentPkParameter = pkHash;
662
+ }
663
+ }
664
+ getResourceIdFromToken() {
665
+ if ((top.window.location.pathname).indexOf("tabContent.jsp") > -1) {
666
+ return UrlUtils.getResourceIdFromUrlToken(window.location['generateHash'](window.location.hash));
667
+ }
668
+ return UrlUtils.getResourceIdFromUrlToken(top.window.location.hash);
669
+ }
670
+ defaultLoadByPK(pkObject) {
671
+ if (!(pkObject === null || pkObject === void 0 ? void 0 : pkObject.pk))
672
+ return;
673
+ const dataUnit = this.getFirstDataUnitFromDOM();
674
+ if (!dataUnit) {
675
+ console.warn("Dataunit não inicializado");
676
+ return;
677
+ }
678
+ const quickFilter = {
679
+ term: "",
680
+ filter: {
681
+ name: "LOAD_BY_PK_FILTER",
682
+ expression: this.buildFilterExpressionByPkObject(pkObject),
683
+ params: this.getFilterParamsFromPkObject(pkObject, dataUnit)
684
+ }
685
+ };
686
+ dataUnit.loadData(quickFilter);
687
+ return true;
688
+ }
689
+ getFirstDataUnitFromDOM() {
690
+ //Primeiro tentamos obeter o dataunit para fazer o loadByPK
691
+ let snkDataUnit = this._element.querySelector("snk-data-unit[data-load-by-pk]");
692
+ if (!snkDataUnit) {
693
+ snkDataUnit = this._element.querySelector("snk-data-unit");
694
+ }
695
+ if (snkDataUnit) {
696
+ return snkDataUnit.dataUnit;
697
+ }
698
+ return undefined;
699
+ }
700
+ getFilterParamsFromPkObject(pkObject, dataUnit) {
701
+ var _a;
702
+ const filterParams = [];
703
+ for (const key in pkObject.pk) {
704
+ if (pkObject.pk.hasOwnProperty(key) && !Array.isArray(pkObject.pk[key])) {
705
+ filterParams.push({
706
+ name: key,
707
+ dataType: ((_a = dataUnit.getField(key)) === null || _a === void 0 ? void 0 : _a.dataType) || this.getDefaultDataTypeLoadByPK(pkObject.pk[key]),
708
+ value: pkObject.pk[key]
709
+ });
710
+ }
711
+ }
712
+ return filterParams;
713
+ }
714
+ getDefaultDataTypeLoadByPK(value) {
715
+ if (typeof value === "number" || value instanceof Number) {
716
+ return DataType.NUMBER;
717
+ }
718
+ if (typeof value === "boolean" || value instanceof Boolean) {
719
+ return DataType.BOOLEAN;
720
+ }
721
+ if (value instanceof Date) {
722
+ return DataType.DATE;
723
+ }
724
+ return DataType.TEXT;
725
+ }
726
+ buildFilterExpressionByPkObject(pkObject) {
727
+ let expression = "";
728
+ for (const field in pkObject.pk) {
729
+ if (!StringUtils.isEmpty(expression)) {
730
+ expression += " AND ";
731
+ }
732
+ if (Array.isArray(pkObject.pk[field])) {
733
+ expression += `${field} IN (${pkObject.pk[field].toString()})`;
734
+ }
735
+ else {
736
+ expression += `${field} = :${field}`;
737
+ }
738
+ }
739
+ return expression;
740
+ }
646
741
  componentWillLoad() {
647
742
  ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
648
743
  this._errorHandler = new SnkErrorHandler(this);
@@ -652,6 +747,9 @@ export class SnkApplication {
652
747
  return this.executeSearch(searchArgument, fieldName, dataUnit);
653
748
  });
654
749
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
750
+ setInterval(() => {
751
+ this.pkChangeListener();
752
+ }, 100);
655
753
  ErrorTracking.init();
656
754
  ConfigStorage.preload(this.applicationResourceID, this.configName);
657
755
  }
@@ -667,6 +765,7 @@ export class SnkApplication {
667
765
  window.requestAnimationFrame(() => {
668
766
  ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", false);
669
767
  this.applicationLoaded.emit(true);
768
+ this.pkChangeListener();
670
769
  });
671
770
  ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
672
771
  }
@@ -723,6 +822,21 @@ export class SnkApplication {
723
822
  },
724
823
  "attribute": "config-name",
725
824
  "reflect": false
825
+ },
826
+ "loadByPK": {
827
+ "type": "unknown",
828
+ "mutable": false,
829
+ "complexType": {
830
+ "original": "(pk:{[key: string]:any}) => void",
831
+ "resolved": "(pk: { [key: string]: any; }) => void",
832
+ "references": {}
833
+ },
834
+ "required": false,
835
+ "optional": false,
836
+ "docs": {
837
+ "tags": [],
838
+ "text": "Usado para receber um par\u00E2metro na inicializa\u00E7\u00E3o da tela, e utiliz\u00E1-lo conforme necess\u00E1rio\ncaso a tela receba um par\u00E2metro, e, esta propriedade n\u00E3o seja informada\n\u00E9 criado um filtro de forma autom\u00E1tica atrav\u00E9s do m\u00E9todo defaultLoadByPk"
839
+ }
726
840
  }
727
841
  };
728
842
  }
@@ -1443,56 +1557,6 @@ export class SnkApplication {
1443
1557
  }]
1444
1558
  }
1445
1559
  },
1446
- "callServiceBroker": {
1447
- "complexType": {
1448
- "signature": "(serviceName: string, payload: string | Object, options?: Options) => Promise<any>",
1449
- "parameters": [{
1450
- "tags": [{
1451
- "name": "param",
1452
- "text": "serviceName - Nome do servi\u00E7o"
1453
- }],
1454
- "text": "- Nome do servi\u00E7o"
1455
- }, {
1456
- "tags": [{
1457
- "name": "param",
1458
- "text": "payload - Dados que ser\u00E3o processados na a\u00E7\u00E3o"
1459
- }],
1460
- "text": "- Dados que ser\u00E3o processados na a\u00E7\u00E3o"
1461
- }, {
1462
- "tags": [{
1463
- "name": "param",
1464
- "text": "options - Par\u00E2metros de URL"
1465
- }],
1466
- "text": "- Par\u00E2metros de URL"
1467
- }],
1468
- "references": {
1469
- "Promise": {
1470
- "location": "global"
1471
- },
1472
- "Object": {
1473
- "location": "global"
1474
- },
1475
- "Options": {
1476
- "location": "import",
1477
- "path": "../../lib/http/data-fetcher/DataFetcher"
1478
- }
1479
- },
1480
- "return": "Promise<any>"
1481
- },
1482
- "docs": {
1483
- "text": "Realiza a chamada ao Service Broker conforme o nome do servi\u00E7o.",
1484
- "tags": [{
1485
- "name": "param",
1486
- "text": "serviceName - Nome do servi\u00E7o"
1487
- }, {
1488
- "name": "param",
1489
- "text": "payload - Dados que ser\u00E3o processados na a\u00E7\u00E3o"
1490
- }, {
1491
- "name": "param",
1492
- "text": "options - Par\u00E2metros de URL"
1493
- }]
1494
- }
1495
- },
1496
1560
  "getResourceID": {
1497
1561
  "complexType": {
1498
1562
  "signature": "() => Promise<string>",
@@ -1753,6 +1817,25 @@ export class SnkApplication {
1753
1817
  "tags": []
1754
1818
  }
1755
1819
  },
1820
+ "isLoadedByPk": {
1821
+ "complexType": {
1822
+ "signature": "() => Promise<boolean>",
1823
+ "parameters": [],
1824
+ "references": {
1825
+ "Promise": {
1826
+ "location": "global"
1827
+ }
1828
+ },
1829
+ "return": "Promise<boolean>"
1830
+ },
1831
+ "docs": {
1832
+ "text": "Obt\u00E9m a informa\u00E7\u00E3o se o \u00FAltimo carregamento do dataunit foi feito atrav\u00E9s de um loadByPk",
1833
+ "tags": [{
1834
+ "name": "returns",
1835
+ "text": "boolean"
1836
+ }]
1837
+ }
1838
+ },
1756
1839
  "executeSearch": {
1757
1840
  "complexType": {
1758
1841
  "signature": "(searchArgument: ISearchArgument, fieldName: string, dataUnit: DataUnit) => Promise<Array<IOption> | IOption>",
@@ -1973,7 +2056,7 @@ export class SnkApplication {
1973
2056
  "return": "Promise<any[]>"
1974
2057
  },
1975
2058
  "docs": {
1976
- "text": "Com base em um campo realiza um \"select distinct\" respeitando os \nfiltros atuais do dataUnit e um crit\u00E9rio de filtro para a pr\u00F3pria \ncoluna.",
2059
+ "text": "Com base em um campo realiza um \"select distinct\" respeitando os\nfiltros atuais do dataUnit e um crit\u00E9rio de filtro para a pr\u00F3pria\ncoluna.",
1977
2060
  "tags": []
1978
2061
  }
1979
2062
  },
@@ -98,6 +98,8 @@ export class SnkFilterBar {
98
98
  }
99
99
  async processAfterUpdateConfig() {
100
100
  if (this._loadingPending) {
101
+ if (await this._application.isLoadedByPk() && !this._configUpdated)
102
+ return;
101
103
  const personalizedFilter = this.getPersonalizedFilterItem();
102
104
  this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
103
105
  if (this._pendingVariables) {
@@ -29,6 +29,9 @@ export default class UrlUtils {
29
29
  static getResourceIdFromUrlToken(url) {
30
30
  try {
31
31
  const parts = url.split('/');
32
+ if (!parts[1]) {
33
+ return null;
34
+ }
32
35
  const encodedValue = parts[1];
33
36
  return atob(encodedValue);
34
37
  }
@@ -42,10 +45,13 @@ export default class UrlUtils {
42
45
  */
43
46
  static getPkObjectFromUrlToken(url) {
44
47
  try {
45
- const parts = url.split('/');
46
- const encodedObjectPart = parts[parts.length - 2];
47
- const decodedObjectPart = atob(encodedObjectPart);
48
- return JSON.parse(decodedObjectPart);
48
+ let pkObjectPart = url.split('/')[2];
49
+ if (!pkObjectPart)
50
+ return null;
51
+ if (pkObjectPart.indexOf('&') > -1) {
52
+ return JSON.parse(atob(pkObjectPart.split('&')[0]));
53
+ }
54
+ return JSON.parse(atob(pkObjectPart));
49
55
  }
50
56
  catch (error) {
51
57
  throw new Error('Erro ao obter a PK do objeto:' + error);
@@ -6442,6 +6442,9 @@ class UrlUtils {
6442
6442
  static getResourceIdFromUrlToken(url) {
6443
6443
  try {
6444
6444
  const parts = url.split('/');
6445
+ if (!parts[1]) {
6446
+ return null;
6447
+ }
6445
6448
  const encodedValue = parts[1];
6446
6449
  return atob(encodedValue);
6447
6450
  }
@@ -6455,10 +6458,13 @@ class UrlUtils {
6455
6458
  */
6456
6459
  static getPkObjectFromUrlToken(url) {
6457
6460
  try {
6458
- const parts = url.split('/');
6459
- const encodedObjectPart = parts[parts.length - 2];
6460
- const decodedObjectPart = atob(encodedObjectPart);
6461
- return JSON.parse(decodedObjectPart);
6461
+ let pkObjectPart = url.split('/')[2];
6462
+ if (!pkObjectPart)
6463
+ return null;
6464
+ if (pkObjectPart.indexOf('&') > -1) {
6465
+ return JSON.parse(atob(pkObjectPart.split('&')[0]));
6466
+ }
6467
+ return JSON.parse(atob(pkObjectPart));
6462
6468
  }
6463
6469
  catch (error) {
6464
6470
  throw new Error('Erro ao obter a PK do objeto:' + error);