@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-60626.0 → 0.0.0-bugfix-dev-kb-63645.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkFormConfigManager-52f99b4d.js → SnkFormConfigManager-1b13bacd.js} +6 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +36 -17
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +2 -1
- package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -1
- package/dist/cjs/{snk-guides-viewer-5d5f0f25.js → snk-guides-viewer-0c42fd4a.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -2
- package/dist/cjs/snk-taskbar.cjs.entry.js +21 -1
- package/dist/collection/components/snk-attach/snk-attach.js +39 -17
- package/dist/collection/components/snk-configurator/snk-configurator.js +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +20 -1
- package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.css +1 -1
- package/dist/collection/components/snk-form/snk-form.js +1 -1
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -3
- package/dist/collection/components/snk-grid/snk-grid.js +20 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +20 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +24 -2
- package/dist/components/SnkFormConfigManager.js +6 -3
- package/dist/components/snk-attach2.js +36 -17
- package/dist/components/snk-configurator2.js +1 -1
- package/dist/components/snk-crud.js +3 -1
- package/dist/components/snk-custom-slot-elements.js +1 -1
- package/dist/components/snk-form.js +1 -1
- package/dist/components/snk-grid2.js +3 -1
- package/dist/components/snk-simple-crud2.js +3 -1
- package/dist/components/snk-taskbar2.js +24 -3
- package/dist/esm/{SnkFormConfigManager-5b0d69cd.js → SnkFormConfigManager-d4554df9.js} +6 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-attach.entry.js +36 -17
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +2 -1
- package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +2 -1
- package/dist/esm/{snk-guides-viewer-ef8c4eec.js → snk-guides-viewer-ef3763df.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +3 -2
- package/dist/esm/snk-taskbar.entry.js +22 -2
- package/dist/sankhyablocks/{p-96f1fdf8.entry.js → p-039c7148.entry.js} +1 -1
- package/dist/sankhyablocks/p-04821c60.entry.js +1 -0
- package/dist/sankhyablocks/p-11a4d155.entry.js +1 -0
- package/dist/sankhyablocks/{p-6fc4feb6.entry.js → p-21a81901.entry.js} +1 -1
- package/dist/sankhyablocks/p-3f1efb97.entry.js +1 -0
- package/dist/sankhyablocks/p-58687027.entry.js +1 -0
- package/dist/sankhyablocks/{p-2ac8bd11.entry.js → p-61eb8397.entry.js} +1 -1
- package/dist/sankhyablocks/{p-294df368.entry.js → p-6aac74e6.entry.js} +1 -1
- package/dist/sankhyablocks/p-7663f597.entry.js +1 -0
- package/dist/sankhyablocks/p-829d4045.js +1 -0
- package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
- package/dist/sankhyablocks/{p-d26365ad.js → p-e4bfe062.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- 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 +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +2 -0
- package/dist/types/components.d.ts +24 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-034c0efb.entry.js +0 -1
- package/dist/sankhyablocks/p-060fdb6c.js +0 -1
- package/dist/sankhyablocks/p-0c846b5a.entry.js +0 -1
- package/dist/sankhyablocks/p-32062be4.entry.js +0 -1
- package/dist/sankhyablocks/p-3d0cc5c0.entry.js +0 -1
- package/dist/sankhyablocks/p-5f74c859.entry.js +0 -1
- package/dist/sankhyablocks/p-e90c9992.entry.js +0 -1
|
@@ -35,6 +35,18 @@ const SnkTaskbar = class {
|
|
|
35
35
|
[taskbarElements.TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
|
|
36
36
|
[taskbarElements.TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
|
|
37
37
|
};
|
|
38
|
+
this.onSaveEvent = (action) => {
|
|
39
|
+
switch (action.type) {
|
|
40
|
+
case core.Action.FIELD_INVALIDATED:
|
|
41
|
+
case core.Action.DATA_SAVED:
|
|
42
|
+
case core.Action.SAVING_ERROR:
|
|
43
|
+
this._isWaitingForSave = false;
|
|
44
|
+
break;
|
|
45
|
+
case core.Action.SAVING_DATA:
|
|
46
|
+
this._isWaitingForSave = true;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
38
50
|
this._permissions = undefined;
|
|
39
51
|
this._overFlowedElements = [];
|
|
40
52
|
this._customElements = undefined;
|
|
@@ -43,6 +55,7 @@ const SnkTaskbar = class {
|
|
|
43
55
|
this._hiddenActionsList = [];
|
|
44
56
|
this._lastWidth = undefined;
|
|
45
57
|
this._hasToUpdateOverFlow = false;
|
|
58
|
+
this._isWaitingForSave = false;
|
|
46
59
|
this.alignRigth = false;
|
|
47
60
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
48
61
|
this.customContainerId = undefined;
|
|
@@ -149,7 +162,13 @@ const SnkTaskbar = class {
|
|
|
149
162
|
this.dataUnit.cancelEdition();
|
|
150
163
|
break;
|
|
151
164
|
case taskbarElements.TaskbarElement.SAVE:
|
|
152
|
-
this.
|
|
165
|
+
if (!this._isWaitingForSave) {
|
|
166
|
+
this._isWaitingForSave = true;
|
|
167
|
+
this.dataUnit.saveData()
|
|
168
|
+
.finally(() => {
|
|
169
|
+
this._isWaitingForSave = false;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
153
172
|
break;
|
|
154
173
|
}
|
|
155
174
|
}
|
|
@@ -348,6 +367,7 @@ const SnkTaskbar = class {
|
|
|
348
367
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
349
368
|
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
350
369
|
this.handleOverFlowStrategy();
|
|
370
|
+
this.dataUnit.subscribe(this.onSaveEvent);
|
|
351
371
|
}
|
|
352
372
|
componentDidRender() {
|
|
353
373
|
this.appendCustomElementsInTaskbar();
|
|
@@ -40,9 +40,22 @@ export class SnkAttach {
|
|
|
40
40
|
this._currentDataUnit = undefined;
|
|
41
41
|
this.crudConfig = undefined;
|
|
42
42
|
}
|
|
43
|
+
async registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
|
44
|
+
var _a;
|
|
45
|
+
if (this._currentDataUnit == null) {
|
|
46
|
+
this.loadAttachmentDataUnit();
|
|
47
|
+
}
|
|
48
|
+
if (oldRegisterKey !== newRegisterKey) {
|
|
49
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
async initAttach() {
|
|
44
53
|
var _a, _b, _c, _d, _e, _f;
|
|
45
|
-
|
|
54
|
+
if (!this.fetcherType && !this.registerKey)
|
|
55
|
+
return;
|
|
56
|
+
if (!this.fetcherType) {
|
|
57
|
+
this.fetcherType = "AnexoSistema";
|
|
58
|
+
}
|
|
46
59
|
this.returnToGridMode();
|
|
47
60
|
if (this.fetcherType === "AnexoSistema") {
|
|
48
61
|
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
@@ -55,7 +68,8 @@ export class SnkAttach {
|
|
|
55
68
|
if (hasMoreOneItem)
|
|
56
69
|
return;
|
|
57
70
|
}
|
|
58
|
-
|
|
71
|
+
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata());
|
|
72
|
+
await ((_f = this._currentDataUnit) === null || _f === void 0 ? void 0 : _f.loadData(undefined, undefined, true, this.registerKey));
|
|
59
73
|
}
|
|
60
74
|
/**
|
|
61
75
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -94,14 +108,14 @@ export class SnkAttach {
|
|
|
94
108
|
if (this._crudElement)
|
|
95
109
|
this._crudElement.goToView(VIEW_MODE.GRID);
|
|
96
110
|
}
|
|
97
|
-
loadAttachmentDataUnit() {
|
|
111
|
+
async loadAttachmentDataUnit() {
|
|
98
112
|
try {
|
|
99
113
|
switch (this.fetcherType) {
|
|
100
114
|
case "AnexoSistema":
|
|
101
|
-
this.loadAnexoSistema();
|
|
115
|
+
await this.loadAnexoSistema();
|
|
102
116
|
break;
|
|
103
117
|
case "Attach":
|
|
104
|
-
this.loadAttach();
|
|
118
|
+
await this.loadAttach();
|
|
105
119
|
break;
|
|
106
120
|
default:
|
|
107
121
|
this._currentFetcher = this.fetcher;
|
|
@@ -113,12 +127,13 @@ export class SnkAttach {
|
|
|
113
127
|
throw new Error('There was an error while creating the data unit');
|
|
114
128
|
}
|
|
115
129
|
}
|
|
116
|
-
loadAnexoSistema() {
|
|
117
|
-
|
|
130
|
+
async loadAnexoSistema() {
|
|
131
|
+
var _a, _b, _c;
|
|
132
|
+
this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
133
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
118
134
|
if (!this._currentDataUnit.metadata) {
|
|
119
|
-
this._currentDataUnit
|
|
120
|
-
|
|
121
|
-
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
|
135
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata());
|
|
136
|
+
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
|
122
137
|
}
|
|
123
138
|
this.initDataUnitLoaders();
|
|
124
139
|
this._currentDataUnit.addFilterProvider({
|
|
@@ -127,10 +142,12 @@ export class SnkAttach {
|
|
|
127
142
|
this._currentDataUnit.addInterceptor({
|
|
128
143
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
|
129
144
|
});
|
|
130
|
-
this._currentDataUnit.loadData()
|
|
145
|
+
await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
|
|
146
|
+
this.disableEditFieldsNotInForm();
|
|
131
147
|
}
|
|
132
|
-
loadAttach() {
|
|
148
|
+
async loadAttach() {
|
|
133
149
|
var _a, _b;
|
|
150
|
+
this._currentFetcher = new AttachFetcher();
|
|
134
151
|
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
135
152
|
this.initDataUnitLoaders();
|
|
136
153
|
this._currentDataUnit.addInterceptor({
|
|
@@ -144,11 +161,10 @@ export class SnkAttach {
|
|
|
144
161
|
}
|
|
145
162
|
});
|
|
146
163
|
if (!this._currentDataUnit.metadata) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
164
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
165
|
+
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
166
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData(undefined, undefined, true, this.registerKey));
|
|
167
|
+
this.disableEditFieldsNotInForm();
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
170
|
initDataUnitLoaders() {
|
|
@@ -384,4 +400,10 @@ export class SnkAttach {
|
|
|
384
400
|
}
|
|
385
401
|
}];
|
|
386
402
|
}
|
|
403
|
+
static get watchers() {
|
|
404
|
+
return [{
|
|
405
|
+
"propName": "registerKey",
|
|
406
|
+
"methodName": "registerKeyWatcher"
|
|
407
|
+
}];
|
|
408
|
+
}
|
|
387
409
|
}
|
|
@@ -87,7 +87,7 @@ export class SnkConfigurator {
|
|
|
87
87
|
const customElements = container === null || container === void 0 ? void 0 : container.querySelector('#SnkConfigContainerSlot');
|
|
88
88
|
if (!customElements)
|
|
89
89
|
return;
|
|
90
|
-
const configuratorCustomElement = customElements.
|
|
90
|
+
const configuratorCustomElement = customElements.firstElementChild;
|
|
91
91
|
if (!configuratorCustomElement)
|
|
92
92
|
return;
|
|
93
93
|
const insideCustomElementsContainer = this._element.querySelector("#slotContainer");
|
|
@@ -38,6 +38,7 @@ export class SnkCrud {
|
|
|
38
38
|
this.formLegacyConfigName = undefined;
|
|
39
39
|
this.disablePersonalizedFilter = undefined;
|
|
40
40
|
this.autoLoad = undefined;
|
|
41
|
+
this.autoFocus = true;
|
|
41
42
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -375,7 +376,7 @@ export class SnkCrud {
|
|
|
375
376
|
return;
|
|
376
377
|
}
|
|
377
378
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
378
|
-
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 }, 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 }, 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" }))));
|
|
379
|
+
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 }, 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 }, 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" }))));
|
|
379
380
|
}
|
|
380
381
|
static get is() { return "snk-crud"; }
|
|
381
382
|
static get encapsulation() { return "scoped"; }
|
|
@@ -713,6 +714,24 @@ export class SnkCrud {
|
|
|
713
714
|
},
|
|
714
715
|
"attribute": "auto-load",
|
|
715
716
|
"reflect": false
|
|
717
|
+
},
|
|
718
|
+
"autoFocus": {
|
|
719
|
+
"type": "boolean",
|
|
720
|
+
"mutable": false,
|
|
721
|
+
"complexType": {
|
|
722
|
+
"original": "boolean",
|
|
723
|
+
"resolved": "boolean",
|
|
724
|
+
"references": {}
|
|
725
|
+
},
|
|
726
|
+
"required": false,
|
|
727
|
+
"optional": true,
|
|
728
|
+
"docs": {
|
|
729
|
+
"tags": [],
|
|
730
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
|
731
|
+
},
|
|
732
|
+
"attribute": "auto-focus",
|
|
733
|
+
"reflect": false,
|
|
734
|
+
"defaultValue": "true"
|
|
716
735
|
}
|
|
717
736
|
};
|
|
718
737
|
}
|
|
@@ -89,7 +89,7 @@ export class SnkForm {
|
|
|
89
89
|
}
|
|
90
90
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
|
91
91
|
this.addFormLegacyConfig();
|
|
92
|
-
this._configManager.loadConfig();
|
|
92
|
+
await this._configManager.loadConfig();
|
|
93
93
|
}
|
|
94
94
|
async handleDataStateChange(evt) {
|
|
95
95
|
var _a;
|
|
@@ -71,11 +71,14 @@ export class SnkFormConfigManager {
|
|
|
71
71
|
var _a;
|
|
72
72
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
73
73
|
if (fields != undefined && fields.length > 0) {
|
|
74
|
-
return fields.map(({ label, name, readOnly, visible }) => {
|
|
74
|
+
return fields.map(({ label, name, readOnly, visible, required }) => {
|
|
75
75
|
if (label == undefined) {
|
|
76
|
-
return dataUnit.getField(name)
|
|
76
|
+
return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
|
|
77
|
+
readOnly,
|
|
78
|
+
visible,
|
|
79
|
+
required });
|
|
77
80
|
}
|
|
78
|
-
return { name, label, readOnly, visible };
|
|
81
|
+
return { name, label, readOnly, visible, required };
|
|
79
82
|
})
|
|
80
83
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
81
84
|
}
|
|
@@ -69,6 +69,7 @@ export class SnkGrid {
|
|
|
69
69
|
this.gridLegacyConfigName = undefined;
|
|
70
70
|
this.filterBarLegacyConfigName = undefined;
|
|
71
71
|
this.autoLoad = undefined;
|
|
72
|
+
this.autoFocus = true;
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
75
|
* Exibe a janela de configurações da grade.
|
|
@@ -415,7 +416,7 @@ export class SnkGrid {
|
|
|
415
416
|
return undefined;
|
|
416
417
|
}
|
|
417
418
|
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--medium" }, this._showSnkFilterBar &&
|
|
418
|
-
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 }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, 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 }))));
|
|
419
|
+
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 }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, 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 }))));
|
|
419
420
|
}
|
|
420
421
|
static get is() { return "snk-grid"; }
|
|
421
422
|
static get encapsulation() { return "scoped"; }
|
|
@@ -843,6 +844,24 @@ export class SnkGrid {
|
|
|
843
844
|
},
|
|
844
845
|
"attribute": "auto-load",
|
|
845
846
|
"reflect": false
|
|
847
|
+
},
|
|
848
|
+
"autoFocus": {
|
|
849
|
+
"type": "boolean",
|
|
850
|
+
"mutable": false,
|
|
851
|
+
"complexType": {
|
|
852
|
+
"original": "boolean",
|
|
853
|
+
"resolved": "boolean",
|
|
854
|
+
"references": {}
|
|
855
|
+
},
|
|
856
|
+
"required": false,
|
|
857
|
+
"optional": true,
|
|
858
|
+
"docs": {
|
|
859
|
+
"tags": [],
|
|
860
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
|
861
|
+
},
|
|
862
|
+
"attribute": "auto-focus",
|
|
863
|
+
"reflect": false,
|
|
864
|
+
"defaultValue": "true"
|
|
846
865
|
}
|
|
847
866
|
};
|
|
848
867
|
}
|
|
@@ -55,6 +55,7 @@ export class SnkSimpleCrud {
|
|
|
55
55
|
this.gridLegacyConfigName = undefined;
|
|
56
56
|
this.formLegacyConfigName = undefined;
|
|
57
57
|
this.ignoreReadOnlyFormFields = false;
|
|
58
|
+
this.autoFocus = true;
|
|
58
59
|
this.autoLoad = undefined;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -694,7 +695,7 @@ export class SnkSimpleCrud {
|
|
|
694
695
|
}
|
|
695
696
|
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.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", 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" })), 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)
|
|
696
697
|
? undefined
|
|
697
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() }))));
|
|
698
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() }))));
|
|
698
699
|
}
|
|
699
700
|
static get is() { return "snk-simple-crud"; }
|
|
700
701
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1067,6 +1068,24 @@ export class SnkSimpleCrud {
|
|
|
1067
1068
|
"reflect": false,
|
|
1068
1069
|
"defaultValue": "false"
|
|
1069
1070
|
},
|
|
1071
|
+
"autoFocus": {
|
|
1072
|
+
"type": "boolean",
|
|
1073
|
+
"mutable": false,
|
|
1074
|
+
"complexType": {
|
|
1075
|
+
"original": "boolean",
|
|
1076
|
+
"resolved": "boolean",
|
|
1077
|
+
"references": {}
|
|
1078
|
+
},
|
|
1079
|
+
"required": false,
|
|
1080
|
+
"optional": true,
|
|
1081
|
+
"docs": {
|
|
1082
|
+
"tags": [],
|
|
1083
|
+
"text": "Define se a grid ser\u00E1 focada ao ser carregada."
|
|
1084
|
+
},
|
|
1085
|
+
"attribute": "auto-focus",
|
|
1086
|
+
"reflect": false,
|
|
1087
|
+
"defaultValue": "true"
|
|
1088
|
+
},
|
|
1070
1089
|
"autoLoad": {
|
|
1071
1090
|
"type": "boolean",
|
|
1072
1091
|
"mutable": false,
|
|
@@ -3,6 +3,7 @@ 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';
|
|
5
5
|
import { PresentationMode } from '../../lib/@types';
|
|
6
|
+
import { Action as DUAction } from '@sankhyalabs/core';
|
|
6
7
|
export class SnkTaskbar {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
|
|
@@ -25,6 +26,18 @@ export class SnkTaskbar {
|
|
|
25
26
|
[TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
|
|
26
27
|
[TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
|
|
27
28
|
};
|
|
29
|
+
this.onSaveEvent = (action) => {
|
|
30
|
+
switch (action.type) {
|
|
31
|
+
case DUAction.FIELD_INVALIDATED:
|
|
32
|
+
case DUAction.DATA_SAVED:
|
|
33
|
+
case DUAction.SAVING_ERROR:
|
|
34
|
+
this._isWaitingForSave = false;
|
|
35
|
+
break;
|
|
36
|
+
case DUAction.SAVING_DATA:
|
|
37
|
+
this._isWaitingForSave = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
28
41
|
this._permissions = undefined;
|
|
29
42
|
this._overFlowedElements = [];
|
|
30
43
|
this._customElements = undefined;
|
|
@@ -33,6 +46,7 @@ export class SnkTaskbar {
|
|
|
33
46
|
this._hiddenActionsList = [];
|
|
34
47
|
this._lastWidth = undefined;
|
|
35
48
|
this._hasToUpdateOverFlow = false;
|
|
49
|
+
this._isWaitingForSave = false;
|
|
36
50
|
this.alignRigth = false;
|
|
37
51
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
|
38
52
|
this.customContainerId = undefined;
|
|
@@ -139,7 +153,13 @@ export class SnkTaskbar {
|
|
|
139
153
|
this.dataUnit.cancelEdition();
|
|
140
154
|
break;
|
|
141
155
|
case TaskbarElement.SAVE:
|
|
142
|
-
this.
|
|
156
|
+
if (!this._isWaitingForSave) {
|
|
157
|
+
this._isWaitingForSave = true;
|
|
158
|
+
this.dataUnit.saveData()
|
|
159
|
+
.finally(() => {
|
|
160
|
+
this._isWaitingForSave = false;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
143
163
|
break;
|
|
144
164
|
}
|
|
145
165
|
}
|
|
@@ -338,6 +358,7 @@ export class SnkTaskbar {
|
|
|
338
358
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
339
359
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
340
360
|
this.handleOverFlowStrategy();
|
|
361
|
+
this.dataUnit.subscribe(this.onSaveEvent);
|
|
341
362
|
}
|
|
342
363
|
componentDidRender() {
|
|
343
364
|
this.appendCustomElementsInTaskbar();
|
|
@@ -678,7 +699,8 @@ export class SnkTaskbar {
|
|
|
678
699
|
"_slotContainer": {},
|
|
679
700
|
"_hiddenActionsList": {},
|
|
680
701
|
"_lastWidth": {},
|
|
681
|
-
"_hasToUpdateOverFlow": {}
|
|
702
|
+
"_hasToUpdateOverFlow": {},
|
|
703
|
+
"_isWaitingForSave": {}
|
|
682
704
|
};
|
|
683
705
|
}
|
|
684
706
|
static get events() {
|
|
@@ -72,11 +72,14 @@ class SnkFormConfigManager {
|
|
|
72
72
|
var _a;
|
|
73
73
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
|
-
return fields.map(({ label, name, readOnly, visible }) => {
|
|
75
|
+
return fields.map(({ label, name, readOnly, visible, required }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
|
-
return dataUnit.getField(name)
|
|
77
|
+
return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
|
|
78
|
+
readOnly,
|
|
79
|
+
visible,
|
|
80
|
+
required });
|
|
78
81
|
}
|
|
79
|
-
return { name, label, readOnly, visible };
|
|
82
|
+
return { name, label, readOnly, visible, required };
|
|
80
83
|
})
|
|
81
84
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
82
85
|
}
|
|
@@ -657,9 +657,22 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
657
657
|
this._currentDataUnit = undefined;
|
|
658
658
|
this.crudConfig = undefined;
|
|
659
659
|
}
|
|
660
|
+
async registerKeyWatcher(newRegisterKey, oldRegisterKey) {
|
|
661
|
+
var _a;
|
|
662
|
+
if (this._currentDataUnit == null) {
|
|
663
|
+
this.loadAttachmentDataUnit();
|
|
664
|
+
}
|
|
665
|
+
if (oldRegisterKey !== newRegisterKey) {
|
|
666
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
|
667
|
+
}
|
|
668
|
+
}
|
|
660
669
|
async initAttach() {
|
|
661
670
|
var _a, _b, _c, _d, _e, _f;
|
|
662
|
-
|
|
671
|
+
if (!this.fetcherType && !this.registerKey)
|
|
672
|
+
return;
|
|
673
|
+
if (!this.fetcherType) {
|
|
674
|
+
this.fetcherType = "AnexoSistema";
|
|
675
|
+
}
|
|
663
676
|
this.returnToGridMode();
|
|
664
677
|
if (this.fetcherType === "AnexoSistema") {
|
|
665
678
|
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
@@ -672,7 +685,8 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
672
685
|
if (hasMoreOneItem)
|
|
673
686
|
return;
|
|
674
687
|
}
|
|
675
|
-
|
|
688
|
+
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata());
|
|
689
|
+
await ((_f = this._currentDataUnit) === null || _f === void 0 ? void 0 : _f.loadData(undefined, undefined, true, this.registerKey));
|
|
676
690
|
}
|
|
677
691
|
/**
|
|
678
692
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -711,14 +725,14 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
711
725
|
if (this._crudElement)
|
|
712
726
|
this._crudElement.goToView(VIEW_MODE.GRID);
|
|
713
727
|
}
|
|
714
|
-
loadAttachmentDataUnit() {
|
|
728
|
+
async loadAttachmentDataUnit() {
|
|
715
729
|
try {
|
|
716
730
|
switch (this.fetcherType) {
|
|
717
731
|
case "AnexoSistema":
|
|
718
|
-
this.loadAnexoSistema();
|
|
732
|
+
await this.loadAnexoSistema();
|
|
719
733
|
break;
|
|
720
734
|
case "Attach":
|
|
721
|
-
this.loadAttach();
|
|
735
|
+
await this.loadAttach();
|
|
722
736
|
break;
|
|
723
737
|
default:
|
|
724
738
|
this._currentFetcher = this.fetcher;
|
|
@@ -730,12 +744,13 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
730
744
|
throw new Error('There was an error while creating the data unit');
|
|
731
745
|
}
|
|
732
746
|
}
|
|
733
|
-
loadAnexoSistema() {
|
|
734
|
-
|
|
747
|
+
async loadAnexoSistema() {
|
|
748
|
+
var _a, _b, _c;
|
|
749
|
+
this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
750
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
735
751
|
if (!this._currentDataUnit.metadata) {
|
|
736
|
-
this._currentDataUnit
|
|
737
|
-
|
|
738
|
-
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
|
752
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata());
|
|
753
|
+
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
|
739
754
|
}
|
|
740
755
|
this.initDataUnitLoaders();
|
|
741
756
|
this._currentDataUnit.addFilterProvider({
|
|
@@ -744,10 +759,12 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
744
759
|
this._currentDataUnit.addInterceptor({
|
|
745
760
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
|
746
761
|
});
|
|
747
|
-
this._currentDataUnit.loadData()
|
|
762
|
+
await ((_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData());
|
|
763
|
+
this.disableEditFieldsNotInForm();
|
|
748
764
|
}
|
|
749
|
-
loadAttach() {
|
|
765
|
+
async loadAttach() {
|
|
750
766
|
var _a, _b;
|
|
767
|
+
this._currentFetcher = new AttachFetcher();
|
|
751
768
|
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
752
769
|
this.initDataUnitLoaders();
|
|
753
770
|
this._currentDataUnit.addInterceptor({
|
|
@@ -761,11 +778,10 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
761
778
|
}
|
|
762
779
|
});
|
|
763
780
|
if (!this._currentDataUnit.metadata) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
});
|
|
781
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
782
|
+
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
783
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData(undefined, undefined, true, this.registerKey));
|
|
784
|
+
this.disableEditFieldsNotInForm();
|
|
769
785
|
}
|
|
770
786
|
}
|
|
771
787
|
initDataUnitLoaders() {
|
|
@@ -824,6 +840,9 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
824
840
|
return null;
|
|
825
841
|
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
|
826
842
|
}
|
|
843
|
+
static get watchers() { return {
|
|
844
|
+
"registerKey": ["registerKeyWatcher"]
|
|
845
|
+
}; }
|
|
827
846
|
static get style() { return snkAttachCss; }
|
|
828
847
|
}, [2, "snk-attach", {
|
|
829
848
|
"fetcherType": [1, "fetcher-type"],
|
|
@@ -96,7 +96,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
96
96
|
const customElements = container === null || container === void 0 ? void 0 : container.querySelector('#SnkConfigContainerSlot');
|
|
97
97
|
if (!customElements)
|
|
98
98
|
return;
|
|
99
|
-
const configuratorCustomElement = customElements.
|
|
99
|
+
const configuratorCustomElement = customElements.firstElementChild;
|
|
100
100
|
if (!configuratorCustomElement)
|
|
101
101
|
return;
|
|
102
102
|
const insideCustomElementsContainer = this._element.querySelector("#slotContainer");
|
|
@@ -78,6 +78,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
78
78
|
this.formLegacyConfigName = undefined;
|
|
79
79
|
this.disablePersonalizedFilter = undefined;
|
|
80
80
|
this.autoLoad = undefined;
|
|
81
|
+
this.autoFocus = true;
|
|
81
82
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
@@ -414,7 +415,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
414
415
|
return;
|
|
415
416
|
}
|
|
416
417
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
417
|
-
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 }, 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 }, 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" }))));
|
|
418
|
+
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 }, 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 }, 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" }))));
|
|
418
419
|
}
|
|
419
420
|
get _element() { return this; }
|
|
420
421
|
static get watchers() { return {
|
|
@@ -439,6 +440,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
439
440
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
440
441
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
441
442
|
"autoLoad": [4, "auto-load"],
|
|
443
|
+
"autoFocus": [4, "auto-focus"],
|
|
442
444
|
"_dataUnit": [32],
|
|
443
445
|
"_dataState": [32],
|
|
444
446
|
"attachmentRegisterKey": [32],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const snkCustomSlotElementsCss = ".
|
|
3
|
+
const snkCustomSlotElementsCss = ".sc-snk-custom-slot-elements-h{display:none}";
|
|
4
4
|
|
|
5
5
|
const SnkCustomSlotElements$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -101,7 +101,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
101
101
|
}
|
|
102
102
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
|
103
103
|
this.addFormLegacyConfig();
|
|
104
|
-
this._configManager.loadConfig();
|
|
104
|
+
await this._configManager.loadConfig();
|
|
105
105
|
}
|
|
106
106
|
async handleDataStateChange(evt) {
|
|
107
107
|
var _a;
|