@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-33766.1 → 0.0.0-bugfix-dev-KB-38407.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/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
- package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-bd4c52da.js → pesquisa-fetcher-977c90b1.js} +221 -25
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_2.cjs.entry.js +17 -4
- package/dist/cjs/snk-application.cjs.entry.js +12 -4
- package/dist/cjs/snk-attach.cjs.entry.js +388 -57
- package/dist/cjs/snk-crud.cjs.entry.js +3 -4
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -5
- package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
- package/dist/cjs/{snk-guides-viewer-dce60912.js → snk-guides-viewer-5803fe92.js} +2 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -5
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +43 -0
- package/dist/collection/components/snk-attach/snk-attach.js +188 -39
- package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
- package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
- package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
- package/dist/collection/components/snk-attach/structure/index.js +6 -3
- package/dist/collection/components/snk-crud/snk-crud.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +15 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +16 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +37 -23
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +7 -1
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
- package/dist/components/SnkMessageBuilder.js +13 -0
- package/dist/components/dataunit-fetcher.js +60 -26
- package/dist/components/snk-actions-button2.js +1 -0
- package/dist/components/snk-application2.js +11 -1
- package/dist/components/snk-attach2.js +394 -57
- package/dist/components/snk-crud.js +1 -1
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-filter-item2.js +3 -0
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/taskbar-actions-button2.js +15 -1
- package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
- package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-65714f21.js → pesquisa-fetcher-5e228b5a.js} +221 -26
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_2.entry.js +17 -4
- package/dist/esm/snk-application.entry.js +11 -3
- package/dist/esm/snk-attach.entry.js +389 -58
- package/dist/esm/snk-crud.entry.js +3 -4
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -5
- package/dist/esm/snk-filter-item.entry.js +3 -0
- package/dist/esm/{snk-guides-viewer-8b9564bd.js → snk-guides-viewer-c77e1c8f.js} +2 -3
- package/dist/esm/snk-guides-viewer.entry.js +3 -4
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +2 -3
- package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
- package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
- package/dist/sankhyablocks/p-25c77ddb.js +65 -0
- package/dist/sankhyablocks/p-2dd38000.entry.js +1 -0
- package/dist/sankhyablocks/p-34156b41.entry.js +1 -0
- package/dist/sankhyablocks/p-3efca291.entry.js +1 -0
- package/dist/sankhyablocks/{p-0874adb5.entry.js → p-40915359.entry.js} +1 -1
- package/dist/sankhyablocks/p-59ce706a.entry.js +1 -0
- package/dist/sankhyablocks/{p-c223b7b2.entry.js → p-86164061.entry.js} +3 -3
- package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
- package/dist/sankhyablocks/p-ab568a2e.entry.js +1 -0
- package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
- package/dist/sankhyablocks/p-ce4bca21.js +1 -0
- package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
- package/dist/sankhyablocks/p-f39f48c2.entry.js +1 -0
- package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -0
- package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
- package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +27 -6
- package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
- package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
- package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
- package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +1 -0
- package/dist/types/components.d.ts +42 -2
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +7 -5
- package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
- package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
- package/dist/sankhyablocks/p-28564b5e.entry.js +0 -1
- package/dist/sankhyablocks/p-29804fc5.js +0 -60
- package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
- package/dist/sankhyablocks/p-55930465.entry.js +0 -1
- package/dist/sankhyablocks/p-95a3778f.entry.js +0 -1
- package/dist/sankhyablocks/p-b146a9f0.entry.js +0 -1
- package/dist/sankhyablocks/p-bedb8ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-cdd66657.entry.js +0 -1
- package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
- package/dist/sankhyablocks/p-ebbc17c6.js +0 -1
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
- /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ApplicationContext, DataType, UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
3
|
+
const getMessage = (key) => {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
return (_b = (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
|
|
6
|
+
};
|
|
7
|
+
export const attachCrudConfig = {
|
|
8
|
+
grid: {
|
|
9
|
+
columns: [
|
|
10
|
+
{ name: "CODATA", orderIndex: 0, width: 0 },
|
|
11
|
+
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
|
12
|
+
{ name: "ARQUIVO", orderIndex: 2, width: 0 },
|
|
13
|
+
{ name: "DTALTER", orderIndex: 3, width: 0 },
|
|
14
|
+
{ name: "USUARIO", orderIndex: 4, width: 0 },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
form: {
|
|
18
|
+
emptyConfig: false,
|
|
19
|
+
fields: [
|
|
20
|
+
{
|
|
21
|
+
name: "DESCRICAO",
|
|
22
|
+
label: getMessage("snkAttach.attachMetadata.lblDescription"),
|
|
23
|
+
visible: true,
|
|
24
|
+
readOnly: false,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "CAMINHO_ARQUIVO",
|
|
29
|
+
label: getMessage("snkAttach.attachMetadata.lblFile"),
|
|
30
|
+
visible: true,
|
|
31
|
+
readOnly: false,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const attachFetcherMetadataBuilder = {
|
|
38
|
+
name: "Attach",
|
|
39
|
+
label: "Attach List",
|
|
40
|
+
fields: [
|
|
41
|
+
{ name: "CODATA", label: getMessage("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
|
|
42
|
+
{ name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT },
|
|
43
|
+
{ name: "ARQUIVO", label: getMessage("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
|
|
44
|
+
{ name: "USUARIO", label: getMessage("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
|
|
45
|
+
{ name: "DTALTER", label: getMessage("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
|
|
46
|
+
{
|
|
47
|
+
name: "CAMINHO_ARQUIVO",
|
|
48
|
+
label: getMessage("snkAttach.attachMetadata.lblFileUpload"),
|
|
49
|
+
dataType: DataType.OBJECT,
|
|
50
|
+
userInterface: UserInterface.FILE,
|
|
51
|
+
readOnly: false,
|
|
52
|
+
required: true,
|
|
53
|
+
visible: true,
|
|
54
|
+
properties: {
|
|
55
|
+
subTitle: getMessage("snkAttach.attachMetadata.lblSubTitle"),
|
|
56
|
+
MAX_FILES: 1,
|
|
57
|
+
STORAGESTRATEGY: "SESSION",
|
|
58
|
+
INTERNAL_FILENAME: "Attach.upload",
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskbarElement } from "
|
|
1
|
+
import { TaskbarElement } from "../../../snk-taskbar/elements/taskbar-elements";
|
|
2
2
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
3
3
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
4
4
|
const getMessage = (key) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { Action, ApplicationContext, DataType } from "@sankhyalabs/core";
|
|
2
|
-
import { SaveErrorsEnum } from "
|
|
3
|
-
import { VIEW_MODE } from "
|
|
4
|
-
import PreloadManager from '
|
|
5
|
-
export class
|
|
2
|
+
import { SaveErrorsEnum } from "../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces";
|
|
3
|
+
import { VIEW_MODE } from "../../../../../lib/utils/constants";
|
|
4
|
+
import PreloadManager from '../../../../../lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager';
|
|
5
|
+
export class AnexoSistemaDataUnitFactory {
|
|
6
6
|
constructor(entityName, getMessage) {
|
|
7
7
|
this.entityName = entityName;
|
|
8
8
|
this.getMessage = getMessage;
|
|
9
9
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
10
10
|
}
|
|
11
|
-
initLoaders(dataUnit,
|
|
11
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
|
12
12
|
if (!this.loader)
|
|
13
13
|
this.loader = dataUnit.dataLoader;
|
|
14
14
|
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
|
15
|
-
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes,
|
|
15
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
|
16
16
|
if (recordIds.length)
|
|
17
17
|
onSuccess();
|
|
18
18
|
return recordIds;
|
|
19
19
|
});
|
|
20
|
-
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids,
|
|
20
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
|
21
21
|
if (recordIds.length)
|
|
22
22
|
onSuccess();
|
|
23
23
|
return recordIds;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
metadataLoader(dataUnit) {
|
|
27
|
+
throw new Error("Method not implemented.");
|
|
28
|
+
}
|
|
26
29
|
dataLoader(dataUnit, request) {
|
|
27
30
|
return new Promise(resolve => {
|
|
28
31
|
this.loader(dataUnit, request).then(response => {
|
|
@@ -38,11 +41,11 @@ export class AttachmentDataUnitBuilder {
|
|
|
38
41
|
});
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
|
-
saveLoader(changes,
|
|
44
|
+
saveLoader(changes, fetcher) {
|
|
42
45
|
return new Promise((resolve) => {
|
|
43
46
|
var _a;
|
|
44
47
|
const change = Array.isArray(changes) ? changes[0] : {};
|
|
45
|
-
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ?
|
|
48
|
+
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
|
|
46
49
|
savePromise(change).then((records) => {
|
|
47
50
|
resolve(records);
|
|
48
51
|
}).catch((error) => {
|
|
@@ -62,11 +65,11 @@ export class AttachmentDataUnitBuilder {
|
|
|
62
65
|
});
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
|
-
removeLoader(dataUnit, ids,
|
|
68
|
+
removeLoader(dataUnit, ids, fetcher) {
|
|
66
69
|
return new Promise((resolve) => {
|
|
67
70
|
const { records } = dataUnit.getSelectionInfo();
|
|
68
71
|
const recordToDelete = records[0];
|
|
69
|
-
|
|
72
|
+
fetcher.delete(recordToDelete).then(() => {
|
|
70
73
|
PreloadManager.removeRecords(dataUnit, [recordToDelete]);
|
|
71
74
|
return resolve(ids);
|
|
72
75
|
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Action, ApplicationContext, StringUtils } from "@sankhyalabs/core";
|
|
2
|
+
import { SaveErrorsEnum } from "../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces";
|
|
3
|
+
import { AutorizationType } from "../../../../../lib/http/data-fetcher/fetchers/auth-fetcher";
|
|
4
|
+
import { attachFetcherMetadataBuilder } from "../../builder/attach-crud-config.builder";
|
|
5
|
+
import { VIEW_MODE } from "../../../../../lib/utils/constants";
|
|
6
|
+
const SERVICE_LOAD = "Attach.load";
|
|
7
|
+
export class AttachFetcherDataUnitFactory {
|
|
8
|
+
constructor(getMessage) {
|
|
9
|
+
this.getMessage = getMessage;
|
|
10
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
11
|
+
}
|
|
12
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
|
13
|
+
dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
|
|
14
|
+
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
|
15
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
|
16
|
+
if (recordIds.length)
|
|
17
|
+
onSuccess();
|
|
18
|
+
return recordIds;
|
|
19
|
+
});
|
|
20
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
|
21
|
+
if (recordIds.length)
|
|
22
|
+
onSuccess();
|
|
23
|
+
return recordIds;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
metadataLoader(_) {
|
|
27
|
+
return Promise.resolve(attachFetcherMetadataBuilder);
|
|
28
|
+
}
|
|
29
|
+
async dataLoader(_, request) {
|
|
30
|
+
if (!request.source) {
|
|
31
|
+
return Promise.resolve({ records: [] });
|
|
32
|
+
}
|
|
33
|
+
const criteria = {
|
|
34
|
+
criteria: {
|
|
35
|
+
codata: request.source,
|
|
36
|
+
tipoAnexo: "N"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const applicationDataFetcher = await this._application.getDataFetcher();
|
|
40
|
+
const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
|
|
41
|
+
const records = [];
|
|
42
|
+
anexo.forEach((param) => {
|
|
43
|
+
records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
|
|
44
|
+
name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
|
|
45
|
+
}] }, param));
|
|
46
|
+
});
|
|
47
|
+
return Promise.resolve({ records });
|
|
48
|
+
}
|
|
49
|
+
saveLoader(changes, fetcher) {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
const change = Array.isArray(changes) ? changes[0] : {};
|
|
52
|
+
fetcher.save(change)
|
|
53
|
+
.then(resolve)
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
if (error.message === SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
|
|
56
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
|
|
57
|
+
return resolve([]);
|
|
58
|
+
}
|
|
59
|
+
if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
|
60
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
|
61
|
+
return resolve([]);
|
|
62
|
+
}
|
|
63
|
+
if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
|
64
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
|
65
|
+
return resolve([]);
|
|
66
|
+
}
|
|
67
|
+
if (error.message) {
|
|
68
|
+
this._application.error((error.title || error.name), error.message);
|
|
69
|
+
return resolve([]);
|
|
70
|
+
}
|
|
71
|
+
resolve([]);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
removeLoader(dataUnit, ids, fetcher) {
|
|
76
|
+
return new Promise((resolve) => {
|
|
77
|
+
dataUnit.getSelectionInfo().records.forEach(async (record) => {
|
|
78
|
+
this._application.hasAccess(AutorizationType.REMOVE)
|
|
79
|
+
.then(async (hasAccess) => {
|
|
80
|
+
if (hasAccess) {
|
|
81
|
+
await fetcher.delete(record);
|
|
82
|
+
resolve(ids);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getFilters() {
|
|
89
|
+
throw new Error('Method not implemented.');
|
|
90
|
+
}
|
|
91
|
+
getInterceptions(dataUnit, action, crudRef) {
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
if (action.type === Action.EDITION_CANCELED) {
|
|
94
|
+
if (!dataUnit.isDirty())
|
|
95
|
+
return resolve(action);
|
|
96
|
+
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
|
97
|
+
if (cancellationConfirmed) {
|
|
98
|
+
crudRef.goToView(VIEW_MODE.GRID);
|
|
99
|
+
return resolve(action);
|
|
100
|
+
}
|
|
101
|
+
return resolve(undefined);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (action.type === Action.DATA_SAVED) {
|
|
105
|
+
dataUnit.loadData();
|
|
106
|
+
return resolve(action);
|
|
107
|
+
}
|
|
108
|
+
resolve(action);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './fetcher/facade/fetcher.facade';
|
|
2
|
+
export * from './fetcher/factory/anexo-sistema-data-unit.factory';
|
|
3
|
+
export * from './fetcher/factory/attach-fetcher-data-unit.factory';
|
|
4
|
+
export * from './builder/taskbar-builder';
|
|
5
|
+
export * from './builder/anexo-sistema-crud-config.builder';
|
|
6
|
+
export * from './builder/attach-crud-config.builder';
|
|
@@ -278,7 +278,7 @@ export class SnkCrud {
|
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
281
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
281
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
282
282
|
}
|
|
283
283
|
static get is() { return "snk-crud"; }
|
|
284
284
|
static get encapsulation() { return "scoped"; }
|
|
@@ -239,7 +239,7 @@ export class SnkDataExporter {
|
|
|
239
239
|
pkObject[`PK_${name}`] = { type: this.parseDataType(type), value };
|
|
240
240
|
pkObject['pks'] = [];
|
|
241
241
|
}
|
|
242
|
-
const dataFields = { nome: name, tipo: type, valor: value };
|
|
242
|
+
const dataFields = { nome: name, tipo: this.parseDataType(type), valor: value };
|
|
243
243
|
fields['fields'].push(dataFields);
|
|
244
244
|
pkObject['pks'].push(fields);
|
|
245
245
|
});
|
|
@@ -254,6 +254,9 @@ export class SnkFilterItem {
|
|
|
254
254
|
}
|
|
255
255
|
canClearFilter() {
|
|
256
256
|
const { value, groupedItems = [] } = this.config;
|
|
257
|
+
if (value != undefined && this.config.type === FilterItemType.MULTI_LIST) {
|
|
258
|
+
return value.some((item) => item.check);
|
|
259
|
+
}
|
|
257
260
|
return value !== undefined || groupedItems.some(item => item.visible);
|
|
258
261
|
}
|
|
259
262
|
getRightIconName() {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
--snk-pesquisa--font-family: var(--font-pattern, Arial);
|
|
7
7
|
/*@doc Define o peso da fonte do componente.*/
|
|
8
8
|
--snk-pesquisa--font-weight: var(--text-weight--medium, 400);
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
/* records */
|
|
11
11
|
/*@doc Define a cor da fonte do indicador de registros do componente.*/
|
|
12
12
|
--snk-pesquisa__records--color: var(--text--primary, #626e82);
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
40
40
|
--snk-pesquisa__scrollbar--width: var(--space--medium, 12px);
|
|
41
41
|
|
|
42
|
-
max-height: 100%;
|
|
43
42
|
height: 100%;
|
|
44
43
|
display: flex;
|
|
45
44
|
flex-direction: column;
|
|
@@ -70,7 +69,6 @@
|
|
|
70
69
|
.snk-pesquisa__content {
|
|
71
70
|
display: flex;
|
|
72
71
|
flex-direction: column;
|
|
73
|
-
height: 100%;
|
|
74
72
|
overflow-y: auto;
|
|
75
73
|
scrollbar-width: thin;
|
|
76
74
|
|
|
@@ -148,4 +146,4 @@
|
|
|
148
146
|
.snk-pesquisa__btn:hover {
|
|
149
147
|
/*public*/
|
|
150
148
|
color: var(--snk-pesquisa__btn-hover--color);
|
|
151
|
-
}
|
|
149
|
+
}
|
|
@@ -59,12 +59,26 @@ export class TaskbarActionsButton {
|
|
|
59
59
|
return this._showDropdown && ((_a = this.actions) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
60
60
|
}
|
|
61
61
|
onSelectAction(iAction) {
|
|
62
|
-
const
|
|
62
|
+
const actions = this.actions.map(action => (Object.assign(Object.assign({}, action), { id: action.value })));
|
|
63
|
+
const selectedAction = this.getSelectedAction(iAction.id, actions);
|
|
63
64
|
this.taskbarActionSelected.emit(selectedAction);
|
|
64
65
|
if (!selectedAction.disableCloseOnSelect) {
|
|
65
66
|
this._showDropdown = false;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
getSelectedAction(id, actions) {
|
|
70
|
+
let selectedItem;
|
|
71
|
+
for (const item of actions) {
|
|
72
|
+
if (item.id === id) {
|
|
73
|
+
selectedItem = item;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
if (!(item === null || item === void 0 ? void 0 : item.children))
|
|
77
|
+
continue;
|
|
78
|
+
selectedItem = this.getSelectedAction(id, item.children);
|
|
79
|
+
}
|
|
80
|
+
return selectedItem;
|
|
81
|
+
}
|
|
68
82
|
dropdownItemBuilder(item, _level) {
|
|
69
83
|
const itemAction = this.actions.find(action => action.value === item.id);
|
|
70
84
|
if (!itemAction || !itemAction.itemBuilder) {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { SaveErrorsEnum } from "./interfaces";
|
|
2
|
+
import { DataFetcher } from "../../DataFetcher";
|
|
3
|
+
const SERVICE = {
|
|
4
|
+
save: "AnexoSistemaSP.salvar",
|
|
5
|
+
delete: "AnexoSistemaSP.excluir",
|
|
6
|
+
download: "AnexoSistemaSP.baixar",
|
|
7
|
+
};
|
|
8
|
+
export class AnexoSistemaFetcher {
|
|
4
9
|
constructor(entityName, registerKey, dataUnitName) {
|
|
5
10
|
var _a;
|
|
6
11
|
this.entityName = entityName;
|
|
@@ -18,14 +23,13 @@ export class AttachFetcher {
|
|
|
18
23
|
}
|
|
19
24
|
async save(change) {
|
|
20
25
|
var _a, _b;
|
|
21
|
-
const serviceName = "AnexoSistemaSP.salvar";
|
|
22
26
|
let { updatingFields: fields } = change;
|
|
23
27
|
fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
|
|
24
28
|
try {
|
|
25
29
|
this.validateFields(fields);
|
|
26
30
|
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
|
27
31
|
const reqBody = {
|
|
28
|
-
serviceName,
|
|
32
|
+
serviceName: SERVICE.save,
|
|
29
33
|
requestBody: {
|
|
30
34
|
params: {
|
|
31
35
|
resourceID: this.resourceID,
|
|
@@ -41,7 +45,7 @@ export class AttachFetcher {
|
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
|
-
const result = await DataFetcher.get().callServiceBroker(
|
|
48
|
+
const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
|
45
49
|
return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
|
|
46
50
|
}
|
|
47
51
|
catch (error) {
|
|
@@ -50,7 +54,6 @@ export class AttachFetcher {
|
|
|
50
54
|
}
|
|
51
55
|
async edit(change) {
|
|
52
56
|
var _a, _b, _c;
|
|
53
|
-
const serviceName = "AnexoSistemaSP.salvar";
|
|
54
57
|
let { updatingFields: fields, record } = change;
|
|
55
58
|
const getFieldValue = (fieldValue) => {
|
|
56
59
|
if (fields[fieldValue] !== undefined)
|
|
@@ -64,7 +67,7 @@ export class AttachFetcher {
|
|
|
64
67
|
try {
|
|
65
68
|
this.validateFields(fields);
|
|
66
69
|
const reqBody = {
|
|
67
|
-
serviceName,
|
|
70
|
+
serviceName: SERVICE.save,
|
|
68
71
|
requestBody: {
|
|
69
72
|
params: {
|
|
70
73
|
resourceID: this.resourceID,
|
|
@@ -82,7 +85,7 @@ export class AttachFetcher {
|
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
|
-
const result = await DataFetcher.get().callServiceBroker(
|
|
88
|
+
const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
|
|
86
89
|
return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
|
|
87
90
|
}
|
|
88
91
|
catch (error) {
|
|
@@ -91,10 +94,9 @@ export class AttachFetcher {
|
|
|
91
94
|
}
|
|
92
95
|
delete(record) {
|
|
93
96
|
var _a;
|
|
94
|
-
const serviceName = "AnexoSistemaSP.excluir";
|
|
95
97
|
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
96
98
|
const reqBody = {
|
|
97
|
-
serviceName,
|
|
99
|
+
serviceName: SERVICE.delete,
|
|
98
100
|
requestBody: {
|
|
99
101
|
paramsDelete: {
|
|
100
102
|
keyAttach: record.CHAVEARQUIVO,
|
|
@@ -106,17 +108,16 @@ export class AttachFetcher {
|
|
|
106
108
|
}
|
|
107
109
|
};
|
|
108
110
|
return new Promise((resolve, reject) => {
|
|
109
|
-
DataFetcher.get().callServiceBroker(
|
|
111
|
+
DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
|
|
110
112
|
.then(result => resolve(result))
|
|
111
113
|
.catch(error => reject(error));
|
|
112
114
|
});
|
|
113
115
|
}
|
|
114
116
|
getDownloadKey(record) {
|
|
115
117
|
var _a;
|
|
116
|
-
const serviceName = "AnexoSistemaSP.baixar";
|
|
117
118
|
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
118
119
|
const reqBody = {
|
|
119
|
-
serviceName,
|
|
120
|
+
serviceName: SERVICE.download,
|
|
120
121
|
requestBody: {
|
|
121
122
|
paramsDown: {
|
|
122
123
|
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
|
@@ -128,7 +129,7 @@ export class AttachFetcher {
|
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
return new Promise((resolve, reject) => {
|
|
131
|
-
DataFetcher.get().callServiceBroker(
|
|
132
|
+
DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
|
|
132
133
|
.then(result => resolve(result))
|
|
133
134
|
.catch(error => reject(error));
|
|
134
135
|
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SaveErrorsEnum } from "./interfaces";
|
|
2
|
+
import { DataFetcher } from "../../DataFetcher";
|
|
3
|
+
const SERVICE = {
|
|
4
|
+
save: "Attach.save",
|
|
5
|
+
delete: "Attach.remove",
|
|
6
|
+
view: "Attach.view",
|
|
7
|
+
repository: "RepositorioArquivoSP.abreArquivo"
|
|
8
|
+
};
|
|
9
|
+
export class AttachFetcher {
|
|
10
|
+
constructor(dataUnitName) {
|
|
11
|
+
this.dataUnitName = dataUnitName;
|
|
12
|
+
}
|
|
13
|
+
async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const isInsert = operation == "INSERT";
|
|
16
|
+
const dataBody = isInsert ? fields : record;
|
|
17
|
+
if (!isInsert && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) !== (record === null || record === void 0 ? void 0 : record.DESCRICAO)) {
|
|
18
|
+
throw new Error(SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
|
|
19
|
+
}
|
|
20
|
+
const reqBody = {
|
|
21
|
+
"anexo": {
|
|
22
|
+
"codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
|
|
23
|
+
"sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
|
|
24
|
+
"tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
|
|
25
|
+
"descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
|
|
26
|
+
"arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
|
|
27
|
+
"ehInclusao": isInsert ? "S" : "N",
|
|
28
|
+
"ehArquivoRepositorio": "N"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody))
|
|
33
|
+
.then(result => {
|
|
34
|
+
var _a;
|
|
35
|
+
return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async edit(change) {
|
|
41
|
+
throw new Error("Method not implemented.");
|
|
42
|
+
}
|
|
43
|
+
async delete(record) {
|
|
44
|
+
var request = {
|
|
45
|
+
anexo: {
|
|
46
|
+
codata: record.CODATA,
|
|
47
|
+
tipo: record.TIPO,
|
|
48
|
+
descricao: record.DESCRICAO,
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const result = await DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(request));
|
|
52
|
+
return Promise.resolve(result);
|
|
53
|
+
}
|
|
54
|
+
async getDownloadKey(record) {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
if (record.EHARQUIVOREPOSITORIO == 'S') {
|
|
57
|
+
const request = {
|
|
58
|
+
config: {
|
|
59
|
+
path: record.ARQUIVO,
|
|
60
|
+
tipoconteudo: record.TIPOCONTEUDO
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const result = await DataFetcher.get().callServiceBroker(SERVICE.repository, JSON.stringify(request));
|
|
64
|
+
return Promise.resolve({
|
|
65
|
+
chave: {
|
|
66
|
+
valor: (_b = (_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.chave) === null || _b === void 0 ? void 0 : _b.valor
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const criteria = {
|
|
71
|
+
anexo: {
|
|
72
|
+
codata: record.CODATA,
|
|
73
|
+
codemp: record.CODEMP,
|
|
74
|
+
sequencia: record.SEQUENCIA,
|
|
75
|
+
tipo: record.TIPO,
|
|
76
|
+
descricao: record.DESCRICAO,
|
|
77
|
+
tipoConteudo: record.TIPOCONTEUDO
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const result = await DataFetcher.get().callServiceBroker(SERVICE.view, JSON.stringify(criteria));
|
|
81
|
+
if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
|
|
82
|
+
return Promise.resolve({
|
|
83
|
+
chave: {
|
|
84
|
+
valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return Promise.reject(new Error("File not found."));
|
|
89
|
+
}
|
|
90
|
+
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,4 +3,5 @@ export var SaveErrorsEnum;
|
|
|
3
3
|
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
|
4
4
|
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
|
5
5
|
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
|
6
|
+
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
|
6
7
|
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
|
@@ -171,6 +171,19 @@ export default class DataUnitFetcher {
|
|
|
171
171
|
});
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
addTransientProperties(dataUnit, updatingFields) {
|
|
175
|
+
const loaderProps = dataUnit.getGlobalLoaderProps();
|
|
176
|
+
if (loaderProps == undefined || loaderProps.size === 0) {
|
|
177
|
+
return updatingFields;
|
|
178
|
+
}
|
|
179
|
+
if (updatingFields == undefined) {
|
|
180
|
+
updatingFields = {};
|
|
181
|
+
}
|
|
182
|
+
Array.from(loaderProps.entries()).forEach(([name, value]) => {
|
|
183
|
+
updatingFields[`transient.${name}`] = value;
|
|
184
|
+
});
|
|
185
|
+
return updatingFields;
|
|
186
|
+
}
|
|
174
187
|
saveData(dataUnit, duChanges) {
|
|
175
188
|
const updatedRecordsIds = [];
|
|
176
189
|
const addedRecordsIds = [];
|
|
@@ -179,7 +192,7 @@ export default class DataUnitFetcher {
|
|
|
179
192
|
const dataUnitInstance = DataUnitStorage.get(changeDU);
|
|
180
193
|
let parsedUpdatingFields;
|
|
181
194
|
if (updatingFields) {
|
|
182
|
-
parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
|
195
|
+
parsedUpdatingFields = Object.entries(this.addTransientProperties(dataUnit, updatingFields)).map(([fieldName, value]) => {
|
|
183
196
|
const descriptor = dataUnitInstance.getField(fieldName);
|
|
184
197
|
const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
|
|
185
198
|
return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
|
|
@@ -226,7 +239,8 @@ export default class DataUnitFetcher {
|
|
|
226
239
|
}
|
|
227
240
|
responseRecord.fields.forEach(({ name, value }) => {
|
|
228
241
|
var _a;
|
|
229
|
-
|
|
242
|
+
const valueFromString = (_a = dataUnitInstance === null || dataUnitInstance === void 0 ? void 0 : dataUnitInstance.valueFromString) === null || _a === void 0 ? void 0 : _a.call(dataUnitInstance, name, value);
|
|
243
|
+
duRecord[name] = (valueFromString !== undefined) ? valueFromString : value;
|
|
230
244
|
});
|
|
231
245
|
dataUnitRecords.push(duRecord);
|
|
232
246
|
});
|