dts-backoffice-util 21.1.0 → 21.2.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.
package/README.md CHANGED
@@ -12,9 +12,9 @@ Segue abaixo as últimas versões da Biblioteca, conforme a versão do PO-UI e A
12
12
 
13
13
  | PO-UI | Angular | Versão dtsBackofficeUtil |
14
14
  |-|-|-|
15
- | v21 | v21 | 21.1.0 |
16
- | v20 | v20 | 20.1.0 |
17
- | v19 | v19 | 19.5.0 |
15
+ | v21 | v21 | 21.2.0 |
16
+ | v20 | v20 | 20.2.0 |
17
+ | v19 | v19 | 19.6.0 |
18
18
  | v18 | v18 | 18.3.0 |
19
19
  | v17 | v17 | 17.2.0 |
20
20
  | v16 | v16 | 16.1.0 |
@@ -271,6 +271,15 @@ class MenuDatasulService {
271
271
  this.openHTMLProgram('THF1', externalName, params, parent);
272
272
  }
273
273
  openHTMLProgram(type, HTMLProgram, params, parent) {
274
+ const backendType = sessionStorage.getItem('totvs.product.backend.type');
275
+ if (backendType === 'DSS') {
276
+ this.openOnDSS(type, HTMLProgram, params, parent);
277
+ }
278
+ else {
279
+ this.openOnDTS4THF(type, HTMLProgram, params, parent);
280
+ }
281
+ }
282
+ openOnDTS4THF(type, HTMLProgram, params, parent) {
274
283
  const datasulPath = document.referrer.indexOf('totvs-menu') > 0 ? 'totvs-menu' : 'menu-html';
275
284
  HTMLProgram = HTMLProgram.replace(/\\/g, '/');
276
285
  if (HTMLProgram.charAt(0) === '/') {
@@ -290,8 +299,33 @@ class MenuDatasulService {
290
299
  if (baseUrl.charAt(baseUrl.length - 1) === '/') {
291
300
  baseUrl = baseUrl.slice(0, -1);
292
301
  }
293
- baseUrl = `${baseUrl}/#/${params}`;
302
+ if (type === 'THF2') {
303
+ baseUrl = `${baseUrl}/#`;
304
+ }
305
+ baseUrl = `${baseUrl}/${params}`;
306
+ }
307
+ this.openWindow(baseUrl, parent);
308
+ }
309
+ openOnDSS(type, HTMLProgram, params, parent) {
310
+ let baseUrl = `${HTMLProgram}`;
311
+ if (params) {
312
+ baseUrl = `${baseUrl}/${params}`;
294
313
  }
314
+ try {
315
+ if (window.top && typeof window.top.navigateSmartX === 'function') {
316
+ window.top.navigateSmartX(baseUrl);
317
+ }
318
+ else {
319
+ // Se falhar e precisar do window.open, a barra na frente e o smart-x
320
+ // são necessários para o navegador não emendar na URL atual do iframe
321
+ this.openWindow(`/smart-x/${baseUrl}`, parent);
322
+ }
323
+ }
324
+ catch (e) {
325
+ this.openWindow(`/smart-x/${baseUrl}`, parent);
326
+ }
327
+ }
328
+ openWindow(baseUrl, parent) {
295
329
  if (parent) {
296
330
  window.open(baseUrl, '_parent');
297
331
  }
@@ -318,7 +352,7 @@ class MenuDatasulService {
318
352
  }
319
353
  const aRequest = [];
320
354
  programList.forEach(programSearch => {
321
- aRequest.push(this.http.post(this.urlMenuPrograms, { search: programSearch }));
355
+ aRequest.push(this.http.post(this.urlMenuPrograms, this.getPayloadSearchProg(programSearch)));
322
356
  });
323
357
  return forkJoin(aRequest).pipe(map$1((response) => {
324
358
  if (!response) {
@@ -348,6 +382,9 @@ class MenuDatasulService {
348
382
  return responseReturn;
349
383
  }));
350
384
  }
385
+ getPayloadSearchProg(programSearch) {
386
+ return { 'codModul': null, 'search': programSearch, 'typeProg': '4,3,1,2', 'groupAplicat': [] };
387
+ }
351
388
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
352
389
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: MenuDatasulService }); }
353
390
  }