@sankhyalabs/sankhyablocks 1.3.5 → 1.3.8

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 (24) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  3. package/dist/cjs/snk-application.cjs.entry.js +93 -25
  4. package/dist/collection/components/snk-application/snk-application.js +93 -11
  5. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -10
  6. package/dist/collection/lib/http/data-fetcher/fetchers/application-config-fetcher.js +2 -2
  7. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +8 -5
  8. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +28 -1
  9. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +2 -2
  10. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +3 -3
  11. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +25 -2
  12. package/dist/collection/lib/utils/urlutils.js +2 -0
  13. package/dist/components/snk-application2.js +96 -26
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/sankhyablocks.js +1 -1
  16. package/dist/esm/snk-application.entry.js +93 -25
  17. package/dist/sankhyablocks/{p-727ea2f4.entry.js → p-58b10602.entry.js} +9 -7
  18. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  19. package/dist/types/components/snk-application/snk-application.d.ts +11 -4
  20. package/dist/types/components.d.ts +8 -4
  21. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +2 -2
  22. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +5 -1
  23. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  24. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { DataType } from "@sankhyalabs/core";
2
2
  import { gql } from "graphql-request";
3
- import { HttpFetcher } from "../DataFetcher";
3
+ import { DataFetcher } from "../DataFetcher";
4
4
  export class PesquisaFetcher {
5
5
  constructor() {
6
6
  this.templateByQuery = new Map();
@@ -16,7 +16,7 @@ export class PesquisaFetcher {
16
16
  }
17
17
  loadSearchOptions(entityName, argument, criteria) {
18
18
  return new Promise((resolve, reject) => {
19
- HttpFetcher.get()
19
+ DataFetcher.get()
20
20
  .callGraphQL({
21
21
  values: { argument, entityName, criteria },
22
22
  query: this.templateByQuery.get("search"),
@@ -60,7 +60,7 @@ export class PesquisaFetcher {
60
60
  }
61
61
  };
62
62
  return new Promise((resolve, reject) => {
63
- HttpFetcher.get()
63
+ DataFetcher.get()
64
64
  .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
65
65
  .then(result => resolve(result))
66
66
  .catch(error => reject(error));
@@ -1,5 +1,5 @@
1
1
  import { gql } from "graphql-request";
2
- import { HttpFetcher } from "../DataFetcher";
2
+ import { DataFetcher } from "../DataFetcher";
3
3
  export class ResourceFetcher {
4
4
  constructor() {
5
5
  this.templateByQuery = new Map();
@@ -11,10 +11,13 @@ export class ResourceFetcher {
11
11
  resource
12
12
  }
13
13
  }`);
14
+ this.templateByQuery.set("saveResource", gql `mutation($resource: ResourceToSave!) {
15
+ $queryAlias$: saveResource(resource: $resource)
16
+ }`);
14
17
  }
15
18
  loadResource(name) {
16
19
  return new Promise((resolve, reject) => {
17
- HttpFetcher.get()
20
+ DataFetcher.get()
18
21
  .callGraphQL({
19
22
  values: { name },
20
23
  query: this.templateByQuery.get("fetchResource"),
@@ -27,4 +30,24 @@ export class ResourceFetcher {
27
30
  });
28
31
  });
29
32
  }
33
+ saveResource(resource, name) {
34
+ return new Promise((resolve, reject) => {
35
+ DataFetcher.get()
36
+ .callGraphQL({
37
+ values: {
38
+ resource: {
39
+ name: name,
40
+ resource: JSON.stringify(resource)
41
+ }
42
+ },
43
+ query: this.templateByQuery.get("saveResource")
44
+ })
45
+ .then((resp) => {
46
+ resolve(resp);
47
+ })
48
+ .catch((error) => {
49
+ reject(error);
50
+ });
51
+ });
52
+ }
30
53
  }
@@ -18,6 +18,8 @@ export default class UrlUtils {
18
18
  return params;
19
19
  }
20
20
  static getUrlBase() {
21
+ if (window['mock_url'])
22
+ return window['mock_url'];
21
23
  return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
22
24
  }
23
25
  }
@@ -6451,24 +6451,26 @@ class UrlUtils {
6451
6451
  return params;
6452
6452
  }
6453
6453
  static getUrlBase() {
6454
+ if (window['mock_url'])
6455
+ return window['mock_url'];
6454
6456
  return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
6455
6457
  }
6456
6458
  }
6457
6459
 
6458
- class HttpFetcher {
6460
+ class DataFetcher {
6459
6461
  constructor() {
6460
6462
  this.watingRequestsById = new Map();
6461
6463
  }
6462
6464
  static get() {
6463
- if (!HttpFetcher.instance) {
6464
- HttpFetcher.instance = new HttpFetcher();
6465
+ if (!DataFetcher.instance) {
6466
+ DataFetcher.instance = new DataFetcher();
6465
6467
  const application = document.querySelector(this.appTagName);
6466
6468
  if (application === null) {
6467
- HttpFetcher.instance.resume();
6469
+ DataFetcher.instance.resume();
6468
6470
  }
6469
6471
  else {
6470
- application.addEventListener('applicationLoading', () => HttpFetcher.instance.pause());
6471
- application.addEventListener('applicationLoaded', () => HttpFetcher.instance.resume());
6472
+ application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
6473
+ application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
6472
6474
  }
6473
6475
  }
6474
6476
  return this.instance;
@@ -6502,8 +6504,6 @@ class HttpFetcher {
6502
6504
  }
6503
6505
  }
6504
6506
  resolveURL() {
6505
- if (window['mock_url'])
6506
- return window['mock_url'];
6507
6507
  return UrlUtils.getUrlBase();
6508
6508
  }
6509
6509
  getContext() {
@@ -6595,7 +6595,7 @@ class HttpFetcher {
6595
6595
  let dataResponse = [];
6596
6596
  let errorsResponse = [];
6597
6597
  try {
6598
- res = await dist.batchRequests('http://localhost:8082/', request);
6598
+ res = await dist.batchRequests(this.resolveURL(), request);
6599
6599
  res.forEach((resItem) => {
6600
6600
  dataResponse.push(resItem.data);
6601
6601
  });
@@ -6633,7 +6633,7 @@ class HttpFetcher {
6633
6633
  }
6634
6634
  ;
6635
6635
  }
6636
- HttpFetcher.appTagName = "snk-application";
6636
+ DataFetcher.appTagName = "snk-application";
6637
6637
  class WaitingRequest {
6638
6638
  constructor(req) {
6639
6639
  this._resolve = () => { };
@@ -6727,7 +6727,7 @@ class DataUnitFetcher {
6727
6727
  }
6728
6728
  loadMetadata(dataUnit) {
6729
6729
  return new Promise((resolve, reject) => {
6730
- HttpFetcher.get()
6730
+ DataFetcher.get()
6731
6731
  .callGraphQL({
6732
6732
  values: { name: dataUnit.name },
6733
6733
  query: this.templateByQuery.get("fetchDataUnit"),
@@ -6768,7 +6768,7 @@ class DataUnitFetcher {
6768
6768
  params: [{ name: "term", value: page.quickFilter }]
6769
6769
  }];
6770
6770
  }
6771
- HttpFetcher.get()
6771
+ DataFetcher.get()
6772
6772
  .callGraphQL({
6773
6773
  values: variables,
6774
6774
  query: this.templateByQuery.get("fetchData"),
@@ -6806,7 +6806,7 @@ class DataUnitFetcher {
6806
6806
  return reqChange;
6807
6807
  });
6808
6808
  return new Promise((resolve, reject) => {
6809
- HttpFetcher.get()
6809
+ DataFetcher.get()
6810
6810
  .callGraphQL({
6811
6811
  values: { changes: changes },
6812
6812
  query: this.templateByQuery.get("saveData"),
@@ -6835,7 +6835,7 @@ class DataUnitFetcher {
6835
6835
  return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
6836
6836
  });
6837
6837
  return new Promise((resolve, reject) => {
6838
- HttpFetcher.get()
6838
+ DataFetcher.get()
6839
6839
  .callGraphQL({
6840
6840
  values: { changes: changes },
6841
6841
  query: this.templateByQuery.get("saveData"),
@@ -6856,6 +6856,9 @@ const formatValueToServer = (value) => {
6856
6856
  if (value instanceof Date) {
6857
6857
  return value.toString();
6858
6858
  }
6859
+ if (typeof value === "string") {
6860
+ return value;
6861
+ }
6859
6862
  //Any others objects
6860
6863
  value = JSON.stringify(value);
6861
6864
  }
@@ -6889,7 +6892,7 @@ class ParametersFetcher {
6889
6892
  }
6890
6893
  async getParam(name, resourceID) {
6891
6894
  const completPath = `param://${resourceID}?params=${window.btoa(name)}`;
6892
- return HttpFetcher.get().callGraphQL({
6895
+ return DataFetcher.get().callGraphQL({
6893
6896
  values: { name: completPath },
6894
6897
  query: this.templateByQuery.get("fetchParam"),
6895
6898
  });
@@ -6942,10 +6945,13 @@ class ResourceFetcher {
6942
6945
  resource
6943
6946
  }
6944
6947
  }`);
6948
+ this.templateByQuery.set("saveResource", dist.gql `mutation($resource: ResourceToSave!) {
6949
+ $queryAlias$: saveResource(resource: $resource)
6950
+ }`);
6945
6951
  }
6946
6952
  loadResource(name) {
6947
6953
  return new Promise((resolve, reject) => {
6948
- HttpFetcher.get()
6954
+ DataFetcher.get()
6949
6955
  .callGraphQL({
6950
6956
  values: { name },
6951
6957
  query: this.templateByQuery.get("fetchResource"),
@@ -6958,6 +6964,26 @@ class ResourceFetcher {
6958
6964
  });
6959
6965
  });
6960
6966
  }
6967
+ saveResource(resource, name) {
6968
+ return new Promise((resolve, reject) => {
6969
+ DataFetcher.get()
6970
+ .callGraphQL({
6971
+ values: {
6972
+ resource: {
6973
+ name: name,
6974
+ resource: JSON.stringify(resource)
6975
+ }
6976
+ },
6977
+ query: this.templateByQuery.get("saveResource")
6978
+ })
6979
+ .then((resp) => {
6980
+ resolve(resp);
6981
+ })
6982
+ .catch((error) => {
6983
+ reject(error);
6984
+ });
6985
+ });
6986
+ }
6961
6987
  }
6962
6988
 
6963
6989
  class FormConfigFetcher extends ResourceFetcher {
@@ -6985,6 +7011,35 @@ class FormConfigFetcher extends ResourceFetcher {
6985
7011
  }
6986
7012
  }
6987
7013
 
7014
+ class GridConfigFetcher extends ResourceFetcher {
7015
+ getConfig(resourceID) {
7016
+ const completePath = `cfg://grid/GrdCfgHtml5:${resourceID}`;
7017
+ return new Promise((resolve, reject) => {
7018
+ this.loadResource(completePath)
7019
+ .then(loadedResource => {
7020
+ if (loadedResource) {
7021
+ let config = JSON.parse(loadedResource);
7022
+ resolve(config);
7023
+ }
7024
+ }).catch((error) => {
7025
+ reject(error);
7026
+ });
7027
+ });
7028
+ }
7029
+ saveConfig(config, resourceID) {
7030
+ const completePath = `cfg://grid/GrdCfgHtml5:${resourceID}`;
7031
+ return new Promise((resolve, reject) => {
7032
+ this.saveResource(config, completePath)
7033
+ .then((resp) => {
7034
+ resolve(resp);
7035
+ })
7036
+ .catch((error) => {
7037
+ reject(error);
7038
+ });
7039
+ });
7040
+ }
7041
+ }
7042
+
6988
7043
  class PesquisaFetcher {
6989
7044
  constructor() {
6990
7045
  this.templateByQuery = new Map();
@@ -7000,7 +7055,7 @@ class PesquisaFetcher {
7000
7055
  }
7001
7056
  loadSearchOptions(entityName, argument, criteria) {
7002
7057
  return new Promise((resolve, reject) => {
7003
- HttpFetcher.get()
7058
+ DataFetcher.get()
7004
7059
  .callGraphQL({
7005
7060
  values: { argument, entityName, criteria },
7006
7061
  query: this.templateByQuery.get("search"),
@@ -7044,7 +7099,7 @@ class PesquisaFetcher {
7044
7099
  }
7045
7100
  };
7046
7101
  return new Promise((resolve, reject) => {
7047
- HttpFetcher.get()
7102
+ DataFetcher.get()
7048
7103
  .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
7049
7104
  .then(result => resolve(result))
7050
7105
  .catch(error => reject(error));
@@ -7153,21 +7208,27 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7153
7208
  async getResourceID() {
7154
7209
  return Promise.resolve(this.resourceID);
7155
7210
  }
7156
- async alert(title, message, icon) {
7157
- return ApplicationUtils.alert(title, message, icon);
7211
+ async alert(title, message, icon, options) {
7212
+ return ApplicationUtils.alert(title, message, icon, options);
7158
7213
  }
7159
- async error(title, message, icon) {
7160
- return ApplicationUtils.error(title, message, icon);
7214
+ async error(title, message, icon, options) {
7215
+ return ApplicationUtils.error(title, message, icon, options);
7161
7216
  }
7162
- async confirm(title, message, icon, critical) {
7163
- return ApplicationUtils.confirm(title, message, icon, critical);
7217
+ async confirm(title, message, icon, critical, options) {
7218
+ return ApplicationUtils.confirm(title, message, icon, critical, options);
7164
7219
  }
7165
- async info(message, options = undefined) {
7220
+ async info(message, options) {
7166
7221
  return ApplicationUtils.info(message, options);
7167
7222
  }
7168
7223
  async loadFormConfig(name) {
7169
7224
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7170
7225
  }
7226
+ async loadGridConfig() {
7227
+ return this.gridConfigFetcher.getConfig(this.resourceID);
7228
+ }
7229
+ async saveGridConfig(config) {
7230
+ return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7231
+ }
7171
7232
  get urlParams() {
7172
7233
  if (!this._urlParams) {
7173
7234
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7186,6 +7247,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7186
7247
  }
7187
7248
  return this._formConfigFetcher;
7188
7249
  }
7250
+ get gridConfigFetcher() {
7251
+ if (!this._gridConfigFetcher) {
7252
+ this._gridConfigFetcher = new GridConfigFetcher();
7253
+ }
7254
+ return this._gridConfigFetcher;
7255
+ }
7189
7256
  get pesquisaFetcher() {
7190
7257
  if (!this._pesquisaFetcher) {
7191
7258
  this._pesquisaFetcher = new PesquisaFetcher();
@@ -7233,6 +7300,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7233
7300
  }
7234
7301
  }
7235
7302
  componentWillLoad() {
7303
+ ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/ez.uploading`);
7236
7304
  ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7237
7305
  return this.executeSearch(searchArgument, fieldName, dataUnit);
7238
7306
  });
@@ -7264,7 +7332,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7264
7332
  "error": [64],
7265
7333
  "confirm": [64],
7266
7334
  "info": [64],
7267
- "loadFormConfig": [64]
7335
+ "loadFormConfig": [64],
7336
+ "loadGridConfig": [64],
7337
+ "saveGridConfig": [64]
7268
7338
  }]);
7269
7339
  function defineCustomElement() {
7270
7340
  if (typeof customElements === "undefined") {
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["snk-pesquisa",[[1,"snk-pesquisa",{"searchLoader":[16],"onSelectItem":[16],"argument":[1025]}]]],["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]]], options);
13
+ return bootstrapLazy([["snk-pesquisa",[[1,"snk-pesquisa",{"searchLoader":[16],"onSelectItem":[16],"argument":[1025]}]]],["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["snk-pesquisa",[[1,"snk-pesquisa",{"searchLoader":[16],"onSelectItem":[16],"argument":[1025]}]]],["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]]], options);
16
+ return bootstrapLazy([["snk-pesquisa",[[1,"snk-pesquisa",{"searchLoader":[16],"onSelectItem":[16],"argument":[1025]}]]],["snk-application",[[2,"snk-application",{"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"closePopUp":[64],"temOpcional":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getResourceID":[64],"alert":[64],"error":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"saveGridConfig":[64]}]]],["teste-pesquisa",[[1,"teste-pesquisa"]]]], options);
17
17
  });
@@ -6450,24 +6450,26 @@ class UrlUtils {
6450
6450
  return params;
6451
6451
  }
6452
6452
  static getUrlBase() {
6453
+ if (window['mock_url'])
6454
+ return window['mock_url'];
6453
6455
  return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
6454
6456
  }
6455
6457
  }
6456
6458
 
6457
- class HttpFetcher {
6459
+ class DataFetcher {
6458
6460
  constructor() {
6459
6461
  this.watingRequestsById = new Map();
6460
6462
  }
6461
6463
  static get() {
6462
- if (!HttpFetcher.instance) {
6463
- HttpFetcher.instance = new HttpFetcher();
6464
+ if (!DataFetcher.instance) {
6465
+ DataFetcher.instance = new DataFetcher();
6464
6466
  const application = document.querySelector(this.appTagName);
6465
6467
  if (application === null) {
6466
- HttpFetcher.instance.resume();
6468
+ DataFetcher.instance.resume();
6467
6469
  }
6468
6470
  else {
6469
- application.addEventListener('applicationLoading', () => HttpFetcher.instance.pause());
6470
- application.addEventListener('applicationLoaded', () => HttpFetcher.instance.resume());
6471
+ application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
6472
+ application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
6471
6473
  }
6472
6474
  }
6473
6475
  return this.instance;
@@ -6501,8 +6503,6 @@ class HttpFetcher {
6501
6503
  }
6502
6504
  }
6503
6505
  resolveURL() {
6504
- if (window['mock_url'])
6505
- return window['mock_url'];
6506
6506
  return UrlUtils.getUrlBase();
6507
6507
  }
6508
6508
  getContext() {
@@ -6594,7 +6594,7 @@ class HttpFetcher {
6594
6594
  let dataResponse = [];
6595
6595
  let errorsResponse = [];
6596
6596
  try {
6597
- res = await dist.batchRequests('http://localhost:8082/', request);
6597
+ res = await dist.batchRequests(this.resolveURL(), request);
6598
6598
  res.forEach((resItem) => {
6599
6599
  dataResponse.push(resItem.data);
6600
6600
  });
@@ -6632,7 +6632,7 @@ class HttpFetcher {
6632
6632
  }
6633
6633
  ;
6634
6634
  }
6635
- HttpFetcher.appTagName = "snk-application";
6635
+ DataFetcher.appTagName = "snk-application";
6636
6636
  class WaitingRequest {
6637
6637
  constructor(req) {
6638
6638
  this._resolve = () => { };
@@ -6726,7 +6726,7 @@ class DataUnitFetcher {
6726
6726
  }
6727
6727
  loadMetadata(dataUnit) {
6728
6728
  return new Promise((resolve, reject) => {
6729
- HttpFetcher.get()
6729
+ DataFetcher.get()
6730
6730
  .callGraphQL({
6731
6731
  values: { name: dataUnit.name },
6732
6732
  query: this.templateByQuery.get("fetchDataUnit"),
@@ -6767,7 +6767,7 @@ class DataUnitFetcher {
6767
6767
  params: [{ name: "term", value: page.quickFilter }]
6768
6768
  }];
6769
6769
  }
6770
- HttpFetcher.get()
6770
+ DataFetcher.get()
6771
6771
  .callGraphQL({
6772
6772
  values: variables,
6773
6773
  query: this.templateByQuery.get("fetchData"),
@@ -6805,7 +6805,7 @@ class DataUnitFetcher {
6805
6805
  return reqChange;
6806
6806
  });
6807
6807
  return new Promise((resolve, reject) => {
6808
- HttpFetcher.get()
6808
+ DataFetcher.get()
6809
6809
  .callGraphQL({
6810
6810
  values: { changes: changes },
6811
6811
  query: this.templateByQuery.get("saveData"),
@@ -6834,7 +6834,7 @@ class DataUnitFetcher {
6834
6834
  return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
6835
6835
  });
6836
6836
  return new Promise((resolve, reject) => {
6837
- HttpFetcher.get()
6837
+ DataFetcher.get()
6838
6838
  .callGraphQL({
6839
6839
  values: { changes: changes },
6840
6840
  query: this.templateByQuery.get("saveData"),
@@ -6855,6 +6855,9 @@ const formatValueToServer = (value) => {
6855
6855
  if (value instanceof Date) {
6856
6856
  return value.toString();
6857
6857
  }
6858
+ if (typeof value === "string") {
6859
+ return value;
6860
+ }
6858
6861
  //Any others objects
6859
6862
  value = JSON.stringify(value);
6860
6863
  }
@@ -6888,7 +6891,7 @@ class ParametersFetcher {
6888
6891
  }
6889
6892
  async getParam(name, resourceID) {
6890
6893
  const completPath = `param://${resourceID}?params=${window.btoa(name)}`;
6891
- return HttpFetcher.get().callGraphQL({
6894
+ return DataFetcher.get().callGraphQL({
6892
6895
  values: { name: completPath },
6893
6896
  query: this.templateByQuery.get("fetchParam"),
6894
6897
  });
@@ -6941,10 +6944,13 @@ class ResourceFetcher {
6941
6944
  resource
6942
6945
  }
6943
6946
  }`);
6947
+ this.templateByQuery.set("saveResource", dist.gql `mutation($resource: ResourceToSave!) {
6948
+ $queryAlias$: saveResource(resource: $resource)
6949
+ }`);
6944
6950
  }
6945
6951
  loadResource(name) {
6946
6952
  return new Promise((resolve, reject) => {
6947
- HttpFetcher.get()
6953
+ DataFetcher.get()
6948
6954
  .callGraphQL({
6949
6955
  values: { name },
6950
6956
  query: this.templateByQuery.get("fetchResource"),
@@ -6957,6 +6963,26 @@ class ResourceFetcher {
6957
6963
  });
6958
6964
  });
6959
6965
  }
6966
+ saveResource(resource, name) {
6967
+ return new Promise((resolve, reject) => {
6968
+ DataFetcher.get()
6969
+ .callGraphQL({
6970
+ values: {
6971
+ resource: {
6972
+ name: name,
6973
+ resource: JSON.stringify(resource)
6974
+ }
6975
+ },
6976
+ query: this.templateByQuery.get("saveResource")
6977
+ })
6978
+ .then((resp) => {
6979
+ resolve(resp);
6980
+ })
6981
+ .catch((error) => {
6982
+ reject(error);
6983
+ });
6984
+ });
6985
+ }
6960
6986
  }
6961
6987
 
6962
6988
  class FormConfigFetcher extends ResourceFetcher {
@@ -6984,6 +7010,35 @@ class FormConfigFetcher extends ResourceFetcher {
6984
7010
  }
6985
7011
  }
6986
7012
 
7013
+ class GridConfigFetcher extends ResourceFetcher {
7014
+ getConfig(resourceID) {
7015
+ const completePath = `cfg://grid/GrdCfgHtml5:${resourceID}`;
7016
+ return new Promise((resolve, reject) => {
7017
+ this.loadResource(completePath)
7018
+ .then(loadedResource => {
7019
+ if (loadedResource) {
7020
+ let config = JSON.parse(loadedResource);
7021
+ resolve(config);
7022
+ }
7023
+ }).catch((error) => {
7024
+ reject(error);
7025
+ });
7026
+ });
7027
+ }
7028
+ saveConfig(config, resourceID) {
7029
+ const completePath = `cfg://grid/GrdCfgHtml5:${resourceID}`;
7030
+ return new Promise((resolve, reject) => {
7031
+ this.saveResource(config, completePath)
7032
+ .then((resp) => {
7033
+ resolve(resp);
7034
+ })
7035
+ .catch((error) => {
7036
+ reject(error);
7037
+ });
7038
+ });
7039
+ }
7040
+ }
7041
+
6987
7042
  class PesquisaFetcher {
6988
7043
  constructor() {
6989
7044
  this.templateByQuery = new Map();
@@ -6999,7 +7054,7 @@ class PesquisaFetcher {
6999
7054
  }
7000
7055
  loadSearchOptions(entityName, argument, criteria) {
7001
7056
  return new Promise((resolve, reject) => {
7002
- HttpFetcher.get()
7057
+ DataFetcher.get()
7003
7058
  .callGraphQL({
7004
7059
  values: { argument, entityName, criteria },
7005
7060
  query: this.templateByQuery.get("search"),
@@ -7043,7 +7098,7 @@ class PesquisaFetcher {
7043
7098
  }
7044
7099
  };
7045
7100
  return new Promise((resolve, reject) => {
7046
- HttpFetcher.get()
7101
+ DataFetcher.get()
7047
7102
  .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
7048
7103
  .then(result => resolve(result))
7049
7104
  .catch(error => reject(error));
@@ -7151,21 +7206,27 @@ const SnkApplication = class {
7151
7206
  async getResourceID() {
7152
7207
  return Promise.resolve(this.resourceID);
7153
7208
  }
7154
- async alert(title, message, icon) {
7155
- return ApplicationUtils.alert(title, message, icon);
7209
+ async alert(title, message, icon, options) {
7210
+ return ApplicationUtils.alert(title, message, icon, options);
7156
7211
  }
7157
- async error(title, message, icon) {
7158
- return ApplicationUtils.error(title, message, icon);
7212
+ async error(title, message, icon, options) {
7213
+ return ApplicationUtils.error(title, message, icon, options);
7159
7214
  }
7160
- async confirm(title, message, icon, critical) {
7161
- return ApplicationUtils.confirm(title, message, icon, critical);
7215
+ async confirm(title, message, icon, critical, options) {
7216
+ return ApplicationUtils.confirm(title, message, icon, critical, options);
7162
7217
  }
7163
- async info(message, options = undefined) {
7218
+ async info(message, options) {
7164
7219
  return ApplicationUtils.info(message, options);
7165
7220
  }
7166
7221
  async loadFormConfig(name) {
7167
7222
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7168
7223
  }
7224
+ async loadGridConfig() {
7225
+ return this.gridConfigFetcher.getConfig(this.resourceID);
7226
+ }
7227
+ async saveGridConfig(config) {
7228
+ return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7229
+ }
7169
7230
  get urlParams() {
7170
7231
  if (!this._urlParams) {
7171
7232
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7184,6 +7245,12 @@ const SnkApplication = class {
7184
7245
  }
7185
7246
  return this._formConfigFetcher;
7186
7247
  }
7248
+ get gridConfigFetcher() {
7249
+ if (!this._gridConfigFetcher) {
7250
+ this._gridConfigFetcher = new GridConfigFetcher();
7251
+ }
7252
+ return this._gridConfigFetcher;
7253
+ }
7187
7254
  get pesquisaFetcher() {
7188
7255
  if (!this._pesquisaFetcher) {
7189
7256
  this._pesquisaFetcher = new PesquisaFetcher();
@@ -7231,6 +7298,7 @@ const SnkApplication = class {
7231
7298
  }
7232
7299
  }
7233
7300
  componentWillLoad() {
7301
+ ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/ez.uploading`);
7234
7302
  ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7235
7303
  return this.executeSearch(searchArgument, fieldName, dataUnit);
7236
7304
  });