@sankhyalabs/sankhyablocks 5.1.3 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-47185d5d.js → SnkMessageBuilder-c6bd8bc7.js} +9 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-config-options.cjs.entry.js +2 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +3 -2
- package/dist/cjs/snk-crud.cjs.entry.js +10 -3
- package/dist/cjs/snk-data-exporter.cjs.entry.js +10 -1
- package/dist/cjs/snk-data-unit-3b6ab2ad.js +436 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +6 -411
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -2
- package/dist/cjs/snk-field-config.cjs.entry.js +2 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -1
- package/dist/cjs/snk-filter-param-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +6 -5
- package/dist/cjs/snk-form.cjs.entry.js +2 -1
- package/dist/cjs/snk-grid.cjs.entry.js +6 -4
- package/dist/cjs/{snk-guides-viewer-6225bb73.js → snk-guides-viewer-8a6743d6.js} +8 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -1
- package/dist/collection/components/snk-application/snk-application.js +2 -2
- package/dist/collection/components/snk-configurator/snk-configurator.js +23 -2
- package/dist/collection/components/snk-crud/snk-crud.js +30 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view.js +27 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +29 -6
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +29 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +64 -3
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +23 -1
- package/dist/collection/components/snk-form/snk-form.js +22 -1
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +22 -1
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +23 -5
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +26 -5
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +22 -1
- package/dist/collection/components/snk-grid/snk-grid.js +26 -4
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +26 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +22 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +23 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +9 -2
- package/dist/components/SnkMessageBuilder.js +9 -2
- package/dist/components/snk-application2.js +1 -1
- package/dist/components/snk-config-options2.js +3 -1
- package/dist/components/snk-configurator2.js +4 -2
- package/dist/components/snk-crud.js +11 -3
- package/dist/components/snk-data-exporter2.js +10 -1
- package/dist/components/snk-data-unit2.js +25 -4
- package/dist/components/snk-detail-view2.js +17 -7
- package/dist/components/snk-field-config2.js +5 -6
- package/dist/components/snk-filter-bar2.js +4 -1
- package/dist/components/snk-filter-param-config.js +3 -1
- package/dist/components/snk-form-config2.js +7 -5
- package/dist/components/snk-form.js +3 -1
- package/dist/components/snk-grid2.js +7 -4
- package/dist/components/snk-simple-crud.js +3 -1
- package/dist/components/snk-tab-config2.js +3 -1
- package/dist/components/snk-taskbar2.js +4 -1
- package/dist/esm/{SnkMessageBuilder-ec0850af.js → SnkMessageBuilder-68bbf0ae.js} +9 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-config-options.entry.js +2 -1
- package/dist/esm/snk-configurator.entry.js +3 -2
- package/dist/esm/snk-crud.entry.js +10 -3
- package/dist/esm/snk-data-exporter.entry.js +10 -1
- package/dist/esm/snk-data-unit-a8093f95.js +434 -0
- package/dist/esm/snk-data-unit.entry.js +5 -414
- package/dist/esm/snk-detail-view.entry.js +7 -2
- package/dist/esm/snk-field-config.entry.js +3 -5
- package/dist/esm/snk-filter-bar.entry.js +3 -1
- package/dist/esm/snk-filter-param-config.entry.js +2 -1
- package/dist/esm/snk-form-config.entry.js +6 -5
- package/dist/esm/snk-form.entry.js +2 -1
- package/dist/esm/snk-grid.entry.js +6 -4
- package/dist/esm/{snk-guides-viewer-73b9eb29.js → snk-guides-viewer-d8654e2a.js} +9 -6
- package/dist/esm/snk-guides-viewer.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +2 -1
- package/dist/esm/snk-tab-config.entry.js +2 -1
- package/dist/esm/snk-taskbar.entry.js +3 -1
- package/dist/sankhyablocks/p-046b2563.entry.js +1 -0
- package/dist/sankhyablocks/p-0a1e7f75.entry.js +1 -0
- package/dist/sankhyablocks/{p-28c800b9.js → p-0d70c017.js} +1 -1
- package/dist/sankhyablocks/p-1a16426f.js +1 -0
- package/dist/sankhyablocks/{p-9ce550b7.entry.js → p-21a6c546.entry.js} +1 -1
- package/dist/sankhyablocks/p-280b1321.entry.js +1 -0
- package/dist/sankhyablocks/p-32599159.entry.js +1 -0
- package/dist/sankhyablocks/p-5b84b0c5.entry.js +1 -0
- package/dist/sankhyablocks/p-601e6920.entry.js +1 -0
- package/dist/sankhyablocks/p-69af76d4.entry.js +1 -0
- package/dist/sankhyablocks/p-76f04efe.entry.js +1 -0
- package/dist/sankhyablocks/p-93d8fe00.entry.js +1 -0
- package/dist/sankhyablocks/p-a12d74dc.entry.js +1 -0
- package/dist/sankhyablocks/p-a7468f4b.js +1 -0
- package/dist/sankhyablocks/p-a80c766c.entry.js +1 -0
- package/dist/sankhyablocks/p-b686e91a.entry.js +1 -0
- package/dist/sankhyablocks/p-b80cf644.entry.js +1 -0
- package/dist/sankhyablocks/p-d65809d5.entry.js +1 -0
- package/dist/sankhyablocks/{p-b9fe5ed3.entry.js → p-e999631f.entry.js} +2 -2
- package/dist/sankhyablocks/p-f29caa0a.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -4
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +5 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view.d.ts +2 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -1
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +13 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form/snk-form.d.ts +5 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +5 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +5 -2
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +5 -0
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +5 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +5 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +5 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +5 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +5 -0
- package/dist/types/components.d.ts +126 -12
- package/dist/types/lib/message/SnkMessageBuilder.d.ts +4 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0154ae58.entry.js +0 -1
- package/dist/sankhyablocks/p-10be1b2a.entry.js +0 -1
- package/dist/sankhyablocks/p-12d2dccf.entry.js +0 -1
- package/dist/sankhyablocks/p-193b0fa5.entry.js +0 -1
- package/dist/sankhyablocks/p-31d4e5d4.entry.js +0 -1
- package/dist/sankhyablocks/p-68507ace.entry.js +0 -1
- package/dist/sankhyablocks/p-72277163.entry.js +0 -1
- package/dist/sankhyablocks/p-7d4bb27a.entry.js +0 -1
- package/dist/sankhyablocks/p-94fef424.entry.js +0 -1
- package/dist/sankhyablocks/p-983fef8f.js +0 -1
- package/dist/sankhyablocks/p-af8cf505.entry.js +0 -1
- package/dist/sankhyablocks/p-c88c4f80.entry.js +0 -1
- package/dist/sankhyablocks/p-dd90bd52.entry.js +0 -1
- package/dist/sankhyablocks/p-eb7b2496.entry.js +0 -1
- package/dist/sankhyablocks/p-ecd3cad5.entry.js +0 -1
- package/dist/sankhyablocks/p-f9ca6d74.entry.js +0 -1
@@ -2,417 +2,12 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
const snkDataUnit = require('./snk-data-unit-3b6ab2ad.js');
|
6
|
+
require('./index-21bd01e1.js');
|
7
|
+
require('@sankhyalabs/core');
|
8
|
+
require('@sankhyalabs/ezui/dist/collection/utils');
|
9
|
+
require('./SnkMessageBuilder-c6bd8bc7.js');
|
9
10
|
|
10
|
-
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
11
11
|
|
12
|
-
const SnkDataUnit = class {
|
13
|
-
constructor(hostRef) {
|
14
|
-
index.registerInstance(this, hostRef);
|
15
|
-
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
16
|
-
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
17
|
-
this.insertionMode = index.createEvent(this, "insertionMode", 3);
|
18
|
-
this.cancelEdition = index.createEvent(this, "cancelEdition", 3);
|
19
|
-
this._onDataUnitResolve = [];
|
20
|
-
this._dataUnitObserver = (action) => {
|
21
|
-
var _a, _b;
|
22
|
-
const duState = this.buildDataState();
|
23
|
-
this.dataState = duState;
|
24
|
-
if (action.type === core.Action.DATA_SAVED) {
|
25
|
-
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
|
26
|
-
if (msg != undefined) {
|
27
|
-
this.showSuccessMessage(msg);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
|
31
|
-
this.insertionMode.emit();
|
32
|
-
}
|
33
|
-
if (action.type === core.Action.EDITION_CANCELED) {
|
34
|
-
this.cancelEdition.emit();
|
35
|
-
}
|
36
|
-
if (action.type === core.Action.RECORDS_REMOVED) {
|
37
|
-
const cachedRecords = action.payload.cachedRecords;
|
38
|
-
let removeFinishMsg;
|
39
|
-
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
40
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
41
|
-
}
|
42
|
-
else {
|
43
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
44
|
-
}
|
45
|
-
if (removeFinishMsg != undefined) {
|
46
|
-
this.showSuccessMessage(removeFinishMsg);
|
47
|
-
}
|
48
|
-
const recordsCount = (_b = (_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
49
|
-
const paginationInfo = this.dataUnit.getPaginationInfo();
|
50
|
-
if (paginationInfo) {
|
51
|
-
if (recordsCount > 0 || paginationInfo.hasMore) {
|
52
|
-
this.dataUnit.gotoPage(paginationInfo.currentPage);
|
53
|
-
}
|
54
|
-
else {
|
55
|
-
this.dataUnit.gotoPage(0);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}
|
59
|
-
this._application.messagesBuilder.currentOperation = this.getMessageOperation();
|
60
|
-
};
|
61
|
-
this.dataState = undefined;
|
62
|
-
this.dataUnitName = undefined;
|
63
|
-
this.entityName = undefined;
|
64
|
-
this.pageSize = 150;
|
65
|
-
this.dataUnit = undefined;
|
66
|
-
this.beforeSave = undefined;
|
67
|
-
this.afterSave = undefined;
|
68
|
-
}
|
69
|
-
observePageSize() {
|
70
|
-
if (this.dataUnit) {
|
71
|
-
this.dataUnit.pageSize = this.pageSize;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
observeDataUnitName(newValue, oldValue) {
|
75
|
-
if (oldValue != newValue) {
|
76
|
-
if (this.dataUnit) {
|
77
|
-
this._application.updateDataunitCache(oldValue, this.dataUnitName, this.dataUnit);
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
this.loadDataUnit();
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
observeEntityName(newValue, oldValue) {
|
85
|
-
if (oldValue != newValue) {
|
86
|
-
this.dataUnit = undefined;
|
87
|
-
this.entityName = newValue;
|
88
|
-
this.loadDataUnit();
|
89
|
-
}
|
90
|
-
}
|
91
|
-
observeDataState(newValue, oldValue) {
|
92
|
-
if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
|
93
|
-
this.dataStateChange.emit(newValue);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
observeDataUnit() {
|
97
|
-
this.handlerLinkFields();
|
98
|
-
this.dataUnitReady.emit(this.dataUnit);
|
99
|
-
}
|
100
|
-
/**
|
101
|
-
* Obtém o dataUnit.
|
102
|
-
*/
|
103
|
-
async getDataUnit() {
|
104
|
-
return new Promise((resolve) => {
|
105
|
-
if (this.dataUnit) {
|
106
|
-
resolve(this.dataUnit);
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
this._onDataUnitResolve.push(resolve);
|
110
|
-
}
|
111
|
-
});
|
112
|
-
}
|
113
|
-
/**
|
114
|
-
* Método que retorna a lista de IDs dos registros selecionados.
|
115
|
-
* @returns Retorna a lista de IDs dos registros selecionados.
|
116
|
-
*/
|
117
|
-
async getSelectedRecordsIDsInfo() {
|
118
|
-
var _a;
|
119
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
120
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
121
|
-
return [];
|
122
|
-
}
|
123
|
-
const selectedRecordsIDsInfo = [];
|
124
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
125
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
126
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
127
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
128
|
-
/*
|
129
|
-
Esse if foi necessário para tratar corretamente o ID
|
130
|
-
do record quando está sendo utilizado no modo standAlone
|
131
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
132
|
-
mas deixa de causar erro nas oprações de CRUD.
|
133
|
-
*/
|
134
|
-
if (!core.JSUtils.isBase64(__record__id__)) {
|
135
|
-
selectedRecordsIDsInfo.push({
|
136
|
-
name: "__record__id__",
|
137
|
-
type: core.DataType.TEXT,
|
138
|
-
value: __record__id__
|
139
|
-
});
|
140
|
-
return;
|
141
|
-
}
|
142
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
143
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
144
|
-
var _a;
|
145
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
146
|
-
if (metadataField == undefined) {
|
147
|
-
return;
|
148
|
-
}
|
149
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
150
|
-
});
|
151
|
-
}
|
152
|
-
});
|
153
|
-
}
|
154
|
-
return selectedRecordsIDsInfo;
|
155
|
-
}
|
156
|
-
async interceptAction(action) {
|
157
|
-
return new Promise(resolve => {
|
158
|
-
var _a, _b;
|
159
|
-
switch (action.type) {
|
160
|
-
case core.Action.RECORDS_ADDED:
|
161
|
-
if (this.isAllowed("INSERT")) {
|
162
|
-
resolve(action);
|
163
|
-
}
|
164
|
-
else {
|
165
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
166
|
-
}
|
167
|
-
break;
|
168
|
-
case core.Action.RECORDS_COPIED:
|
169
|
-
if (this.isAllowed("CLONE")) {
|
170
|
-
resolve(action);
|
171
|
-
}
|
172
|
-
else {
|
173
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
174
|
-
}
|
175
|
-
break;
|
176
|
-
case core.Action.DATA_CHANGED:
|
177
|
-
case core.Action.CHANGING_DATA:
|
178
|
-
if (this.isAllowed("UPDATE")) {
|
179
|
-
resolve(action);
|
180
|
-
}
|
181
|
-
else {
|
182
|
-
this.dataUnit.cancelEdition();
|
183
|
-
utils.ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate"));
|
184
|
-
}
|
185
|
-
break;
|
186
|
-
case core.Action.SAVING_DATA:
|
187
|
-
if (this.beforeSave) {
|
188
|
-
const continueAction = this.beforeSave(this.dataUnit);
|
189
|
-
if (continueAction instanceof Promise) {
|
190
|
-
continueAction.then(result => resolve(result ? action : undefined));
|
191
|
-
}
|
192
|
-
else {
|
193
|
-
resolve(continueAction ? action : undefined);
|
194
|
-
}
|
195
|
-
}
|
196
|
-
else {
|
197
|
-
resolve(action);
|
198
|
-
}
|
199
|
-
break;
|
200
|
-
case core.Action.DATA_SAVED:
|
201
|
-
if (this.afterSave) {
|
202
|
-
this.afterSave(this.dataUnit);
|
203
|
-
}
|
204
|
-
else {
|
205
|
-
resolve(action);
|
206
|
-
}
|
207
|
-
break;
|
208
|
-
case core.Action.EDITION_CANCELED:
|
209
|
-
if (this.dataState.hasDirtyRecords) {
|
210
|
-
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
211
|
-
if ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fromParent) {
|
212
|
-
resolve(action);
|
213
|
-
return;
|
214
|
-
}
|
215
|
-
if (cancelConfirmation == undefined) {
|
216
|
-
this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
217
|
-
resolve(action);
|
218
|
-
}
|
219
|
-
else {
|
220
|
-
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
221
|
-
utils.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
|
222
|
-
.then((result) => {
|
223
|
-
result && this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
224
|
-
resolve(result ? action : undefined);
|
225
|
-
});
|
226
|
-
}
|
227
|
-
}
|
228
|
-
else {
|
229
|
-
resolve(action);
|
230
|
-
}
|
231
|
-
break;
|
232
|
-
case core.Action.REMOVING_RECORDS:
|
233
|
-
if (this.isAllowed("REMOVE")) {
|
234
|
-
let multipleSelection = false;
|
235
|
-
let removeConfirmation = this.getMessage("snkDataUnit.removeConfirmation");
|
236
|
-
const selection = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getSelectionInfo();
|
237
|
-
if ((selection === null || selection === void 0 ? void 0 : selection.length) > 1) {
|
238
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
239
|
-
multipleSelection = true;
|
240
|
-
}
|
241
|
-
if (removeConfirmation == undefined) {
|
242
|
-
resolve(action);
|
243
|
-
}
|
244
|
-
else {
|
245
|
-
const options = {
|
246
|
-
canClose: false,
|
247
|
-
labelCancel: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "no" : "cancel"}`),
|
248
|
-
labelConfirm: this.getMessage(`snkDataUnit.confirm.${multipleSelection ? "yes" : "delete"}`),
|
249
|
-
btnConfirmDanger: false
|
250
|
-
};
|
251
|
-
const removeConfirmationTitle = this.getMessage("snkDataUnit.removeConfirmationTitle");
|
252
|
-
utils.ApplicationUtils.confirm(removeConfirmationTitle, removeConfirmation, null, utils.DialogType.WARN, options)
|
253
|
-
.then((result) => resolve(result ? action : undefined));
|
254
|
-
}
|
255
|
-
}
|
256
|
-
else {
|
257
|
-
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenRemove"));
|
258
|
-
}
|
259
|
-
break;
|
260
|
-
default:
|
261
|
-
resolve(action);
|
262
|
-
}
|
263
|
-
});
|
264
|
-
}
|
265
|
-
showSuccessMessage(message) {
|
266
|
-
utils.ApplicationUtils.info(message, { iconName: "check" });
|
267
|
-
}
|
268
|
-
isAllowed(flag) {
|
269
|
-
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
270
|
-
}
|
271
|
-
buildDataState() {
|
272
|
-
const selectionInfo = this.dataUnit.getSelectionInfo();
|
273
|
-
return new DataStateImpl({
|
274
|
-
insertionMode: this.dataUnit.hasNewRecord(),
|
275
|
-
hasNext: this.dataUnit.hasNext(),
|
276
|
-
hasPrevious: this.dataUnit.hasPrevious(),
|
277
|
-
copyMode: this.dataUnit.hasCopiedRecord(),
|
278
|
-
isDirty: this.dataUnit.isDirty(),
|
279
|
-
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
280
|
-
selectedRecords: undefined,
|
281
|
-
selectionInfo,
|
282
|
-
selectedRecord: this.dataUnit.getSelectedRecord()
|
283
|
-
});
|
284
|
-
}
|
285
|
-
/**
|
286
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
287
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
288
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
289
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
290
|
-
*/
|
291
|
-
getMessage(key, params = undefined) {
|
292
|
-
if (!params) {
|
293
|
-
params = this.getMessageParams();
|
294
|
-
}
|
295
|
-
return this._application.messagesBuilder.getMessage(key, params);
|
296
|
-
}
|
297
|
-
getMessageParams() {
|
298
|
-
//FIXME: Devido ao recurso de multiseleção do dataunit, precisaremos criar um mecanismo para
|
299
|
-
//oferecer todos os registros selecionados para a mensagem, pois mensagens podem ficar incorretas.
|
300
|
-
return this.dataState.selectedRecord;
|
301
|
-
}
|
302
|
-
getMessageOperation() {
|
303
|
-
if (this.dataState.copyMode) {
|
304
|
-
return SnkMessageBuilder.OperationMap.CLONE;
|
305
|
-
}
|
306
|
-
if (this.dataState.insertionMode) {
|
307
|
-
return SnkMessageBuilder.OperationMap.INSERT;
|
308
|
-
}
|
309
|
-
if (this.dataState.isDirty) {
|
310
|
-
return SnkMessageBuilder.OperationMap.UPDATE;
|
311
|
-
}
|
312
|
-
return SnkMessageBuilder.OperationMap.CLEAN;
|
313
|
-
}
|
314
|
-
async getDataUnitParentOrChild() {
|
315
|
-
var _a;
|
316
|
-
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
317
|
-
if (this._parentSnkDataUnit) {
|
318
|
-
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
319
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit);
|
320
|
-
}
|
321
|
-
else {
|
322
|
-
return await this._application.getDataUnit(this.entityName, cacheName);
|
323
|
-
}
|
324
|
-
}
|
325
|
-
async loadDataUnit() {
|
326
|
-
if (this.dataUnit == null && this._application && this.entityName) {
|
327
|
-
this.dataUnit = await this.getDataUnitParentOrChild();
|
328
|
-
}
|
329
|
-
if (this.dataUnit) {
|
330
|
-
this.dataUnit.pageSize = this.pageSize;
|
331
|
-
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
332
|
-
this.dataUnit.addInterceptor(this);
|
333
|
-
this.dataUnit.subscribe(this._dataUnitObserver);
|
334
|
-
this.dataState = this.buildDataState();
|
335
|
-
let resolver;
|
336
|
-
while (resolver = this._onDataUnitResolve.pop()) {
|
337
|
-
resolver(this.dataUnit);
|
338
|
-
}
|
339
|
-
}
|
340
|
-
}
|
341
|
-
getParentSnkDataUnit() {
|
342
|
-
let currentElement = this.element;
|
343
|
-
while (currentElement.parentNode) {
|
344
|
-
if (currentElement.parentNode.nodeName === 'SNK-DATA-UNIT') {
|
345
|
-
return currentElement.parentNode;
|
346
|
-
}
|
347
|
-
currentElement = currentElement.parentNode;
|
348
|
-
}
|
349
|
-
return;
|
350
|
-
}
|
351
|
-
handlerLinkFields() {
|
352
|
-
var _a, _b;
|
353
|
-
const metadata = Object.assign({}, this.dataUnit.metadata);
|
354
|
-
if (!this._parentDataUnit)
|
355
|
-
return;
|
356
|
-
const child = this._parentDataUnit.getChildInfo(this.entityName);
|
357
|
-
if (!child)
|
358
|
-
return;
|
359
|
-
const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
|
360
|
-
(_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
361
|
-
if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
|
362
|
-
field.visible = false;
|
363
|
-
}
|
364
|
-
});
|
365
|
-
this.dataUnit.metadata = metadata;
|
366
|
-
}
|
367
|
-
//---------------------------------------------
|
368
|
-
// Lifecycle web component
|
369
|
-
//---------------------------------------------
|
370
|
-
componentWillLoad() {
|
371
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
372
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
373
|
-
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
374
|
-
}
|
375
|
-
disconnectedCallback() {
|
376
|
-
if (this.dataUnit) {
|
377
|
-
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
378
|
-
this.dataUnit.removeInterceptor(this);
|
379
|
-
}
|
380
|
-
}
|
381
|
-
componentDidLoad() {
|
382
|
-
this.loadDataUnit();
|
383
|
-
}
|
384
|
-
render() {
|
385
|
-
return (index.h(index.Host, null));
|
386
|
-
}
|
387
|
-
get element() { return index.getElement(this); }
|
388
|
-
static get watchers() { return {
|
389
|
-
"pageSize": ["observePageSize"],
|
390
|
-
"dataUnitName": ["observeDataUnitName"],
|
391
|
-
"entityName": ["observeEntityName"],
|
392
|
-
"dataState": ["observeDataState"],
|
393
|
-
"dataUnit": ["observeDataUnit"]
|
394
|
-
}; }
|
395
|
-
};
|
396
|
-
class DataStateImpl {
|
397
|
-
constructor(datastate) {
|
398
|
-
this.copyMode = datastate.copyMode;
|
399
|
-
this.insertionMode = datastate.insertionMode;
|
400
|
-
this.isDirty = datastate.isDirty;
|
401
|
-
this.hasDirtyRecords = datastate.hasDirtyRecords;
|
402
|
-
this.hasNext = datastate.hasNext;
|
403
|
-
this.hasPrevious = datastate.hasPrevious;
|
404
|
-
this.selectionInfo = datastate.selectionInfo;
|
405
|
-
this.selectedRecord = datastate.selectedRecord;
|
406
|
-
}
|
407
|
-
get selectedRecords() {
|
408
|
-
var _a;
|
409
|
-
console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`.");
|
410
|
-
if ((_a = this.selectionInfo) === null || _a === void 0 ? void 0 : _a.isAllRecords()) {
|
411
|
-
throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");
|
412
|
-
}
|
413
|
-
return this.selectionInfo.records;
|
414
|
-
}
|
415
|
-
}
|
416
|
-
SnkDataUnit.style = snkDataUnitCss;
|
417
12
|
|
418
|
-
exports.snk_data_unit = SnkDataUnit;
|
13
|
+
exports.snk_data_unit = snkDataUnit.SnkDataUnit;
|
@@ -11,7 +11,8 @@ require('@sankhyalabs/core');
|
|
11
11
|
const index$1 = require('./index-f400b1d6.js');
|
12
12
|
const taskbarElements = require('./taskbar-elements-5e87cf44.js');
|
13
13
|
const constants = require('./constants-ae0ed870.js');
|
14
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
14
|
+
const snkGuidesViewer = require('./snk-guides-viewer-8a6743d6.js');
|
15
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-c6bd8bc7.js');
|
15
16
|
require('./ConfigStorage-98c5108f.js');
|
16
17
|
require('./form-config-fetcher-6b19bf3b.js');
|
17
18
|
require('./_commonjsHelpers-537d719a.js');
|
@@ -77,6 +78,7 @@ const SnkDetailView = class {
|
|
77
78
|
this.dataUnit = undefined;
|
78
79
|
this.selectedForm = undefined;
|
79
80
|
this.dataState = undefined;
|
81
|
+
this.messagesBuilder = undefined;
|
80
82
|
this.branchGuide = undefined;
|
81
83
|
}
|
82
84
|
observerDataState(newValue, oldValue) {
|
@@ -217,11 +219,14 @@ const SnkDetailView = class {
|
|
217
219
|
this._configName = `dynaform.${this.entityName}`;
|
218
220
|
this.formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this._configName, () => this.loadMetadata());
|
219
221
|
this.formConfigManager.loadConfig();
|
222
|
+
if (this.messagesBuilder == undefined) {
|
223
|
+
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
224
|
+
}
|
220
225
|
}
|
221
226
|
render() {
|
222
227
|
this.updateLabel();
|
223
228
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
224
|
-
return (index.h(index.Host, null, index.h("snk-data-unit", { dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: evt => this.dataState = evt.detail }, index.h("ez-view-stack", { ref: ref => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-flex ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: evt => this.executeActionHandler(evt), presentationMode: index$1.PresentationMode.SECONDARY, isDetail: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), label: this.label, levelPath: this._levelPath }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: index$1.PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit })))))));
|
229
|
+
return (index.h(index.Host, null, index.h("snk-data-unit", { dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: evt => this.dataState = evt.detail, messagesBuilder: this.messagesBuilder }, index.h("ez-view-stack", { ref: ref => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-flex ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: evt => this.executeActionHandler(evt), presentationMode: index$1.PresentationMode.SECONDARY, isDetail: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), label: this.label, levelPath: this._levelPath }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: index$1.PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit })))))));
|
225
230
|
}
|
226
231
|
static get watchers() { return {
|
227
232
|
"dataState": ["observerDataState"]
|
@@ -17,6 +17,7 @@ const SnkFieldConfig = class {
|
|
17
17
|
this.fieldConfig = undefined;
|
18
18
|
this.modeInsertion = true;
|
19
19
|
this.dataUnit = undefined;
|
20
|
+
this.messagesBuilder = undefined;
|
20
21
|
}
|
21
22
|
handleAction(evt, type) {
|
22
23
|
evt.preventDefault();
|
@@ -34,16 +35,13 @@ const SnkFieldConfig = class {
|
|
34
35
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts".
|
35
36
|
*/
|
36
37
|
getMessage(key) {
|
37
|
-
return this.
|
38
|
+
return this.messagesBuilder.getMessage(key, {});
|
38
39
|
}
|
39
40
|
isRequired() {
|
40
41
|
var _a, _b;
|
41
42
|
const fieldMD = this.dataUnit && this.dataUnit.getField((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
42
43
|
return (fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.required) === true || ((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.required) === true;
|
43
44
|
}
|
44
|
-
componentWillLoad() {
|
45
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
46
|
-
}
|
47
45
|
componentDidLoad() {
|
48
46
|
core.ElementIDUtils.addIDInfo(this._element);
|
49
47
|
}
|
@@ -140,6 +140,7 @@ const SnkFilterBar = class {
|
|
140
140
|
this.dataUnit = undefined;
|
141
141
|
this.configName = undefined;
|
142
142
|
this.filterConfig = undefined;
|
143
|
+
this.messagesBuilder = undefined;
|
143
144
|
this.allowDefault = undefined;
|
144
145
|
this.scrollerLocked = false;
|
145
146
|
}
|
@@ -204,7 +205,8 @@ const SnkFilterBar = class {
|
|
204
205
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
|
205
206
|
*/
|
206
207
|
getMessage(key, params) {
|
207
|
-
|
208
|
+
var _a;
|
209
|
+
return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
|
208
210
|
}
|
209
211
|
getFilter(_dataUnit) {
|
210
212
|
var _a;
|
@@ -72,6 +72,7 @@ const SnkFilterParamConfig = class {
|
|
72
72
|
this._expressionItem = undefined;
|
73
73
|
this._informedInstance = false;
|
74
74
|
this._canSave = false;
|
75
|
+
this.messagesBuilder = undefined;
|
75
76
|
}
|
76
77
|
open(expressionItem) {
|
77
78
|
this._opened = true;
|
@@ -94,7 +95,7 @@ const SnkFilterParamConfig = class {
|
|
94
95
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
|
95
96
|
*/
|
96
97
|
getMessage(key, params) {
|
97
|
-
return this.
|
98
|
+
return this.messagesBuilder.getMessage(key, params);
|
98
99
|
}
|
99
100
|
getConfigValue(configName, inputName, inputAlias = "") {
|
100
101
|
var _a, _b, _c;
|
@@ -49,6 +49,7 @@ const SnkFormConfig = class {
|
|
49
49
|
this._tempGroups = [];
|
50
50
|
this.dataUnit = undefined;
|
51
51
|
this.configManager = undefined;
|
52
|
+
this.messagesBuilder = undefined;
|
52
53
|
}
|
53
54
|
observeConfigManager() {
|
54
55
|
this.loadConfig(this._sortableTimer);
|
@@ -253,8 +254,8 @@ const SnkFormConfig = class {
|
|
253
254
|
var _a;
|
254
255
|
return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
|
255
256
|
var _a, _b;
|
256
|
-
return index.h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, index.h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name, id: field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
257
|
-
index.h("div", { class: "ez-flex form-config__config-options" }, index.h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
257
|
+
return index.h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, index.h("snk-field-config", { messagesBuilder: this.messagesBuilder, onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name, id: field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
258
|
+
index.h("div", { class: "ez-flex form-config__config-options" }, index.h("snk-config-options", { idConfig: field.name, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
258
259
|
}) : index.h("div", { class: "form-config__add-group-container" }, index.h("div", { class: "form-config__add-group-content" }, index.h("div", { class: "form-config__add-group-label" }, index.h("label", { class: "ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold" }, this.getMessage("snkFormConfig.form.labelDropField")))));
|
259
260
|
}
|
260
261
|
handleconfigOptionsChanged(fieldEdited) {
|
@@ -961,7 +962,7 @@ const SnkFormConfig = class {
|
|
961
962
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
|
962
963
|
*/
|
963
964
|
getMessage(key, params) {
|
964
|
-
return this.
|
965
|
+
return this.messagesBuilder.getMessage(key, params);
|
965
966
|
}
|
966
967
|
componentDidRender() {
|
967
968
|
this.controlSortableField();
|
@@ -986,7 +987,7 @@ const SnkFormConfig = class {
|
|
986
987
|
}), onEzAction: (evt) => this.controlSelectFormConfig(evt), id: "selectConfig" })), index.h("div", { class: "ez-col ez-col--sd-5 ez-col--tb-3 ez-align--middle ez-align--right" }, this._formConfigChanged === true && this._optionFormConfigChanged === false &&
|
987
988
|
index.h("div", { class: "ez-row ez-align--middle ez-align--right" }, index.h("ez-button", { label: "Cancelar", class: "ez-padding-left--medium", size: "small", onClick: () => this.cancelChangeConfig() }), index.h("ez-button", { label: "Salvar", class: "ez-button--primary ez-padding-left--medium", size: "small", onClick: () => this.saveConfig() }, index.h("ez-icon", { class: "ez-margin-right--small", slot: "leftIcon", iconName: "save" }))), this._optionFormConfigChanged === true &&
|
988
989
|
index.h("div", { class: "ez-row ez-align--middle ez-align--right" }, index.h("ez-button", { label: "Cancelar", class: "ez-padding-left--medium", size: "small", onClick: () => this.cancelChangeOptionConfig() }), index.h("ez-button", { label: this.getMessage("snkFormConfig.applyConfig"), class: "ez-button--primary ez-padding-left--medium", size: "small", onClick: () => this.applyOptionConfig() })))), index.h("div", { class: "ez-row ez-padding--medium", ref: ref => this._sortableContainer = ref }, index.h("div", { class: "form-config__tab-container ez-col ez-col--sd-9 ez-col--tb-9 ez-padding-right--medium" }, ((_b = this._layoutFormConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
989
|
-
index.h("section", { class: "ez-box__container", ref: ref => this._formContainer = ref }, index.h("snk-tab-config", { ref: ref => this._tabConfig = ref, selectedIndex: this._tabSelected, onEzTabChange: (ev) => this.changeTabSelected(ev.detail), onEzOrderChange: (ev) => this.changeTabOrder(ev.detail), onEditionTitleTab: (ev) => this.changeTabLabel(ev), onDeleteTab: (ev) => this.handleDeleteTab(ev), onHideTab: (ev) => this.changeHideTab(ev), onCanStartDrag: () => this.handleCanStartDragTab() }, this._layoutFormConfig.map((tab) => index.h("snk-tab", { tabKey: tab.tab, label: tab.tab, visible: tab.visible }))), this._layoutFormConfig.map((tab, indexTab) => index.h("div", { id: "tab" + indexTab, "data-draggable-parent": "group", class: this._tabSelected === indexTab
|
990
|
+
index.h("section", { class: "ez-box__container", ref: ref => this._formContainer = ref }, index.h("snk-tab-config", { ref: ref => this._tabConfig = ref, selectedIndex: this._tabSelected, messagesBuilder: this.messagesBuilder, onEzTabChange: (ev) => this.changeTabSelected(ev.detail), onEzOrderChange: (ev) => this.changeTabOrder(ev.detail), onEditionTitleTab: (ev) => this.changeTabLabel(ev), onDeleteTab: (ev) => this.handleDeleteTab(ev), onHideTab: (ev) => this.changeHideTab(ev), onCanStartDrag: () => this.handleCanStartDragTab() }, this._layoutFormConfig.map((tab) => index.h("snk-tab", { tabKey: tab.tab, label: tab.tab, visible: tab.visible }))), this._layoutFormConfig.map((tab, indexTab) => index.h("div", { id: "tab" + indexTab, "data-draggable-parent": "group", class: this._tabSelected === indexTab
|
990
991
|
? "form-config__tab-content ez-flex ez-flex--column ez-size-width--full ez-padding--medium"
|
991
992
|
: "form-config__hide-content" }, tab.groups.map((group, indexGroup) => {
|
992
993
|
if (group.group) {
|
@@ -999,7 +1000,7 @@ const SnkFormConfig = class {
|
|
999
1000
|
return index.h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, index.h("label", { class: "ez-text ez-text--secondary ez-margin-vertical--small" }, this.getMessage("snkFormConfig.form.subTitleInfo")), index.h("div", { id: CONTAINER_ID.withoutGroup, class: "ez-row", "data-draggable-parent": "field" }, this.getFieldsByGroup(group)), index.h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" }));
|
1000
1001
|
}
|
1001
1002
|
}), this.renderTempGroupByTab(tab.tab))), index.h("div", { class: "form-config__btn-add-group ez-row" }, index.h("div", { class: "form-config__btn-add-group-container ez-col ez-col--sd-12 ez-col--tb-12 ez-align--center" }, index.h("ez-button", { label: this.getMessage("snkFormConfig.form.labelNewGroup"), class: "ez-padding-horizontal--small ez-button--primary", size: "small", onClick: () => this.addNewGroup() }, index.h("ez-icon", { class: "ez-margin-right--small", slot: "leftIcon", iconName: "plus" })))))), index.h("div", { class: "form-config__fields-available ez-col ez-col--sd-3 ez-col--tb-3" }, index.h("section", { class: "ez-box__container ez-col ez-col--pn-12" }, index.h("h1", { class: "ez-title ez-title--large ez-title--primary ez-padding-bottom--medium" }, this.getMessage("snkFormConfig.availableFields.title")), index.h("ez-filter-input", { id: "searchFields", ref: ref => this._filterFieldsAvailable = ref, label: this.getMessage("snkFormConfig.availableFields.labelSearchField"), onEzChange: evt => this.onFilterChange(evt.detail) }), index.h("span", { class: "ez-box__label-counter ez-text ez-text--medium ez-text--primary ez-margin-bottom--medium" }, this.handleLabelCounter((_c = this._fieldsAvailable) === null || _c === void 0 ? void 0 : _c.length)), ((_d = this._layoutFormConfig) === null || _d === void 0 ? void 0 : _d.length) > 0 &&
|
1002
|
-
index.h("div", { id: CONTAINER_ID.fieldsAvailable, class: "ez-row", "data-draggable-parent": "field" }, this.orderFieldsAvailable(this._fieldsAvailable).map((field) => index.h("div", { key: field.name, class: this._fieldsAvailableStyle, "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, index.h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, dataUnit: this.dataUnit, fieldConfig: field, id: field.name })))))))));
|
1003
|
+
index.h("div", { id: CONTAINER_ID.fieldsAvailable, class: "ez-row", "data-draggable-parent": "field" }, this.orderFieldsAvailable(this._fieldsAvailable).map((field) => index.h("div", { key: field.name, class: this._fieldsAvailableStyle, "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, index.h("snk-field-config", { messagesBuilder: this.messagesBuilder, onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, dataUnit: this.dataUnit, fieldConfig: field, id: field.name })))))))));
|
1003
1004
|
}
|
1004
1005
|
get _element() { return index.getElement(this); }
|
1005
1006
|
static get watchers() { return {
|
@@ -23,6 +23,7 @@ const SnkForm = class {
|
|
23
23
|
this._configManager = undefined;
|
24
24
|
this.configName = undefined;
|
25
25
|
this.recordsValidator = undefined;
|
26
|
+
this.messagesBuilder = undefined;
|
26
27
|
}
|
27
28
|
/**
|
28
29
|
* Exibe a janela de configurações do formulário.
|
@@ -73,7 +74,7 @@ const SnkForm = class {
|
|
73
74
|
return undefined;
|
74
75
|
}
|
75
76
|
return (index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
76
|
-
index.h("snk-form-config", { dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
77
|
+
index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
77
78
|
}
|
78
79
|
get _element() { return index.getElement(this); }
|
79
80
|
};
|
@@ -43,6 +43,7 @@ const SnkGrid = class {
|
|
43
43
|
this.statusResolver = undefined;
|
44
44
|
this.multipleSelection = undefined;
|
45
45
|
this.presentationMode = index$1.PresentationMode.PRIMARY;
|
46
|
+
this.messagesBuilder = undefined;
|
46
47
|
}
|
47
48
|
/**
|
48
49
|
* Exibe a janela de configurações da grade.
|
@@ -246,10 +247,11 @@ const SnkGrid = class {
|
|
246
247
|
return disabledButtons;
|
247
248
|
}
|
248
249
|
componentWillRender() {
|
250
|
+
var _a;
|
249
251
|
const invisibleButtons = this._dataUnit && this._dataUnit.records.length > 0 ? [] : ["DATA_EXPORTER"];
|
250
|
-
const
|
252
|
+
const hasSelectedRecord = this._dataState && !!((_a = this._dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.length);
|
251
253
|
let headerTaskbarId;
|
252
|
-
if (
|
254
|
+
if (hasSelectedRecord) {
|
253
255
|
headerTaskbarId = this.isDetail ? "snkGridHeaderTaskbar.detail.selected" : "snkGridHeaderTaskbar.selected";
|
254
256
|
}
|
255
257
|
else {
|
@@ -274,8 +276,8 @@ const SnkGrid = class {
|
|
274
276
|
if (!this._dataUnit) {
|
275
277
|
return undefined;
|
276
278
|
}
|
277
|
-
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
278
|
-
index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton() })), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
|
279
|
+
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
280
|
+
index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton() })), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
|
279
281
|
}
|
280
282
|
get _element() { return index.getElement(this); }
|
281
283
|
};
|