@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-61118.4 → 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.
Files changed (77) hide show
  1. package/dist/cjs/{SnkFormConfigManager-52f99b4d.js → SnkFormConfigManager-1b13bacd.js} +6 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-application.cjs.entry.js +20 -2
  5. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-crud.cjs.entry.js +2 -1
  7. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +6 -2
  8. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-grid.cjs.entry.js +2 -1
  11. package/dist/cjs/{snk-guides-viewer-5d5f0f25.js → snk-guides-viewer-0c42fd4a.js} +1 -1
  12. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -3
  14. package/dist/cjs/snk-taskbar.cjs.entry.js +40 -6
  15. package/dist/collection/components/snk-application/snk-application.js +26 -5
  16. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -1
  17. package/dist/collection/components/snk-crud/snk-crud.js +20 -1
  18. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.css +1 -1
  19. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.js +22 -1
  20. package/dist/collection/components/snk-form/snk-form.js +1 -1
  21. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -3
  22. package/dist/collection/components/snk-grid/snk-grid.js +20 -1
  23. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +24 -2
  24. package/dist/collection/components/snk-taskbar/snk-taskbar.js +52 -7
  25. package/dist/components/SnkFormConfigManager.js +6 -3
  26. package/dist/components/snk-application2.js +20 -2
  27. package/dist/components/snk-configurator2.js +1 -1
  28. package/dist/components/snk-crud.js +3 -1
  29. package/dist/components/snk-custom-slot-elements.js +7 -3
  30. package/dist/components/snk-form.js +1 -1
  31. package/dist/components/snk-grid2.js +3 -1
  32. package/dist/components/snk-simple-crud2.js +7 -2
  33. package/dist/components/snk-taskbar2.js +44 -9
  34. package/dist/esm/{SnkFormConfigManager-5b0d69cd.js → SnkFormConfigManager-d4554df9.js} +6 -3
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/sankhyablocks.js +1 -1
  37. package/dist/esm/snk-application.entry.js +20 -2
  38. package/dist/esm/snk-configurator.entry.js +1 -1
  39. package/dist/esm/snk-crud.entry.js +2 -1
  40. package/dist/esm/snk-custom-slot-elements.entry.js +7 -3
  41. package/dist/esm/snk-detail-view.entry.js +2 -2
  42. package/dist/esm/snk-form.entry.js +2 -2
  43. package/dist/esm/snk-grid.entry.js +2 -1
  44. package/dist/esm/{snk-guides-viewer-ef8c4eec.js → snk-guides-viewer-ef3763df.js} +1 -1
  45. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  46. package/dist/esm/snk-simple-crud.entry.js +7 -3
  47. package/dist/esm/snk-taskbar.entry.js +41 -7
  48. package/dist/sankhyablocks/p-04821c60.entry.js +1 -0
  49. package/dist/sankhyablocks/p-11a4d155.entry.js +1 -0
  50. package/dist/sankhyablocks/p-21a81901.entry.js +1 -0
  51. package/dist/sankhyablocks/p-3f1efb97.entry.js +1 -0
  52. package/dist/sankhyablocks/p-58687027.entry.js +1 -0
  53. package/dist/sankhyablocks/p-5fa1576b.entry.js +11 -0
  54. package/dist/sankhyablocks/{p-2ac8bd11.entry.js → p-61eb8397.entry.js} +1 -1
  55. package/dist/sankhyablocks/{p-294df368.entry.js → p-6aac74e6.entry.js} +1 -1
  56. package/dist/sankhyablocks/p-7663f597.entry.js +1 -0
  57. package/dist/sankhyablocks/p-829d4045.js +1 -0
  58. package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
  59. package/dist/sankhyablocks/{p-d26365ad.js → p-e4bfe062.js} +1 -1
  60. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  61. package/dist/types/components/snk-application/snk-application.d.ts +6 -3
  62. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  63. package/dist/types/components/snk-custom-slot-elements/snk-custom-slot-elements.d.ts +6 -0
  64. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  65. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  66. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
  67. package/dist/types/components.d.ts +34 -2
  68. package/package.json +1 -1
  69. package/dist/sankhyablocks/p-034c0efb.entry.js +0 -1
  70. package/dist/sankhyablocks/p-060fdb6c.js +0 -1
  71. package/dist/sankhyablocks/p-0c846b5a.entry.js +0 -1
  72. package/dist/sankhyablocks/p-32062be4.entry.js +0 -1
  73. package/dist/sankhyablocks/p-5f74c859.entry.js +0 -1
  74. package/dist/sankhyablocks/p-69754d94.entry.js +0 -1
  75. package/dist/sankhyablocks/p-7259f903.entry.js +0 -11
  76. package/dist/sankhyablocks/p-b8577312.entry.js +0 -1
  77. package/dist/sankhyablocks/p-cfb98f51.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;
@@ -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.dataUnit.saveData();
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
- return container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
271
+ slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
244
272
  }
