@sankhyalabs/sankhyablocks 8.16.0-dev.44 → 8.16.0-dev.46
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +25 -22
- package/dist/cjs/snk-application.cjs.entry.js +10 -0
- package/dist/cjs/snk-crud.cjs.entry.js +8 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/{snk-data-unit-3d4d0e2a.js → snk-data-unit-3d9b6ed4.js} +25 -13
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +10 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -4
- package/dist/cjs/snk-taskbar.cjs.entry.js +37 -35
- package/dist/collection/components/snk-actions-button/interfaces/index.js +1 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
- package/dist/collection/components/snk-application/snk-application.js +41 -1
- package/dist/collection/components/snk-crud/snk-crud.js +26 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +25 -13
- package/dist/collection/components/snk-grid/snk-grid.js +28 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +25 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -36
- package/dist/components/snk-actions-button2.js +27 -26
- package/dist/components/snk-application2.js +12 -1
- package/dist/components/snk-crud.js +9 -2
- package/dist/components/snk-data-unit2.js +25 -13
- package/dist/components/snk-grid2.js +11 -2
- package/dist/components/snk-simple-crud2.js +8 -4
- package/dist/components/snk-taskbar2.js +38 -36
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +26 -23
- package/dist/esm/snk-application.entry.js +11 -1
- package/dist/esm/snk-crud.entry.js +8 -2
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/{snk-data-unit-618e0b80.js → snk-data-unit-9fa7d2b9.js} +25 -13
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +10 -2
- package/dist/esm/snk-simple-crud.entry.js +7 -4
- package/dist/esm/snk-taskbar.entry.js +38 -36
- package/dist/sankhyablocks/{p-c1adf0dd.entry.js → p-0d2a2e9e.entry.js} +1 -1
- package/dist/sankhyablocks/p-200a5481.entry.js +11 -0
- package/dist/sankhyablocks/p-342eeb3b.js +1 -0
- package/dist/sankhyablocks/p-4e1f992e.entry.js +1 -0
- package/dist/sankhyablocks/p-520c7c38.entry.js +1 -0
- package/dist/sankhyablocks/{p-9c3138f5.entry.js → p-7075b789.entry.js} +1 -1
- package/dist/sankhyablocks/p-83e71703.entry.js +1 -0
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +1 -0
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
- package/dist/types/components/snk-application/snk-application.d.ts +6 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -0
- package/dist/types/components.d.ts +22 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
- package/dist/sankhyablocks/p-1dbd5c18.entry.js +0 -1
- package/dist/sankhyablocks/p-2aae03a1.entry.js +0 -1
- package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
- package/dist/sankhyablocks/p-a75e9dcc.js +0 -1
- package/dist/sankhyablocks/p-da87e42c.entry.js +0 -11
- package/dist/sankhyablocks/p-f0aaad2b.entry.js +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME } from '@sankhyalabs/core';
|
1
|
+
import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME, LockManager, LockManagerOperation } from '@sankhyalabs/core';
|
2
2
|
import { h, Host } from '@stencil/core';
|
3
3
|
import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
|
4
4
|
import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
|
@@ -149,42 +149,44 @@ export class SnkTaskbar {
|
|
149
149
|
return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
|
150
150
|
}
|
151
151
|
elementClick(elem) {
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
this._isWaitingForSave
|
178
|
-
|
179
|
-
.
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
152
|
+
LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
|
153
|
+
if (this.dataUnit) {
|
154
|
+
switch (elem) {
|
155
|
+
case TaskbarElement.PREVIOUS:
|
156
|
+
this.dataUnit.previousRecord();
|
157
|
+
break;
|
158
|
+
case TaskbarElement.NEXT:
|
159
|
+
this.dataUnit.nextRecord();
|
160
|
+
break;
|
161
|
+
case TaskbarElement.REFRESH:
|
162
|
+
this.dataUnit.loadData();
|
163
|
+
break;
|
164
|
+
case TaskbarElement.CLONE:
|
165
|
+
this.dataUnit.copySelected();
|
166
|
+
break;
|
167
|
+
case TaskbarElement.REMOVE:
|
168
|
+
this.dataUnit.removeSelectedRecords();
|
169
|
+
break;
|
170
|
+
case TaskbarElement.INSERT:
|
171
|
+
this.dataUnit.addRecord();
|
172
|
+
break;
|
173
|
+
case TaskbarElement.CANCEL:
|
174
|
+
this.dataUnit.cancelEdition();
|
175
|
+
break;
|
176
|
+
case TaskbarElement.SAVE:
|
177
|
+
if (!this._isWaitingForSave) {
|
178
|
+
this._isWaitingForSave = true;
|
179
|
+
this.dataUnit.saveData()
|
180
|
+
.finally(() => {
|
181
|
+
this._isWaitingForSave = false;
|
182
|
+
});
|
183
|
+
}
|
184
|
+
break;
|
185
|
+
}
|
184
186
|
}
|
185
|
-
|
186
|
-
|
187
|
-
|
187
|
+
if (this.isEnabled(elem))
|
188
|
+
this.actionClick.emit(elem);
|
189
|
+
});
|
188
190
|
}
|
189
191
|
isEnabled(elem) {
|
190
192
|
if (!this.isAllowed(elem)) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ServiceUtils, StorageType, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { D as DataFetcher } from './DataFetcher.js';
|
4
4
|
import { P as ParamType } from './ParamType.js';
|
5
5
|
import './pesquisa-fetcher.js';
|
@@ -598,6 +598,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
598
598
|
super();
|
599
599
|
this.__registerHost();
|
600
600
|
this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
|
601
|
+
this._actions = [];
|
601
602
|
this.handleClick = (evt) => {
|
602
603
|
const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
|
603
604
|
const executor = new ExecutorFactory(selectedAction.type).executor;
|
@@ -607,27 +608,22 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
607
608
|
};
|
608
609
|
this._items = [];
|
609
610
|
this._showDropdown = false;
|
610
|
-
this._actions = [];
|
611
|
-
this._isOrderActions = false;
|
612
611
|
}
|
613
612
|
async getActions() {
|
614
|
-
|
615
|
-
param: {
|
616
|
-
entityName: this._entityName,
|
617
|
-
resourceID: this._resourceID
|
618
|
-
}
|
619
|
-
};
|
620
|
-
return DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param).then((result) => {
|
613
|
+
const actions = await ServiceUtils.useCacheWithService(`SnkActionsButton_${this._entityName}-${this._resourceID}`, async () => {
|
621
614
|
var _a;
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
});
|
615
|
+
const param = {
|
616
|
+
param: {
|
617
|
+
entityName: this._entityName,
|
618
|
+
resourceID: this._resourceID,
|
619
|
+
},
|
620
|
+
};
|
621
|
+
const result = await DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param);
|
622
|
+
return ((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action) || [];
|
623
|
+
}, StorageType.IN_MEMORY_CACHE);
|
624
|
+
this._actions = SnkActionsButton.parameters.isOrderActions
|
625
|
+
? ArrayUtils.sortAlphabetically(actions, 'description')
|
626
|
+
: actions;
|
631
627
|
}
|
632
628
|
controlDropdown() {
|
633
629
|
this._showDropdown = !this._showDropdown;
|
@@ -660,7 +656,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
660
656
|
}
|
661
657
|
async componentWillLoad() {
|
662
658
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
663
|
-
|
659
|
+
await this.loadParameters();
|
664
660
|
const snkDataUnit = this._element.parentElement;
|
665
661
|
this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
|
666
662
|
this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
|
@@ -669,9 +665,8 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
669
665
|
this._resourceID = await ResourceIDUtils.getResourceID();
|
670
666
|
}
|
671
667
|
this.setEvents();
|
672
|
-
this.getActions()
|
673
|
-
|
674
|
-
});
|
668
|
+
await this.getActions();
|
669
|
+
this.loadItems();
|
675
670
|
}
|
676
671
|
async componentDidLoad() {
|
677
672
|
if (!this._element)
|
@@ -698,6 +693,11 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
698
693
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
699
694
|
};
|
700
695
|
}
|
696
|
+
async loadParameters() {
|
697
|
+
if (SnkActionsButton.parameters.isOrderActions != null)
|
698
|
+
return;
|
699
|
+
SnkActionsButton.parameters.isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
|
700
|
+
}
|
701
701
|
render() {
|
702
702
|
return (h(Host, null, (this._actions && this._actions.length > 0) &&
|
703
703
|
(h("div", { class: `ez-padding-left--medium snk-actions-button
|
@@ -713,10 +713,11 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
713
713
|
static get style() { return snkActionsButtonCss; }
|
714
714
|
}, [2, "snk-actions-button", {
|
715
715
|
"_items": [32],
|
716
|
-
"_showDropdown": [32]
|
717
|
-
"_actions": [32],
|
718
|
-
"_isOrderActions": [32]
|
716
|
+
"_showDropdown": [32]
|
719
717
|
}]);
|
718
|
+
SnkActionsButton.parameters = {
|
719
|
+
isOrderActions: null
|
720
|
+
};
|
720
721
|
function defineCustomElement() {
|
721
722
|
if (typeof customElements === "undefined") {
|
722
723
|
return;
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
|
7
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
7
|
+
import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher.js';
|
8
8
|
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
10
10
|
import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
|
@@ -869,6 +869,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
869
869
|
async isLoadedByPk() {
|
870
870
|
return Promise.resolve(this._isLoadedByPk);
|
871
871
|
}
|
872
|
+
/**
|
873
|
+
* Remove registro do cache do PreLoader do dataunit.
|
874
|
+
* Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
|
875
|
+
*/
|
876
|
+
async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
|
877
|
+
const records = recordsIDs.map(id => {
|
878
|
+
return { "__record__id__": id };
|
879
|
+
});
|
880
|
+
PreloadManager.removeRecords(dataUnit, records);
|
881
|
+
}
|
872
882
|
async getAuthList(auth) {
|
873
883
|
return await (new MGEAuthorization()).parseFromJSON(auth);
|
874
884
|
}
|
@@ -1407,6 +1417,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1407
1417
|
"info": [64],
|
1408
1418
|
"loadTotals": [64],
|
1409
1419
|
"isLoadedByPk": [64],
|
1420
|
+
"preloadMangerRemoveRecord": [64],
|
1410
1421
|
"executeSearch": [64],
|
1411
1422
|
"executePreparedSearch": [64],
|
1412
1423
|
"isDebugMode": [64],
|
@@ -83,6 +83,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
83
83
|
this.enableGridInsert = false;
|
84
84
|
this.domainMessagesBuilder = undefined;
|
85
85
|
this.ignoreReadOnlyFormFields = undefined;
|
86
|
+
this.enableLockManger = false;
|
86
87
|
this.setCustomFormTitle = undefined;
|
87
88
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
88
89
|
}
|
@@ -323,11 +324,16 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
323
324
|
if (!isDocumentBody)
|
324
325
|
element.focus();
|
325
326
|
}
|
327
|
+
async function handleAddRecord() {
|
328
|
+
if (!dataUnit.hasNewRecord()) {
|
329
|
+
dataUnit.addRecord();
|
330
|
+
}
|
331
|
+
}
|
326
332
|
keyboardManager
|
327
333
|
.bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
|
328
334
|
.bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
329
335
|
.bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
330
|
-
.bind("F8",
|
336
|
+
.bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
|
331
337
|
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
332
338
|
.bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
333
339
|
.bind("ctrl + .", () => {
|
@@ -424,7 +430,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
424
430
|
return;
|
425
431
|
}
|
426
432
|
this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
|
427
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
433
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
428
434
|
}
|
429
435
|
get _element() { return this; }
|
430
436
|
static get watchers() { return {
|
@@ -453,6 +459,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
453
459
|
"enableGridInsert": [4, "enable-grid-insert"],
|
454
460
|
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
455
461
|
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
462
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
456
463
|
"setCustomFormTitle": [16],
|
457
464
|
"_dataUnit": [32],
|
458
465
|
"_dataState": [32],
|
@@ -24,7 +24,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
24
24
|
this._rowMetadataCache = new Map();
|
25
25
|
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
26
26
|
this._dataUnitObserver = async (action) => {
|
27
|
-
const duState = this.buildDataState(action.type);
|
27
|
+
const duState = await this.buildDataState(action.type);
|
28
28
|
this.dataState = duState;
|
29
29
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
30
30
|
switch (action.type) {
|
@@ -136,14 +136,22 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
136
136
|
async getRowMetadata(record) {
|
137
137
|
return this.doGetRowMetadata(record);
|
138
138
|
}
|
139
|
-
doGetRowMetadata(record) {
|
139
|
+
async doGetRowMetadata(record) {
|
140
140
|
const selectedRecord = this.dataUnit.getSelectedRecord();
|
141
141
|
if (!record && !selectedRecord) {
|
142
142
|
return;
|
143
143
|
}
|
144
144
|
const currentRecord = record || selectedRecord;
|
145
145
|
const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
|
146
|
-
|
146
|
+
let rowMetadata = this._metadataByRow.get(recordId);
|
147
|
+
/*
|
148
|
+
Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
|
149
|
+
muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
|
150
|
+
corretos nao confiando apenas no _metadataByRow
|
151
|
+
*/
|
152
|
+
if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
|
153
|
+
rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
|
154
|
+
}
|
147
155
|
if (!rowMetadata) {
|
148
156
|
return;
|
149
157
|
}
|
@@ -337,7 +345,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
337
345
|
case Action.RECORDS_COPIED:
|
338
346
|
return this.interceptRecordsCopied(action);
|
339
347
|
case Action.DATA_CHANGED:
|
340
|
-
await this.handleLoadRowMetadata(action);
|
348
|
+
await this.handleLoadRowMetadata(action.payload);
|
341
349
|
return await this.interceptDataChange(action);
|
342
350
|
case Action.CHANGING_DATA:
|
343
351
|
return await this.interceptDataChange(action);
|
@@ -357,8 +365,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
357
365
|
return action;
|
358
366
|
}
|
359
367
|
}
|
360
|
-
async handleLoadRowMetadata(
|
361
|
-
|
368
|
+
async handleLoadRowMetadata(record) {
|
369
|
+
if (!record)
|
370
|
+
return;
|
362
371
|
const keysPayload = Object.keys(record);
|
363
372
|
const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
|
364
373
|
if (rmpField) {
|
@@ -437,7 +446,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
437
446
|
isAllowed(flag) {
|
438
447
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
439
448
|
}
|
440
|
-
buildDataState(actionType) {
|
449
|
+
async buildDataState(actionType) {
|
441
450
|
var _a;
|
442
451
|
const selectionInfo = this.dataUnit.getSelectionInfo();
|
443
452
|
const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
|
@@ -445,7 +454,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
445
454
|
let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
|
446
455
|
const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
|
447
456
|
if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
|
448
|
-
rowMetadata = this.doGetRowMetadata(selectedRecord);
|
457
|
+
rowMetadata = await this.doGetRowMetadata(selectedRecord);
|
449
458
|
}
|
450
459
|
else if (rowMetadata) {
|
451
460
|
rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
|
@@ -467,17 +476,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
467
476
|
});
|
468
477
|
}
|
469
478
|
async handleDataSaved(action) {
|
470
|
-
|
479
|
+
var _a, _b, _c;
|
480
|
+
const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
|
471
481
|
if (newRowMetadata) {
|
472
482
|
newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
|
473
483
|
}
|
474
484
|
const recordId = action.payload.records[0].__record__id__;
|
475
485
|
this._metadataByRow.set(recordId, newRowMetadata);
|
476
|
-
this.dataState = this.buildDataState();
|
477
|
-
|
486
|
+
this.dataState = await this.buildDataState();
|
487
|
+
let saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
488
|
+
if (saveOperation == 'copy')
|
489
|
+
saveOperation = OperationMap.CLONE;
|
490
|
+
if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
|
478
491
|
return;
|
479
492
|
}
|
480
|
-
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
481
493
|
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
482
494
|
if (msg != undefined) {
|
483
495
|
this.showSuccessMessage(msg);
|
@@ -570,7 +582,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
570
582
|
const { records } = this.getMetadataByRow(this.dataUnit);
|
571
583
|
this.dataUnit.records = records;
|
572
584
|
}
|
573
|
-
this.dataState = this.buildDataState();
|
585
|
+
this.dataState = await this.buildDataState();
|
574
586
|
let resolver;
|
575
587
|
while (resolver = this._onDataUnitResolve.pop()) {
|
576
588
|
resolver(this.dataUnit);
|
@@ -153,6 +153,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
153
153
|
this.autoLoad = undefined;
|
154
154
|
this.autoFocus = true;
|
155
155
|
this.enableGridInsert = false;
|
156
|
+
this.enableLockManger = false;
|
156
157
|
}
|
157
158
|
/**
|
158
159
|
* Exibe a janela de configurações da grade.
|
@@ -240,10 +241,17 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
240
241
|
this._grid.setFocus();
|
241
242
|
}
|
242
243
|
async handleClick(event) {
|
244
|
+
var _a;
|
243
245
|
if (this.hasToBlockEvent(event)) {
|
244
246
|
event.preventDefault();
|
245
247
|
event.stopPropagation();
|
246
|
-
await this._dataUnit.cancelEdition()
|
248
|
+
if (!await this._dataUnit.cancelEdition())
|
249
|
+
return;
|
250
|
+
const newEvent = new event.constructor(event.type, event);
|
251
|
+
(_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
|
252
|
+
}
|
253
|
+
if (this._grid && !this._grid.contains(event.target)) {
|
254
|
+
this._grid.stopEdit();
|
247
255
|
}
|
248
256
|
}
|
249
257
|
hasToBlockEvent(event) {
|
@@ -534,7 +542,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
534
542
|
return undefined;
|
535
543
|
}
|
536
544
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
|
537
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), 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(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
545
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), 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(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
538
546
|
}
|
539
547
|
get _element() { return this; }
|
540
548
|
static get watchers() { return {
|
@@ -566,6 +574,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
566
574
|
"autoLoad": [4, "auto-load"],
|
567
575
|
"autoFocus": [4, "auto-focus"],
|
568
576
|
"enableGridInsert": [4, "enable-grid-insert"],
|
577
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
569
578
|
"_dataUnit": [32],
|
570
579
|
"_dataState": [32],
|
571
580
|
"_gridConfig": [32],
|
@@ -123,6 +123,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
123
123
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
124
124
|
this.gridConfig = undefined;
|
125
125
|
this.formConfig = undefined;
|
126
|
+
this.enableLockManger = false;
|
126
127
|
this._formFields = [];
|
127
128
|
this._fieldsProps = new Map();
|
128
129
|
this._enableContinuousInsert = true;
|
@@ -807,16 +808,18 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
807
808
|
return;
|
808
809
|
this.goToView(VIEW_MODE.FORM);
|
809
810
|
}
|
811
|
+
renderTaskbarContent() {
|
812
|
+
var _a;
|
813
|
+
return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
814
|
+
}
|
810
815
|
/* istanbul ignore next */
|
811
816
|
render() {
|
812
|
-
var _a;
|
813
817
|
if (this.dataUnit == undefined) {
|
814
818
|
return;
|
815
819
|
}
|
816
|
-
|
817
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
820
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
818
821
|
? undefined
|
819
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert
|
822
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
820
823
|
}
|
821
824
|
get _element() { return this; }
|
822
825
|
static get watchers() { return {
|
@@ -835,6 +838,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
835
838
|
"mode": [2],
|
836
839
|
"gridConfig": [1040],
|
837
840
|
"formConfig": [1040],
|
841
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
838
842
|
"multipleSelection": [4, "multiple-selection"],
|
839
843
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
840
844
|
"pageSize": [2, "page-size"],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
2
|
-
import { Action, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { Action, LockManager, LockManagerOperation, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
4
4
|
import { P as PresentationMode } from './ISave.js';
|
5
5
|
import { s as store } from './index2.js';
|
@@ -273,42 +273,44 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
273
273
|
return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
|
274
274
|
}
|
275
275
|
elementClick(elem) {
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
this._isWaitingForSave
|
302
|
-
|
303
|
-
.
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
276
|
+
LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
|
277
|
+
if (this.dataUnit) {
|
278
|
+
switch (elem) {
|
279
|
+
case TaskbarElement.PREVIOUS:
|
280
|
+
this.dataUnit.previousRecord();
|
281
|
+
break;
|
282
|
+
case TaskbarElement.NEXT:
|
283
|
+
this.dataUnit.nextRecord();
|
284
|
+
break;
|
285
|
+
case TaskbarElement.REFRESH:
|
286
|
+
this.dataUnit.loadData();
|
287
|
+
break;
|
288
|
+
case TaskbarElement.CLONE:
|
289
|
+
this.dataUnit.copySelected();
|
290
|
+
break;
|
291
|
+
case TaskbarElement.REMOVE:
|
292
|
+
this.dataUnit.removeSelectedRecords();
|
293
|
+
break;
|
294
|
+
case TaskbarElement.INSERT:
|
295
|
+
this.dataUnit.addRecord();
|
296
|
+
break;
|
297
|
+
case TaskbarElement.CANCEL:
|
298
|
+
this.dataUnit.cancelEdition();
|
299
|
+
break;
|
300
|
+
case TaskbarElement.SAVE:
|
301
|
+
if (!this._isWaitingForSave) {
|
302
|
+
this._isWaitingForSave = true;
|
303
|
+
this.dataUnit.saveData()
|
304
|
+
.finally(() => {
|
305
|
+
this._isWaitingForSave = false;
|
306
|
+
});
|
307
|
+
}
|
308
|
+
break;
|
309
|
+
}
|
308
310
|
}
|
309
|
-
|
310
|
-
|
311
|
-
|
311
|
+
if (this.isEnabled(elem))
|
312
|
+
this.actionClick.emit(elem);
|
313
|
+
});
|
312
314
|
}
|
313
315
|
isEnabled(elem) {
|
314
316
|
if (!this.isAllowed(elem)) {
|