@sankhyalabs/sankhyablocks 5.4.3 → 5.5.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-26da04f7.js} +35 -1
- package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
- package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
- 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 +449 -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 +22 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-c43df27b.js} +4 -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-field-config.cjs.entry.js +1 -1
- 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 -4
- package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-e6a65393.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
- 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} +47 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +5 -4
- package/dist/cjs/taskbar-elements-80285601.js +313 -0
- package/dist/collection/collection-manifest.json +2 -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-grid/snk-grid.js +11 -3
- 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/message/SnkMessageBuilder.js +5 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -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/utils/constants.js +1 -0
- package/dist/components/SnkMessageBuilder.js +35 -1
- package/dist/components/constants.js +1 -0
- package/dist/components/dataunit-fetcher.js +317 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -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-unit2.js +4 -0
- package/dist/components/snk-grid2.js +11 -4
- 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 +7 -2
- package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-7a9392e6.js} +35 -1
- package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
- package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
- 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 +445 -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 +23 -14
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-f9e4c694.js} +4 -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-field-config.entry.js +1 -1
- 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 +11 -4
- package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-62a9f74d.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -4
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-bar_2.entry.js +324 -0
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +5 -4
- package/dist/esm/taskbar-elements-055ba1ad.js +309 -0
- 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-4512cc6c.entry.js +1 -0
- package/dist/sankhyablocks/p-5cbbe1f7.entry.js +1 -0
- package/dist/sankhyablocks/p-63d01871.entry.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-741b00ef.entry.js +1 -0
- 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-92a0fca4.js +1 -0
- package/dist/sankhyablocks/p-999d1953.entry.js +1 -0
- package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-a412992c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-703dddb9.js → p-aeffd219.js} +1 -1
- package/dist/sankhyablocks/p-b2523981.entry.js +11 -0
- package/dist/sankhyablocks/p-c3efd4eb.entry.js +1 -0
- package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
- package/dist/sankhyablocks/p-ebe876f5.entry.js +1 -0
- package/dist/sankhyablocks/p-ed438690.js +1 -0
- package/dist/sankhyablocks/p-f2223502.js +1 -0
- package/dist/sankhyablocks/p-f3d0c744.entry.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/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-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 +67 -0
- 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/message/resources/snk-attach.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
- package/dist/types/lib/utils/constants.d.ts +2 -1
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-fc7ca86c.js +0 -200
- package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
- package/dist/cjs/taskbar-elements-5e87cf44.js +0 -115
- package/dist/esm/index-e467ade5.js +0 -198
- package/dist/esm/snk-simple-bar.entry.js +0 -26
- package/dist/esm/taskbar-elements-10d80c79.js +0 -112
- package/dist/sankhyablocks/p-1393dc00.entry.js +0 -1
- 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-79f01b63.entry.js +0 -1
- package/dist/sankhyablocks/p-81e85890.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,202 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
3
|
+
import { AttachFetcher } from "../../lib/http/data-fetcher/fetchers/attach-fetcher";
|
4
|
+
import { VIEW_MODE } from "../../lib/utils/constants";
|
5
|
+
import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
|
6
|
+
import { AttachmentDataUnitBuilder, buildTaskBarManager, crudConfig } from "./structure";
|
7
|
+
const RESOURCE_ID = 'AnexoSistema';
|
8
|
+
const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
|
9
|
+
export class SnkAttach {
|
10
|
+
constructor() {
|
11
|
+
this.handleTaskbarClick = ({ detail: taskbar }) => {
|
12
|
+
if (["DOWNLOAD", "LINK"].includes(taskbar))
|
13
|
+
return this.downloadAttachment(this.dataUnit.getSelectedRecord());
|
14
|
+
};
|
15
|
+
this.handleBack = () => {
|
16
|
+
this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
|
17
|
+
if (cancelationConfirmed)
|
18
|
+
this.back.emit();
|
19
|
+
});
|
20
|
+
};
|
21
|
+
this.handleFinish = () => {
|
22
|
+
if (!this.dataUnit.isDirty())
|
23
|
+
return this.back.emit();
|
24
|
+
this.dataUnit.saveData().then(() => {
|
25
|
+
this.showFinishedToast();
|
26
|
+
this.back.emit();
|
27
|
+
});
|
28
|
+
};
|
29
|
+
this.registerKey = undefined;
|
30
|
+
this.entityName = undefined;
|
31
|
+
this.messagesBuilder = undefined;
|
32
|
+
this.dataUnit = undefined;
|
33
|
+
this.crudConfig = {};
|
34
|
+
}
|
35
|
+
registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
36
|
+
var _a;
|
37
|
+
if (oldRegisterKey !== newRegisterKey) {
|
38
|
+
this.returnToGridMode();
|
39
|
+
this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
40
|
+
this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
|
41
|
+
this.dataUnit.loadData();
|
42
|
+
}
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
46
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
47
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
48
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
|
49
|
+
*/
|
50
|
+
getMessage(key, params) {
|
51
|
+
if (this.messagesBuilder)
|
52
|
+
return this.messagesBuilder.getMessage(key, params);
|
53
|
+
}
|
54
|
+
showFinishedToast() {
|
55
|
+
this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
|
56
|
+
}
|
57
|
+
downloadAttachment(selectedRecord) {
|
58
|
+
if (!selectedRecord)
|
59
|
+
throw new Error('Nenhum registro selecionado');
|
60
|
+
if (selectedRecord.LINK) {
|
61
|
+
window.open(`${selectedRecord.LINK}`);
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
|
65
|
+
window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
|
66
|
+
});
|
67
|
+
}
|
68
|
+
returnToGridMode() {
|
69
|
+
this.dataUnit.clearSelection();
|
70
|
+
if (this._crudElement)
|
71
|
+
this._crudElement.goToView(VIEW_MODE.GRID);
|
72
|
+
}
|
73
|
+
loadAttachmentDataUnit() {
|
74
|
+
var _a;
|
75
|
+
try {
|
76
|
+
const dataUnit = this.dataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
77
|
+
this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
78
|
+
if (!dataUnit.metadata)
|
79
|
+
dataUnit.loadMetadata().then(() => {
|
80
|
+
this.crudConfig = crudConfig;
|
81
|
+
});
|
82
|
+
this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
|
83
|
+
dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
|
84
|
+
dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
|
85
|
+
this.dataUnit = dataUnit;
|
86
|
+
this.dataUnit.loadData();
|
87
|
+
return this.dataUnit;
|
88
|
+
}
|
89
|
+
catch (error) {
|
90
|
+
throw new Error('There was an error while creating the data unit');
|
91
|
+
}
|
92
|
+
}
|
93
|
+
componentWillLoad() {
|
94
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
95
|
+
this.loadAttachmentDataUnit();
|
96
|
+
}
|
97
|
+
render() {
|
98
|
+
if (!this.dataUnit)
|
99
|
+
return null;
|
100
|
+
return (h("main", null, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, 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 }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
101
|
+
}
|
102
|
+
static get is() { return "snk-attach"; }
|
103
|
+
static get encapsulation() { return "scoped"; }
|
104
|
+
static get originalStyleUrls() {
|
105
|
+
return {
|
106
|
+
"$": ["snk-attach.css"]
|
107
|
+
};
|
108
|
+
}
|
109
|
+
static get styleUrls() {
|
110
|
+
return {
|
111
|
+
"$": ["snk-attach.css"]
|
112
|
+
};
|
113
|
+
}
|
114
|
+
static get properties() {
|
115
|
+
return {
|
116
|
+
"registerKey": {
|
117
|
+
"type": "string",
|
118
|
+
"mutable": false,
|
119
|
+
"complexType": {
|
120
|
+
"original": "string",
|
121
|
+
"resolved": "string",
|
122
|
+
"references": {}
|
123
|
+
},
|
124
|
+
"required": true,
|
125
|
+
"optional": false,
|
126
|
+
"docs": {
|
127
|
+
"tags": [],
|
128
|
+
"text": "Identifica\u00E7\u00E3o do registro pai."
|
129
|
+
},
|
130
|
+
"attribute": "register-key",
|
131
|
+
"reflect": false
|
132
|
+
},
|
133
|
+
"entityName": {
|
134
|
+
"type": "string",
|
135
|
+
"mutable": false,
|
136
|
+
"complexType": {
|
137
|
+
"original": "string",
|
138
|
+
"resolved": "string",
|
139
|
+
"references": {}
|
140
|
+
},
|
141
|
+
"required": true,
|
142
|
+
"optional": false,
|
143
|
+
"docs": {
|
144
|
+
"tags": [],
|
145
|
+
"text": "Nome da entidade \u00E0 ser utilizada para relacionar o anexo ao DataUnit pai."
|
146
|
+
},
|
147
|
+
"attribute": "entity-name",
|
148
|
+
"reflect": false
|
149
|
+
},
|
150
|
+
"messagesBuilder": {
|
151
|
+
"type": "unknown",
|
152
|
+
"mutable": true,
|
153
|
+
"complexType": {
|
154
|
+
"original": "SnkMessageBuilder",
|
155
|
+
"resolved": "SnkMessageBuilder",
|
156
|
+
"references": {
|
157
|
+
"SnkMessageBuilder": {
|
158
|
+
"location": "import",
|
159
|
+
"path": "../../lib/message/SnkMessageBuilder"
|
160
|
+
}
|
161
|
+
}
|
162
|
+
},
|
163
|
+
"required": false,
|
164
|
+
"optional": false,
|
165
|
+
"docs": {
|
166
|
+
"tags": [],
|
167
|
+
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
168
|
+
}
|
169
|
+
}
|
170
|
+
};
|
171
|
+
}
|
172
|
+
static get states() {
|
173
|
+
return {
|
174
|
+
"dataUnit": {},
|
175
|
+
"crudConfig": {}
|
176
|
+
};
|
177
|
+
}
|
178
|
+
static get events() {
|
179
|
+
return [{
|
180
|
+
"method": "back",
|
181
|
+
"name": "back",
|
182
|
+
"bubbles": true,
|
183
|
+
"cancelable": true,
|
184
|
+
"composed": true,
|
185
|
+
"docs": {
|
186
|
+
"tags": [],
|
187
|
+
"text": "Evento disparado quando o usu\u00E1rio clica no bot\u00E3o voltar."
|
188
|
+
},
|
189
|
+
"complexType": {
|
190
|
+
"original": "void",
|
191
|
+
"resolved": "void",
|
192
|
+
"references": {}
|
193
|
+
}
|
194
|
+
}];
|
195
|
+
}
|
196
|
+
static get watchers() {
|
197
|
+
return [{
|
198
|
+
"propName": "registerKey",
|
199
|
+
"methodName": "registerKeyWatcher"
|
200
|
+
}];
|
201
|
+
}
|
202
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export const crudConfig = {
|
2
|
+
grid: {
|
3
|
+
columns: [
|
4
|
+
{ name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
|
5
|
+
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
6
|
+
{ name: "DHCAD", orderIndex: 2, width: 0 },
|
7
|
+
{ name: "DHALTER", orderIndex: 3, width: 0 },
|
8
|
+
{ name: "TIPOAPRES", orderIndex: 4, width: 0 },
|
9
|
+
{ name: "TIPOACESSO", orderIndex: 5, width: 0 },
|
10
|
+
{ name: "CODUSU", orderIndex: 6, width: 0 },
|
11
|
+
{ name: "CODUSUALT", orderIndex: 7, width: 0 }
|
12
|
+
]
|
13
|
+
},
|
14
|
+
form: {
|
15
|
+
emptyConfig: false,
|
16
|
+
fields: [
|
17
|
+
{
|
18
|
+
name: "DESCRICAO",
|
19
|
+
required: true
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: "TIPOAPRES",
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: "TIPOACESSO",
|
27
|
+
required: true,
|
28
|
+
},
|
29
|
+
{
|
30
|
+
name: "LINK"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
name: "NOMEARQUIVO"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
},
|
37
|
+
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import { Action, ApplicationContext, DataType } from "@sankhyalabs/core";
|
2
|
+
import { SaveErrorsEnum } from "../../../lib/http/data-fetcher/fetchers/fecthAttach/interfaces";
|
3
|
+
import { VIEW_MODE } from "../../../lib/utils/constants";
|
4
|
+
export class AttachmentDataUnitBuilder {
|
5
|
+
constructor(entityName, getMessage) {
|
6
|
+
this.entityName = entityName;
|
7
|
+
this.getMessage = getMessage;
|
8
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
9
|
+
}
|
10
|
+
initLoaders(dataUnit, attachFetcher, onSuccess) {
|
11
|
+
if (!this.loader)
|
12
|
+
this.loader = dataUnit.dataLoader;
|
13
|
+
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
14
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
|
15
|
+
if (recordIds.length)
|
16
|
+
onSuccess();
|
17
|
+
return recordIds;
|
18
|
+
});
|
19
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
|
20
|
+
if (recordIds.length)
|
21
|
+
onSuccess();
|
22
|
+
return recordIds;
|
23
|
+
});
|
24
|
+
}
|
25
|
+
dataLoader(dataUnit, request) {
|
26
|
+
return new Promise(resolve => {
|
27
|
+
this.loader(dataUnit, request).then(response => {
|
28
|
+
const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
|
29
|
+
let fileInfo;
|
30
|
+
if (!record.LINK)
|
31
|
+
fileInfo = [{
|
32
|
+
name: record.NOMEARQUIVO,
|
33
|
+
}];
|
34
|
+
return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
|
35
|
+
});
|
36
|
+
resolve(Object.assign(Object.assign({}, response), { records }));
|
37
|
+
});
|
38
|
+
});
|
39
|
+
}
|
40
|
+
saveLoader(changes, attachFetcher) {
|
41
|
+
return new Promise((resolve) => {
|
42
|
+
var _a;
|
43
|
+
const change = Array.isArray(changes) ? changes[0] : {};
|
44
|
+
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);
|
45
|
+
savePromise(change).then((records) => {
|
46
|
+
resolve(records);
|
47
|
+
}).catch((error) => {
|
48
|
+
if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
49
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
50
|
+
return resolve([]);
|
51
|
+
}
|
52
|
+
if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
53
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
54
|
+
return resolve([]);
|
55
|
+
}
|
56
|
+
if (error.message) {
|
57
|
+
this._application.error((error.title || error.name), error.message);
|
58
|
+
return resolve([]);
|
59
|
+
}
|
60
|
+
resolve([]);
|
61
|
+
});
|
62
|
+
});
|
63
|
+
}
|
64
|
+
removeLoader(dataUnit, ids, attachFetcher) {
|
65
|
+
return new Promise((resolve) => {
|
66
|
+
const { records } = dataUnit.getSelectionInfo();
|
67
|
+
attachFetcher.delete(records[0]).then(() => {
|
68
|
+
resolve(ids);
|
69
|
+
});
|
70
|
+
resolve([]);
|
71
|
+
});
|
72
|
+
}
|
73
|
+
getFilters(registerKey) {
|
74
|
+
return [
|
75
|
+
{
|
76
|
+
name: 'AttachmentsByPK',
|
77
|
+
expression: 'this.PKREGISTRO = :PKREGISTRO',
|
78
|
+
params: [{
|
79
|
+
name: "PKREGISTRO",
|
80
|
+
dataType: DataType.TEXT,
|
81
|
+
value: `${registerKey}_${this.entityName}`
|
82
|
+
}]
|
83
|
+
}
|
84
|
+
];
|
85
|
+
}
|
86
|
+
getInterceptions(dataUnit, action, crudRef) {
|
87
|
+
return new Promise((resolve) => {
|
88
|
+
if (action.type === Action.EDITION_CANCELED) {
|
89
|
+
if (!dataUnit.isDirty())
|
90
|
+
return resolve(action);
|
91
|
+
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
92
|
+
if (cancellationConfirmed) {
|
93
|
+
crudRef.goToView(VIEW_MODE.GRID);
|
94
|
+
return resolve(action);
|
95
|
+
}
|
96
|
+
return resolve(undefined);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
if (action.type === Action.DATA_SAVED) {
|
100
|
+
dataUnit.loadData();
|
101
|
+
return resolve(action);
|
102
|
+
}
|
103
|
+
resolve(action);
|
104
|
+
});
|
105
|
+
}
|
106
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { TaskbarElement } from "../../snk-taskbar/elements/taskbar-elements";
|
2
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
3
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
4
|
+
const getMessage = (key) => {
|
5
|
+
var _a, _b;
|
6
|
+
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);
|
7
|
+
};
|
8
|
+
export const TaskbarAttachButtons = {
|
9
|
+
DOWNLOAD: {
|
10
|
+
hint: getMessage("snkAttach.taskbar.titleDownload"),
|
11
|
+
name: "DOWNLOAD",
|
12
|
+
iconName: 'file-download'
|
13
|
+
},
|
14
|
+
LINK: {
|
15
|
+
hint: getMessage("snkAttach.taskbar.titleLink"),
|
16
|
+
name: "LINK",
|
17
|
+
iconName: "launch"
|
18
|
+
}
|
19
|
+
};
|
20
|
+
export const buildTaskBarManager = () => {
|
21
|
+
const disabledButtonsWithoutSelection = [
|
22
|
+
TaskbarElement.REMOVE,
|
23
|
+
"DOWNLOAD",
|
24
|
+
"LINK"
|
25
|
+
];
|
26
|
+
return {
|
27
|
+
getButtons: (_, dataState, currentButtons) => {
|
28
|
+
if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
|
29
|
+
return currentButtons.reverse();
|
30
|
+
else
|
31
|
+
currentButtons.splice(currentButtons.indexOf(TaskbarElement.REFRESH), 1);
|
32
|
+
const { selectedRecord } = dataState || {};
|
33
|
+
const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
|
34
|
+
currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
|
35
|
+
const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== TaskbarElement.CLONE)));
|
36
|
+
updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
|
37
|
+
return updatedButtons;
|
38
|
+
},
|
39
|
+
isEnabled: (_, dataState, currentButton) => {
|
40
|
+
const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
|
41
|
+
const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
|
42
|
+
if (disabledButton && !hasSelectedRecord)
|
43
|
+
return false;
|
44
|
+
return true;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
};
|
@@ -117,7 +117,7 @@ export class SnkConfigurator {
|
|
117
117
|
"mutable": false,
|
118
118
|
"complexType": {
|
119
119
|
"original": "VIEW_MODE",
|
120
|
-
"resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
|
120
|
+
"resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
|
121
121
|
"references": {
|
122
122
|
"VIEW_MODE": {
|
123
123
|
"location": "import",
|
@@ -176,7 +176,7 @@ export class SnkConfigurator {
|
|
176
176
|
},
|
177
177
|
"complexType": {
|
178
178
|
"original": "VIEW_MODE",
|
179
|
-
"resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
|
179
|
+
"resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
|
180
180
|
"references": {
|
181
181
|
"VIEW_MODE": {
|
182
182
|
"location": "import",
|
@@ -196,7 +196,7 @@ export class SnkConfigurator {
|
|
196
196
|
},
|
197
197
|
"complexType": {
|
198
198
|
"original": "VIEW_MODE",
|
199
|
-
"resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
|
199
|
+
"resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
|
200
200
|
"references": {
|
201
201
|
"VIEW_MODE": {
|
202
202
|
"location": "import",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h } from '@stencil/core';
|
2
|
-
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, ElementIDUtils, VersionUtils } from '@sankhyalabs/core';
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
4
4
|
import { PresentationMode } from '../../lib';
|
5
5
|
import { VIEW_MODE } from '../../lib/utils/constants';
|
@@ -12,6 +12,7 @@ export class SnkCrud {
|
|
12
12
|
constructor() {
|
13
13
|
this._dataUnit = undefined;
|
14
14
|
this._dataState = undefined;
|
15
|
+
this.attachmentRegisterKey = undefined;
|
15
16
|
this._currentViewMode = VIEW_MODE.GRID;
|
16
17
|
this.configName = undefined;
|
17
18
|
this.actionsList = undefined;
|
@@ -33,15 +34,17 @@ export class SnkCrud {
|
|
33
34
|
this.setViewMode(VIEW_MODE.FORM);
|
34
35
|
}
|
35
36
|
async executeAction(act) {
|
36
|
-
if (act === TaskbarElement.GRID_MODE)
|
37
|
-
this.setViewMode(VIEW_MODE.GRID);
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
this.
|
44
|
-
|
37
|
+
if (act === TaskbarElement.GRID_MODE)
|
38
|
+
return this.setViewMode(VIEW_MODE.GRID);
|
39
|
+
if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE)
|
40
|
+
return this.gridToForm(act !== TaskbarElement.UPDATE);
|
41
|
+
if (act === TaskbarElement.CONFIGURATOR)
|
42
|
+
return this._snkConfigurator.open();
|
43
|
+
if (act === "ATTACH")
|
44
|
+
return this.setViewMode(VIEW_MODE.ATTACHMENT);
|
45
|
+
}
|
46
|
+
handleAttachBack() {
|
47
|
+
this.setViewMode(VIEW_MODE.GRID);
|
45
48
|
}
|
46
49
|
setViewMode(viewMode) {
|
47
50
|
this._viewStack.show(viewMode);
|
@@ -104,8 +107,15 @@ export class SnkCrud {
|
|
104
107
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
105
108
|
}
|
106
109
|
}
|
110
|
+
async canRenderAttachment() {
|
111
|
+
var _a, _b, _c, _d, _e;
|
112
|
+
const isValidVersion = VersionUtils.isRequiredVersion((_a = window.envContext) === null || _a === void 0 ? void 0 : _a.sysVersion, '4.22');
|
113
|
+
const recordCriteria = await ((_c = (_b = this._snkDataUnit) === null || _b === void 0 ? void 0 : _b.getSelectedRecordsIDsInfo) === null || _c === void 0 ? void 0 : _c.call(_b));
|
114
|
+
this.attachmentRegisterKey = (_d = recordCriteria.find(criteria => !!criteria.value)) === null || _d === void 0 ? void 0 : _d.value;
|
115
|
+
return isValidVersion && ((_e = this._dataState) === null || _e === void 0 ? void 0 : _e.selectedRecord) !== undefined;
|
116
|
+
}
|
107
117
|
render() {
|
108
|
-
return (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 }, 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" }, h("slot", { name: "SnkFormTaskBar" }))), 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) })));
|
118
|
+
return (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 }, 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" }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, this.canRenderAttachment() && (h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.handleAttachBack.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) })));
|
109
119
|
}
|
110
120
|
static get is() { return "snk-crud"; }
|
111
121
|
static get encapsulation() { return "scoped"; }
|
@@ -288,6 +298,7 @@ export class SnkCrud {
|
|
288
298
|
return {
|
289
299
|
"_dataUnit": {},
|
290
300
|
"_dataState": {},
|
301
|
+
"attachmentRegisterKey": {},
|
291
302
|
"_currentViewMode": {}
|
292
303
|
};
|
293
304
|
}
|
@@ -55,6 +55,7 @@ export class SnkDataUnit {
|
|
55
55
|
this.dataUnit = undefined;
|
56
56
|
this.beforeSave = undefined;
|
57
57
|
this.afterSave = undefined;
|
58
|
+
this.useCancelConfirm = true;
|
58
59
|
}
|
59
60
|
observePageSize() {
|
60
61
|
if (this.dataUnit) {
|
@@ -204,6 +205,8 @@ export class SnkDataUnit {
|
|
204
205
|
}
|
205
206
|
break;
|
206
207
|
case Action.EDITION_CANCELED:
|
208
|
+
if (!this.useCancelConfirm)
|
209
|
+
return resolve(action);
|
207
210
|
if (this.dataState.hasDirtyRecords) {
|
208
211
|
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
209
212
|
if ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) {
|
@@ -563,6 +566,24 @@ export class SnkDataUnit {
|
|
563
566
|
"tags": [],
|
564
567
|
"text": "Executado ap\u00F3s a a\u00E7\u00E3o de salvar."
|
565
568
|
}
|
569
|
+
},
|
570
|
+
"useCancelConfirm": {
|
571
|
+
"type": "boolean",
|
572
|
+
"mutable": false,
|
573
|
+
"complexType": {
|
574
|
+
"original": "boolean",
|
575
|
+
"resolved": "boolean",
|
576
|
+
"references": {}
|
577
|
+
},
|
578
|
+
"required": false,
|
579
|
+
"optional": false,
|
580
|
+
"docs": {
|
581
|
+
"tags": [],
|
582
|
+
"text": "Determina se ser\u00E1 usado mensagem de confirma\u00E7\u00E3o padr\u00E3o na tentativa de cancelar a edi\u00E7\u00E3o."
|
583
|
+
},
|
584
|
+
"attribute": "use-cancel-confirm",
|
585
|
+
"reflect": false,
|
586
|
+
"defaultValue": "true"
|
566
587
|
}
|
567
588
|
};
|
568
589
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { h } from '@stencil/core';
|
2
|
-
import { ApplicationContext, DataType, ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, DataType, ElementIDUtils, VersionUtils } from '@sankhyalabs/core';
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
|
+
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
4
5
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
5
6
|
import { PresentationMode } from '../../lib/@types';
|
6
7
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
@@ -15,7 +16,7 @@ export class SnkGrid {
|
|
15
16
|
});
|
16
17
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
17
18
|
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER"],
|
18
|
-
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH", "DATA_EXPORTER"],
|
19
|
+
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", this.getAttachAvailable(), "REFRESH", "DATA_EXPORTER"],
|
19
20
|
"snkGridHeaderTaskbar.detail.unselected": ["REFRESH"],
|
20
21
|
"snkGridHeaderTaskbar.detail.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
|
21
22
|
});
|
@@ -56,6 +57,13 @@ export class SnkGrid {
|
|
56
57
|
async setConfig(config) {
|
57
58
|
this.setGridConfig(config);
|
58
59
|
}
|
60
|
+
getAttachAvailable() {
|
61
|
+
var _a;
|
62
|
+
const isValidVersion = VersionUtils.isRequiredVersion((_a = window.envContext) === null || _a === void 0 ? void 0 : _a.sysVersion, '4.22');
|
63
|
+
if (isValidVersion)
|
64
|
+
return TaskbarElement.ATTACH;
|
65
|
+
return "";
|
66
|
+
}
|
59
67
|
openGridConfig() {
|
60
68
|
this._grid.getColumnsState()
|
61
69
|
.then((gridColumns) => {
|
@@ -225,7 +233,7 @@ export class SnkGrid {
|
|
225
233
|
const disabledButtons = [];
|
226
234
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
227
235
|
if (this._dataState.selectionInfo.length > 1) {
|
228
|
-
disabledButtons.push(
|
236
|
+
disabledButtons.push(TaskbarElement.CLONE, "ATTACH");
|
229
237
|
}
|
230
238
|
if (this._dataState.selectionInfo.isAllRecords()) {
|
231
239
|
disabledButtons.push("REMOVE");
|
@@ -1,17 +1,32 @@
|
|
1
1
|
import { h } from '@stencil/core';
|
2
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
export class SnkSimpleBar {
|
4
4
|
constructor() {
|
5
5
|
this.label = undefined;
|
6
6
|
this.breadcrumbItens = undefined;
|
7
|
+
this.messagesBuilder = undefined;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
11
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
12
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
13
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-simple-bar.msg.ts"
|
14
|
+
*/
|
15
|
+
getMessage(key, params) {
|
16
|
+
var _a;
|
17
|
+
if (this.messagesBuilder)
|
18
|
+
return this.messagesBuilder.getMessage(key, params);
|
19
|
+
if ((_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder)
|
20
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
7
21
|
}
|
8
22
|
componentDidLoad() {
|
9
23
|
if (!this._element)
|
10
24
|
return;
|
11
25
|
ElementIDUtils.addIDInfo(this._element);
|
26
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
12
27
|
}
|
13
28
|
render() {
|
14
|
-
return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
29
|
+
return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
15
30
|
}
|
16
31
|
static get is() { return "snk-simple-bar"; }
|
17
32
|
static get encapsulation() { return "scoped"; }
|
@@ -66,6 +81,26 @@ export class SnkSimpleBar {
|
|
66
81
|
"tags": [],
|
67
82
|
"text": "Define os itens que ser\u00E3o apresentados pelo breadcrumb"
|
68
83
|
}
|
84
|
+
},
|
85
|
+
"messagesBuilder": {
|
86
|
+
"type": "unknown",
|
87
|
+
"mutable": true,
|
88
|
+
"complexType": {
|
89
|
+
"original": "SnkMessageBuilder",
|
90
|
+
"resolved": "SnkMessageBuilder",
|
91
|
+
"references": {
|
92
|
+
"SnkMessageBuilder": {
|
93
|
+
"location": "import",
|
94
|
+
"path": "../../lib/message/SnkMessageBuilder"
|
95
|
+
}
|
96
|
+
}
|
97
|
+
},
|
98
|
+
"required": false,
|
99
|
+
"optional": false,
|
100
|
+
"docs": {
|
101
|
+
"tags": [],
|
102
|
+
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
103
|
+
}
|
69
104
|
}
|
70
105
|
};
|
71
106
|
}
|