245
273
  else {
246
- return this._element.querySelector(`#${this.customSlotId}`);
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
  *
@@ -795,15 +802,23 @@ export class SnkApplication {
795
802
  return;
796
803
  const resourceIDfromUrl = this.getResourceIdFromToken();
797
804
  const pkObject = UrlUtils.getPkObjectFromUrlToken(top.window.location.hash);
798
- if (pkObject == undefined || resourceIDfromUrl !== this.applicationResourceID)
805
+ const redirectFrom = window["redirectFrom"];
806
+ if (pkObject === undefined) {
799
807
  return;
808
+ }
809
+ if (!redirectFrom || redirectFrom.split("_")[0].indexOf(resourceIDfromUrl.split("_")[0]) === -1) {
810
+ if (resourceIDfromUrl !== this.applicationResourceID) {
811
+ return;
812
+ }
813
+ }
800
814
  const pkParam = { pk: pkObject };
801
815
  this._isLoadedByPk = true;
802
816
  if (this.loadByPK) {
803
- this.loadByPK(pkParam);
817
+ this.loadByPK(pkParam, redirectFrom);
804
818
  this._currentPkParameter = pkHash;
805
819
  return;
806
820
  }
821
+ this._loadPkParameter = { pk: pkParam, redirect: redirectFrom };
807
822
  this.defaultLoadByPK(pkParam, pkHash);
808
823
  }
809
824
  getResourceIdFromToken() {
@@ -1082,10 +1097,10 @@ export class SnkApplication {
1082
1097
  "type": "unknown",
1083
1098
  "mutable": false,
1084
1099
  "complexType": {
1085
- "original": "(objPK :{pk: Record<string, any>}) => void",
1086
- "resolved": "(objPK: { pk: Record<string, any>; }) => void",
1100
+ "original": "LoadByPkHandler",
1101
+ "resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
1087
1102
  "references": {
1088
- "Record": {
1103
+ "LoadByPkHandler": {
1089
1104
  "location": "global"
1090
1105
  }
1091
1106
  }
@@ -2499,6 +2514,12 @@ export class SnkApplication {
2499
2514
  };
2500
2515
  }
2501
2516
  static get elementRef() { return "_element"; }
2517
+ static get watchers() {
2518
+ return [{
2519
+ "propName": "loadByPK",
2520
+ "methodName": "watchPropHandler"
2521
+ }];
2522
+ }
2502
2523
  }
2503
2524
  class RequestListenerLoadingBar {
2504
2525
  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.firstChild;
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
  }
@@ -1,3 +1,3 @@
1
- .custom-slot-elements-container{
1
+ :host{
2
2
  display: none;
3
3
  }
@@ -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 }, h("div", { id: this.slotName, class: "custom-slot-elements-container" }, h("slot", null))));
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
  }
@@ -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
  /**
@@ -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.dataUnit.saveData();
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
- return container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
262
+ slotContainer = container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
234
263
  }
235
264
  else {
236
- return this._element.querySelector(`#${this.customSlotId}`);
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
  }
@@ -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
  }
@@ -290,6 +290,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
290
290
  this._duPromises = new Map();
291
291
  this._requestListener = new RequestListenerLoadingBar();
292
292
  this._pendingActions = new Map;
293
+ this._loadPkParameter = null;
293
294
  this._isLoadedByPk = false;
294
295
  this.messagesBuilder = undefined;
295
296
  this.configName = undefined;
@@ -347,6 +348,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
347
348
  });
348
349
  }
349
350
  }
351
+ watchPropHandler(newValue, _) {
352
+ if (newValue && this._loadPkParameter) {
353
+ this.loadByPK(this._loadPkParameter.pk, this._loadPkParameter.redirect);
354
+ this._loadPkParameter = null;
355
+ }
356
+ }
350
357
  /**
351
358
  * Obtém o controlador de teclado.
352
359
  *
@@ -1053,15 +1060,23 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1053
1060
  return;
1054
1061
  const resourceIDfromUrl = this.getResourceIdFromToken();
1055
1062
  const pkObject = UrlUtils.getPkObjectFromUrlToken(top.window.location.hash);
1056
- if (pkObject == undefined || resourceIDfromUrl !== this.applicationResourceID)
1063
+ const redirectFrom = window["redirectFrom"];
1064
+ if (pkObject === undefined) {
1057
1065
  return;
1066
+ }
1067
+ if (!redirectFrom || redirectFrom.split("_")[0].indexOf(resourceIDfromUrl.split("_")[0]) === -1) {
1068
+ if (resourceIDfromUrl !== this.applicationResourceID) {
1069
+ return;
1070
+ }
1071
+ }
1058
1072
  const pkParam = { pk: pkObject };
1059
1073
  this._isLoadedByPk = true;
1060
1074
  if (this.loadByPK) {
1061
- this.loadByPK(pkParam);
1075
+ this.loadByPK(pkParam, redirectFrom);
1062
1076
  this._currentPkParameter = pkHash;
1063
1077
  return;
1064
1078
  }
1079
+ this._loadPkParameter = { pk: pkParam, redirect: redirectFrom };
1065
1080
  this.defaultLoadByPK(pkParam, pkHash);
1066
1081
  }
1067
1082
  getResourceIdFromToken() {
@@ -1252,6 +1267,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
1252
1267
  return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
1253
1268
  }
1254
1269
  get _element() { return this; }
1270
+ static get watchers() { return {
1271
+ "loadByPK": ["watchPropHandler"]
1272
+ }; }
1255
1273
  static get style() { return snkApplicationCss; }
1256
1274
  }, [2, "snk-application", {
1257
1275
  "messagesBuilder": [1040],
@@ -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.firstChild;
99
+ const configuratorCustomElement = customElements.firstElementChild;
100
100
  if (!configuratorCustomElement)
101
101
  return;
102
102
  const insideCustomElementsContainer = this._element.querySelector("#slotContainer");