@sankhyalabs/sankhyablocks 8.16.0-dev.56 → 8.16.0-dev.58
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-3f27ea94.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-2ec4811b.js} +3 -0
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +9 -5
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-dcd05129.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -1
- package/dist/components/pesquisa-fetcher.js +4 -1
- package/dist/components/snk-attach2.js +8 -4
- package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-139ff541.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-24e5bba0.js} +4 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +9 -5
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-0c3efe6a.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-046ce9d2.entry.js → p-0791a167.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a3fadd0b.entry.js → p-2011eaa3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4138da61.entry.js → p-5daf2e8c.entry.js} +1 -1
- package/dist/sankhyablocks/p-73b19d2a.entry.js +1 -0
- package/dist/sankhyablocks/{p-e97be1c8.js → p-994903df.js} +1 -1
- package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-9f358458.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3728d2aa.entry.js → p-bca6e570.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0387d9d7.entry.js → p-c9ab5a1f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e4391e16.js → p-cb617269.js} +1 -1
- package/dist/sankhyablocks/p-e6683406.js +6 -0
- package/dist/sankhyablocks/{p-e390641b.entry.js → p-e7469b05.entry.js} +1 -1
- package/dist/sankhyablocks/{p-af7f7b3e.entry.js → p-f35db6f1.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-341465ce.js +0 -6
- package/dist/sankhyablocks/p-8ee1eccc.entry.js +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
const DataFetcher = require('./DataFetcher-e059eb72.js');
|
4
|
-
require('./pesquisa-fetcher-
|
4
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
5
5
|
const core = require('@sankhyalabs/core');
|
6
6
|
require('./index-1dfc7a6e.js');
|
7
7
|
require('./ISave-e91b70a7.js');
|
@@ -75,6 +75,9 @@ class PesquisaFetcher {
|
|
75
75
|
value = core.ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
76
76
|
}
|
77
77
|
}
|
78
|
+
if (param.dataType === core.DataType.NUMBER && value === undefined) {
|
79
|
+
throw new core.ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
|
80
|
+
}
|
78
81
|
let type = param.dataType;
|
79
82
|
if (type === core.DataType.OBJECT) {
|
80
83
|
value = value.value;
|
@@ -6,7 +6,7 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const DataFetcher = require('./DataFetcher-e059eb72.js');
|
8
8
|
const ParamType = require('./ParamType-90b440a0.js');
|
9
|
-
require('./pesquisa-fetcher-
|
9
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
10
10
|
require('./index-1dfc7a6e.js');
|
11
11
|
require('./ISave-e91b70a7.js');
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -9,7 +9,7 @@ const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
|
|
9
9
|
const DataFetcher = require('./DataFetcher-e059eb72.js');
|
10
10
|
const authFetcher = require('./auth-fetcher-4f853233.js');
|
11
11
|
const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
|
12
|
-
const pesquisaFetcher = require('./pesquisa-fetcher-
|
12
|
+
const pesquisaFetcher = require('./pesquisa-fetcher-2ec4811b.js');
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
|
14
14
|
require('./form-config-fetcher-39397ac5.js');
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const DataFetcher = require('./DataFetcher-e059eb72.js');
|
8
|
-
require('./pesquisa-fetcher-
|
8
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
9
9
|
require('./index-1dfc7a6e.js');
|
10
10
|
const ISave = require('./ISave-e91b70a7.js');
|
11
11
|
const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
|
@@ -555,14 +555,18 @@ const buildTaskBarManager = () => {
|
|
555
555
|
];
|
556
556
|
return {
|
557
557
|
getButtons: (_, dataState, currentButtons) => {
|
558
|
-
|
558
|
+
const refreshBtnIndex = currentButtons.indexOf(taskbarElements.TaskbarElement.REFRESH);
|
559
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
|
559
560
|
return currentButtons.reverse();
|
560
|
-
|
561
|
-
|
561
|
+
}
|
562
|
+
else if (refreshBtnIndex !== -1) {
|
563
|
+
currentButtons.splice(refreshBtnIndex, 1);
|
564
|
+
}
|
562
565
|
const { selectedRecord } = dataState || {};
|
563
566
|
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
564
567
|
currentButtons.splice(currentButtons.indexOf(taskbarElements.TaskbarElement.DIVIDER) + 1, 0, taskbarElements.TaskbarElement.REMOVE, taskbarTobeAdded, taskbarElements.TaskbarElement.DIVIDER);
|
565
|
-
const
|
568
|
+
const buttonsToRemove = [taskbarElements.TaskbarElement.CLONE, taskbarElements.TaskbarElement.DATA_EXPORTER];
|
569
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
|
566
570
|
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, taskbarElements.TaskbarElement.DIVIDER);
|
567
571
|
return updatedButtons;
|
568
572
|
},
|
@@ -6,7 +6,7 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
8
8
|
require('./DataFetcher-e059eb72.js');
|
9
|
-
require('./pesquisa-fetcher-
|
9
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
10
10
|
const index$1 = require('./index-1dfc7a6e.js');
|
11
11
|
require('./ISave-e91b70a7.js');
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -9,7 +9,7 @@ const index = require('./index-1dfc7a6e.js');
|
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
10
10
|
const DataFetcher = require('./DataFetcher-e059eb72.js');
|
11
11
|
const snkDataUnit = require('./snk-data-unit-3d9b6ed4.js');
|
12
|
-
require('./pesquisa-fetcher-
|
12
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
13
13
|
require('./ISave-e91b70a7.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
7
7
|
const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
|
8
8
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
9
9
|
require('./DataFetcher-e059eb72.js');
|
10
|
-
require('./pesquisa-fetcher-
|
10
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
11
11
|
const index$1 = require('./index-1dfc7a6e.js');
|
12
12
|
require('./ISave-e91b70a7.js');
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -17,7 +17,7 @@ require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
17
|
require('./form-config-fetcher-39397ac5.js');
|
18
18
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
19
19
|
const constants = require('./constants-35ddd366.js');
|
20
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
20
|
+
const snkGuidesViewer = require('./snk-guides-viewer-dcd05129.js');
|
21
21
|
const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
|
22
22
|
require('./ConfigStorage-f079f5fd.js');
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
@@ -9,10 +9,10 @@ const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
|
|
9
9
|
const index$1 = require('./index-1dfc7a6e.js');
|
10
10
|
const fieldSearch = require('./field-search-68e34bf4.js');
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
12
|
-
const ContinuousInsertUtils = require('./ContinuousInsertUtils-
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-3f27ea94.js');
|
13
13
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
14
14
|
require('./DataFetcher-e059eb72.js');
|
15
|
-
require('./pesquisa-fetcher-
|
15
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
16
16
|
require('./ISave-e91b70a7.js');
|
17
17
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
18
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -8,7 +8,7 @@ const fieldSearch = require('./field-search-68e34bf4.js');
|
|
8
8
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
10
10
|
require('./DataFetcher-e059eb72.js');
|
11
|
-
require('./pesquisa-fetcher-
|
11
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
12
12
|
const index$1 = require('./index-1dfc7a6e.js');
|
13
13
|
require('./ISave-e91b70a7.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-dcd05129.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('./SnkFormConfigManager-63369164.js');
|
@@ -18,7 +18,7 @@ require('./field-search-68e34bf4.js');
|
|
18
18
|
require('./taskbar-elements-9ad1f9c0.js');
|
19
19
|
require('./index-1dfc7a6e.js');
|
20
20
|
require('./index-102ba62d.js');
|
21
|
-
require('./pesquisa-fetcher-
|
21
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
22
22
|
require('./ISave-e91b70a7.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
24
24
|
require('./dataunit-fetcher-228016f4.js');
|
@@ -8,8 +8,8 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const constants = require('./constants-35ddd366.js');
|
9
9
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
10
10
|
require('./DataFetcher-e059eb72.js');
|
11
|
-
require('./pesquisa-fetcher-
|
12
|
-
const ContinuousInsertUtils = require('./ContinuousInsertUtils-
|
11
|
+
require('./pesquisa-fetcher-2ec4811b.js');
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-3f27ea94.js');
|
13
13
|
const index = require('./index-1dfc7a6e.js');
|
14
14
|
require('./ISave-e91b70a7.js');
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -25,14 +25,18 @@ export const buildTaskBarManager = () => {
|
|
25
25
|
];
|
26
26
|
return {
|
27
27
|
getButtons: (_, dataState, currentButtons) => {
|
28
|
-
|
28
|
+
const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
|
29
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
|
29
30
|
return currentButtons.reverse();
|
30
|
-
|
31
|
-
|
31
|
+
}
|
32
|
+
else if (refreshBtnIndex !== -1) {
|
33
|
+
currentButtons.splice(refreshBtnIndex, 1);
|
34
|
+
}
|
32
35
|
const { selectedRecord } = dataState || {};
|
33
36
|
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
34
37
|
currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
|
35
|
-
const
|
38
|
+
const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
|
39
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
|
36
40
|
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
|
37
41
|
return updatedButtons;
|
38
42
|
},
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApplicationContext, DataType } from "@sankhyalabs/core";
|
1
|
+
import { ApplicationContext, DataType, ErrorException } from "@sankhyalabs/core";
|
2
2
|
import { gql } from "graphql-request";
|
3
3
|
import { DataFetcher } from "../DataFetcher";
|
4
4
|
export class PesquisaFetcher {
|
@@ -73,6 +73,9 @@ export class PesquisaFetcher {
|
|
73
73
|
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
74
74
|
}
|
75
75
|
}
|
76
|
+
if (param.dataType === DataType.NUMBER && value === undefined) {
|
77
|
+
throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
|
78
|
+
}
|
76
79
|
let type = param.dataType;
|
77
80
|
if (type === DataType.OBJECT) {
|
78
81
|
value = value.value;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext } from '@sankhyalabs/core';
|
1
|
+
import { DataType, ApplicationContext, ErrorException } from '@sankhyalabs/core';
|
2
2
|
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
3
3
|
|
4
4
|
class PesquisaFetcher {
|
@@ -73,6 +73,9 @@ class PesquisaFetcher {
|
|
73
73
|
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
74
74
|
}
|
75
75
|
}
|
76
|
+
if (param.dataType === DataType.NUMBER && value === undefined) {
|
77
|
+
throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
|
78
|
+
}
|
76
79
|
let type = param.dataType;
|
77
80
|
if (type === DataType.OBJECT) {
|
78
81
|
value = value.value;
|
@@ -557,14 +557,18 @@ const buildTaskBarManager = () => {
|
|
557
557
|
];
|
558
558
|
return {
|
559
559
|
getButtons: (_, dataState, currentButtons) => {
|
560
|
-
|
560
|
+
const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
|
561
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
|
561
562
|
return currentButtons.reverse();
|
562
|
-
|
563
|
-
|
563
|
+
}
|
564
|
+
else if (refreshBtnIndex !== -1) {
|
565
|
+
currentButtons.splice(refreshBtnIndex, 1);
|
566
|
+
}
|
564
567
|
const { selectedRecord } = dataState || {};
|
565
568
|
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
566
569
|
currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
|
567
|
-
const
|
570
|
+
const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
|
571
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
|
568
572
|
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
|
569
573
|
return updatedButtons;
|
570
574
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher-5034df59.js';
|
2
|
-
import './pesquisa-fetcher-
|
2
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
4
4
|
import './index-3aa4977a.js';
|
5
5
|
import './ISave-d8c8bc59.js';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext } from '@sankhyalabs/core';
|
1
|
+
import { DataType, ApplicationContext, ErrorException } from '@sankhyalabs/core';
|
2
2
|
import { d as dist, D as DataFetcher } from './DataFetcher-5034df59.js';
|
3
3
|
|
4
4
|
class PesquisaFetcher {
|
@@ -73,6 +73,9 @@ class PesquisaFetcher {
|
|
73
73
|
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
74
74
|
}
|
75
75
|
}
|
76
|
+
if (param.dataType === DataType.NUMBER && value === undefined) {
|
77
|
+
throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
|
78
|
+
}
|
76
79
|
let type = param.dataType;
|
77
80
|
if (type === DataType.OBJECT) {
|
78
81
|
value = value.value;
|
@@ -2,7 +2,7 @@ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent
|
|
2
2
|
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ServiceUtils, StorageType, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { D as DataFetcher } from './DataFetcher-5034df59.js';
|
4
4
|
import { P as ParamType } from './ParamType-d5152b06.js';
|
5
|
-
import './pesquisa-fetcher-
|
5
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
6
6
|
import './index-3aa4977a.js';
|
7
7
|
import './ISave-d8c8bc59.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -5,7 +5,7 @@ import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
|
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-5034df59.js';
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-ca5d3a49.js';
|
7
7
|
import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-56cb648b.js';
|
8
|
-
import { P as PesquisaFetcher } from './pesquisa-fetcher-
|
8
|
+
import { P as PesquisaFetcher } from './pesquisa-fetcher-24e5bba0.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
|
10
10
|
import './form-config-fetcher-a7d3e277.js';
|
11
11
|
import './filter-item-type.enum-d45e026f.js';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js';
|
2
2
|
import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
|
3
3
|
import { D as DataFetcher } from './DataFetcher-5034df59.js';
|
4
|
-
import './pesquisa-fetcher-
|
4
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
5
5
|
import './index-3aa4977a.js';
|
6
6
|
import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
|
7
7
|
import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-56cb648b.js';
|
@@ -551,14 +551,18 @@ const buildTaskBarManager = () => {
|
|
551
551
|
];
|
552
552
|
return {
|
553
553
|
getButtons: (_, dataState, currentButtons) => {
|
554
|
-
|
554
|
+
const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
|
555
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
|
555
556
|
return currentButtons.reverse();
|
556
|
-
|
557
|
-
|
557
|
+
}
|
558
|
+
else if (refreshBtnIndex !== -1) {
|
559
|
+
currentButtons.splice(refreshBtnIndex, 1);
|
560
|
+
}
|
558
561
|
const { selectedRecord } = dataState || {};
|
559
562
|
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
560
563
|
currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
|
561
|
-
const
|
564
|
+
const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
|
565
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
|
562
566
|
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
|
563
567
|
return updatedButtons;
|
564
568
|
},
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
2
2
|
import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
|
3
3
|
import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
|
4
4
|
import './DataFetcher-5034df59.js';
|
5
|
-
import './pesquisa-fetcher-
|
5
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
6
6
|
import { P as PresentationMode } from './index-3aa4977a.js';
|
7
7
|
import './ISave-d8c8bc59.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -5,7 +5,7 @@ import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat
|
|
5
5
|
import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-7302ee87.js';
|
6
6
|
import { D as DataFetcher } from './DataFetcher-5034df59.js';
|
7
7
|
import { S as SnkDataUnit } from './snk-data-unit-9fa7d2b9.js';
|
8
|
-
import './pesquisa-fetcher-
|
8
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
9
9
|
import './ISave-d8c8bc59.js';
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -3,7 +3,7 @@ import { Action } from '@sankhyalabs/core';
|
|
3
3
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager-b409c745.js';
|
4
4
|
import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
5
|
import './DataFetcher-5034df59.js';
|
6
|
-
import './pesquisa-fetcher-
|
6
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
7
7
|
import { P as PresentationMode } from './index-3aa4977a.js';
|
8
8
|
import './ISave-d8c8bc59.js';
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -13,7 +13,7 @@ import './filter-item-type.enum-d45e026f.js';
|
|
13
13
|
import './form-config-fetcher-a7d3e277.js';
|
14
14
|
import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
|
15
15
|
import { V as VIEW_MODE } from './constants-7302ee87.js';
|
16
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
16
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-0c3efe6a.js';
|
17
17
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-6fff4a4c.js';
|
18
18
|
import './ConfigStorage-6514d66e.js';
|
19
19
|
import './PrintUtils-3e4ff0f5.js';
|
@@ -5,10 +5,10 @@ import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
|
|
5
5
|
import { P as PresentationMode } from './index-3aa4977a.js';
|
6
6
|
import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-f8b1d91e.js';
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils } from './ContinuousInsertUtils-
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils } from './ContinuousInsertUtils-139ff541.js';
|
9
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
10
10
|
import './DataFetcher-5034df59.js';
|
11
|
-
import './pesquisa-fetcher-
|
11
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
12
12
|
import './ISave-d8c8bc59.js';
|
13
13
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
14
14
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -6,7 +6,7 @@ import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } fr
|
|
6
6
|
import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
|
7
7
|
import { V as VIEW_MODE } from './constants-7302ee87.js';
|
8
8
|
import './DataFetcher-5034df59.js';
|
9
|
-
import './pesquisa-fetcher-
|
9
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
10
10
|
import { P as PresentationMode } from './index-3aa4977a.js';
|
11
11
|
import './ISave-d8c8bc59.js';
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-0c3efe6a.js';
|
2
2
|
import './index-a7d3d3f1.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
4
|
import './SnkFormConfigManager-b409c745.js';
|
@@ -14,7 +14,7 @@ import './field-search-f8b1d91e.js';
|
|
14
14
|
import './taskbar-elements-d59867f1.js';
|
15
15
|
import './index-3aa4977a.js';
|
16
16
|
import './index-bdf75557.js';
|
17
|
-
import './pesquisa-fetcher-
|
17
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
18
18
|
import './ISave-d8c8bc59.js';
|
19
19
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
20
20
|
import './dataunit-fetcher-56cb648b.js';
|
@@ -4,8 +4,8 @@ import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7302ee87.js';
|
5
5
|
import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
|
6
6
|
import './DataFetcher-5034df59.js';
|
7
|
-
import './pesquisa-fetcher-
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils } from './ContinuousInsertUtils-
|
7
|
+
import './pesquisa-fetcher-24e5bba0.js';
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils } from './ContinuousInsertUtils-139ff541.js';
|
9
9
|
import { D as DataExporterOption, P as PresentationMode } from './index-3aa4977a.js';
|
10
10
|
import './ISave-d8c8bc59.js';
|
11
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ApplicationContext as o,ObjectUtils as r,UserInterface as n,DataType as l,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as h}from"@sankhyalabs/ezui/dist/collection/utils";import{D as c,a as u,b as p}from"./p-30cf616e.js";import{R as m}from"./p-95ce311a.js";import{D as v}from"./p-00278e07.js";import{S as x}from"./p-342eeb3b.js";import"./p-341465ce.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47d24ac8.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import"./p-8d884fab.js";import"./p-17425c72.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"./p-7dd49d15.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class g{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===c.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===c.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this._selectedNumber>0&&this.setExportAllRecords(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];if(t===c.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===c.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportAllRecords(t,e){var i;const s=[c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS];if(t===c.EXPORT_ALL_RECORDS&&e.push(this.getAllRecords()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS));null==s&&(e.push(this.getAllRecords()),s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS))),(null===(i=s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_ALL_RECORDS_TO_PDF&&s.children.push(this.getExportAllRecordsToPDF()),t===c.EXPORT_ALL_RECORDS_TO_XLS&&s.children.push(this.getExportAllRecordsToXLS())}}setExportByEmail(t,e){t===c.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:c.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:c.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,group:t}}getCurrentPage(){return{id:c.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getAllRecords(){return{id:c.EXPORT_ALL_RECORDS,label:this._getMessage("snkDataExporter.label.allRecords"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:c.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:c.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`}}getExportAllRecordsToPDF(){return{id:c.EXPORT_ALL_RECORDS_TO_PDF,label:"PDF (.pdf)"}}getExportAllRecordsToXLS(){return{id:c.EXPORT_ALL_RECORDS_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:c.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function f(t){const e=[];let i=0;for(const s of t){if(i+=s.width,i>=800)break;e.push(s)}return e}function b(t){return Object.keys(c).find((e=>c[e]===t))}class E{constructor(t){this._provider=t}async getParsedColumns(){return f(await this._provider.getColumnsMetadata())}async getParams(t){var e,i,s,o,r,n,l;const a=null===(i=(e=this._provider).getFilters)||void 0===i?void 0:i.call(e),d=(null===(s=b(null==t?void 0:t.exportOption))||void 0===s?void 0:s.includes("PDF"))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),h=null===(r=(o=this._provider).getOrders)||void 0===r?void 0:r.call(o),u=null===(l=(n=this._provider).getResourceURI)||void 0===l?void 0:l.call(n),p=this._provider.getSelectedIDs(),m=t.exportOption,v=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];delete t.exportOption;let x=Object.assign({filters:a,columns:d,sort:h,resourceURI:u,selectedIDs:p.slice(0,this._provider.getExportLimit())},t);if(v.includes(m)||"page"==t.type){const t=this._provider.getOffset(),e=this._provider.getPageSize();x=Object.assign(Object.assign({},x),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(x=Object.assign(Object.assign({},x),{offset:0,limit:this._provider.getExportLimit(),selectedIDs:[]}));return Promise.resolve(x)}async executeExport(t){const e=await this.getParams(t),{methodName:i}=e,s=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(e,["methodName"]),n=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.${i}`,l={serviceName:n,requestBody:s};return new Promise(((t,e)=>{v.get().callServiceBroker(n,r.objectToString(l)).then((e=>t(this.getFormatResponse(e)))).catch((t=>e(t)))}))}getFormatResponse(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}}class w{constructor(t){this._provider=t}async getParsedColumns(){return f(await this._provider.getColumnsMetadata())}async executeExport(t){var e;const{methodName:i,gridTitle:s}=t,o=await this._provider.getRecords(),r=(null===(e=b(null==t?void 0:t.exportOption))||void 0===e?void 0:e.includes("PDF"))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),[n,l]=this.getExecutor(i),a={serviceName:n,requestBody:{grid:{gridTitle:s,columns:this.buildColumnsObject(r),rows:this.buildRowsObject(r,o),customOptions:{xlsxExtension:!1}}}};return new Promise(((t,e)=>{v.get().callServiceBroker(n,a).then((e=>t(l(e)))).catch((t=>e(t)))}))}getExecutor(t){return"exportToPDF"===t?["GridPDFBuilderSP.buildPDFFromJson",t=>({fileSessionKey:t.chavePDF.valor,canPrint:"S"===t.permiteImprimir.valor,canExport:"S"===t.permiteExportar.valor,canSendEmail:"S"===t.canSendEmail.valor,useAppPrint:!0})]:["GridXLSBuilderSP.buildXLSFromJson",t=>({fileSessionKey:t.chaveXLS.valor,canPrint:!0,canExport:!0,canSendEmail:!0,useAppPrint:!1})]}buildColumnsObject(t){return{column:t.map(((t,e)=>{const{label:i,id:s,width:o,userInterface:r}=t;return Object.assign({index:e+1,id:s,label:i,width:o,presentationType:"P"},D[r]||{type:"S",align:"left"})}))}}buildRowsObject(t,e){return{row:e.map((e=>{const i={};return t.forEach(((t,s)=>i["c"+(s+1)]={$:this.formatValue(e,t)})),i}))}}formatValue(t,e){return null!=this._provider.formatValue?this._provider.formatValue(t,e):t[e.id]||""}}const D={[n.DATE]:{type:"D",align:"center"},[n.DATETIME]:{type:"H",align:"center"},[n.TIME]:{type:"I",align:"right"},[n.ELAPSEDTIME]:{type:"I",align:"right"},[n.DECIMALNUMBER]:{type:"F",align:"right"},[n.INTEGERNUMBER]:{type:"I",align:"right"},[n.SEARCH]:{type:"S",align:"right"}},k=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._releasedToExport=[c.EXPORT_TO_PDF,c.EXPORT_TO_XLS,c.EXPORT_BY_EMAIL,c.EXPORT_PDF_TO_EMAIL,c.EXPORT_XLS_TO_EMAIL,c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS,c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS],this._items=[],this._showDropdown=!1,this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=p[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:p.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,gridTitle:this._appLabel},(()=>{this._snkEmailSender.close(),d.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){null!=this.provider&&null!=t&&null!=e&&this.getExporterStrategy().executeExport(t).then((t=>e(t))).catch((t=>{console.error(t);let{title:e,message:i,statusMessage:s}=t||{};d.error(e||this.getMessage("snkDataExporter.message.exportError"),s||i||this.getMessage("snkDataExporter.message.unknownFailure"))}))}getExporterStrategy(){return null==this.provider.getRecords?new E(this.provider):new w(this.provider)}getOptionKey(t){return Object.keys(c).find((e=>c[e]===t))}getExportType(t){return t===c.EXPORT_ALL_RECORDS_TO_PDF||t===c.EXPORT_ALL_RECORDS_TO_XLS?"all":t===c.EXPORT_PAGE_TO_PDF||t===c.EXPORT_PAGE_TO_XLS?"page":"selection"}async dispatchExporter(t){var e,i,s;const r=this.getOptionKey(t),n=null!==(e=u[r])&&void 0!==e?e:u.EXPORT_TO_PDF,l={methodName:c[`EXPORT_TO_${n}`],fileName:this._appLabel,gridTitle:this._appLabel,exportOption:t,limit:null===(s=null===(i=this.provider)||void 0===i?void 0:i.getExportLimit)||void 0===s?void 0:s.call(i),type:this.getExportType(t)};await this.resolveExporter(l,(t=>{t.canExport||n===u.EXPORT_TO_PDF?function({fileSessionKey:t,isDownload:e}){const i=o.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),d.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:n})):d.error(this.getMessage("snkDataExporter.title.permission"),this.getMessage("snkDataExporter.message.exportPermission"))}))}async processExporter(t){var e,i,s,o,r,n,l;const a=null==t?void 0:t.detail,u=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS],p=null===(e=null==a?void 0:a.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==a?void 0:a.id)===c.EXPORT_CURRENT_PAGE)return;const m=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),v=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),x=null===(r=null===(o=this.provider)||void 0===o?void 0:o.getPageSize)||void 0===r?void 0:r.call(o),g=null===(l=null===(n=this.provider)||void 0===n?void 0:n.getExportLimit)||void 0===l?void 0:l.call(n);let f=!1;if(u.includes(null==a?void 0:a.id)&&x<=g||p?f=!1:(null==m?void 0:m.length)?f=m.length>g:v>g&&(f=!0),f){const t=g.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await d.confirm(e.title,e.description,null,h.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(p)return this.openPersonalizedReports(a.id),void(this._showDropdown=!1);this.getFilteredReleasedToExport().includes(null==a?void 0:a.id)&&(a.id===c.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(a.id),this._showDropdown=!1)}getFilteredReleasedToExport(){var t,e;if(null==this.provider)return this._releasedToExport;const i=null===(e=(t=this.provider).getHiddenOptions)||void 0===e?void 0:e.call(t);return null==i?this._releasedToExport:this._releasedToExport.filter((t=>!i.includes(t)))}loadItems(){const t=[];this.getFilteredReleasedToExport().forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e,i;const s=null===(i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID)||void 0===i?void 0:i.call(e);if(null==s)return void(this._items=t);const n=await function(t){const e=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.getPersonalizedReports`,i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,r.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:s});null==n||n.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e,i;const s=[],o=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(i=null===(e=this.provider)||void 0===e?void 0:e.getSelectedIDs)||void 0===i||i.call(e).forEach((({name:t,type:e,value:i},o)=>{const r={fields:[]};0===o&&(s[`PK_${t}`]={type:this.parseDataType(e),value:i},s.pks=[]);const n={nome:`PK_${t}`,tipo:this.parseDataType(e),valor:i};r.fields.push(n),s.pks.push(r)})),this._application.openApp(`${m}${o}`,s)}parseDataType(t){switch(t){case l.NUMBER:return"I";case l.DATE:return"D";default:return"S"}}loadDropdown(){var t;this._selectedNumber=(null===(t=this.provider)||void 0===t?void 0:t.getSelectedNumber())||0,this._itemBuilder=new g(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=o.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};k.style=".sc-snk-data-exporter-h{display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{k as snk_data_exporter}
|
1
|
+
import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ApplicationContext as o,ObjectUtils as r,UserInterface as n,DataType as l,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as h}from"@sankhyalabs/ezui/dist/collection/utils";import{D as c,a as u,b as p}from"./p-30cf616e.js";import{R as m}from"./p-95ce311a.js";import{D as v}from"./p-00278e07.js";import{S as x}from"./p-342eeb3b.js";import"./p-e6683406.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47d24ac8.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import"./p-8d884fab.js";import"./p-17425c72.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"./p-7dd49d15.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class g{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===c.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===c.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this._selectedNumber>0&&this.setExportAllRecords(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];if(t===c.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===c.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportAllRecords(t,e){var i;const s=[c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS];if(t===c.EXPORT_ALL_RECORDS&&e.push(this.getAllRecords()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS));null==s&&(e.push(this.getAllRecords()),s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS))),(null===(i=s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_ALL_RECORDS_TO_PDF&&s.children.push(this.getExportAllRecordsToPDF()),t===c.EXPORT_ALL_RECORDS_TO_XLS&&s.children.push(this.getExportAllRecordsToXLS())}}setExportByEmail(t,e){t===c.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:c.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:c.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,group:t}}getCurrentPage(){return{id:c.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getAllRecords(){return{id:c.EXPORT_ALL_RECORDS,label:this._getMessage("snkDataExporter.label.allRecords"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:c.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:c.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`}}getExportAllRecordsToPDF(){return{id:c.EXPORT_ALL_RECORDS_TO_PDF,label:"PDF (.pdf)"}}getExportAllRecordsToXLS(){return{id:c.EXPORT_ALL_RECORDS_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:c.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function f(t){const e=[];let i=0;for(const s of t){if(i+=s.width,i>=800)break;e.push(s)}return e}function b(t){return Object.keys(c).find((e=>c[e]===t))}class E{constructor(t){this._provider=t}async getParsedColumns(){return f(await this._provider.getColumnsMetadata())}async getParams(t){var e,i,s,o,r,n,l;const a=null===(i=(e=this._provider).getFilters)||void 0===i?void 0:i.call(e),d=(null===(s=b(null==t?void 0:t.exportOption))||void 0===s?void 0:s.includes("PDF"))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),h=null===(r=(o=this._provider).getOrders)||void 0===r?void 0:r.call(o),u=null===(l=(n=this._provider).getResourceURI)||void 0===l?void 0:l.call(n),p=this._provider.getSelectedIDs(),m=t.exportOption,v=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];delete t.exportOption;let x=Object.assign({filters:a,columns:d,sort:h,resourceURI:u,selectedIDs:p.slice(0,this._provider.getExportLimit())},t);if(v.includes(m)||"page"==t.type){const t=this._provider.getOffset(),e=this._provider.getPageSize();x=Object.assign(Object.assign({},x),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(x=Object.assign(Object.assign({},x),{offset:0,limit:this._provider.getExportLimit(),selectedIDs:[]}));return Promise.resolve(x)}async executeExport(t){const e=await this.getParams(t),{methodName:i}=e,s=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(e,["methodName"]),n=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.${i}`,l={serviceName:n,requestBody:s};return new Promise(((t,e)=>{v.get().callServiceBroker(n,r.objectToString(l)).then((e=>t(this.getFormatResponse(e)))).catch((t=>e(t)))}))}getFormatResponse(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}}class w{constructor(t){this._provider=t}async getParsedColumns(){return f(await this._provider.getColumnsMetadata())}async executeExport(t){var e;const{methodName:i,gridTitle:s}=t,o=await this._provider.getRecords(),r=(null===(e=b(null==t?void 0:t.exportOption))||void 0===e?void 0:e.includes("PDF"))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),[n,l]=this.getExecutor(i),a={serviceName:n,requestBody:{grid:{gridTitle:s,columns:this.buildColumnsObject(r),rows:this.buildRowsObject(r,o),customOptions:{xlsxExtension:!1}}}};return new Promise(((t,e)=>{v.get().callServiceBroker(n,a).then((e=>t(l(e)))).catch((t=>e(t)))}))}getExecutor(t){return"exportToPDF"===t?["GridPDFBuilderSP.buildPDFFromJson",t=>({fileSessionKey:t.chavePDF.valor,canPrint:"S"===t.permiteImprimir.valor,canExport:"S"===t.permiteExportar.valor,canSendEmail:"S"===t.canSendEmail.valor,useAppPrint:!0})]:["GridXLSBuilderSP.buildXLSFromJson",t=>({fileSessionKey:t.chaveXLS.valor,canPrint:!0,canExport:!0,canSendEmail:!0,useAppPrint:!1})]}buildColumnsObject(t){return{column:t.map(((t,e)=>{const{label:i,id:s,width:o,userInterface:r}=t;return Object.assign({index:e+1,id:s,label:i,width:o,presentationType:"P"},D[r]||{type:"S",align:"left"})}))}}buildRowsObject(t,e){return{row:e.map((e=>{const i={};return t.forEach(((t,s)=>i["c"+(s+1)]={$:this.formatValue(e,t)})),i}))}}formatValue(t,e){return null!=this._provider.formatValue?this._provider.formatValue(t,e):t[e.id]||""}}const D={[n.DATE]:{type:"D",align:"center"},[n.DATETIME]:{type:"H",align:"center"},[n.TIME]:{type:"I",align:"right"},[n.ELAPSEDTIME]:{type:"I",align:"right"},[n.DECIMALNUMBER]:{type:"F",align:"right"},[n.INTEGERNUMBER]:{type:"I",align:"right"},[n.SEARCH]:{type:"S",align:"right"}},k=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._releasedToExport=[c.EXPORT_TO_PDF,c.EXPORT_TO_XLS,c.EXPORT_BY_EMAIL,c.EXPORT_PDF_TO_EMAIL,c.EXPORT_XLS_TO_EMAIL,c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS,c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS],this._items=[],this._showDropdown=!1,this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=p[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:p.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,gridTitle:this._appLabel},(()=>{this._snkEmailSender.close(),d.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){null!=this.provider&&null!=t&&null!=e&&this.getExporterStrategy().executeExport(t).then((t=>e(t))).catch((t=>{console.error(t);let{title:e,message:i,statusMessage:s}=t||{};d.error(e||this.getMessage("snkDataExporter.message.exportError"),s||i||this.getMessage("snkDataExporter.message.unknownFailure"))}))}getExporterStrategy(){return null==this.provider.getRecords?new E(this.provider):new w(this.provider)}getOptionKey(t){return Object.keys(c).find((e=>c[e]===t))}getExportType(t){return t===c.EXPORT_ALL_RECORDS_TO_PDF||t===c.EXPORT_ALL_RECORDS_TO_XLS?"all":t===c.EXPORT_PAGE_TO_PDF||t===c.EXPORT_PAGE_TO_XLS?"page":"selection"}async dispatchExporter(t){var e,i,s;const r=this.getOptionKey(t),n=null!==(e=u[r])&&void 0!==e?e:u.EXPORT_TO_PDF,l={methodName:c[`EXPORT_TO_${n}`],fileName:this._appLabel,gridTitle:this._appLabel,exportOption:t,limit:null===(s=null===(i=this.provider)||void 0===i?void 0:i.getExportLimit)||void 0===s?void 0:s.call(i),type:this.getExportType(t)};await this.resolveExporter(l,(t=>{t.canExport||n===u.EXPORT_TO_PDF?function({fileSessionKey:t,isDownload:e}){const i=o.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),d.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:n})):d.error(this.getMessage("snkDataExporter.title.permission"),this.getMessage("snkDataExporter.message.exportPermission"))}))}async processExporter(t){var e,i,s,o,r,n,l;const a=null==t?void 0:t.detail,u=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS],p=null===(e=null==a?void 0:a.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==a?void 0:a.id)===c.EXPORT_CURRENT_PAGE)return;const m=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),v=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),x=null===(r=null===(o=this.provider)||void 0===o?void 0:o.getPageSize)||void 0===r?void 0:r.call(o),g=null===(l=null===(n=this.provider)||void 0===n?void 0:n.getExportLimit)||void 0===l?void 0:l.call(n);let f=!1;if(u.includes(null==a?void 0:a.id)&&x<=g||p?f=!1:(null==m?void 0:m.length)?f=m.length>g:v>g&&(f=!0),f){const t=g.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await d.confirm(e.title,e.description,null,h.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(p)return this.openPersonalizedReports(a.id),void(this._showDropdown=!1);this.getFilteredReleasedToExport().includes(null==a?void 0:a.id)&&(a.id===c.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(a.id),this._showDropdown=!1)}getFilteredReleasedToExport(){var t,e;if(null==this.provider)return this._releasedToExport;const i=null===(e=(t=this.provider).getHiddenOptions)||void 0===e?void 0:e.call(t);return null==i?this._releasedToExport:this._releasedToExport.filter((t=>!i.includes(t)))}loadItems(){const t=[];this.getFilteredReleasedToExport().forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e,i;const s=null===(i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID)||void 0===i?void 0:i.call(e);if(null==s)return void(this._items=t);const n=await function(t){const e=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.getPersonalizedReports`,i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,r.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:s});null==n||n.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e,i;const s=[],o=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(i=null===(e=this.provider)||void 0===e?void 0:e.getSelectedIDs)||void 0===i||i.call(e).forEach((({name:t,type:e,value:i},o)=>{const r={fields:[]};0===o&&(s[`PK_${t}`]={type:this.parseDataType(e),value:i},s.pks=[]);const n={nome:`PK_${t}`,tipo:this.parseDataType(e),valor:i};r.fields.push(n),s.pks.push(r)})),this._application.openApp(`${m}${o}`,s)}parseDataType(t){switch(t){case l.NUMBER:return"I";case l.DATE:return"D";default:return"S"}}loadDropdown(){var t;this._selectedNumber=(null===(t=this.provider)||void 0===t?void 0:t.getSelectedNumber())||0,this._itemBuilder=new g(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=o.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};k.style=".sc-snk-data-exporter-h{display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{k as snk_data_exporter}
|