@sankhyalabs/sankhyablocks 4.6.0 → 4.6.2
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-d147f088.js → SnkMessageBuilder-47185d5d.js} +1 -0
- package/dist/cjs/{constants-73803daf.js → constants-ae0ed870.js} +0 -2
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- 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 +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +50 -25
- package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +18 -6
- package/dist/cjs/{snk-guides-viewer-5d3dca5d.js → snk-guides-viewer-cb02e675.js} +12 -4
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +15 -8
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-processor-6f3d2a75.js → taskbar-processor-bce3f499.js} +1 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +10 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +49 -24
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +17 -5
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +13 -6
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +1 -1
- package/dist/collection/lib/message/resources/snk-form.msg.js +1 -0
- package/dist/components/SnkMessageBuilder.js +1 -0
- package/dist/components/constants.js +1 -2
- package/dist/components/snk-data-unit2.js +49 -24
- package/dist/components/snk-detail-view2.js +10 -2
- package/dist/components/snk-field-config2.js +1 -1
- package/dist/components/snk-form-config2.js +2 -2
- package/dist/components/snk-grid2.js +17 -5
- package/dist/components/snk-simple-crud.js +13 -6
- package/dist/components/snk-tab-config2.js +1 -1
- package/dist/components/taskbar-processor.js +1 -1
- package/dist/esm/{SnkMessageBuilder-0e1ffd61.js → SnkMessageBuilder-ec0850af.js} +1 -0
- package/dist/esm/{constants-9560e54f.js → constants-15617e7d.js} +1 -2
- package/dist/esm/snk-application.entry.js +1 -1
- 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 +1 -1
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/snk-data-unit.entry.js +50 -25
- package/dist/esm/snk-detail-view.entry.js +3 -3
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +2 -2
- package/dist/esm/snk-grid-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +18 -6
- package/dist/esm/{snk-guides-viewer-6bb54367.js → snk-guides-viewer-b13cff0a.js} +12 -4
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +15 -8
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/{taskbar-processor-c2a99aba.js → taskbar-processor-94402e6e.js} +1 -1
- package/dist/sankhyablocks/p-0c0c086f.entry.js +1 -0
- package/dist/sankhyablocks/{p-9f00c061.entry.js → p-0d9f624f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8b0e8deb.entry.js → p-1374b0e2.entry.js} +1 -1
- package/dist/sankhyablocks/p-28c800b9.js +1 -0
- package/dist/sankhyablocks/{p-dbeac5db.entry.js → p-3169584f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9f2306ba.entry.js → p-31d4e5d4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2a3996b0.entry.js → p-5b80ee28.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cf9d1b55.entry.js → p-604e6970.entry.js} +1 -1
- package/dist/sankhyablocks/p-6181e6cb.entry.js +1 -0
- package/dist/sankhyablocks/p-64f21075.entry.js +1 -0
- package/dist/sankhyablocks/p-94fef424.entry.js +1 -0
- package/dist/sankhyablocks/{p-4bd183ba.entry.js → p-a61d2aa0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-869d6616.entry.js → p-af8cf505.entry.js} +1 -1
- package/dist/sankhyablocks/p-c2beb95c.js +1 -0
- package/dist/sankhyablocks/{p-86efa17d.entry.js → p-c88c4f80.entry.js} +1 -1
- package/dist/sankhyablocks/p-e1dbaecb.js +1 -0
- package/dist/sankhyablocks/p-f587a454.js +1 -0
- package/dist/sankhyablocks/{p-f83e3219.entry.js → p-f9ca6d74.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b318cec6.entry.js → p-fa8a62f2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +8 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-4fb98039.entry.js +0 -1
- package/dist/sankhyablocks/p-5518d572.js +0 -1
- package/dist/sankhyablocks/p-5a3e0eb6.js +0 -1
- package/dist/sankhyablocks/p-7889d481.entry.js +0 -1
- package/dist/sankhyablocks/p-8490ca88.entry.js +0 -1
- package/dist/sankhyablocks/p-9bf0319f.js +0 -1
- package/dist/sankhyablocks/p-c0bfafcb.entry.js +0 -1
- package/dist/sankhyablocks/p-ecbfbb4a.js +0 -1
@@ -2,7 +2,6 @@ import { Host, h } from '@stencil/core';
|
|
2
2
|
import { Action, ApplicationContext, ObjectUtils, DataType, JSUtils } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { OperationMap } from '../../lib/message/SnkMessageBuilder';
|
5
|
-
import { ALL_RECORD } from '../../lib/utils/constants';
|
6
5
|
export class SnkDataUnit {
|
7
6
|
constructor() {
|
8
7
|
this._onDataUnitResolve = [];
|
@@ -23,21 +22,27 @@ export class SnkDataUnit {
|
|
23
22
|
this.cancelEdition.emit();
|
24
23
|
}
|
25
24
|
if (action.type === Action.RECORDS_REMOVED) {
|
26
|
-
let removeFinishMsg;
|
27
25
|
const cachedRecords = action.payload.cachedRecords;
|
26
|
+
let removeFinishMsg;
|
28
27
|
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
29
28
|
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
30
29
|
}
|
31
|
-
else if (cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.some((record) => record.__record__id__ === ALL_RECORD)) {
|
32
|
-
const size = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) === null || _b === void 0 ? void 0 : _b.total;
|
33
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size });
|
34
|
-
}
|
35
30
|
else {
|
36
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", cachedRecords
|
31
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
37
32
|
}
|
38
33
|
if (removeFinishMsg != undefined) {
|
39
34
|
this.showSuccessMessage(removeFinishMsg);
|
40
35
|
}
|
36
|
+
const recordsCount = (_b = (_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
37
|
+
const paginationInfo = this.dataUnit.getPaginationInfo();
|
38
|
+
if (paginationInfo) {
|
39
|
+
if (recordsCount > 0 || paginationInfo.hasMore) {
|
40
|
+
this.dataUnit.gotoPage(paginationInfo.currentPage);
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
this.dataUnit.gotoPage(0);
|
44
|
+
}
|
45
|
+
}
|
41
46
|
}
|
42
47
|
this._application.messagesBuilder.currentOperation = this.getMessageOperation();
|
43
48
|
};
|
@@ -99,8 +104,12 @@ export class SnkDataUnit {
|
|
99
104
|
*/
|
100
105
|
async getSelectedRecordsIDsInfo() {
|
101
106
|
var _a;
|
107
|
+
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
108
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
109
|
+
return [];
|
110
|
+
}
|
102
111
|
const selectedRecordsIDsInfo = [];
|
103
|
-
const selectedRecords =
|
112
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
104
113
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
105
114
|
selectedRecords.forEach(({ __record__id__ }) => {
|
106
115
|
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
@@ -134,7 +143,7 @@ export class SnkDataUnit {
|
|
134
143
|
}
|
135
144
|
async interceptAction(action) {
|
136
145
|
return new Promise(resolve => {
|
137
|
-
var _a, _b
|
146
|
+
var _a, _b;
|
138
147
|
switch (action.type) {
|
139
148
|
case Action.RECORDS_ADDED:
|
140
149
|
if (this.isAllowed("INSERT")) {
|
@@ -212,14 +221,9 @@ export class SnkDataUnit {
|
|
212
221
|
if (this.isAllowed("REMOVE")) {
|
213
222
|
let multipleSelection = false;
|
214
223
|
let removeConfirmation = this.getMessage("snkDataUnit.removeConfirmation");
|
215
|
-
const
|
216
|
-
if ((
|
217
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size:
|
218
|
-
multipleSelection = true;
|
219
|
-
}
|
220
|
-
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.some((record) => record.__record__id__ === ALL_RECORD)) {
|
221
|
-
const size = (_d = (_c = this.dataUnit) === null || _c === void 0 ? void 0 : _c.getPaginationInfo()) === null || _d === void 0 ? void 0 : _d.total;
|
222
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size });
|
224
|
+
const selection = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getSelectionInfo();
|
225
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) > 1) {
|
226
|
+
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
223
227
|
multipleSelection = true;
|
224
228
|
}
|
225
229
|
if (removeConfirmation == undefined) {
|
@@ -253,16 +257,18 @@ export class SnkDataUnit {
|
|
253
257
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
254
258
|
}
|
255
259
|
buildDataState() {
|
256
|
-
|
260
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
261
|
+
return new DataStateImpl({
|
257
262
|
insertionMode: this.dataUnit.hasNewRecord(),
|
258
263
|
hasNext: this.dataUnit.hasNext(),
|
259
264
|
hasPrevious: this.dataUnit.hasPrevious(),
|
260
265
|
copyMode: this.dataUnit.hasCopiedRecord(),
|
261
266
|
isDirty: this.dataUnit.isDirty(),
|
262
267
|
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
263
|
-
selectedRecords:
|
268
|
+
selectedRecords: undefined,
|
269
|
+
selectionInfo,
|
264
270
|
selectedRecord: this.dataUnit.getSelectedRecord()
|
265
|
-
};
|
271
|
+
});
|
266
272
|
}
|
267
273
|
/**
|
268
274
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -277,10 +283,9 @@ export class SnkDataUnit {
|
|
277
283
|
return this._application.messagesBuilder.getMessage(key, params);
|
278
284
|
}
|
279
285
|
getMessageParams() {
|
280
|
-
//
|
281
|
-
//
|
282
|
-
|
283
|
-
return this.dataState.selectedRecords ? this.dataState.selectedRecords[0] : undefined;
|
286
|
+
//FIXME: Devido ao recurso de multiseleção do dataunit, precisaremos criar um mecanismo para
|
287
|
+
//oferecer todos os registros selecionados para a mensagem, pois mensagens podem ficar incorretas.
|
288
|
+
return this.dataState.selectedRecord;
|
284
289
|
}
|
285
290
|
getMessageOperation() {
|
286
291
|
if (this.dataState.copyMode) {
|
@@ -663,3 +668,23 @@ export class SnkDataUnit {
|
|
663
668
|
}];
|
664
669
|
}
|
665
670
|
}
|
671
|
+
class DataStateImpl {
|
672
|
+
constructor(datastate) {
|
673
|
+
this.copyMode = datastate.copyMode;
|
674
|
+
this.insertionMode = datastate.insertionMode;
|
675
|
+
this.isDirty = datastate.isDirty;
|
676
|
+
this.hasDirtyRecords = datastate.hasDirtyRecords;
|
677
|
+
this.hasNext = datastate.hasNext;
|
678
|
+
this.hasPrevious = datastate.hasPrevious;
|
679
|
+
this.selectionInfo = datastate.selectionInfo;
|
680
|
+
this.selectedRecord = datastate.selectedRecord;
|
681
|
+
}
|
682
|
+
get selectedRecords() {
|
683
|
+
var _a;
|
684
|
+
console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`.");
|
685
|
+
if ((_a = this.selectionInfo) === null || _a === void 0 ? void 0 : _a.isAllRecords()) {
|
686
|
+
throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");
|
687
|
+
}
|
688
|
+
return this.selectionInfo.records;
|
689
|
+
}
|
690
|
+
}
|
package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js
CHANGED
@@ -971,7 +971,7 @@ export class SnkFormConfig {
|
|
971
971
|
}
|
972
972
|
render() {
|
973
973
|
var _a, _b, _c, _d;
|
974
|
-
return (h(Host, null, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-7 ez-col--tb-9 ez-align--middle" }, h("ez-button", { mode: "icon", iconName: "arrow_back", class: "ez-padding--small", size: "small", onClick: () => this.closeFormConfig(), id: "formConfigToBack" }), h("h1", { class: "ez-title ez-title--extra-large ez-padding--small" }, this.getMessage("snkFormConfig.title")), this._formConfigOptions &&
|
974
|
+
return (h(Host, null, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-7 ez-col--tb-9 ez-align--middle" }, h("ez-button", { mode: "icon", title: this.getMessage("snkFormConfig.goBackTitle"), iconName: "arrow_back", class: "ez-padding--small", size: "small", onClick: () => this.closeFormConfig(), id: "formConfigToBack" }), h("h1", { class: "ez-title ez-title--extra-large ez-padding--small" }, this.getMessage("snkFormConfig.title")), this._formConfigOptions &&
|
975
975
|
h("ez-actions-button", { class: "form-config__actions-button ez-margin-left--medium", value: (_a = this._optionFormConfigSelected) === null || _a === void 0 ? void 0 : _a.origin, showLabel: true, displayIcon: "chevron-down", checkOption: true, size: "small", actions: this._formConfigOptions.map((option) => {
|
976
976
|
return { value: option.origin, label: option.name };
|
977
977
|
}), onEzAction: (evt) => this.controlSelectFormConfig(evt), id: "selectConfig" })), 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 &&
|
@@ -142,7 +142,6 @@ export class SnkGrid {
|
|
142
142
|
}
|
143
143
|
async dataExporterProviderStore() {
|
144
144
|
var _a, _b;
|
145
|
-
const paginationInfo = this.getPaginationInfo();
|
146
145
|
const columnsMetadata = [];
|
147
146
|
const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
|
148
147
|
await ((_b = this._grid) === null || _b === void 0 ? void 0 : _b.getColumnsState().then(this.buildColumnsMetadata.bind(this, columnsMetadata)));
|
@@ -164,7 +163,7 @@ export class SnkGrid {
|
|
164
163
|
},
|
165
164
|
getSelectedNumber: () => {
|
166
165
|
var _a, _b;
|
167
|
-
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.
|
166
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
|
168
167
|
},
|
169
168
|
getTotalRecords: () => {
|
170
169
|
var _a, _b, _c;
|
@@ -175,7 +174,7 @@ export class SnkGrid {
|
|
175
174
|
return selectedIDs || [];
|
176
175
|
},
|
177
176
|
getOffset: () => {
|
178
|
-
return this.getExporterOffset(
|
177
|
+
return this.getExporterOffset(this.getPaginationInfo());
|
179
178
|
},
|
180
179
|
getLimit: () => {
|
181
180
|
var _a;
|
@@ -217,10 +216,23 @@ export class SnkGrid {
|
|
217
216
|
}
|
218
217
|
this.loadConfig();
|
219
218
|
}
|
219
|
+
getHeaderDisabledButtons() {
|
220
|
+
var _a;
|
221
|
+
const disabledButtons = [];
|
222
|
+
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
223
|
+
if (this._dataState.selectionInfo.length > 1) {
|
224
|
+
disabledButtons.push("CLONE");
|
225
|
+
}
|
226
|
+
if (this._dataState.selectionInfo.isAllRecords()) {
|
227
|
+
disabledButtons.push("REMOVE");
|
228
|
+
}
|
229
|
+
}
|
230
|
+
return disabledButtons;
|
231
|
+
}
|
220
232
|
componentWillRender() {
|
221
233
|
const invisibleButtons = this._dataUnit && this._dataUnit.records.length > 0 ? [] : ["DATA_EXPORTER"];
|
222
|
-
const headerTaskbarId = this._dataState && this._dataState.
|
223
|
-
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState,
|
234
|
+
const headerTaskbarId = this._dataState && this._dataState.selectionInfo.isEmpty() ? "snkGridHeaderTaskbar.unselected" : "snkGridHeaderTaskbar.selected";
|
235
|
+
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState, this.getHeaderDisabledButtons(), invisibleButtons);
|
224
236
|
this._topTaskbarProcessor.process(this.getTopTaskBarId(this.presentationMode === PresentationMode.SECONDARY ? ".secondary" : ""), this.taskbarManager, this._dataState, undefined, invisibleButtons);
|
225
237
|
this.dataExporterProviderStore();
|
226
238
|
}
|
@@ -7,13 +7,13 @@ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
7
7
|
import InMemoryLoader from '../../lib/dataUnit/InMemoryLoader';
|
8
8
|
export class SnkSimpleCrud {
|
9
9
|
constructor() {
|
10
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER"];
|
11
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
10
|
+
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
11
|
+
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
12
12
|
this._taskbarProcessor = new TaskbarProcessor({
|
13
|
-
"snkSimpleCrudTaskbar.form_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.GRID_MODE),
|
14
|
-
"snkSimpleCrudTaskbar.grid_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.FORM_MODE),
|
15
|
-
"snkSimpleCrudTaskbar.form_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.GRID_MODE),
|
16
|
-
"snkSimpleCrudTaskbar.grid_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.FORM_MODE),
|
13
|
+
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
14
|
+
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
15
|
+
"snkSimpleCrudTaskbar.form_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(TaskbarElement.GRID_MODE),
|
16
|
+
"snkSimpleCrudTaskbar.grid_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(TaskbarElement.FORM_MODE),
|
17
17
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
18
18
|
});
|
19
19
|
this._currentViewMode = VIEW_MODE.GRID;
|
@@ -23,6 +23,13 @@ export class SnkSimpleCrud {
|
|
23
23
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
24
24
|
this.taskbarManager = undefined;
|
25
25
|
}
|
26
|
+
resolveInMemoryBtns(taskbarButtons) {
|
27
|
+
const newTaskBarConfig = [...taskbarButtons];
|
28
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
29
|
+
newTaskBarConfig.splice(1, 1);
|
30
|
+
}
|
31
|
+
return newTaskBarConfig;
|
32
|
+
}
|
26
33
|
/**
|
27
34
|
* Usado para alternar a visão entre GRID e FORM externamente.
|
28
35
|
*/
|
@@ -6,7 +6,7 @@ export default class TaskbarProcessor {
|
|
6
6
|
var _a;
|
7
7
|
this.customButtons = new Map();
|
8
8
|
this.buttons = "";
|
9
|
-
this.disabledButtons = [];
|
9
|
+
this.disabledButtons = [].concat(disabledButtons);
|
10
10
|
(_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
|
11
11
|
let buttonName;
|
12
12
|
if (typeof btnDef === "string") {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
const REPORT_LAUNCHER_RESOURCE_ID = "br.com.sankhya.controls.ReportLauncher";
|
2
2
|
const KEY_PORT_EXPORT = "global.porta.app.impressao";
|
3
|
-
const ALL_RECORD = "ALL_RECORD";
|
4
3
|
var VIEW_MODE;
|
5
4
|
(function (VIEW_MODE) {
|
6
5
|
VIEW_MODE[VIEW_MODE["GRID"] = 0] = "GRID";
|
@@ -99,4 +98,4 @@ var SIMPLE_CRUD_MODE;
|
|
99
98
|
SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
|
100
99
|
})(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
|
101
100
|
|
102
|
-
export {
|
101
|
+
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_PORT_EXPORT as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TAGS_BY_TYPE as T, VIEW_MODE as V, WEB_CONNECTION as W, VARS_BY_TYPE as a, TAB_NAMES as b, KEY_EVENTS as c, TYPE_ACTIONS as d };
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
2
2
|
import { Action, ObjectUtils, JSUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { O as OperationMap } from './SnkMessageBuilder.js';
|
5
|
-
import { A as ALL_RECORD } from './constants.js';
|
6
5
|
|
7
6
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
8
7
|
|
@@ -32,21 +31,27 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
32
31
|
this.cancelEdition.emit();
|
33
32
|
}
|
34
33
|
if (action.type === Action.RECORDS_REMOVED) {
|
35
|
-
let removeFinishMsg;
|
36
34
|
const cachedRecords = action.payload.cachedRecords;
|
35
|
+
let removeFinishMsg;
|
37
36
|
if ((cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.length) > 1) {
|
38
37
|
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size: cachedRecords.length });
|
39
38
|
}
|
40
|
-
else if (cachedRecords === null || cachedRecords === void 0 ? void 0 : cachedRecords.some((record) => record.__record__id__ === ALL_RECORD)) {
|
41
|
-
const size = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) === null || _b === void 0 ? void 0 : _b.total;
|
42
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeAllInfo", { size });
|
43
|
-
}
|
44
39
|
else {
|
45
|
-
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", cachedRecords
|
40
|
+
removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
46
41
|
}
|
47
42
|
if (removeFinishMsg != undefined) {
|
48
43
|
this.showSuccessMessage(removeFinishMsg);
|
49
44
|
}
|
45
|
+
const recordsCount = (_b = (_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
46
|
+
const paginationInfo = this.dataUnit.getPaginationInfo();
|
47
|
+
if (paginationInfo) {
|
48
|
+
if (recordsCount > 0 || paginationInfo.hasMore) {
|
49
|
+
this.dataUnit.gotoPage(paginationInfo.currentPage);
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
this.dataUnit.gotoPage(0);
|
53
|
+
}
|
54
|
+
}
|
50
55
|
}
|
51
56
|
this._application.messagesBuilder.currentOperation = this.getMessageOperation();
|
52
57
|
};
|
@@ -108,8 +113,12 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
108
113
|
*/
|
109
114
|
async getSelectedRecordsIDsInfo() {
|
110
115
|
var _a;
|
116
|
+
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
117
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
118
|
+
return [];
|
119
|
+
}
|
111
120
|
const selectedRecordsIDsInfo = [];
|
112
|
-
const selectedRecords =
|
121
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
113
122
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
114
123
|
selectedRecords.forEach(({ __record__id__ }) => {
|
115
124
|
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
@@ -143,7 +152,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
143
152
|
}
|
144
153
|
async interceptAction(action) {
|
145
154
|
return new Promise(resolve => {
|
146
|
-
var _a, _b
|
155
|
+
var _a, _b;
|
147
156
|
switch (action.type) {
|
148
157
|
case Action.RECORDS_ADDED:
|
149
158
|
if (this.isAllowed("INSERT")) {
|
@@ -221,14 +230,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
221
230
|
if (this.isAllowed("REMOVE")) {
|
222
231
|
let multipleSelection = false;
|
223
232
|
let removeConfirmation = this.getMessage("snkDataUnit.removeConfirmation");
|
224
|
-
const
|
225
|
-
if ((
|
226
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size:
|
227
|
-
multipleSelection = true;
|
228
|
-
}
|
229
|
-
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.some((record) => record.__record__id__ === ALL_RECORD)) {
|
230
|
-
const size = (_d = (_c = this.dataUnit) === null || _c === void 0 ? void 0 : _c.getPaginationInfo()) === null || _d === void 0 ? void 0 : _d.total;
|
231
|
-
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size });
|
233
|
+
const selection = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getSelectionInfo();
|
234
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) > 1) {
|
235
|
+
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
232
236
|
multipleSelection = true;
|
233
237
|
}
|
234
238
|
if (removeConfirmation == undefined) {
|
@@ -262,16 +266,18 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
262
266
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
263
267
|
}
|
264
268
|
buildDataState() {
|
265
|
-
|
269
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
270
|
+
return new DataStateImpl({
|
266
271
|
insertionMode: this.dataUnit.hasNewRecord(),
|
267
272
|
hasNext: this.dataUnit.hasNext(),
|
268
273
|
hasPrevious: this.dataUnit.hasPrevious(),
|
269
274
|
copyMode: this.dataUnit.hasCopiedRecord(),
|
270
275
|
isDirty: this.dataUnit.isDirty(),
|
271
276
|
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
272
|
-
selectedRecords:
|
277
|
+
selectedRecords: undefined,
|
278
|
+
selectionInfo,
|
273
279
|
selectedRecord: this.dataUnit.getSelectedRecord()
|
274
|
-
};
|
280
|
+
});
|
275
281
|
}
|
276
282
|
/**
|
277
283
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -286,10 +292,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
286
292
|
return this._application.messagesBuilder.getMessage(key, params);
|
287
293
|
}
|
288
294
|
getMessageParams() {
|
289
|
-
//
|
290
|
-
//
|
291
|
-
|
292
|
-
return this.dataState.selectedRecords ? this.dataState.selectedRecords[0] : undefined;
|
295
|
+
//FIXME: Devido ao recurso de multiseleção do dataunit, precisaremos criar um mecanismo para
|
296
|
+
//oferecer todos os registros selecionados para a mensagem, pois mensagens podem ficar incorretas.
|
297
|
+
return this.dataState.selectedRecord;
|
293
298
|
}
|
294
299
|
getMessageOperation() {
|
295
300
|
if (this.dataState.copyMode) {
|
@@ -396,6 +401,26 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
396
401
|
"getDataUnit": [64],
|
397
402
|
"getSelectedRecordsIDsInfo": [64]
|
398
403
|
}]);
|
404
|
+
class DataStateImpl {
|
405
|
+
constructor(datastate) {
|
406
|
+
this.copyMode = datastate.copyMode;
|
407
|
+
this.insertionMode = datastate.insertionMode;
|
408
|
+
this.isDirty = datastate.isDirty;
|
409
|
+
this.hasDirtyRecords = datastate.hasDirtyRecords;
|
410
|
+
this.hasNext = datastate.hasNext;
|
411
|
+
this.hasPrevious = datastate.hasPrevious;
|
412
|
+
this.selectionInfo = datastate.selectionInfo;
|
413
|
+
this.selectedRecord = datastate.selectedRecord;
|
414
|
+
}
|
415
|
+
get selectedRecords() {
|
416
|
+
var _a;
|
417
|
+
console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`.");
|
418
|
+
if ((_a = this.selectionInfo) === null || _a === void 0 ? void 0 : _a.isAllRecords()) {
|
419
|
+
throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");
|
420
|
+
}
|
421
|
+
return this.selectionInfo.records;
|
422
|
+
}
|
423
|
+
}
|
399
424
|
function defineCustomElement() {
|
400
425
|
if (typeof customElements === "undefined") {
|
401
426
|
return;
|
@@ -168,7 +168,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
168
168
|
}
|
169
169
|
}
|
170
170
|
loadTaskbarProcessor() {
|
171
|
-
var _a;
|
171
|
+
var _a, _b;
|
172
172
|
const taskbarId = ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkGuideViewer.finish_edition" : "snkGuideViewer.regular";
|
173
173
|
const disabledButtons = [];
|
174
174
|
if (!this.dataState || !this.dataState.hasPrevious) {
|
@@ -177,6 +177,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
177
177
|
if (!this.dataState || !this.dataState.hasNext) {
|
178
178
|
disabledButtons.push("NEXT");
|
179
179
|
}
|
180
|
+
if ((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) {
|
181
|
+
if (this.dataState.selectionInfo.length > 1) {
|
182
|
+
disabledButtons.push("CLONE");
|
183
|
+
}
|
184
|
+
if (this.dataState.selectionInfo.isAllRecords()) {
|
185
|
+
disabledButtons.push("REMOVE");
|
186
|
+
}
|
187
|
+
}
|
180
188
|
const btnsRegularMode = ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "CONFIGURATOR"];
|
181
189
|
if (this.presentationMode == PresentationMode.SECONDARY) {
|
182
190
|
btnsRegularMode.unshift("INSERT");
|
@@ -327,7 +335,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
327
335
|
}
|
328
336
|
this.loadTaskbarProcessor();
|
329
337
|
const showGuides = this._guides && (this._guides.length > 1);
|
330
|
-
return (h("section", { class: "snk-guides-viewer" }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: "
|
338
|
+
return (h("section", { class: "snk-guides-viewer" }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getMessage("snkCrud.title")), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
331
339
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: showGuides ? "snk-guides-viewer__container" : undefined }, showGuides && h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzChange: evt => this.updateSelectedGuideHandler(evt.detail) }), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
332
340
|
}
|
333
341
|
static get watchers() { return {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
2
|
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import {
|
3
|
+
import { A as ACTION_CONFIG } from './constants.js';
|
4
4
|
|
5
5
|
const snkFieldConfigCss = ".sc-snk-field-config-h{--snk-field-config--height:42px;--snk-field-config--width:100%;--snk-field-config__icon--width:48px;--snk-field-config-slim--height:32px;--snk-field-config--border-radius:var(--border--radius-medium, 12px);--snk-field-config--font-size:var(--text--medium, 14px);--snk-field-config--font-family:var(--font-pattern, Arial);--snk-field-config--font-weight:var(--text-weight--medium, 400);--snk-field-config--color:var(--title--primary, #000);--snk-field-config--padding-left:var(--space--medium, 6px);--snk-field-config__input--background-color:var(--background--medium, #e0e0e0);--snk-field-config__input--border:var(--border--medium, 2px solid);--snk-field-config__input--border-color:var(--background--xlight, #fff);--snk-field-config__required--color:var(--color--error, #FF0000);--snk-field-config__label--gap:var(--space--extra-small, 3px);--snk-field-config__transition--visibility:var(--transition, 0.2s linear);--snk-field-config__transition--opacity:var(--transition, 0.15s linear);--snk-field-config__config-popover--z-index:var(--more-visible, 2);--snk-field-config__config-outer-arrow--background-color:var(--color--secondary-200, #D2D3DA);--snk-field-config__draggable--padding-right:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--snk-field-config--width)}.field-config.sc-snk-field-config{width:100%;box-sizing:border-box;display:flex;align-items:center;padding-left:var(--snk-field-config--padding-left);font-weight:var(--snk-field-config--font-weight);height:var(--snk-field-config--height);border-radius:var(--snk-field-config--border-radius);font-family:var(--snk-field-config--font-family);font-size:var(--snk-field-config--font-size);border:var(--snk-field-config__input--border);border-color:var(--snk-field-config__input--border-color);background-color:var(--snk-field-config__input--background-color);color:var(--snk-field-config--color)}.field-config__config-popover.sc-snk-field-config{width:40px;margin-left:auto;z-index:var(--snk-field-config__config-popover--z-index)}.field-config__label.sc-snk-field-config{display:flex;flex-direction:row-reverse;line-height:calc(var(--snk-field-config--font-size) + 2px);gap:var(--snk-field-config__label--gap)}.field-config__label-text.sc-snk-field-config{overflow:hidden;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;display:-webkit-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;word-break:break-word}.field-config__label-required.sc-snk-field-config{color:var(--snk-field-config__required--color)}.field-config__add.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options--is-active.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config__remove-icon.sc-snk-field-config{margin-right:-15px}.field-config.sc-snk-field-config:hover .field-config__options.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config.sc-snk-field-config:hover .field-config__add.sc-snk-field-config{visibility:visible;opacity:1}.field-config__draggable.sc-snk-field-config{padding-right:var(--snk-field-config__draggable--padding-right)}.field-config__config-outer-arrow.sc-snk-field-config{clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px;padding-top:3px;border-bottom:1px solid #FFFFFF;background-color:var(--snk-field-config__config-outer-arrow--background-color)}.field-config__config-inner-arrow.sc-snk-field-config{background-color:#FFFFFF;clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px}.ez-box__container.sc-snk-field-config ez-collapsible-box.sc-snk-field-config{--snk-collapsible-box__header--padding-left:6px}ez-icon.sc-snk-field-config{--snk-icon--color:var(--snk-field-config--color)}ez-popover.sc-snk-field-config{--snk-popover__box--background-color:transparent;--snk-popover__box--box-shadow:none}.field-config__options.sc-snk-field-config ez-button.sc-snk-field-config{--snk-button--background-color:transparent;--snk-button--focus--border:none;--snk-button--focus--box-shadow:none}@media screen and (min-width: 1200px){.field-config__label.sc-snk-field-config{flex-direction:row}}";
|
6
6
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
2
2
|
import { a as draggable_bundle, d as defineCustomElement$1 } from './snk-tab-config2.js';
|
3
3
|
import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
|
-
import { C as CONFIG_EVENTS,
|
5
|
+
import { C as CONFIG_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
|
6
6
|
import { U as UserConfigType } from './form-config-fetcher.js';
|
7
7
|
import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
8
8
|
import { d as defineCustomElement$3 } from './snk-config-options2.js';
|
@@ -977,7 +977,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
977
977
|
}
|
978
978
|
render() {
|
979
979
|
var _a, _b, _c, _d;
|
980
|
-
return (h(Host, null, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-7 ez-col--tb-9 ez-align--middle" }, h("ez-button", { mode: "icon", iconName: "arrow_back", class: "ez-padding--small", size: "small", onClick: () => this.closeFormConfig(), id: "formConfigToBack" }), h("h1", { class: "ez-title ez-title--extra-large ez-padding--small" }, this.getMessage("snkFormConfig.title")), this._formConfigOptions &&
|
980
|
+
return (h(Host, null, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-7 ez-col--tb-9 ez-align--middle" }, h("ez-button", { mode: "icon", title: this.getMessage("snkFormConfig.goBackTitle"), iconName: "arrow_back", class: "ez-padding--small", size: "small", onClick: () => this.closeFormConfig(), id: "formConfigToBack" }), h("h1", { class: "ez-title ez-title--extra-large ez-padding--small" }, this.getMessage("snkFormConfig.title")), this._formConfigOptions &&
|
981
981
|
h("ez-actions-button", { class: "form-config__actions-button ez-margin-left--medium", value: (_a = this._optionFormConfigSelected) === null || _a === void 0 ? void 0 : _a.origin, showLabel: true, displayIcon: "chevron-down", checkOption: true, size: "small", actions: this._formConfigOptions.map((option) => {
|
982
982
|
return { value: option.origin, label: option.name };
|
983
983
|
}), onEzAction: (evt) => this.controlSelectFormConfig(evt), id: "selectConfig" })), 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 &&
|
@@ -158,7 +158,6 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
158
158
|
}
|
159
159
|
async dataExporterProviderStore() {
|
160
160
|
var _a, _b;
|
161
|
-
const paginationInfo = this.getPaginationInfo();
|
162
161
|
const columnsMetadata = [];
|
163
162
|
const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
|
164
163
|
await ((_b = this._grid) === null || _b === void 0 ? void 0 : _b.getColumnsState().then(this.buildColumnsMetadata.bind(this, columnsMetadata)));
|
@@ -180,7 +179,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
180
179
|
},
|
181
180
|
getSelectedNumber: () => {
|
182
181
|
var _a, _b;
|
183
|
-
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.
|
182
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
|
184
183
|
},
|
185
184
|
getTotalRecords: () => {
|
186
185
|
var _a, _b, _c;
|
@@ -191,7 +190,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
191
190
|
return selectedIDs || [];
|
192
191
|
},
|
193
192
|
getOffset: () => {
|
194
|
-
return this.getExporterOffset(
|
193
|
+
return this.getExporterOffset(this.getPaginationInfo());
|
195
194
|
},
|
196
195
|
getLimit: () => {
|
197
196
|
var _a;
|
@@ -233,10 +232,23 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
233
232
|
}
|
234
233
|
this.loadConfig();
|
235
234
|
}
|
235
|
+
getHeaderDisabledButtons() {
|
236
|
+
var _a;
|
237
|
+
const disabledButtons = [];
|
238
|
+
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
239
|
+
if (this._dataState.selectionInfo.length > 1) {
|
240
|
+
disabledButtons.push("CLONE");
|
241
|
+
}
|
242
|
+
if (this._dataState.selectionInfo.isAllRecords()) {
|
243
|
+
disabledButtons.push("REMOVE");
|
244
|
+
}
|
245
|
+
}
|
246
|
+
return disabledButtons;
|
247
|
+
}
|
236
248
|
componentWillRender() {
|
237
249
|
const invisibleButtons = this._dataUnit && this._dataUnit.records.length > 0 ? [] : ["DATA_EXPORTER"];
|
238
|
-
const headerTaskbarId = this._dataState && this._dataState.
|
239
|
-
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState,
|
250
|
+
const headerTaskbarId = this._dataState && this._dataState.selectionInfo.isEmpty() ? "snkGridHeaderTaskbar.unselected" : "snkGridHeaderTaskbar.selected";
|
251
|
+
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState, this.getHeaderDisabledButtons(), invisibleButtons);
|
240
252
|
this._topTaskbarProcessor.process(this.getTopTaskBarId(this.presentationMode === PresentationMode.SECONDARY ? ".secondary" : ""), this.taskbarManager, this._dataState, undefined, invisibleButtons);
|
241
253
|
this.dataExporterProviderStore();
|
242
254
|
}
|
@@ -129,13 +129,13 @@ const SnkSimpleCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
129
129
|
this.__registerHost();
|
130
130
|
this.dataStateChange = createEvent(this, "dataStateChange", 3);
|
131
131
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
132
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER"];
|
133
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
132
|
+
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
|
133
|
+
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
|
134
134
|
this._taskbarProcessor = new TaskbarProcessor({
|
135
|
-
"snkSimpleCrudTaskbar.form_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.GRID_MODE),
|
136
|
-
"snkSimpleCrudTaskbar.grid_regular": this.REGULAR_DEFAULT_BTNS.concat(TaskbarElement.FORM_MODE),
|
137
|
-
"snkSimpleCrudTaskbar.form_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.GRID_MODE),
|
138
|
-
"snkSimpleCrudTaskbar.grid_selected": this.REGULAR_SELECTED_BTNS.concat(TaskbarElement.FORM_MODE),
|
135
|
+
"snkSimpleCrudTaskbar.form_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.GRID_MODE),
|
136
|
+
"snkSimpleCrudTaskbar.grid_regular": this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(TaskbarElement.FORM_MODE),
|
137
|
+
"snkSimpleCrudTaskbar.form_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(TaskbarElement.GRID_MODE),
|
138
|
+
"snkSimpleCrudTaskbar.grid_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(TaskbarElement.FORM_MODE),
|
139
139
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
140
140
|
});
|
141
141
|
this._currentViewMode = VIEW_MODE.GRID;
|
@@ -145,6 +145,13 @@ const SnkSimpleCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
145
145
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
146
146
|
this.taskbarManager = undefined;
|
147
147
|
}
|
148
|
+
resolveInMemoryBtns(taskbarButtons) {
|
149
|
+
const newTaskBarConfig = [...taskbarButtons];
|
150
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
151
|
+
newTaskBarConfig.splice(1, 1);
|
152
|
+
}
|
153
|
+
return newTaskBarConfig;
|
154
|
+
}
|
148
155
|
/**
|
149
156
|
* Usado para alternar a visão entre GRID e FORM externamente.
|
150
157
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
|
2
2
|
import { c as createCommonjsModule } from './_commonjsHelpers.js';
|
3
3
|
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
4
|
-
import { C as CONFIG_EVENTS,
|
4
|
+
import { C as CONFIG_EVENTS, c as KEY_EVENTS, d as TYPE_ACTIONS, b as TAB_NAMES } from './constants.js';
|
5
5
|
|
6
6
|
var draggable_bundle = createCommonjsModule(function (module, exports) {
|
7
7
|
(function webpackUniversalModuleDefinition(root, factory) {
|
@@ -6,7 +6,7 @@ class TaskbarProcessor {
|
|
6
6
|
var _a;
|
7
7
|
this.customButtons = new Map();
|
8
8
|
this.buttons = "";
|
9
|
-
this.disabledButtons = [];
|
9
|
+
this.disabledButtons = [].concat(disabledButtons);
|
10
10
|
(_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
|
11
11
|
let buttonName;
|
12
12
|
if (typeof btnDef === "string") {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
const REPORT_LAUNCHER_RESOURCE_ID = "br.com.sankhya.controls.ReportLauncher";
|
2
2
|
const KEY_PORT_EXPORT = "global.porta.app.impressao";
|
3
|
-
const ALL_RECORD = "ALL_RECORD";
|
4
3
|
var VIEW_MODE;
|
5
4
|
(function (VIEW_MODE) {
|
6
5
|
VIEW_MODE[VIEW_MODE["GRID"] = 0] = "GRID";
|
@@ -99,4 +98,4 @@ var SIMPLE_CRUD_MODE;
|
|
99
98
|
SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
|
100
99
|
})(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
|
101
100
|
|
102
|
-
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TAB_NAMES as T, VARS_BY_TYPE as V, WEB_CONNECTION as W, TAGS_BY_TYPE as a, TYPE_ACTIONS as b, VIEW_MODE as c, KEY_PORT_EXPORT as d
|
101
|
+
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TAB_NAMES as T, VARS_BY_TYPE as V, WEB_CONNECTION as W, TAGS_BY_TYPE as a, TYPE_ACTIONS as b, VIEW_MODE as c, KEY_PORT_EXPORT as d };
|