@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-61118.4 → 0.0.0-bugfix-dev-KB-63028.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/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +29 -16
- 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 +6 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/{snk-data-unit-eca53cfc.js → snk-data-unit-5be491da.js} +6 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +6 -2
- package/dist/cjs/snk-taskbar.cjs.entry.js +40 -6
- package/dist/collection/components/snk-application/snk-application.js +37 -33
- 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-custom-slot-elements/snk-custom-slot-elements.js +22 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +6 -2
- package/dist/collection/components/snk-grid/snk-grid.js +20 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +24 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +52 -7
- package/dist/components/snk-application2.js +29 -16
- package/dist/components/snk-configurator2.js +1 -1
- package/dist/components/snk-crud.js +3 -1
- package/dist/components/snk-custom-slot-elements.js +7 -3
- package/dist/components/snk-data-unit2.js +6 -2
- package/dist/components/snk-grid2.js +3 -1
- package/dist/components/snk-simple-crud2.js +7 -2
- package/dist/components/snk-taskbar2.js +44 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +29 -16
- 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 +7 -3
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/{snk-data-unit-49b898f7.js → snk-data-unit-9110a07b.js} +6 -2
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +2 -1
- package/dist/esm/snk-simple-crud.entry.js +6 -2
- package/dist/esm/snk-taskbar.entry.js +41 -7
- package/dist/sankhyablocks/p-04821c60.entry.js +1 -0
- package/dist/sankhyablocks/p-21a81901.entry.js +1 -0
- package/dist/sankhyablocks/p-3f1efb97.entry.js +1 -0
- package/dist/sankhyablocks/p-543537ca.js +1 -0
- package/dist/sankhyablocks/{p-e5c25e0b.entry.js → p-5646ee8c.entry.js} +1 -1
- package/dist/sankhyablocks/p-58687027.entry.js +1 -0
- package/dist/sankhyablocks/{p-ba05fdb8.entry.js → p-70a6e662.entry.js} +1 -1
- package/dist/sankhyablocks/p-7663f597.entry.js +1 -0
- package/dist/sankhyablocks/p-8322ccdb.entry.js +1 -0
- package/dist/sankhyablocks/p-9b1c0824.entry.js +11 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -8
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-custom-slot-elements/snk-custom-slot-elements.d.ts +6 -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 +4 -0
- package/dist/types/components.d.ts +36 -4
- package/package.json +1 -1
- package/dist/sankhyablocks/p-034c0efb.entry.js +0 -1
- package/dist/sankhyablocks/p-0c846b5a.entry.js +0 -1
- package/dist/sankhyablocks/p-5f74c859.entry.js +0 -1
- package/dist/sankhyablocks/p-69754d94.entry.js +0 -1
- package/dist/sankhyablocks/p-7259f903.entry.js +0 -11
- package/dist/sankhyablocks/p-b8577312.entry.js +0 -1
- package/dist/sankhyablocks/p-cfb98f51.entry.js +0 -1
- package/dist/sankhyablocks/p-f88cfc3c.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;
|
|
@@ -58,6 +71,14 @@ const SnkTaskbar = class {
|
|
|
58
71
|
this.presentationMode = index$1.PresentationMode.PRIMARY;
|
|
59
72
|
this.messagesBuilder = undefined;
|
|
60
73
|
}
|
|
74
|
+
handleCustomSlotElementsLoaded(event) {
|
|
75
|
+
if (this.hasToSearchCustomElements(event)) {
|
|
76
|
+
this.getCustomElements(true);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
hasToSearchCustomElements(event) {
|
|
80
|
+
return this.customSlotId === event.detail && !this._slotContainer;
|
|
81
|
+
}
|
|
61
82
|
observeButtons() {
|
|
62
83
|
this._definitions = undefined;
|
|
63
84
|
requestAnimationFrame(() => {
|
|
@@ -141,7 +162,13 @@ const SnkTaskbar = class {
|
|
|
141
162
|
this.dataUnit.cancelEdition();
|
|
142
163
|
break;
|
|
143
164
|
case taskbarElements.TaskbarElement.SAVE:
|
|
144
|
-
this.
|
|
165
|
+
if (!this._isWaitingForSave) {
|
|
166
|
+
this._isWaitingForSave = true;
|
|
167
|
+
this.dataUnit.saveData()
|
|
168
|
+
.finally(() => {
|
|
169
|
+
this._isWaitingForSave = false;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
145
172
|
break;
|
|
146
173
|
}
|
|
147
174
|
}
|
|
@@ -229,22 +256,28 @@ const SnkTaskbar = class {
|
|
|
229
256
|
}
|
|
230
257
|
return index.h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
|
|
231
258
|
}
|
|
232
|
-
getCustomElements() {
|
|
259
|
+
getCustomElements(searchOnDocument) {
|
|
233
260
|
var _a, _b;
|
|
234
261
|
this._customElementsId = [];
|
|
235
262
|
this._customElements = new Map();
|
|
236
|
-
this._slotContainer = this.buildSlotContainer();
|
|
263
|
+
this._slotContainer = this.buildSlotContainer(searchOnDocument);
|
|
237
264
|
const customElementsArray = Array.from((_b = (_a = this._slotContainer) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
|
|
238
265
|
customElementsArray.forEach(item => this._customElements.set(item.id, item));
|
|
239
266
|
}
|
|
240
|
-
buildSlotContainer() {
|
|
267
|
+
buildSlotContainer(searchOnDocument) {
|
|
268
|
+
let slotContainer;
|
|
241
269
|
if (this.customContainerId) {
|
|
242
270
|
const container = document.querySelector(`#${this.customContainerId}`);
|
|
243
|
-
|
|
271
|
+
slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
|
|
244
272
|
}
|
|
245
273
|
else {
|
|
246
|
-
|
|
274
|
+
slotContainer = this._element.querySelector(`#${this.customSlotId}`);
|
|
275
|
+
}
|
|
276
|
+
// Caso nõa encontre o slot container dentro do próprio elemento, tenta buscar na DOM do document.
|
|
277
|
+
if (searchOnDocument && !slotContainer) {
|
|
278
|
+
slotContainer = document.querySelector(`#${this.customSlotId}`);
|
|
247
279
|
}
|
|
280
|
+
return slotContainer;
|
|
248
281
|
}
|
|
249
282
|
componentWillLoad() {
|
|
250
283
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
@@ -334,6 +367,7 @@ const SnkTaskbar = class {
|
|
|
334
367
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
335
368
|
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
336
369
|
this.handleOverFlowStrategy();
|
|
370
|
+
this.dataUnit.subscribe(this.onSaveEvent);
|
|
337
371
|
}
|
|
338
372
|
componentDidRender() {
|
|
339
373
|
this.appendCustomElementsInTaskbar();
|
|
@@ -30,6 +30,7 @@ export class SnkApplication {
|
|
|
30
30
|
this._duPromises = new Map();
|
|
31
31
|
this._requestListener = new RequestListenerLoadingBar();
|
|
32
32
|
this._pendingActions = new Map;
|
|
33
|
+
this._loadPkParameter = null;
|
|
33
34
|
this._isLoadedByPk = false;
|
|
34
35
|
this.messagesBuilder = undefined;
|
|
35
36
|
this.configName = undefined;
|
|
@@ -87,6 +88,12 @@ export class SnkApplication {
|
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
}
|
|
91
|
+
watchPropHandler(newValue, _) {
|
|
92
|
+
if (newValue && this._loadPkParameter) {
|
|
93
|
+
this.loadByPK(this._loadPkParameter.pk, this._loadPkParameter.redirect);
|
|
94
|
+
this._loadPkParameter = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
90
97
|
/**
|
|
91
98
|
* Obtém o controlador de teclado.
|
|
92
99
|
*
|
|
@@ -347,7 +354,7 @@ export class SnkApplication {
|
|
|
347
354
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
|
348
355
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
|
349
356
|
*/
|
|
350
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID
|
|
357
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
351
358
|
if (resourceID == undefined) {
|
|
352
359
|
resourceID = this.applicationResourceID;
|
|
353
360
|
}
|
|
@@ -357,18 +364,13 @@ export class SnkApplication {
|
|
|
357
364
|
duPromisses.push(new PendingPromise(resolve, reject));
|
|
358
365
|
if (!waitingDu) {
|
|
359
366
|
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
|
360
|
-
|
|
367
|
+
dataUnit.loadMetadata().then(() => {
|
|
361
368
|
this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
while (duPromisses.length > 0) {
|
|
368
|
-
duPromisses.pop().reject(reason);
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
}
|
|
369
|
+
}).catch(reason => {
|
|
370
|
+
while (duPromisses.length > 0) {
|
|
371
|
+
duPromisses.pop().reject(reason);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
372
374
|
}
|
|
373
375
|
});
|
|
374
376
|
}
|
|
@@ -395,14 +397,14 @@ export class SnkApplication {
|
|
|
395
397
|
/**
|
|
396
398
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
|
397
399
|
*/
|
|
398
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID
|
|
400
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
|
399
401
|
return new Promise((resolve, reject) => {
|
|
400
402
|
const dataUnit = this._duCache.get(dataUnitName);
|
|
401
403
|
if (dataUnit) {
|
|
402
404
|
resolve(dataUnit);
|
|
403
405
|
}
|
|
404
406
|
else {
|
|
405
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID
|
|
407
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
|
406
408
|
resolve(dataUnit);
|
|
407
409
|
}).catch(reason => reject(reason));
|
|
408
410
|
}
|
|
@@ -795,15 +797,23 @@ export class SnkApplication {
|
|
|
795
797
|
return;
|
|
796
798
|
const resourceIDfromUrl = this.getResourceIdFromToken();
|
|
797
799
|
const pkObject = UrlUtils.getPkObjectFromUrlToken(top.window.location.hash);
|
|
798
|
-
|
|
800
|
+
const redirectFrom = window["redirectFrom"];
|
|
801
|
+
if (pkObject === undefined) {
|
|
799
802
|
return;
|
|
803
|
+
}
|
|
804
|
+
if (!redirectFrom || redirectFrom.split("_")[0].indexOf(resourceIDfromUrl.split("_")[0]) === -1) {
|
|
805
|
+
if (resourceIDfromUrl !== this.applicationResourceID) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
800
809
|
const pkParam = { pk: pkObject };
|
|
801
810
|
this._isLoadedByPk = true;
|
|
802
811
|
if (this.loadByPK) {
|
|
803
|
-
this.loadByPK(pkParam);
|
|
812
|
+
this.loadByPK(pkParam, redirectFrom);
|
|
804
813
|
this._currentPkParameter = pkHash;
|
|
805
814
|
return;
|
|
806
815
|
}
|
|
816
|
+
this._loadPkParameter = { pk: pkParam, redirect: redirectFrom };
|
|
807
817
|
this.defaultLoadByPK(pkParam, pkHash);
|
|
808
818
|
}
|
|
809
819
|
getResourceIdFromToken() {
|
|
@@ -1082,10 +1092,10 @@ export class SnkApplication {
|
|
|
1082
1092
|
"type": "unknown",
|
|
1083
1093
|
"mutable": false,
|
|
1084
1094
|
"complexType": {
|
|
1085
|
-
"original": "
|
|
1086
|
-
"resolved": "(objPK: { pk: Record<string, any>; }) => void",
|
|
1095
|
+
"original": "LoadByPkHandler",
|
|
1096
|
+
"resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
|
|
1087
1097
|
"references": {
|
|
1088
|
-
"
|
|
1098
|
+
"LoadByPkHandler": {
|
|
1089
1099
|
"location": "global"
|
|
1090
1100
|
}
|
|
1091
1101
|
}
|
|
@@ -1686,7 +1696,7 @@ export class SnkApplication {
|
|
|
1686
1696
|
},
|
|
1687
1697
|
"createDataunit": {
|
|
1688
1698
|
"complexType": {
|
|
1689
|
-
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string
|
|
1699
|
+
"signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
|
1690
1700
|
"parameters": [{
|
|
1691
1701
|
"tags": [],
|
|
1692
1702
|
"text": ""
|
|
@@ -1702,9 +1712,6 @@ export class SnkApplication {
|
|
|
1702
1712
|
}, {
|
|
1703
1713
|
"tags": [],
|
|
1704
1714
|
"text": ""
|
|
1705
|
-
}, {
|
|
1706
|
-
"tags": [],
|
|
1707
|
-
"text": ""
|
|
1708
1715
|
}],
|
|
1709
1716
|
"references": {
|
|
1710
1717
|
"Promise": {
|
|
@@ -1713,9 +1720,6 @@ export class SnkApplication {
|
|
|
1713
1720
|
"DataUnit": {
|
|
1714
1721
|
"location": "import",
|
|
1715
1722
|
"path": "@sankhyalabs/core"
|
|
1716
|
-
},
|
|
1717
|
-
"GetDataUnitOptions": {
|
|
1718
|
-
"location": "global"
|
|
1719
1723
|
}
|
|
1720
1724
|
},
|
|
1721
1725
|
"return": "Promise<DataUnit>"
|
|
@@ -1774,7 +1778,7 @@ export class SnkApplication {
|
|
|
1774
1778
|
},
|
|
1775
1779
|
"getDataUnit": {
|
|
1776
1780
|
"complexType": {
|
|
1777
|
-
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string
|
|
1781
|
+
"signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
|
|
1778
1782
|
"parameters": [{
|
|
1779
1783
|
"tags": [],
|
|
1780
1784
|
"text": ""
|
|
@@ -1790,9 +1794,6 @@ export class SnkApplication {
|
|
|
1790
1794
|
}, {
|
|
1791
1795
|
"tags": [],
|
|
1792
1796
|
"text": ""
|
|
1793
|
-
}, {
|
|
1794
|
-
"tags": [],
|
|
1795
|
-
"text": ""
|
|
1796
1797
|
}],
|
|
1797
1798
|
"references": {
|
|
1798
1799
|
"Promise": {
|
|
@@ -1801,9 +1802,6 @@ export class SnkApplication {
|
|
|
1801
1802
|
"DataUnit": {
|
|
1802
1803
|
"location": "import",
|
|
1803
1804
|
"path": "@sankhyalabs/core"
|
|
1804
|
-
},
|
|
1805
|
-
"GetDataUnitOptions": {
|
|
1806
|
-
"location": "global"
|
|
1807
1805
|
}
|
|
1808
1806
|
},
|
|
1809
1807
|
"return": "Promise<DataUnit>"
|
|
@@ -2499,6 +2497,12 @@ export class SnkApplication {
|
|
|
2499
2497
|
};
|
|
2500
2498
|
}
|
|
2501
2499
|
static get elementRef() { return "_element"; }
|
|
2500
|
+
static get watchers() {
|
|
2501
|
+
return [{
|
|
2502
|
+
"propName": "loadByPK",
|
|
2503
|
+
"methodName": "watchPropHandler"
|
|
2504
|
+
}];
|
|
2505
|
+
}
|
|
2502
2506
|
}
|
|
2503
2507
|
class RequestListenerLoadingBar {
|
|
2504
2508
|
constructor() {
|
|
@@ -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
|
}
|
|
@@ -3,8 +3,11 @@ export class SnkCustomSlotElements {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
this.slotName = 'CUSTOM_SLOT_ELEMENTS';
|
|
5
5
|
}
|
|
6
|
+
componentDidLoad() {
|
|
7
|
+
this.snkCustomSlotElementsLoaded.emit(this.slotName);
|
|
8
|
+
}
|
|
6
9
|
render() {
|
|
7
|
-
return (h(Host, { slot: this.slotName
|
|
10
|
+
return (h(Host, { slot: this.slotName, id: this.slotName, class: "custom-slot-elements-container" }, h("slot", null)));
|
|
8
11
|
}
|
|
9
12
|
static get is() { return "snk-custom-slot-elements"; }
|
|
10
13
|
static get encapsulation() { return "scoped"; }
|
|
@@ -40,4 +43,22 @@ export class SnkCustomSlotElements {
|
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
}
|
|
46
|
+
static get events() {
|
|
47
|
+
return [{
|
|
48
|
+
"method": "snkCustomSlotElementsLoaded",
|
|
49
|
+
"name": "snkCustomSlotElementsLoaded",
|
|
50
|
+
"bubbles": true,
|
|
51
|
+
"cancelable": true,
|
|
52
|
+
"composed": true,
|
|
53
|
+
"docs": {
|
|
54
|
+
"tags": [],
|
|
55
|
+
"text": "Emitido quando elemento \u00E9 carregado na tela."
|
|
56
|
+
},
|
|
57
|
+
"complexType": {
|
|
58
|
+
"original": "string",
|
|
59
|
+
"resolved": "string",
|
|
60
|
+
"references": {}
|
|
61
|
+
}
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
43
64
|
}
|
|
@@ -32,6 +32,10 @@ export class SnkDataUnit {
|
|
|
32
32
|
case Action.RECORDS_REMOVED:
|
|
33
33
|
this.handleRecordsRemoved(action);
|
|
34
34
|
break;
|
|
35
|
+
case Action.METADATA_LOADED:
|
|
36
|
+
this.fillFieldsWithRmp(this.dataUnit.metadata);
|
|
37
|
+
this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
|
|
38
|
+
break;
|
|
35
39
|
default:
|
|
36
40
|
break;
|
|
37
41
|
}
|
|
@@ -521,10 +525,10 @@ export class SnkDataUnit {
|
|
|
521
525
|
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
|
522
526
|
if (this._parentSnkDataUnit) {
|
|
523
527
|
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
|
524
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID
|
|
528
|
+
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
|
525
529
|
}
|
|
526
530
|
else {
|
|
527
|
-
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID
|
|
531
|
+
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
|
528
532
|
}
|
|
529
533
|
}
|
|
530
534
|
async loadDataUnit() {
|
|
@@ -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
|
/**
|
|
@@ -465,7 +466,7 @@ export class SnkSimpleCrud {
|
|
|
465
466
|
this.dataState = Object.assign({}, evt.detail);
|
|
466
467
|
}
|
|
467
468
|
getTaskBarDisabledButtons() {
|
|
468
|
-
var _a, _b, _c, _d;
|
|
469
|
+
var _a, _b, _c, _d, _e, _f;
|
|
469
470
|
const disabledButtons = [];
|
|
470
471
|
if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
|
|
471
472
|
disabledButtons.push(TaskbarElement.NEXT);
|
|
@@ -476,6 +477,9 @@ export class SnkSimpleCrud {
|
|
|
476
477
|
if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
|
|
477
478
|
disabledButtons.push(TaskbarElement.FORM_MODE);
|
|
478
479
|
}
|
|
480
|
+
if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
|
|
481
|
+
disabledButtons.push(TaskbarElement.CLONE);
|
|
482
|
+
}
|
|
479
483
|
return disabledButtons;
|
|
480
484
|
}
|
|
481
485
|
handleCancelEdit() {
|
|
@@ -691,7 +695,7 @@ export class SnkSimpleCrud {
|
|
|
691
695
|
}
|
|
692
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)
|
|
693
697
|
? undefined
|
|
694
|
-
: 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() }))));
|
|
695
699
|
}
|
|
696
700
|
static get is() { return "snk-simple-crud"; }
|
|
697
701
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1064,6 +1068,24 @@ export class SnkSimpleCrud {
|
|
|
1064
1068
|
"reflect": false,
|
|
1065
1069
|
"defaultValue": "false"
|
|
1066
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
|
+
},
|
|
1067
1089
|
"autoLoad": {
|
|
1068
1090
|
"type": "boolean",
|
|
1069
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;
|
|
@@ -48,6 +62,14 @@ export class SnkTaskbar {
|
|
|
48
62
|
this.presentationMode = PresentationMode.PRIMARY;
|
|
49
63
|
this.messagesBuilder = undefined;
|
|
50
64
|
}
|
|
65
|
+
handleCustomSlotElementsLoaded(event) {
|
|
66
|
+
if (this.hasToSearchCustomElements(event)) {
|
|
67
|
+
this.getCustomElements(true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
hasToSearchCustomElements(event) {
|
|
71
|
+
return this.customSlotId === event.detail && !this._slotContainer;
|
|
72
|
+
}
|
|
51
73
|
observeButtons() {
|
|
52
74
|
this._definitions = undefined;
|
|
53
75
|
requestAnimationFrame(() => {
|
|
@@ -131,7 +153,13 @@ export class SnkTaskbar {
|
|
|
131
153
|
this.dataUnit.cancelEdition();
|
|
132
154
|
break;
|
|
133
155
|
case TaskbarElement.SAVE:
|
|
134
|
-
this.
|
|
156
|
+
if (!this._isWaitingForSave) {
|
|
157
|
+
this._isWaitingForSave = true;
|
|
158
|
+
this.dataUnit.saveData()
|
|
159
|
+
.finally(() => {
|
|
160
|
+
this._isWaitingForSave = false;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
135
163
|
break;
|
|
136
164
|
}
|
|
137
165
|
}
|
|
@@ -219,22 +247,28 @@ export class SnkTaskbar {
|
|
|
219
247
|
}
|
|
220
248
|
return h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
|
|
221
249
|
}
|
|
222
|
-
getCustomElements() {
|
|
250
|
+
getCustomElements(searchOnDocument) {
|
|
223
251
|
var _a, _b;
|
|
224
252
|
this._customElementsId = [];
|
|
225
253
|
this._customElements = new Map();
|
|
226
|
-
this._slotContainer = this.buildSlotContainer();
|
|
254
|
+
this._slotContainer = this.buildSlotContainer(searchOnDocument);
|
|
227
255
|
const customElementsArray = Array.from((_b = (_a = this._slotContainer) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
|
|
228
256
|
customElementsArray.forEach(item => this._customElements.set(item.id, item));
|
|
229
257
|
}
|
|
230
|
-
buildSlotContainer() {
|
|
258
|
+
buildSlotContainer(searchOnDocument) {
|
|
259
|
+
let slotContainer;
|
|
231
260
|
if (this.customContainerId) {
|
|
232
261
|
const container = document.querySelector(`#${this.customContainerId}`);
|
|
233
|
-
|
|
262
|
+
slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
|
|
234
263
|
}
|
|
235
264
|
else {
|
|
236
|
-
|
|
265
|
+
slotContainer = this._element.querySelector(`#${this.customSlotId}`);
|
|
266
|
+
}
|
|
267
|
+
// Caso nõa encontre o slot container dentro do próprio elemento, tenta buscar na DOM do document.
|
|
268
|
+
if (searchOnDocument && !slotContainer) {
|
|
269
|
+
slotContainer = document.querySelector(`#${this.customSlotId}`);
|
|
237
270
|
}
|
|
271
|
+
return slotContainer;
|
|
238
272
|
}
|
|
239
273
|
componentWillLoad() {
|
|
240
274
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
@@ -324,6 +358,7 @@ export class SnkTaskbar {
|
|
|
324
358
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
325
359
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
326
360
|
this.handleOverFlowStrategy();
|
|
361
|
+
this.dataUnit.subscribe(this.onSaveEvent);
|
|
327
362
|
}
|
|
328
363
|
componentDidRender() {
|
|
329
364
|
this.appendCustomElementsInTaskbar();
|
|
@@ -664,7 +699,8 @@ export class SnkTaskbar {
|
|
|
664
699
|
"_slotContainer": {},
|
|
665
700
|
"_hiddenActionsList": {},
|
|
666
701
|
"_lastWidth": {},
|
|
667
|
-
"_hasToUpdateOverFlow": {}
|
|
702
|
+
"_hasToUpdateOverFlow": {},
|
|
703
|
+
"_isWaitingForSave": {}
|
|
668
704
|
};
|
|
669
705
|
}
|
|
670
706
|
static get events() {
|
|
@@ -698,4 +734,13 @@ export class SnkTaskbar {
|
|
|
698
734
|
"methodName": "observeLastWidth"
|
|
699
735
|
}];
|
|
700
736
|
}
|
|
737
|
+
static get listeners() {
|
|
738
|
+
return [{
|
|
739
|
+
"name": "snkCustomSlotElementsLoaded",
|
|
740
|
+
"method": "handleCustomSlotElementsLoaded",
|
|
741
|
+
"target": "window",
|
|
742
|
+
"capture": false,
|
|
743
|
+
"passive": false
|
|
744
|
+
}];
|
|
745
|
+
}
|
|
701
746
|
}
|