@sankhyalabs/sankhyablocks 5.4.3 → 5.6.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/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-e64dce7f.js} +49 -1
- package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
- package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
- package/dist/cjs/index-8d94b7e0.js +7 -0
- package/dist/cjs/{index-fc7ca86c.js → index-de79181a.js} +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +3 -315
- package/dist/cjs/snk-attach.cjs.entry.js +450 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +23 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-85d6565e.js} +4 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
- package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +11 -3
- package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-9784c527.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
- package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
- package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +48 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +6 -4
- package/dist/cjs/{taskbar-elements-5e87cf44.js → taskbar-elements-bc2598f9.js} +4 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
- package/dist/collection/components/snk-attach/snk-attach.css +8 -0
- package/dist/collection/components/snk-attach/snk-attach.js +202 -0
- package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
- package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
- package/dist/collection/components/snk-attach/structure/index.js +3 -0
- package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
- package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
- package/dist/collection/components/snk-crud/snk-crud.js +22 -11
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
- package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
- package/dist/collection/components/snk-grid/snk-grid.js +11 -3
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +7 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
- package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
- package/dist/collection/lib/store/index.js +2 -1
- package/dist/collection/lib/utils/constants.js +1 -0
- package/dist/components/SnkMessageBuilder.js +49 -1
- package/dist/components/constants.js +1 -0
- package/dist/components/dataunit-fetcher.js +317 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index2.js +1 -1
- package/dist/components/index3.js +199 -0
- package/dist/components/snk-application2.js +2 -314
- package/dist/components/snk-attach.d.ts +11 -0
- package/dist/components/snk-attach.js +6 -0
- package/dist/components/snk-attach2.js +498 -0
- package/dist/components/snk-crud.js +77 -48
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-data-unit2.js +4 -0
- package/dist/components/snk-expression-item.d.ts +11 -0
- package/dist/components/snk-expression-item.js +6 -0
- package/dist/components/snk-expression-item2.js +241 -0
- package/dist/components/snk-filter-field-search.js +1 -200
- package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
- package/dist/components/snk-filter-param-config.js +1 -273
- package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
- package/dist/components/snk-grid2.js +12 -4
- package/dist/components/snk-personalized-filter.d.ts +11 -0
- package/dist/components/snk-personalized-filter.js +158 -0
- package/dist/components/snk-simple-bar.js +1 -41
- package/dist/components/snk-simple-bar2.js +59 -0
- package/dist/components/snk-simple-crud.js +1 -328
- package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
- package/dist/components/snk-taskbar2.js +10 -199
- package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-f3590f65.js} +49 -1
- package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
- package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
- package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
- package/dist/esm/index-620ac460.js +7 -0
- package/dist/esm/{index-e467ade5.js → index-8efbf198.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +3 -315
- package/dist/esm/snk-attach.entry.js +446 -0
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +25 -15
- package/dist/esm/snk-data-exporter.entry.js +4 -4
- package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-50b1660c.js} +4 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +6 -6
- package/dist/esm/snk-expression-item.entry.js +209 -0
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-grid-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +13 -5
- package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-4d12f268.js} +3 -3
- package/dist/esm/snk-guides-viewer.entry.js +5 -5
- package/dist/esm/snk-personalized-filter.entry.js +122 -0
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-bar_2.entry.js +325 -0
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +7 -5
- package/dist/esm/{taskbar-elements-10d80c79.js → taskbar-elements-e6af3e93.js} +5 -2
- package/dist/sankhyablocks/p-17375123.js +1 -0
- package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
- package/dist/sankhyablocks/p-1dcfd32a.entry.js +1 -0
- package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
- package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
- package/dist/sankhyablocks/p-3d3263b4.js +1 -0
- package/dist/sankhyablocks/p-3fbe2d69.entry.js +11 -0
- package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
- package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
- package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
- package/dist/sankhyablocks/p-6a02e236.js +1 -0
- package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
- package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
- package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-c4417efb.entry.js} +1 -1
- package/dist/sankhyablocks/p-c9477950.js +1 -0
- package/dist/sankhyablocks/{p-703dddb9.js → p-ccd26e3a.js} +1 -1
- package/dist/sankhyablocks/p-d410f45a.js +1 -0
- package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
- package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
- package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
- package/dist/sankhyablocks/{p-1393dc00.entry.js → p-f344b811.entry.js} +1 -1
- package/dist/sankhyablocks/p-f4184ce7.js +1 -0
- package/dist/sankhyablocks/p-f821768b.js +74 -0
- package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
- package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
- package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
- package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
- package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
- package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
- package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
- package/dist/types/components.d.ts +150 -9
- package/dist/types/global.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
- package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
- package/dist/types/lib/store/index.d.ts +1 -0
- package/dist/types/lib/utils/constants.d.ts +2 -1
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
- package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
- package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
- package/dist/esm/snk-simple-bar.entry.js +0 -26
- package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
- package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
- package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
- package/dist/sankhyablocks/p-74724fa7.js +0 -1
- package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
- package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
- package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
- package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
- package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
- package/dist/sankhyablocks/p-98f7f796.js +0 -1
- package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
- package/dist/sankhyablocks/p-bc281de0.js +0 -1
- package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
- package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
- package/dist/sankhyablocks/p-f587a454.js +0 -1
- package/dist/types/components/snk-application/snk-application.d.ts +0 -259
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
- package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -0,0 +1,450 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-21bd01e1.js');
|
6
|
+
const core = require('@sankhyalabs/core');
|
7
|
+
const DataFetcher = require('./DataFetcher-a9d0228f.js');
|
8
|
+
const constants = require('./constants-3787fa32.js');
|
9
|
+
const dataunitFetcher = require('./dataunit-fetcher-8f5ade55.js');
|
10
|
+
const taskbarElements = require('./taskbar-elements-bc2598f9.js');
|
11
|
+
require('./_commonjsHelpers-537d719a.js');
|
12
|
+
require('./index-f400b1d6.js');
|
13
|
+
require('./index-de79181a.js');
|
14
|
+
|
15
|
+
var SaveErrorsEnum;
|
16
|
+
(function (SaveErrorsEnum) {
|
17
|
+
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
18
|
+
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
19
|
+
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
20
|
+
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
21
|
+
|
22
|
+
class AttachFetcher {
|
23
|
+
constructor(entityName, registerKey, dataUnitName) {
|
24
|
+
var _a;
|
25
|
+
this.entityName = entityName;
|
26
|
+
this.registerKey = registerKey;
|
27
|
+
this.dataUnitName = dataUnitName;
|
28
|
+
this.validateFields = (fields) => {
|
29
|
+
if (!!fields.LINK && !!fields.NOMEARQUIVO)
|
30
|
+
throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
|
31
|
+
if (!fields.LINK && !fields.NOMEARQUIVO)
|
32
|
+
throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
|
33
|
+
if (!this.registerKey)
|
34
|
+
throw new Error('Register key can not be null');
|
35
|
+
};
|
36
|
+
this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
|
37
|
+
}
|
38
|
+
async save(change) {
|
39
|
+
var _a, _b;
|
40
|
+
const serviceName = "AnexoSistemaSP.salvar";
|
41
|
+
let { updatingFields: fields } = change;
|
42
|
+
fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
|
43
|
+
try {
|
44
|
+
this.validateFields(fields);
|
45
|
+
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
46
|
+
const reqBody = {
|
47
|
+
serviceName,
|
48
|
+
requestBody: {
|
49
|
+
params: {
|
50
|
+
resourceID: this.resourceID,
|
51
|
+
description: fields.DESCRICAO,
|
52
|
+
fileSelect: fileInfo ? 1 : 0,
|
53
|
+
keySession: (_b = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _b === void 0 ? void 0 : _b.fileNameTmp,
|
54
|
+
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
55
|
+
link: fields.LINK,
|
56
|
+
nameEntity: this.entityName,
|
57
|
+
pkEntity: this.registerKey,
|
58
|
+
typeAcess: fields.TIPOACESSO,
|
59
|
+
typeApres: fields.TIPOAPRES,
|
60
|
+
}
|
61
|
+
}
|
62
|
+
};
|
63
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
|
64
|
+
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 })]);
|
65
|
+
}
|
66
|
+
catch (error) {
|
67
|
+
return Promise.reject(error);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
async edit(change) {
|
71
|
+
var _a, _b, _c;
|
72
|
+
const serviceName = "AnexoSistemaSP.salvar";
|
73
|
+
let { updatingFields: fields, record } = change;
|
74
|
+
const getFieldValue = (fieldValue) => {
|
75
|
+
if (fields[fieldValue] !== undefined)
|
76
|
+
return fields[fieldValue];
|
77
|
+
return record[fieldValue];
|
78
|
+
};
|
79
|
+
const attachField = getFieldValue('NOMEARQUIVO');
|
80
|
+
const hasNewAttachment = (_b = (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.downloadURL;
|
81
|
+
fields = Object.assign(Object.assign({}, fields), { DESCRICAO: getFieldValue('DESCRICAO'), LINK: getFieldValue('LINK'), TIPOACESSO: getFieldValue('TIPOACESSO'), TIPOAPRES: getFieldValue('TIPOAPRES'), CHAVEARQUIVO: record.CHAVEARQUIVO, NOMEARQUIVO: attachField === null || attachField === void 0 ? void 0 : attachField[0] });
|
82
|
+
const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
|
83
|
+
try {
|
84
|
+
this.validateFields(fields);
|
85
|
+
const reqBody = {
|
86
|
+
serviceName,
|
87
|
+
requestBody: {
|
88
|
+
params: {
|
89
|
+
resourceID: this.resourceID,
|
90
|
+
nuAttach: record === null || record === void 0 ? void 0 : record.NUATTACH,
|
91
|
+
description: fields.DESCRICAO,
|
92
|
+
fileSelect: hasNewAttachment ? 1 : 0,
|
93
|
+
keySession: (_c = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _c === void 0 ? void 0 : _c.fileNameTmp,
|
94
|
+
keyAttach: fields.CHAVEARQUIVO,
|
95
|
+
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
96
|
+
link: fields.LINK,
|
97
|
+
nameEntity: this.entityName,
|
98
|
+
pkEntity: this.registerKey,
|
99
|
+
typeAcess: fields.TIPOACESSO,
|
100
|
+
typeApres: fields.TIPOAPRES,
|
101
|
+
}
|
102
|
+
}
|
103
|
+
};
|
104
|
+
const result = await DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
|
105
|
+
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 })]);
|
106
|
+
}
|
107
|
+
catch (error) {
|
108
|
+
return Promise.reject(error);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
delete(record) {
|
112
|
+
var _a;
|
113
|
+
const serviceName = "AnexoSistemaSP.excluir";
|
114
|
+
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
115
|
+
const reqBody = {
|
116
|
+
serviceName,
|
117
|
+
requestBody: {
|
118
|
+
paramsDelete: {
|
119
|
+
keyAttach: record.CHAVEARQUIVO,
|
120
|
+
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
121
|
+
nameEntity: record.NOMEINSTANCIA,
|
122
|
+
nuAttach: record.NUATTACH,
|
123
|
+
pkEntity: record.PKREGISTRO
|
124
|
+
}
|
125
|
+
}
|
126
|
+
};
|
127
|
+
return new Promise((resolve, reject) => {
|
128
|
+
DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
|
129
|
+
.then(result => resolve(result))
|
130
|
+
.catch(error => reject(error));
|
131
|
+
});
|
132
|
+
}
|
133
|
+
getDownloadKey(record) {
|
134
|
+
var _a;
|
135
|
+
const serviceName = "AnexoSistemaSP.baixar";
|
136
|
+
const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
137
|
+
const reqBody = {
|
138
|
+
serviceName,
|
139
|
+
requestBody: {
|
140
|
+
paramsDown: {
|
141
|
+
nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
|
142
|
+
nameEntity: record.NOMEINSTANCIA,
|
143
|
+
nuAttach: record.NUATTACH,
|
144
|
+
pkEntity: record.PKREGISTRO,
|
145
|
+
keyAttach: record.CHAVEARQUIVO,
|
146
|
+
}
|
147
|
+
}
|
148
|
+
};
|
149
|
+
return new Promise((resolve, reject) => {
|
150
|
+
DataFetcher.DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
|
151
|
+
.then(result => resolve(result))
|
152
|
+
.catch(error => reject(error));
|
153
|
+
});
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
class AttachmentDataUnitBuilder {
|
158
|
+
constructor(entityName, getMessage) {
|
159
|
+
this.entityName = entityName;
|
160
|
+
this.getMessage = getMessage;
|
161
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
162
|
+
}
|
163
|
+
initLoaders(dataUnit, attachFetcher, onSuccess) {
|
164
|
+
if (!this.loader)
|
165
|
+
this.loader = dataUnit.dataLoader;
|
166
|
+
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
167
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
|
168
|
+
if (recordIds.length)
|
169
|
+
onSuccess();
|
170
|
+
return recordIds;
|
171
|
+
});
|
172
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
|
173
|
+
if (recordIds.length)
|
174
|
+
onSuccess();
|
175
|
+
return recordIds;
|
176
|
+
});
|
177
|
+
}
|
178
|
+
dataLoader(dataUnit, request) {
|
179
|
+
return new Promise(resolve => {
|
180
|
+
this.loader(dataUnit, request).then(response => {
|
181
|
+
const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
|
182
|
+
let fileInfo;
|
183
|
+
if (!record.LINK)
|
184
|
+
fileInfo = [{
|
185
|
+
name: record.NOMEARQUIVO,
|
186
|
+
}];
|
187
|
+
return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
|
188
|
+
});
|
189
|
+
resolve(Object.assign(Object.assign({}, response), { records }));
|
190
|
+
});
|
191
|
+
});
|
192
|
+
}
|
193
|
+
saveLoader(changes, attachFetcher) {
|
194
|
+
return new Promise((resolve) => {
|
195
|
+
var _a;
|
196
|
+
const change = Array.isArray(changes) ? changes[0] : {};
|
197
|
+
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? attachFetcher.edit.bind(attachFetcher) : attachFetcher.save.bind(attachFetcher);
|
198
|
+
savePromise(change).then((records) => {
|
199
|
+
resolve(records);
|
200
|
+
}).catch((error) => {
|
201
|
+
if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
202
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
203
|
+
return resolve([]);
|
204
|
+
}
|
205
|
+
if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
206
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
207
|
+
return resolve([]);
|
208
|
+
}
|
209
|
+
if (error.message) {
|
210
|
+
this._application.error((error.title || error.name), error.message);
|
211
|
+
return resolve([]);
|
212
|
+
}
|
213
|
+
resolve([]);
|
214
|
+
});
|
215
|
+
});
|
216
|
+
}
|
217
|
+
removeLoader(dataUnit, ids, attachFetcher) {
|
218
|
+
return new Promise((resolve) => {
|
219
|
+
const { records } = dataUnit.getSelectionInfo();
|
220
|
+
attachFetcher.delete(records[0]).then(() => {
|
221
|
+
resolve(ids);
|
222
|
+
});
|
223
|
+
resolve([]);
|
224
|
+
});
|
225
|
+
}
|
226
|
+
getFilters(registerKey) {
|
227
|
+
return [
|
228
|
+
{
|
229
|
+
name: 'AttachmentsByPK',
|
230
|
+
expression: 'this.PKREGISTRO = :PKREGISTRO',
|
231
|
+
params: [{
|
232
|
+
name: "PKREGISTRO",
|
233
|
+
dataType: core.DataType.TEXT,
|
234
|
+
value: `${registerKey}_${this.entityName}`
|
235
|
+
}]
|
236
|
+
}
|
237
|
+
];
|
238
|
+
}
|
239
|
+
getInterceptions(dataUnit, action, crudRef) {
|
240
|
+
return new Promise((resolve) => {
|
241
|
+
if (action.type === core.Action.EDITION_CANCELED) {
|
242
|
+
if (!dataUnit.isDirty())
|
243
|
+
return resolve(action);
|
244
|
+
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
245
|
+
if (cancellationConfirmed) {
|
246
|
+
crudRef.goToView(constants.VIEW_MODE.GRID);
|
247
|
+
return resolve(action);
|
248
|
+
}
|
249
|
+
return resolve(undefined);
|
250
|
+
});
|
251
|
+
}
|
252
|
+
if (action.type === core.Action.DATA_SAVED) {
|
253
|
+
dataUnit.loadData();
|
254
|
+
return resolve(action);
|
255
|
+
}
|
256
|
+
resolve(action);
|
257
|
+
});
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
262
|
+
const getMessage = (key) => {
|
263
|
+
var _a, _b;
|
264
|
+
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);
|
265
|
+
};
|
266
|
+
const TaskbarAttachButtons = {
|
267
|
+
DOWNLOAD: {
|
268
|
+
hint: getMessage("snkAttach.taskbar.titleDownload"),
|
269
|
+
name: "DOWNLOAD",
|
270
|
+
iconName: 'file-download'
|
271
|
+
},
|
272
|
+
LINK: {
|
273
|
+
hint: getMessage("snkAttach.taskbar.titleLink"),
|
274
|
+
name: "LINK",
|
275
|
+
iconName: "launch"
|
276
|
+
}
|
277
|
+
};
|
278
|
+
const buildTaskBarManager = () => {
|
279
|
+
const disabledButtonsWithoutSelection = [
|
280
|
+
taskbarElements.TaskbarElement.REMOVE,
|
281
|
+
"DOWNLOAD",
|
282
|
+
"LINK"
|
283
|
+
];
|
284
|
+
return {
|
285
|
+
getButtons: (_, dataState, currentButtons) => {
|
286
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
|
287
|
+
return currentButtons.reverse();
|
288
|
+
else
|
289
|
+
currentButtons.splice(currentButtons.indexOf(taskbarElements.TaskbarElement.REFRESH), 1);
|
290
|
+
const { selectedRecord } = dataState || {};
|
291
|
+
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
292
|
+
currentButtons.splice(currentButtons.indexOf(taskbarElements.TaskbarElement.DIVIDER) + 1, 0, taskbarElements.TaskbarElement.REMOVE, taskbarTobeAdded, taskbarElements.TaskbarElement.DIVIDER);
|
293
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== taskbarElements.TaskbarElement.CLONE)));
|
294
|
+
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, taskbarElements.TaskbarElement.DIVIDER);
|
295
|
+
return updatedButtons;
|
296
|
+
},
|
297
|
+
isEnabled: (_, dataState, currentButton) => {
|
298
|
+
const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
|
299
|
+
const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
|
300
|
+
if (disabledButton && !hasSelectedRecord)
|
301
|
+
return false;
|
302
|
+
return true;
|
303
|
+
}
|
304
|
+
};
|
305
|
+
};
|
306
|
+
|
307
|
+
const crudConfig = {
|
308
|
+
grid: {
|
309
|
+
columns: [
|
310
|
+
{ name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
|
311
|
+
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
312
|
+
{ name: "DHCAD", orderIndex: 2, width: 0 },
|
313
|
+
{ name: "DHALTER", orderIndex: 3, width: 0 },
|
314
|
+
{ name: "TIPOAPRES", orderIndex: 4, width: 0 },
|
315
|
+
{ name: "TIPOACESSO", orderIndex: 5, width: 0 },
|
316
|
+
{ name: "CODUSU", orderIndex: 6, width: 0 },
|
317
|
+
{ name: "CODUSUALT", orderIndex: 7, width: 0 }
|
318
|
+
]
|
319
|
+
},
|
320
|
+
form: {
|
321
|
+
emptyConfig: false,
|
322
|
+
fields: [
|
323
|
+
{
|
324
|
+
name: "DESCRICAO",
|
325
|
+
required: true
|
326
|
+
},
|
327
|
+
{
|
328
|
+
name: "TIPOAPRES",
|
329
|
+
required: true,
|
330
|
+
},
|
331
|
+
{
|
332
|
+
name: "TIPOACESSO",
|
333
|
+
required: true,
|
334
|
+
},
|
335
|
+
{
|
336
|
+
name: "LINK"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
name: "NOMEARQUIVO"
|
340
|
+
}
|
341
|
+
]
|
342
|
+
},
|
343
|
+
};
|
344
|
+
|
345
|
+
const snkAttachCss = ".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}";
|
346
|
+
|
347
|
+
const RESOURCE_ID = 'AnexoSistema';
|
348
|
+
const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
|
349
|
+
const SnkAttach = class {
|
350
|
+
constructor(hostRef) {
|
351
|
+
index.registerInstance(this, hostRef);
|
352
|
+
this.back = index.createEvent(this, "back", 7);
|
353
|
+
this.handleTaskbarClick = ({ detail: taskbar }) => {
|
354
|
+
if (["DOWNLOAD", "LINK"].includes(taskbar))
|
355
|
+
return this.downloadAttachment(this.dataUnit.getSelectedRecord());
|
356
|
+
};
|
357
|
+
this.handleBack = () => {
|
358
|
+
this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
|
359
|
+
if (cancelationConfirmed)
|
360
|
+
this.back.emit();
|
361
|
+
});
|
362
|
+
};
|
363
|
+
this.handleFinish = () => {
|
364
|
+
if (!this.dataUnit.isDirty())
|
365
|
+
return this.back.emit();
|
366
|
+
this.dataUnit.saveData().then(() => {
|
367
|
+
this.showFinishedToast();
|
368
|
+
this.back.emit();
|
369
|
+
});
|
370
|
+
};
|
371
|
+
this.registerKey = undefined;
|
372
|
+
this.entityName = undefined;
|
373
|
+
this.messagesBuilder = undefined;
|
374
|
+
this.dataUnit = undefined;
|
375
|
+
this.crudConfig = {};
|
376
|
+
}
|
377
|
+
registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
378
|
+
var _a;
|
379
|
+
if (oldRegisterKey !== newRegisterKey) {
|
380
|
+
this.returnToGridMode();
|
381
|
+
this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
382
|
+
this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
|
383
|
+
this.dataUnit.loadData();
|
384
|
+
}
|
385
|
+
}
|
386
|
+
/**
|
387
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
388
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
389
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
390
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
|
391
|
+
*/
|
392
|
+
getMessage(key, params) {
|
393
|
+
if (this.messagesBuilder)
|
394
|
+
return this.messagesBuilder.getMessage(key, params);
|
395
|
+
}
|
396
|
+
showFinishedToast() {
|
397
|
+
this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
|
398
|
+
}
|
399
|
+
downloadAttachment(selectedRecord) {
|
400
|
+
if (!selectedRecord)
|
401
|
+
throw new Error('Nenhum registro selecionado');
|
402
|
+
if (selectedRecord.LINK) {
|
403
|
+
window.open(`${selectedRecord.LINK}`);
|
404
|
+
return;
|
405
|
+
}
|
406
|
+
this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
|
407
|
+
window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
|
408
|
+
});
|
409
|
+
}
|
410
|
+
returnToGridMode() {
|
411
|
+
this.dataUnit.clearSelection();
|
412
|
+
if (this._crudElement)
|
413
|
+
this._crudElement.goToView(constants.VIEW_MODE.GRID);
|
414
|
+
}
|
415
|
+
loadAttachmentDataUnit() {
|
416
|
+
var _a;
|
417
|
+
try {
|
418
|
+
const dataUnit = this.dataUnit || new dataunitFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
419
|
+
this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
420
|
+
if (!dataUnit.metadata)
|
421
|
+
dataUnit.loadMetadata().then(() => {
|
422
|
+
this.crudConfig = crudConfig;
|
423
|
+
});
|
424
|
+
this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
|
425
|
+
dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
|
426
|
+
dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
|
427
|
+
this.dataUnit = dataUnit;
|
428
|
+
this.dataUnit.loadData();
|
429
|
+
return this.dataUnit;
|
430
|
+
}
|
431
|
+
catch (error) {
|
432
|
+
throw new Error('There was an error while creating the data unit');
|
433
|
+
}
|
434
|
+
}
|
435
|
+
componentWillLoad() {
|
436
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
437
|
+
this.loadAttachmentDataUnit();
|
438
|
+
}
|
439
|
+
render() {
|
440
|
+
if (!this.dataUnit)
|
441
|
+
return null;
|
442
|
+
return (index.h("main", null, index.h("header", { class: "snk-attach__header" }, index.h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, index.h("div", { slot: "rightSlot" }, index.h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), index.h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, index.h("div", { class: "ez-box__container" }, index.h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: this.crudConfig.grid, formConfig: this.crudConfig.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick }, index.h("div", { slot: "snkSimpleCrudHeader" }, index.h("div", { class: "ez-flex ez-flex--column" }, index.h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), index.h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
443
|
+
}
|
444
|
+
static get watchers() { return {
|
445
|
+
"registerKey": ["registerKeyWatcher"]
|
446
|
+
}; }
|
447
|
+
};
|
448
|
+
SnkAttach.style = snkAttachCss;
|
449
|
+
|
450
|
+
exports.snk_attach = SnkAttach;
|
@@ -6,7 +6,7 @@ const index = require('./index-21bd01e1.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
9
|
-
const constants = require('./constants-
|
9
|
+
const constants = require('./constants-3787fa32.js');
|
10
10
|
|
11
11
|
const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
|
12
12
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-21bd01e1.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
8
|
-
const constants = require('./constants-
|
8
|
+
const constants = require('./constants-3787fa32.js');
|
9
9
|
|
10
10
|
const snkConfiguratorCss = ".sc-snk-configurator-h{--snk-configurator__button-close--padding-left:var(--space--medium, 12px);--snk-configurator__title--color:var(--title--primary, #2B3A54);--snk-configurator__title--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__title--font-size:var(--title--large, 20px);--snk-configurator__title--font-weight:var(--text-weight--extra-large, 700);--snk-configurator__subtitle--color:var(--title--primary, #2B3A54);--snk-configurator__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__subtitle--font-size:var(--text--medium, 14px);--snk-configurator__subtitle--font-weight:var(--text-weight--large, 600);--snk-configurator__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-configurator__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-configurator__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-configurator__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-configurator__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-configurator__scrollbar--width:var(--space--medium, 12px)}.snk-configurator.sc-snk-configurator{display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.snk-configurator.sc-snk-configurator{width:359px;max-width:359px}}.snk-configurator__button-config.sc-snk-configurator{--ez-button--min-width:100%}.snk-configurator__header.sc-snk-configurator{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-configurator__title.sc-snk-configurator{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-configurator__title--color);font-size:var(--snk-configurator__title--font-size);font-family:var(--snk-configurator__title--font-family);font-weight:var(--snk-configurator__title--font-weight)}.snk-configurator__subtitle.sc-snk-configurator{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-configurator__subtitle--color);font-size:var(--snk-configurator__subtitle--font-size);font-family:var(--snk-configurator__subtitle--font-family);font-weight:var(--snk-configurator__subtitle--font-weight)}.snk-configurator__button-close.sc-snk-configurator{padding-left:var(--snk-configurator__button-close--padding-left)}.snk-configurator__main.sc-snk-configurator{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-configurator__scrollbar--color-clicked) var(--snk-configurator__scrollbar--color-background)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar{background-color:var(--snk-configurator__scrollbar--color-background);width:var(--snk-configurator__scrollbar--width);max-width:var(--snk-configurator__scrollbar--width);min-width:var(--snk-configurator__scrollbar--width)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-track{background-color:var(--snk-configurator__scrollbar--color-background);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb{background-color:var(--snk-configurator__scrollbar--color-default);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:hover,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-configurator__scrollbar--color-hover)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:vertical:active,.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-configurator__scrollbar--color-clicked)}";
|
11
11
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-21bd01e1.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const taskbarElements = require('./taskbar-elements-
|
7
|
+
const taskbarElements = require('./taskbar-elements-bc2598f9.js');
|
8
8
|
require('./DataFetcher-a9d0228f.js');
|
9
9
|
require('./pesquisa-fetcher-954b74c3.js');
|
10
10
|
const index$1 = require('./index-f400b1d6.js');
|
11
|
-
const constants = require('./constants-
|
12
|
-
require('./index-
|
11
|
+
const constants = require('./constants-3787fa32.js');
|
12
|
+
require('./index-de79181a.js');
|
13
13
|
require('./_commonjsHelpers-537d719a.js');
|
14
14
|
|
15
15
|
const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
@@ -20,6 +20,7 @@ const SnkCrud = class {
|
|
20
20
|
this.actionClick = index.createEvent(this, "actionClick", 7);
|
21
21
|
this._dataUnit = undefined;
|
22
22
|
this._dataState = undefined;
|
23
|
+
this.attachmentRegisterKey = undefined;
|
23
24
|
this._currentViewMode = constants.VIEW_MODE.GRID;
|
24
25
|
this.configName = undefined;
|
25
26
|
this.actionsList = undefined;
|
@@ -41,15 +42,17 @@ const SnkCrud = class {
|
|
41
42
|
this.setViewMode(constants.VIEW_MODE.FORM);
|
42
43
|
}
|
43
44
|
async executeAction(act) {
|
44
|
-
if (act === taskbarElements.TaskbarElement.GRID_MODE)
|
45
|
-
this.setViewMode(constants.VIEW_MODE.GRID);
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
this.
|
52
|
-
|
45
|
+
if (act === taskbarElements.TaskbarElement.GRID_MODE)
|
46
|
+
return this.setViewMode(constants.VIEW_MODE.GRID);
|
47
|
+
if (act === taskbarElements.TaskbarElement.FORM_MODE || act === taskbarElements.TaskbarElement.UPDATE)
|
48
|
+
return this.gridToForm(act !== taskbarElements.TaskbarElement.UPDATE);
|
49
|
+
if (act === taskbarElements.TaskbarElement.CONFIGURATOR)
|
50
|
+
return this._snkConfigurator.open();
|
51
|
+
if (act === "ATTACH")
|
52
|
+
return this.setViewMode(constants.VIEW_MODE.ATTACHMENT);
|
53
|
+
}
|
54
|
+
handleAttachBack() {
|
55
|
+
this.setViewMode(constants.VIEW_MODE.GRID);
|
53
56
|
}
|
54
57
|
setViewMode(viewMode) {
|
55
58
|
this._viewStack.show(viewMode);
|
@@ -112,8 +115,15 @@ const SnkCrud = class {
|
|
112
115
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
113
116
|
}
|
114
117
|
}
|
118
|
+
async canRenderAttachment() {
|
119
|
+
var _a, _b, _c, _d, _e;
|
120
|
+
const isValidVersion = core.VersionUtils.isRequiredVersion((_a = window.envContext) === null || _a === void 0 ? void 0 : _a.sysVersion, '4.22');
|
121
|
+
const recordCriteria = await ((_c = (_b = this._snkDataUnit) === null || _b === void 0 ? void 0 : _b.getSelectedRecordsIDsInfo) === null || _c === void 0 ? void 0 : _c.call(_b));
|
122
|
+
this.attachmentRegisterKey = (_d = recordCriteria.find(criteria => !!criteria.value)) === null || _d === void 0 ? void 0 : _d.value;
|
123
|
+
return isValidVersion && ((_e = this._dataState) === null || _e === void 0 ? void 0 : _e.selectedRecord) !== undefined;
|
124
|
+
}
|
115
125
|
render() {
|
116
|
-
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, index.h("stack-item", null, index.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 }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(constants.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" }, index.h("slot", { name: "SnkFormTaskBar" }))), index.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) })));
|
126
|
+
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, index.h("stack-item", null, index.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 }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(constants.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" }, index.h("slot", { name: "SnkFormTaskBar" }))), index.h("stack-item", null, this.canRenderAttachment() && (index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.handleAttachBack.bind(this) }))), index.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) })));
|
117
127
|
}
|
118
128
|
get _element() { return index.getElement(this); }
|
119
129
|
};
|
@@ -6,11 +6,11 @@ const index$1 = require('./index-21bd01e1.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
8
8
|
const index = require('./index-f400b1d6.js');
|
9
|
-
const constants = require('./constants-
|
9
|
+
const constants = require('./constants-3787fa32.js');
|
10
10
|
const DataFetcher = require('./DataFetcher-a9d0228f.js');
|
11
|
-
const snkDataUnit = require('./snk-data-unit-
|
11
|
+
const snkDataUnit = require('./snk-data-unit-85d6565e.js');
|
12
12
|
require('./_commonjsHelpers-537d719a.js');
|
13
|
-
require('./SnkMessageBuilder-
|
13
|
+
require('./SnkMessageBuilder-e64dce7f.js');
|
14
14
|
|
15
15
|
class ItemBuilder {
|
16
16
|
constructor(getMessage, selectedNumber) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
const index = require('./index-21bd01e1.js');
|
4
4
|
const core = require('@sankhyalabs/core');
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
6
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-e64dce7f.js');
|
7
7
|
|
8
8
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
9
9
|
|
@@ -66,6 +66,7 @@ const SnkDataUnit = class {
|
|
66
66
|
this.dataUnit = undefined;
|
67
67
|
this.beforeSave = undefined;
|
68
68
|
this.afterSave = undefined;
|
69
|
+
this.useCancelConfirm = true;
|
69
70
|
}
|
70
71
|
observePageSize() {
|
71
72
|
if (this.dataUnit) {
|
@@ -214,6 +215,8 @@ const SnkDataUnit = class {
|
|
214
215
|
}
|
215
216
|
break;
|
216
217
|
case core.Action.EDITION_CANCELED:
|
218
|
+
if (!this.useCancelConfirm)
|
219
|
+
return resolve(action);
|
217
220
|
if (this.dataState.hasDirtyRecords) {
|
218
221
|
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
219
222
|
if ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) {
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
5
|
+
const snkDataUnit = require('./snk-data-unit-85d6565e.js');
|
6
6
|
require('./index-21bd01e1.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
9
|
-
require('./SnkMessageBuilder-
|
9
|
+
require('./SnkMessageBuilder-e64dce7f.js');
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -9,14 +9,14 @@ require('./DataFetcher-a9d0228f.js');
|
|
9
9
|
require('./pesquisa-fetcher-954b74c3.js');
|
10
10
|
require('@sankhyalabs/core');
|
11
11
|
const index$1 = require('./index-f400b1d6.js');
|
12
|
-
const taskbarElements = require('./taskbar-elements-
|
13
|
-
const constants = require('./constants-
|
14
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
15
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
12
|
+
const taskbarElements = require('./taskbar-elements-bc2598f9.js');
|
13
|
+
const constants = require('./constants-3787fa32.js');
|
14
|
+
const snkGuidesViewer = require('./snk-guides-viewer-9784c527.js');
|
15
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-e64dce7f.js');
|
16
16
|
require('./ConfigStorage-91adf3fe.js');
|
17
17
|
require('./form-config-fetcher-fa19680a.js');
|
18
18
|
require('./_commonjsHelpers-537d719a.js');
|
19
|
-
require('./index-
|
19
|
+
require('./index-de79181a.js');
|
20
20
|
require('./taskbar-processor-bce3f499.js');
|
21
21
|
|
22
22
|
class GuideBuilder {
|