@sankhyalabs/sankhyablocks 8.16.0-dev.104 → 8.16.0-dev.106
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/{ClientSideExporterProvider-8c219037.js → ClientSideExporterProvider-a2753c93.js} +3 -3
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-aecd7c18.js} +31 -24
- package/dist/cjs/{dataunit-fetcher-4a5d491a.js → dataunit-fetcher-a723f0dc.js} +5 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_7.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +19 -11
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-4b510d6e.js → snk-data-unit-ebfdb9ba.js} +226 -12
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +23 -9
- package/dist/cjs/{snk-guides-viewer-e8e5f7b4.js → snk-guides-viewer-fd39f437.js} +99 -44
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +67 -24
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
- package/dist/cjs/{taskbar-elements-7e19882d.js → taskbar-elements-02379452.js} +3 -0
- package/dist/collection/components/snk-crud/snk-crud.js +35 -9
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +117 -43
- package/dist/collection/components/snk-data-unit/MultipleUpdateHelper.js +128 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +107 -12
- package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +38 -6
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +83 -22
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +5 -2
- package/dist/collection/lib/message/SnkMessageBuilder.js +1 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +28 -23
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
- package/dist/components/ContinuousInsertUtils.js +2 -2
- package/dist/components/SnkMessageBuilder.js +31 -24
- package/dist/components/dataunit-fetcher.js +5 -2
- package/dist/components/snk-crud.js +18 -9
- package/dist/components/snk-data-unit2.js +225 -11
- package/dist/components/snk-detail-view2.js +98 -43
- package/dist/components/snk-grid2.js +21 -6
- package/dist/components/snk-simple-crud2.js +66 -22
- package/dist/components/snk-taskbar2.js +4 -0
- package/dist/esm/{ClientSideExporterProvider-a37f890b.js → ClientSideExporterProvider-b3871edb.js} +3 -3
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-12f5fe1a.js} +31 -24
- package/dist/esm/{dataunit-fetcher-1d02ecfc.js → dataunit-fetcher-0e025732.js} +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_7.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +19 -11
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-7d0ce406.js → snk-data-unit-03654813.js} +226 -12
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +23 -9
- package/dist/esm/{snk-guides-viewer-c44b3839.js → snk-guides-viewer-75e06feb.js} +100 -45
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +68 -25
- package/dist/esm/snk-taskbar.entry.js +2 -1
- package/dist/esm/{taskbar-elements-d2353c64.js → taskbar-elements-c62b6c66.js} +3 -0
- package/dist/sankhyablocks/{p-35f85998.entry.js → p-1a51dfde.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ef6f0a1b.entry.js → p-1c29409b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5503e89f.entry.js → p-271c86d3.entry.js} +1 -1
- package/dist/sankhyablocks/p-2d6df7e7.entry.js +1 -0
- package/dist/sankhyablocks/p-41da5310.js +1 -0
- package/dist/sankhyablocks/{p-b2a2a83e.entry.js → p-4a93daef.entry.js} +1 -1
- package/dist/sankhyablocks/p-65be98c5.entry.js +1 -0
- package/dist/sankhyablocks/{p-6541bb6d.entry.js → p-6a0c8ce0.entry.js} +1 -1
- package/dist/sankhyablocks/p-7993b2e3.js +60 -0
- package/dist/sankhyablocks/{p-754559b9.entry.js → p-7cd5c315.entry.js} +1 -1
- package/dist/sankhyablocks/p-80f8c22c.js +1 -0
- package/dist/sankhyablocks/p-885802c3.js +1 -0
- package/dist/sankhyablocks/p-ab0caed6.entry.js +1 -0
- package/dist/sankhyablocks/{p-38e3ffda.entry.js → p-ad07f0c5.entry.js} +1 -1
- package/dist/sankhyablocks/p-cc8c3bca.entry.js +1 -0
- package/dist/sankhyablocks/{p-3b190fb1.entry.js → p-d31a701e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-00796b12.entry.js → p-dc6ad9a6.entry.js} +1 -1
- package/dist/sankhyablocks/p-f4d5bb7f.js +1 -0
- package/dist/sankhyablocks/p-fb0f0087.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +10 -1
- package/dist/types/components/snk-data-unit/MultipleUpdateHelper.d.ts +9 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +17 -0
- package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +5 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +9 -2
- 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 +28 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -1
- package/dist/types/lib/message/SnkMessageBuilder.d.ts +2 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-3fc82614.js +0 -1
- package/dist/sankhyablocks/p-460f1827.entry.js +0 -1
- package/dist/sankhyablocks/p-6e0a5314.js +0 -1
- package/dist/sankhyablocks/p-835128f5.entry.js +0 -1
- package/dist/sankhyablocks/p-8fa828b5.js +0 -1
- package/dist/sankhyablocks/p-92778d5a.js +0 -1
- package/dist/sankhyablocks/p-a8be1d67.js +0 -60
- package/dist/sankhyablocks/p-a962a3e4.entry.js +0 -1
- package/dist/sankhyablocks/p-e35fe2bd.entry.js +0 -1
@@ -3,11 +3,140 @@
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
4
4
|
const core = require('@sankhyalabs/core');
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
7
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
6
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
|
7
|
+
const dataunitFetcher = require('./dataunit-fetcher-a723f0dc.js');
|
8
8
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
9
9
|
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
10
10
|
|
11
|
+
const NO_TAB_NAME = "__NO_TAB_NAME__";
|
12
|
+
const MAIN_TAB_NAME = "__main";
|
13
|
+
async function showConfirmMultipleUpdatePopup({ title, labelBtnConfirm, labelBtnCancel, message, changingFields, }) {
|
14
|
+
return new Promise((resolve) => {
|
15
|
+
const popup = builPopup(title, resolve);
|
16
|
+
const contentContainer = buildContentContainer();
|
17
|
+
contentContainer.appendChild(buildMessage(message));
|
18
|
+
contentContainer.appendChild(buildChangesContainer(changingFields));
|
19
|
+
const actionsContainer = buildActionsContainer();
|
20
|
+
actionsContainer.appendChild(buildCancelBtn(popup, labelBtnCancel, resolve));
|
21
|
+
actionsContainer.appendChild(buildConfirmBtn(popup, labelBtnConfirm, resolve));
|
22
|
+
contentContainer.appendChild(actionsContainer);
|
23
|
+
popup.appendChild(contentContainer);
|
24
|
+
document.body.appendChild(popup);
|
25
|
+
});
|
26
|
+
}
|
27
|
+
function groupChanges(changingFields) {
|
28
|
+
const changesMap = new Map();
|
29
|
+
changingFields.forEach(change => {
|
30
|
+
var _a;
|
31
|
+
const key = (_a = change.tabName) !== null && _a !== void 0 ? _a : NO_TAB_NAME;
|
32
|
+
if (!changesMap.has(key))
|
33
|
+
changesMap.set(key, []);
|
34
|
+
changesMap.get(key).push(change);
|
35
|
+
});
|
36
|
+
return changesMap;
|
37
|
+
}
|
38
|
+
function getTabName(tabName) {
|
39
|
+
switch (tabName) {
|
40
|
+
case NO_TAB_NAME:
|
41
|
+
return "";
|
42
|
+
case MAIN_TAB_NAME:
|
43
|
+
return "Principal";
|
44
|
+
default:
|
45
|
+
return tabName;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
function buildChangesDiv(tabName, changes) {
|
49
|
+
const changeLabel = document.createElement('span');
|
50
|
+
changeLabel.innerText = getTabName(tabName);
|
51
|
+
changeLabel.style.display = 'block';
|
52
|
+
changeLabel.style.fontWeight = 'var(--text-weight--large, 500)';
|
53
|
+
changeLabel.style.fontSize = 'var(--text--medium, 14px)';
|
54
|
+
changeLabel.style.marginBottom = 'var(--space--small, 6px)';
|
55
|
+
const changeDiv = document.createElement('div');
|
56
|
+
changeDiv.style.padding = 'var(--space--medium, 12px) 0';
|
57
|
+
changeDiv.style.borderTop = '1px solid var(--color--disable-secondary, #f2f5f8)';
|
58
|
+
changeDiv.appendChild(changeLabel);
|
59
|
+
changes.forEach(change => {
|
60
|
+
const changeLine = document.createElement('span');
|
61
|
+
changeLine.innerHTML = `${change.label}: <span style="color: var(--text--primary, #626e82)">${change.value}</span>`;
|
62
|
+
changeLine.style.display = 'block';
|
63
|
+
changeLine.style.marginBottom = 'var(--space--extra-small, 3px)';
|
64
|
+
changeDiv.appendChild(changeLine);
|
65
|
+
});
|
66
|
+
return changeDiv;
|
67
|
+
}
|
68
|
+
function buildChangesContainer(changingFields) {
|
69
|
+
const changesContainer = document.createElement('div');
|
70
|
+
changesContainer.style.flexDirection = 'column';
|
71
|
+
changesContainer.style.display = 'flex';
|
72
|
+
changesContainer.style.overflow = 'auto';
|
73
|
+
changesContainer.style.maxHeight = '300px';
|
74
|
+
const changesMap = groupChanges(changingFields);
|
75
|
+
changesMap.forEach((changes, key) => {
|
76
|
+
changesContainer.appendChild(buildChangesDiv(key, changes));
|
77
|
+
});
|
78
|
+
return changesContainer;
|
79
|
+
}
|
80
|
+
function buildMessage(messageContent) {
|
81
|
+
const message = document.createElement('p');
|
82
|
+
message.textContent = messageContent;
|
83
|
+
message.style.fontSize = 'var(--text--medium, 14px)';
|
84
|
+
return message;
|
85
|
+
}
|
86
|
+
function buildContentContainer() {
|
87
|
+
const contentContainer = document.createElement('div');
|
88
|
+
contentContainer.style.display = 'flex';
|
89
|
+
contentContainer.style.flexDirection = 'column';
|
90
|
+
contentContainer.style.fontFamily = 'var(--font-pattern, Roboto)';
|
91
|
+
contentContainer.style.fontSize = 'var(--text--medium, 14px)';
|
92
|
+
return contentContainer;
|
93
|
+
}
|
94
|
+
function buildActionsContainer() {
|
95
|
+
const actionsContainer = document.createElement('div');
|
96
|
+
actionsContainer.style.display = 'flex';
|
97
|
+
actionsContainer.style.flexDirection = 'row';
|
98
|
+
actionsContainer.style.justifyContent = 'flex-end';
|
99
|
+
actionsContainer.style.gap = '5px';
|
100
|
+
return actionsContainer;
|
101
|
+
}
|
102
|
+
function builPopup(title, resolve) {
|
103
|
+
const popup = document.createElement('ez-popup');
|
104
|
+
popup.opened = true;
|
105
|
+
popup.size = 'small';
|
106
|
+
popup.ezTitle = title;
|
107
|
+
popup.heightMode = 'auto';
|
108
|
+
popup.addEventListener('ezClosePopup', () => {
|
109
|
+
document.body.removeChild(popup);
|
110
|
+
resolve(false);
|
111
|
+
}, { once: true });
|
112
|
+
popup.addEventListener('ezPopupAction', () => {
|
113
|
+
document.body.removeChild(popup);
|
114
|
+
resolve(false);
|
115
|
+
}, { once: true });
|
116
|
+
return popup;
|
117
|
+
}
|
118
|
+
function buildConfirmBtn(popup, confirmBtnLabel, resolve) {
|
119
|
+
const confirmBtn = document.createElement('ez-button');
|
120
|
+
confirmBtn.label = confirmBtnLabel;
|
121
|
+
confirmBtn.size = 'medium';
|
122
|
+
confirmBtn.classList.add('ez-button--primary');
|
123
|
+
confirmBtn.onclick = () => {
|
124
|
+
document.body.removeChild(popup);
|
125
|
+
resolve(true);
|
126
|
+
};
|
127
|
+
return confirmBtn;
|
128
|
+
}
|
129
|
+
function buildCancelBtn(popup, cancelBtnLabel, resolve) {
|
130
|
+
const cancelBtn = document.createElement('ez-button');
|
131
|
+
cancelBtn.label = cancelBtnLabel;
|
132
|
+
cancelBtn.size = 'medium';
|
133
|
+
cancelBtn.onclick = () => {
|
134
|
+
document.body.removeChild(popup);
|
135
|
+
resolve(false);
|
136
|
+
};
|
137
|
+
return cancelBtn;
|
138
|
+
}
|
139
|
+
|
11
140
|
const SnkDataUnit = class {
|
12
141
|
constructor(hostRef) {
|
13
142
|
index.registerInstance(this, hostRef);
|
@@ -23,6 +152,7 @@ const SnkDataUnit = class {
|
|
23
152
|
this._fieldsWithRmPrecision = [];
|
24
153
|
this._metadataByRow = new Map();
|
25
154
|
this._rowMetadataCache = new Map();
|
155
|
+
this._formFieldsConfig = [];
|
26
156
|
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
27
157
|
this._dataUnitObserver = async (action) => {
|
28
158
|
const duState = await this.buildDataState(action.type);
|
@@ -99,6 +229,10 @@ const SnkDataUnit = class {
|
|
99
229
|
this.messagesBuilderUpdated.emit(newValue);
|
100
230
|
}
|
101
231
|
}
|
232
|
+
onMasterFormConfigChange({ detail }) {
|
233
|
+
var _a;
|
234
|
+
this._formFieldsConfig = (_a = detail === null || detail === void 0 ? void 0 : detail.fields) !== null && _a !== void 0 ? _a : [];
|
235
|
+
}
|
102
236
|
/**
|
103
237
|
* Obtém o dataUnit.
|
104
238
|
*/
|
@@ -273,9 +407,13 @@ const SnkDataUnit = class {
|
|
273
407
|
this._openedAlert = false;
|
274
408
|
}
|
275
409
|
async interceptSavingData(action) {
|
276
|
-
if (
|
277
|
-
|
410
|
+
if (this.dataUnit.isMultipleEdition) {
|
411
|
+
const confirm = await this.confirmMultipleSavingData();
|
412
|
+
if (!confirm)
|
413
|
+
return undefined;
|
278
414
|
}
|
415
|
+
if (!this.beforeSave)
|
416
|
+
return action;
|
279
417
|
const continueAction = this.beforeSave(this.dataUnit);
|
280
418
|
if (continueAction instanceof Promise) {
|
281
419
|
const result = await continueAction;
|
@@ -283,6 +421,46 @@ const SnkDataUnit = class {
|
|
283
421
|
}
|
284
422
|
return continueAction ? action : undefined;
|
285
423
|
}
|
424
|
+
async confirmMultipleSavingData() {
|
425
|
+
const selectedRecords = this.dataUnit.getSelectionInfo().records;
|
426
|
+
const title = this.getMessage('snkDataUnit.multipleUpdateConfirmationTitle');
|
427
|
+
const message = this.getMessage('snkDataUnit.multipleUpdateConfirmationMessage', { size: selectedRecords.length });
|
428
|
+
const labelBtnCancel = this.getMessage('snkDataUnit.confirm.cancel');
|
429
|
+
const labelBtnConfirm = this.getMessage('snkDataUnit.confirm.updateMultipleConfirm');
|
430
|
+
return await showConfirmMultipleUpdatePopup({
|
431
|
+
title,
|
432
|
+
message,
|
433
|
+
labelBtnConfirm,
|
434
|
+
labelBtnCancel,
|
435
|
+
changingFields: this.getChangingFields(),
|
436
|
+
});
|
437
|
+
}
|
438
|
+
getChangingFields() {
|
439
|
+
const changes = this.dataUnit.buildChangesToSave();
|
440
|
+
if (!(changes === null || changes === void 0 ? void 0 : changes.length))
|
441
|
+
return [];
|
442
|
+
const change = changes[0];
|
443
|
+
const changingFields = Object.keys(change.updatingFields).map(key => this.buildChangingField(key, change[key]));
|
444
|
+
return changingFields;
|
445
|
+
}
|
446
|
+
buildChangingField(key, value) {
|
447
|
+
const fieldLabel = this.dataUnit.getField(key).label;
|
448
|
+
const formattedValue = this.dataUnit.getFormattedValue(key, value);
|
449
|
+
return {
|
450
|
+
label: fieldLabel,
|
451
|
+
value: formattedValue,
|
452
|
+
tabName: this.getFieldTabName(key),
|
453
|
+
};
|
454
|
+
}
|
455
|
+
getFieldTabName(fieldName) {
|
456
|
+
var _a;
|
457
|
+
const tab = (_a = this._formFieldsConfig.find(f => f.name === fieldName)) === null || _a === void 0 ? void 0 : _a.tab;
|
458
|
+
if (!tab)
|
459
|
+
return undefined;
|
460
|
+
if (typeof tab === 'string')
|
461
|
+
return tab;
|
462
|
+
return tab.label;
|
463
|
+
}
|
286
464
|
interceptDataSaved(action) {
|
287
465
|
if (this.afterSave) {
|
288
466
|
this.afterSave(this.dataUnit);
|
@@ -302,7 +480,17 @@ const SnkDataUnit = class {
|
|
302
480
|
}
|
303
481
|
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
304
482
|
const confirm = await utils.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation);
|
305
|
-
|
483
|
+
if (confirm) {
|
484
|
+
let editionCanceledMessage;
|
485
|
+
if (this.dataUnit.isMultipleEdition) {
|
486
|
+
const selectedRecords = this.dataUnit.getSelectionInfo().records;
|
487
|
+
editionCanceledMessage = this.buildMultipleUpdateMessage(selectedRecords, true);
|
488
|
+
}
|
489
|
+
else {
|
490
|
+
editionCanceledMessage = this.getMessage("snkDataUnit.cancelInfo");
|
491
|
+
}
|
492
|
+
this.showSuccessMessage(editionCanceledMessage);
|
493
|
+
}
|
306
494
|
return confirm ? action : undefined;
|
307
495
|
}
|
308
496
|
async interceptRemovingRecords(action) {
|
@@ -480,24 +668,50 @@ const SnkDataUnit = class {
|
|
480
668
|
}
|
481
669
|
async handleDataSaved(action) {
|
482
670
|
var _a, _b, _c;
|
483
|
-
const
|
671
|
+
const changes = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes;
|
672
|
+
const affectedRecords = (_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.records;
|
673
|
+
const newRowMetadata = await this.handleLoadRowMetadata((_c = changes === null || changes === void 0 ? void 0 : changes[0]) === null || _c === void 0 ? void 0 : _c.record);
|
484
674
|
if (newRowMetadata) {
|
485
675
|
newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
|
486
676
|
}
|
487
|
-
const recordId =
|
677
|
+
const recordId = affectedRecords[0].__record__id__;
|
488
678
|
this._metadataByRow.set(recordId, newRowMetadata);
|
489
679
|
this.dataState = await this.buildDataState();
|
490
|
-
let saveOperation =
|
491
|
-
if (saveOperation == 'copy')
|
680
|
+
let saveOperation = changes[0]._operation.toLowerCase();
|
681
|
+
if (saveOperation == 'copy') {
|
492
682
|
saveOperation = SnkMessageBuilder.OperationMap.CLONE;
|
493
|
-
if (this.ignoreSaveMessage && ![SnkMessageBuilder.OperationMap.CLONE, SnkMessageBuilder.OperationMap.INSERT].includes(saveOperation)) {
|
494
|
-
return;
|
495
683
|
}
|
496
|
-
|
684
|
+
if (this.canIgnoreOperationMessage(saveOperation))
|
685
|
+
return;
|
686
|
+
let msg = this.buildOperationMessage(saveOperation, affectedRecords);
|
497
687
|
if (msg != undefined) {
|
498
688
|
this.showSuccessMessage(msg);
|
499
689
|
}
|
500
690
|
}
|
691
|
+
canIgnoreOperationMessage(saveOperation) {
|
692
|
+
return this.ignoreSaveMessage && !this.isCloneOrInsertOperation(saveOperation);
|
693
|
+
}
|
694
|
+
isCloneOrInsertOperation(saveOperation) {
|
695
|
+
return [SnkMessageBuilder.OperationMap.CLONE, SnkMessageBuilder.OperationMap.INSERT].includes(saveOperation);
|
696
|
+
}
|
697
|
+
buildOperationMessage(saveOperation, records) {
|
698
|
+
if (this.isMultiplesUpdate(saveOperation, records)) {
|
699
|
+
return this.buildMultipleUpdateMessage(records);
|
700
|
+
}
|
701
|
+
return this.getMessage('snkDataUnit.saveInfo', records[0], saveOperation);
|
702
|
+
}
|
703
|
+
buildMultipleUpdateMessage(records, isCancel) {
|
704
|
+
/**
|
705
|
+
* FIXME: No futuro, precisamos pensar em um mecanismo para deixar as mensagens de feedback mais dinâmicas.
|
706
|
+
* Podemo ocorrer cenários onde temos mais de um registro selecionado e também cenários onde a chave primária
|
707
|
+
* de um registro se trata de uma chave composta.
|
708
|
+
*/
|
709
|
+
const key = `snkDataUnit.${isCancel ? 'cancelInfo' : 'saveInfo'}`;
|
710
|
+
return this.getMessage(key, { records: records }, SnkMessageBuilder.OperationMap.UPDATE_MULTIPLES);
|
711
|
+
}
|
712
|
+
isMultiplesUpdate(saveOperation, records) {
|
713
|
+
return saveOperation === SnkMessageBuilder.OperationMap.UPDATE && records.length > 1;
|
714
|
+
}
|
501
715
|
handleRecordsRemoved(action) {
|
502
716
|
var _a, _b;
|
503
717
|
let removeFinishMsg = this.buildRemoveFinishMessage(action);
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
5
|
+
const snkDataUnit = require('./snk-data-unit-ebfdb9ba.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
9
|
-
require('./SnkMessageBuilder-
|
10
|
-
require('./dataunit-fetcher-
|
9
|
+
require('./SnkMessageBuilder-aecd7c18.js');
|
10
|
+
require('./dataunit-fetcher-a723f0dc.js');
|
11
11
|
require('./DataFetcher-1afdb18e.js');
|
12
12
|
require('./PrintUtils-bcaeb82f.js');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -11,13 +11,13 @@ require('./ISave-c76e2c51.js');
|
|
11
11
|
const index$1 = require('./index-e3e39724.js');
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
|
-
require('./dataunit-fetcher-
|
14
|
+
require('./dataunit-fetcher-a723f0dc.js');
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
16
16
|
require('./form-config-fetcher-40d3f752.js');
|
17
17
|
const constants = require('./constants-77c1b8bd.js');
|
18
|
-
const taskbarElements = require('./taskbar-elements-
|
19
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
20
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
18
|
+
const taskbarElements = require('./taskbar-elements-02379452.js');
|
19
|
+
const snkGuidesViewer = require('./snk-guides-viewer-fd39f437.js');
|
20
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-aecd7c18.js');
|
21
21
|
require('./ConfigStorage-df09fb78.js');
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const taskbarElements = require('./taskbar-elements-
|
7
|
+
const taskbarElements = require('./taskbar-elements-02379452.js');
|
8
8
|
const ConfigStorage = require('./ConfigStorage-df09fb78.js');
|
9
9
|
const index$1 = require('./index-e3e39724.js');
|
10
10
|
const fieldSearch = require('./field-search-68e34bf4.js');
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
12
|
-
const ClientSideExporterProvider = require('./ClientSideExporterProvider-
|
12
|
+
const ClientSideExporterProvider = require('./ClientSideExporterProvider-a2753c93.js');
|
13
13
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
14
14
|
require('./DataFetcher-1afdb18e.js');
|
15
15
|
require('./ISave-c76e2c51.js');
|
16
16
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
17
17
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
18
|
-
require('./dataunit-fetcher-
|
18
|
+
require('./dataunit-fetcher-a723f0dc.js');
|
19
19
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
20
20
|
require('./form-config-fetcher-40d3f752.js');
|
21
21
|
require('./constants-77c1b8bd.js');
|
@@ -100,7 +100,7 @@ const SnkGrid = class {
|
|
100
100
|
});
|
101
101
|
this._headerTaskbarProcessor = new fieldSearch.TaskbarProcessor({
|
102
102
|
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON", "MORE_OPTIONS"],
|
103
|
-
"snkGridHeaderTaskbar.selected":
|
103
|
+
"snkGridHeaderTaskbar.selected": this.getGridHeaderSelectedBtns(),
|
104
104
|
"snkGridHeaderTaskbar.detail.unselected": ["REFRESH", "MORE_OPTIONS"],
|
105
105
|
"snkGridHeaderTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"],
|
106
106
|
"snkGridHeaderTaskbar.singleTaskbar.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON", "MORE_OPTIONS"],
|
@@ -151,6 +151,17 @@ const SnkGrid = class {
|
|
151
151
|
this.enableGridInsert = false;
|
152
152
|
this.outlineMode = false;
|
153
153
|
this.strategyExporter = index$1.ExporterStrategy.SERVER_SIDE;
|
154
|
+
this.multipleEditionEnabled = true;
|
155
|
+
}
|
156
|
+
getGridHeaderSelectedBtns() {
|
157
|
+
const btns = [
|
158
|
+
taskbarElements.TaskbarElement.UPDATE, taskbarElements.TaskbarElement.CLONE, taskbarElements.TaskbarElement.REMOVE,
|
159
|
+
taskbarElements.TaskbarElement.MORE_OPTIONS, taskbarElements.TaskbarElement.DIVIDER, taskbarElements.TaskbarElement.ATTACH, taskbarElements.TaskbarElement.FORM_MODE,
|
160
|
+
taskbarElements.TaskbarElement.CONFIGURATOR, taskbarElements.TaskbarElement.REFRESH, taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.ACTIONS_BUTTON
|
161
|
+
];
|
162
|
+
if (this.multipleEditionEnabled)
|
163
|
+
btns.unshift(taskbarElements.TaskbarElement.UPDATE_MULTIPLE);
|
164
|
+
return btns;
|
154
165
|
}
|
155
166
|
reloadConfig() {
|
156
167
|
this.loadConfig();
|
@@ -435,20 +446,23 @@ const SnkGrid = class {
|
|
435
446
|
const disabledButtons = [];
|
436
447
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
437
448
|
if (this._dataState.selectionInfo.length > 1) {
|
438
|
-
disabledButtons.push(taskbarElements.TaskbarElement.CLONE,
|
449
|
+
disabledButtons.push(taskbarElements.TaskbarElement.CLONE, taskbarElements.TaskbarElement.ATTACH, taskbarElements.TaskbarElement.UPDATE);
|
439
450
|
}
|
440
451
|
if (this._dataState.selectionInfo.isAllRecords()) {
|
441
|
-
disabledButtons.push(
|
452
|
+
disabledButtons.push(taskbarElements.TaskbarElement.REMOVE);
|
442
453
|
}
|
443
454
|
}
|
444
455
|
return disabledButtons;
|
445
456
|
}
|
446
457
|
getInvisibleButtons() {
|
458
|
+
var _a, _b;
|
447
459
|
let invisibleButtons = [];
|
448
460
|
if (!this._dataUnit || this._dataUnit.records.length === 0)
|
449
|
-
invisibleButtons.push(
|
450
|
-
if (this._dataState
|
451
|
-
invisibleButtons.push(
|
461
|
+
invisibleButtons.push(taskbarElements.TaskbarElement.DATA_EXPORTER);
|
462
|
+
if (((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo.mode) === DataUnit.SelectionMode.ALL_RECORDS)
|
463
|
+
invisibleButtons.push(taskbarElements.TaskbarElement.ACTIONS_BUTTON);
|
464
|
+
if (((_b = this._dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo.length) === 1)
|
465
|
+
invisibleButtons.push(taskbarElements.TaskbarElement.UPDATE_MULTIPLE);
|
452
466
|
return invisibleButtons;
|
453
467
|
}
|
454
468
|
componentWillRender() {
|