@sankhyalabs/sankhyablocks 5.12.0 → 5.14.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 (35) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  3. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-crud.cjs.entry.js +25 -1
  5. package/dist/cjs/snk-form-config.cjs.entry.js +33 -56
  6. package/dist/cjs/snk-tab-config.cjs.entry.js +13 -21
  7. package/dist/collection/components/snk-configurator/snk-configurator.js +5 -5
  8. package/dist/collection/components/snk-crud/snk-crud.js +85 -1
  9. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +33 -56
  10. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +32 -21
  11. package/dist/components/snk-configurator2.js +1 -1
  12. package/dist/components/snk-crud.js +28 -2
  13. package/dist/components/snk-form-config2.js +33 -56
  14. package/dist/components/snk-tab-config2.js +14 -21
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/sankhyablocks.js +1 -1
  17. package/dist/esm/snk-configurator.entry.js +1 -1
  18. package/dist/esm/snk-crud.entry.js +25 -1
  19. package/dist/esm/snk-form-config.entry.js +33 -56
  20. package/dist/esm/snk-tab-config.entry.js +13 -21
  21. package/dist/sankhyablocks/p-4f05a335.entry.js +1 -0
  22. package/dist/sankhyablocks/p-584a315a.entry.js +1 -0
  23. package/dist/sankhyablocks/p-69859375.entry.js +1 -0
  24. package/dist/sankhyablocks/p-72e78de0.entry.js +1 -0
  25. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  26. package/dist/types/components/snk-configurator/snk-configurator.d.ts +2 -2
  27. package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
  28. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -1
  29. package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +4 -0
  30. package/dist/types/components.d.ts +26 -2
  31. package/package.json +1 -1
  32. package/dist/sankhyablocks/p-0409d41b.entry.js +0 -1
  33. package/dist/sankhyablocks/p-1c0ee011.entry.js +0 -1
  34. package/dist/sankhyablocks/p-4e148be2.entry.js +0 -1
  35. package/dist/sankhyablocks/p-c88d26af.entry.js +0 -1
@@ -31,6 +31,20 @@ export class SnkCrud {
31
31
  async goToView(mode) {
32
32
  this.executeAction(mode);
33
33
  }
34
+ /**
35
+ * Usado para abrir o configurator do CRUD
36
+ */
37
+ async openConfigurator() {
38
+ var _a;
39
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
40
+ }
41
+ /**
42
+ * Usado para fechar o configurator do CRUD
43
+ */
44
+ async closeConfigurator() {
45
+ var _a;
46
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
47
+ }
34
48
  currentViewModeWatcher(currentView) {
35
49
  this._viewHistory = [...this._viewHistory.slice(-1), currentView];
36
50
  }
@@ -123,8 +137,16 @@ export class SnkCrud {
123
137
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
124
138
  }
125
139
  }
140
+ handleConfiguratorEvent(evt, type) {
141
+ evt.stopImmediatePropagation();
142
+ if (type === 'SAVE') {
143
+ this.configuratorSave.emit();
144
+ return;
145
+ }
146
+ this.configuratorCancel.emit();
147
+ }
126
148
  render() {
127
- return (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, "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 }, 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" }, 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 }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
149
+ return (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, "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 }, 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" }, 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') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
128
150
  }
129
151
  static get is() { return "snk-crud"; }
130
152
  static get encapsulation() { return "scoped"; }
@@ -349,6 +371,36 @@ export class SnkCrud {
349
371
  "resolved": "string",
350
372
  "references": {}
351
373
  }
374
+ }, {
375
+ "method": "configuratorSave",
376
+ "name": "configuratorSave",
377
+ "bubbles": true,
378
+ "cancelable": true,
379
+ "composed": true,
380
+ "docs": {
381
+ "tags": [],
382
+ "text": "Emitido quando salva a configura\u00E7\u00E3o no configurator do CRUD."
383
+ },
384
+ "complexType": {
385
+ "original": "any",
386
+ "resolved": "any",
387
+ "references": {}
388
+ }
389
+ }, {
390
+ "method": "configuratorCancel",
391
+ "name": "configuratorCancel",
392
+ "bubbles": true,
393
+ "cancelable": true,
394
+ "composed": true,
395
+ "docs": {
396
+ "tags": [],
397
+ "text": "Emitido quando cancela o salvamento da configura\u00E7\u00E3o no configurator do CRUD."
398
+ },
399
+ "complexType": {
400
+ "original": "any",
401
+ "resolved": "any",
402
+ "references": {}
403
+ }
352
404
  }];
353
405
  }
354
406
  static get methods() {
@@ -371,6 +423,38 @@ export class SnkCrud {
371
423
  "text": "Usado para alternar a vis\u00E3o entre GRID e FORM externamente.",
372
424
  "tags": []
373
425
  }
426
+ },
427
+ "openConfigurator": {
428
+ "complexType": {
429
+ "signature": "() => Promise<void>",
430
+ "parameters": [],
431
+ "references": {
432
+ "Promise": {
433
+ "location": "global"
434
+ }
435
+ },
436
+ "return": "Promise<void>"
437
+ },
438
+ "docs": {
439
+ "text": "Usado para abrir o configurator do CRUD",
440
+ "tags": []
441
+ }
442
+ },
443
+ "closeConfigurator": {
444
+ "complexType": {
445
+ "signature": "() => Promise<void>",
446
+ "parameters": [],
447
+ "references": {
448
+ "Promise": {
449
+ "location": "global"
450
+ }
451
+ },
452
+ "return": "Promise<void>"
453
+ },
454
+ "docs": {
455
+ "text": "Usado para fechar o configurator do CRUD",
456
+ "tags": []
457
+ }
374
458
  }
375
459
  };
376
460
  }
@@ -15,7 +15,6 @@ export class SnkFormConfig {
15
15
  constructor() {
16
16
  this._listEnabledFields = [];
17
17
  this._renderTimer = 500;
18
- this._sortableTimer = 100;
19
18
  this._tabSelected = 1;
20
19
  this._labelNewGroup = "Novo grupo";
21
20
  this._mouseOnFieldConfig = false;
@@ -40,36 +39,20 @@ export class SnkFormConfig {
40
39
  this.messagesBuilder = undefined;
41
40
  }
42
41
  observeConfigManager() {
43
- this.loadConfig(this._sortableTimer);
42
+ this.loadConfig();
44
43
  }
45
- loadFields(updateTimer = 0) {
44
+ loadFields() {
46
45
  this._layoutFormConfig = [];
47
- // this._layoutFormConfig ? this._layoutFormConfig.length = 0 : this._layoutFormConfig = [];
48
- /*
49
- TODO: Validar a possibilidade de fazer diretamente this._layoutFormConfig.length = 0
50
- sem a necessidade do ternario abaixo, para isso definir um default para o this._layoutFormConfig
51
- na declaração da variavel
52
- - Impactou:
53
- - Inserir um field, alterar a tab de lugar e inserir um novo campo
54
- - Ocultar/Deletar sequencialmente mais de uma aba
55
- */
56
- if (updateTimer > 0) {
57
- setTimeout(() => {
58
- this.buildFields();
59
- }, updateTimer);
60
- }
61
- else {
62
- this.buildFields();
63
- }
46
+ this.buildFields();
64
47
  }
65
48
  buildFields() {
66
49
  this.buildFormConfig();
67
50
  this.buildAvailableFields();
68
51
  }
69
- loadFormConfig(updateTimer) {
52
+ loadFormConfig() {
70
53
  var _a;
71
54
  this._formConfig = this.getConfig();
72
- this.loadFields(updateTimer);
55
+ this.loadFields();
73
56
  this.controlFieldConfig();
74
57
  if (((_a = this._filterFieldsAvailable) === null || _a === void 0 ? void 0 : _a.value) != undefined) {
75
58
  this._filterFieldsAvailable.value = "";
@@ -112,12 +95,12 @@ export class SnkFormConfig {
112
95
  }
113
96
  }
114
97
  resetChangeConfig() {
115
- this.loadFormConfig(this._sortableTimer);
98
+ this.loadFormConfig();
116
99
  this.clearTempGroups();
117
100
  }
118
101
  resetChangeOptionConfig() {
119
102
  this._formConfigChanged = false;
120
- this.loadConfig(this._sortableTimer);
103
+ this.loadConfig();
121
104
  this.clearTempGroups();
122
105
  }
123
106
  getTabsToSave() {
@@ -242,7 +225,7 @@ export class SnkFormConfig {
242
225
  var _a;
243
226
  return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
244
227
  var _a, _b;
245
- return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { messagesBuilder: this.messagesBuilder, onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name, id: field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
228
+ return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { messagesBuilder: this.messagesBuilder, onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name, id: field.name, key: field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
246
229
  h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
247
230
  }) : h("div", { class: "form-config__add-group-container" }, h("div", { class: "form-config__add-group-content" }, h("div", { class: "form-config__add-group-label" }, h("label", { class: "ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold" }, this.getMessage("snkFormConfig.form.labelDropField")))));
248
231
  }
@@ -335,9 +318,7 @@ export class SnkFormConfig {
335
318
  && oldContainer.id === newContainer.id) {
336
319
  evt.cancel();
337
320
  this._fieldsAvailable = [];
338
- setTimeout(() => {
339
- this.buildAvailableFields();
340
- }, this._sortableTimer);
321
+ this.buildAvailableFields();
341
322
  return true;
342
323
  }
343
324
  return false;
@@ -356,7 +337,7 @@ export class SnkFormConfig {
356
337
  }
357
338
  };
358
339
  setTimeout(() => {
359
- this.handleFieldConfigChange(eventDetail, this._sortableTimer);
340
+ this.handleFieldConfigChange(eventDetail);
360
341
  }, this._renderTimer);
361
342
  return true;
362
343
  }
@@ -380,11 +361,7 @@ export class SnkFormConfig {
380
361
  if (isNewGroup) {
381
362
  this.clearTempGroups(true);
382
363
  }
383
- const sortableTimer = oldContainer.dataset.groupName !== newContainer.dataset.groupName
384
- || (newContainer.id === CONTAINER_ID.withoutGroup && oldContainer.id === CONTAINER_ID.fieldsAvailable)
385
- ? this._sortableTimer
386
- : 0;
387
- this.updateFieldsToSave(sortableTimer);
364
+ this.updateFieldsToSave();
388
365
  }, this._renderTimer);
389
366
  return true;
390
367
  }
@@ -414,12 +391,12 @@ export class SnkFormConfig {
414
391
  return;
415
392
  }
416
393
  }
417
- updateFieldsToSave(updateTimer = 0) {
394
+ updateFieldsToSave() {
418
395
  const fields = this.getFieldsToSave();
419
396
  if ((fields === null || fields === void 0 ? void 0 : fields.length) > 0) {
420
397
  this._formConfig.fields = fields;
421
398
  }
422
- this.loadFields(updateTimer);
399
+ this.loadFields();
423
400
  this._formConfigChanged = true;
424
401
  }
425
402
  controlSortableField() {
@@ -448,7 +425,7 @@ export class SnkFormConfig {
448
425
  controlStopDraggingGroup(evt) {
449
426
  if (evt.data.newIndex !== evt.data.oldIndex) {
450
427
  setTimeout(() => {
451
- this.updateFieldsToSave(this._sortableTimer);
428
+ this.updateFieldsToSave();
452
429
  }, this._renderTimer);
453
430
  }
454
431
  }
@@ -523,7 +500,7 @@ export class SnkFormConfig {
523
500
  });
524
501
  if (tabs.length > 0) {
525
502
  this._formConfig.tabs = tabs;
526
- this.loadFields(this._sortableTimer);
503
+ this.loadFields();
527
504
  this.controlFieldConfig();
528
505
  this._formConfigChanged = true;
529
506
  }
@@ -550,13 +527,13 @@ export class SnkFormConfig {
550
527
  if (config != undefined) {
551
528
  this._formConfig = config;
552
529
  this._tabSelected = 1;
553
- this.loadFields(this._sortableTimer);
530
+ this.loadFields();
554
531
  this.controlFieldConfig();
555
532
  this.clearTempGroups();
556
533
  }
557
534
  }
558
- loadConfig(updateTimer = 0) {
559
- this.loadFormConfig(updateTimer);
535
+ loadConfig() {
536
+ this.loadFormConfig();
560
537
  this.loadUserConfig();
561
538
  }
562
539
  addNewGroup() {
@@ -597,7 +574,7 @@ export class SnkFormConfig {
597
574
  });
598
575
  }
599
576
  else {
600
- this.updateFieldsToSave(this._sortableTimer);
577
+ this.updateFieldsToSave();
601
578
  }
602
579
  }
603
580
  checkGroupExists(newLabel, indexGroup, isTempGroup = false) {
@@ -608,11 +585,11 @@ export class SnkFormConfig {
608
585
  if (tabGroupsNames === null || tabGroupsNames === void 0 ? void 0 : tabGroupsNames.includes(newLabel === null || newLabel === void 0 ? void 0 : newLabel.toLowerCase())) {
609
586
  const title = this.getMessage("snkFormConfig.confirm.title");
610
587
  const message = `
611
- ${this.getMessage("snkFormConfig.alert.titleGroupExists")}
612
- <b>${newLabel}</b>
613
- ${this.getMessage("snkFormConfig.alert.inTab")}
614
- <b>${tabName === TAB_NAMES.main ? this.getMessage("snkFormConfig.form.mainArea") : tabName}</b>.
615
- <br/><br/>
588
+ ${this.getMessage("snkFormConfig.alert.titleGroupExists")}
589
+ <b>${newLabel}</b>
590
+ ${this.getMessage("snkFormConfig.alert.inTab")}
591
+ <b>${tabName === TAB_NAMES.main ? this.getMessage("snkFormConfig.form.mainArea") : tabName}</b>.
592
+ <br/><br/>
616
593
  ${this.getMessage("snkFormConfig.alert.infoValidTitle")}
617
594
  `;
618
595
  ApplicationUtils.alert(title, message)
@@ -643,7 +620,7 @@ export class SnkFormConfig {
643
620
  field.group = newLabel;
644
621
  }
645
622
  });
646
- this.loadFields(this._sortableTimer);
623
+ this.loadFields();
647
624
  this.controlFieldConfig();
648
625
  this._formConfigChanged = true;
649
626
  }
@@ -857,14 +834,14 @@ export class SnkFormConfig {
857
834
  this._formConfigChanged = true;
858
835
  this.resetSortables();
859
836
  }
860
- controlRemoveFieldConfig(fieldConfig, updateTimer) {
837
+ controlRemoveFieldConfig(fieldConfig) {
861
838
  var _a;
862
839
  this._formConfigChanged = false;
863
840
  if (fieldConfig == undefined) {
864
841
  return;
865
842
  }
866
843
  this._formConfig.fields = (_a = this._formConfig.fields) === null || _a === void 0 ? void 0 : _a.filter((field) => field.name !== fieldConfig.name);
867
- this.loadFields(updateTimer);
844
+ this.loadFields();
868
845
  this.controlFieldConfig();
869
846
  this._formConfigChanged = true;
870
847
  this.resetSortables();
@@ -873,14 +850,14 @@ export class SnkFormConfig {
873
850
  this.controlSortableField();
874
851
  this.controlSortableGroup();
875
852
  }
876
- handleFieldConfigChange(evt, updateTimer = 0) {
853
+ handleFieldConfigChange(evt) {
877
854
  const { field: fieldConfig, type: actionType } = evt.detail;
878
855
  if (actionType === ACTION_CONFIG.configuration) {
879
856
  this.controlFieldConfig(fieldConfig);
880
857
  return;
881
858
  }
882
859
  if (actionType === ACTION_CONFIG.remove) {
883
- this.controlRemoveFieldConfig(fieldConfig, updateTimer);
860
+ this.controlRemoveFieldConfig(fieldConfig);
884
861
  return;
885
862
  }
886
863
  if (actionType === ACTION_CONFIG.add) {
@@ -901,7 +878,7 @@ export class SnkFormConfig {
901
878
  tab.label = newLabel;
902
879
  }
903
880
  });
904
- this.loadFields(this._sortableTimer);
881
+ this.loadFields();
905
882
  this.controlFieldConfig();
906
883
  this._formConfigChanged = true;
907
884
  }
@@ -921,7 +898,7 @@ export class SnkFormConfig {
921
898
  this._formConfig.tabs = (_a = this._formConfig.tabs) === null || _a === void 0 ? void 0 : _a.filter((tab) => {
922
899
  return tab.label !== tabSelected.detail.label;
923
900
  });
924
- this.loadFields(this._sortableTimer);
901
+ this.loadFields();
925
902
  this.controlFieldConfig();
926
903
  this._formConfigChanged = true;
927
904
  }
@@ -934,7 +911,7 @@ export class SnkFormConfig {
934
911
  tab.visible = !tab.visible;
935
912
  }
936
913
  });
937
- this.loadFields(this._sortableTimer);
914
+ this.loadFields();
938
915
  this.controlFieldConfig();
939
916
  this._formConfigChanged = true;
940
917
  }
@@ -978,7 +955,7 @@ export class SnkFormConfig {
978
955
  }), onEzAction: (evt) => this.controlSelectFormConfig(evt), id: "selectConfig" })), h("div", { class: "ez-col ez-col--sd-5 ez-col--tb-3 ez-align--middle ez-align--right" }, this._formConfigChanged === true && this._optionFormConfigChanged === false &&
979
956
  h("div", { class: "ez-row ez-align--middle ez-align--right" }, h("ez-button", { label: "Cancelar", class: "ez-padding-left--medium", size: "small", onClick: () => this.cancelChangeConfig() }), h("ez-button", { label: "Salvar", class: "ez-button--primary ez-padding-left--medium", size: "small", onClick: () => this.saveConfig() }, h("ez-icon", { class: "ez-margin-right--small", slot: "leftIcon", iconName: "save" }))), this._optionFormConfigChanged === true &&
980
957
  h("div", { class: "ez-row ez-align--middle ez-align--right" }, h("ez-button", { label: "Cancelar", class: "ez-padding-left--medium", size: "small", onClick: () => this.cancelChangeOptionConfig() }), h("ez-button", { label: this.getMessage("snkFormConfig.applyConfig"), class: "ez-button--primary ez-padding-left--medium", size: "small", onClick: () => this.applyOptionConfig() })))), h("div", { class: "ez-row ez-padding--medium", ref: ref => this._sortableContainer = ref }, h("div", { class: "form-config__tab-container ez-col ez-col--sd-9 ez-col--tb-9 ez-padding-right--medium" }, ((_b = this._layoutFormConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
981
- h("section", { class: "ez-box__container", ref: ref => this._formContainer = ref }, h("snk-tab-config", { ref: ref => this._tabConfig = ref, selectedIndex: this._tabSelected, messagesBuilder: this.messagesBuilder, onEzTabChange: (ev) => this.changeTabSelected(ev.detail), onEzOrderChange: (ev) => this.changeTabOrder(ev.detail), onEditionTitleTab: (ev) => this.changeTabLabel(ev), onDeleteTab: (ev) => this.handleDeleteTab(ev), onHideTab: (ev) => this.changeHideTab(ev), onCanStartDrag: () => this.handleCanStartDragTab() }, this._layoutFormConfig.map((tab) => h("snk-tab", { tabKey: tab.tab, label: tab.tab, visible: tab.visible }))), this._layoutFormConfig.map((tab, indexTab) => h("div", { id: "tab" + indexTab, "data-draggable-parent": "group", class: this._tabSelected === indexTab
958
+ h("section", { class: "ez-box__container", ref: ref => this._formContainer = ref }, h("snk-tab-config", { ref: ref => this._tabConfig = ref, selectedIndex: this._tabSelected, messagesBuilder: this.messagesBuilder, onEzTabChange: (ev) => this.changeTabSelected(ev.detail), onEzOrderChange: (ev) => this.changeTabOrder(ev.detail), onEditionTitleTab: (ev) => this.changeTabLabel(ev), onDeleteTab: (ev) => this.handleDeleteTab(ev), onHideTab: (ev) => this.changeHideTab(ev), onCanStartDrag: () => this.handleCanStartDragTab(), tabItems: this._layoutFormConfig.map((tab) => { return { tabKey: tab.tab, label: tab.tab, visible: tab.visible }; }) }), this._layoutFormConfig.map((tab, indexTab) => h("div", { id: "tab" + indexTab, "data-draggable-parent": "group", class: this._tabSelected === indexTab
982
959
  ? "form-config__tab-content ez-flex ez-flex--column ez-size-width--full ez-padding--medium"
983
960
  : "form-config__hide-content" }, tab.groups.map((group, indexGroup) => {
984
961
  if (group.group) {
@@ -13,6 +13,7 @@ export class SnkTabConfig {
13
13
  this.selectedIndex = undefined;
14
14
  this.selectedTab = undefined;
15
15
  this.tabs = undefined;
16
+ this.tabItems = undefined;
16
17
  this.messagesBuilder = undefined;
17
18
  }
18
19
  /**
@@ -120,7 +121,7 @@ export class SnkTabConfig {
120
121
  window.clearTimeout(this._scrollCallBackFocus);
121
122
  this._scrollCallBackFocus = window.setTimeout(() => {
122
123
  const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
123
- tabtoscroll.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
124
+ tabtoscroll === null || tabtoscroll === void 0 ? void 0 : tabtoscroll.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
124
125
  }, 200);
125
126
  }
126
127
  controlKeyEventEnter(evt) {
@@ -270,27 +271,18 @@ export class SnkTabConfig {
270
271
  }
271
272
  }
272
273
  componentWillRender() {
273
- if (this._processedTabs == undefined) {
274
- this._processedTabs = [];
275
- if (this.tabs) {
276
- this.tabs.split(",").forEach((label) => {
277
- label = label.trim();
278
- this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
279
- });
280
- }
281
- this._hostElem.querySelectorAll("snk-tab").forEach((elem) => {
282
- const tabKey = elem.getAttribute("tabKey");
283
- const label = elem.getAttribute("label") !== TAB_NAMES.main ? elem.getAttribute("label") : this.getMessage("snkFormConfig.form.mainArea");
284
- const visible = elem.hasAttribute("visible");
285
- const tab = { label, tabKey, index: this._processedTabs.length, visible };
286
- const content = elem.firstChild;
287
- if (content) {
288
- content.setAttribute("slot", "tab" + tab.index);
289
- this._hostElem.appendChild(content);
290
- }
291
- this._processedTabs.push(tab);
274
+ this._processedTabs = [];
275
+ if (this.tabs) {
276
+ this.tabs.split(",").forEach((label) => {
277
+ label = label.trim();
278
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
292
279
  });
293
280
  }
281
+ this.tabItems.forEach((tab) => {
282
+ tab.label = tab.label !== TAB_NAMES.main ? tab.label : this.getMessage("snkFormConfig.form.mainArea");
283
+ tab.index = this._processedTabs.length;
284
+ this._processedTabs.push(tab);
285
+ });
294
286
  }
295
287
  componentDidRender() {
296
288
  this.updateScroll();
@@ -311,7 +303,7 @@ export class SnkTabConfig {
311
303
  this.selectedTab = tab.tabKey;
312
304
  this.selectedIndex = index;
313
305
  }
314
- return h("button", { id: tabId, class: `tab-config__tab${isSelected ? " tab-config__tab--is-active" : ""}`, onClick: () => this.handleTabClick(tab), onDblClick: () => { this._activeEditText = true; this._activeEditTextIndex = index; }, "data-draggable-element": index > 0 ? "tab" : "", onMouseLeave: () => this.onHideActions(index) }, (this._activeEditText === true && this._activeEditTextIndex === index && index > 0) ||
306
+ return h("button", { id: tabId, class: `tab-config__tab${isSelected ? " tab-config__tab--is-active" : ""}`, onClick: () => this.handleTabClick(tab), onDblClick: () => { this._activeEditText = true; this._activeEditTextIndex = index; }, "data-draggable-element": index > 0 ? "tab" : "", onMouseLeave: () => this.onHideActions(index), key: tab.label }, (this._activeEditText === true && this._activeEditTextIndex === index && index > 0) ||
315
307
  h(Fragment, null, index > 0 && h("ez-icon", { iconName: tab.leftIcon || "drag-indicator", class: "tab-config__left-icon" }), (tab.visible === false && index > 0) && h("ez-icon", { iconName: tab.leftIcon || "eye-off", class: "tab-config__left-icon tab-config__left-icon--eye-off" }), h("span", { class: "tab-config__tab-label" + (tab.visible === false && index > 0 ? " tab-config__tab-label-disabled" : ""), title: tab.label }, tab.label), index > 0 &&
316
308
  h("ez-actions-button", { class: "tab-config__actions-button", size: "small", ref: elem => this._refTabActions[index] = elem, actions: tab.visible === false ? this._actionsShow : this._actionsHide, isTransparent: true, arrowActive: true, onEzAction: (ev) => this.handleActions(ev, tab) }), h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } })), (this._activeEditText === true && index > 0 && this._activeEditTextIndex === index) &&
317
309
  h("ez-text-edit", { value: tab.label, styled: this.getStyledLabel(tabId), class: "tab-config__edit-text", onSaveEdition: (ev) => this.handleSaveEditionText(ev), onCancelEdition: () => this.cancelEditText() }));
@@ -382,6 +374,25 @@ export class SnkTabConfig {
382
374
  "attribute": "tabs",
383
375
  "reflect": false
384
376
  },
377
+ "tabItems": {
378
+ "type": "unknown",
379
+ "mutable": false,
380
+ "complexType": {
381
+ "original": "ITab[]",
382
+ "resolved": "ITab[]",
383
+ "references": {
384
+ "ITab": {
385
+ "location": "local"
386
+ }
387
+ }
388
+ },
389
+ "required": false,
390
+ "optional": false,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": "Define o nome das abas do componente separadas por v\u00EDrgulas \",\"."
394
+ }
395
+ },
385
396
  "messagesBuilder": {
386
397
  "type": "unknown",
387
398
  "mutable": true,
@@ -87,7 +87,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
87
87
  }
88
88
  }
89
89
  render() {
90
- return (h("ez-modal", { opened: this._opened, "close-esc": false, "close-outside-click": false, "modal-size": "small", scrim: "light" }, h("div", { class: "snk-configurator" }, h("div", { class: "snk-configurator__header" }, h("label", { class: "snk-configurator__title" }, this.getMessage('snkConfigurator.titleConfigurations')), h("div", { class: "snk-configurator__button-close" }, h("ez-button", { mode: "icon", iconName: "close", size: "medium", onClick: () => this.closeConfig() }))), h("div", { class: "snk-configurator__main" }, h("ez-collapsible-box", { boxBordered: true, label: "Modo de visualiza\u00E7\u00E3o ", headerSize: "medium", class: "snk-configurator__collapsable-box" }, h("ez-radio-button", { value: this.getViewModeValue().toString(), onEzChange: (evt) => this.onViewModeChanged(evt), enabled: this.enableModeConfig() }, h("ez-radio-button-option", { label: this.getMessage('snkConfigurator.labelGrid'), value: VIEW_MODE.GRID }), h("ez-radio-button-option", { label: this.getMessage('snkConfigurator.labelForm'), value: VIEW_MODE.FORM })), h("div", { class: "snk-configurator__collsable-box-action" }, h("ez-button", { label: this.viewMode === VIEW_MODE.GRID ? this.getMessage('snkConfigurator.labelConfigGrid') : this.getMessage('snkConfigurator.labelConfigForm'), class: "snk-configurator__button-config ez-button--secondary", onClick: () => this.onClickOpenConfig(), id: "openConfigurator" }))), h("div", { class: "snk-configurator__outline" }, h("slot", { name: "SnkConfigContainerSlot" }))), this.showActionButtons && (h("div", { class: "snk-configurator__action-buttons" }, h("ez-button", { label: "Cancelar", onClick: () => this.cancel.emit(true) }), h("ez-button", { label: "Salvar", onClick: () => this.save.emit(true), class: "ez-button--primary" }))))));
90
+ return (h("ez-modal", { opened: this._opened, "close-esc": false, "close-outside-click": false, "modal-size": "small", scrim: "light" }, h("div", { class: "snk-configurator" }, h("div", { class: "snk-configurator__header" }, h("label", { class: "snk-configurator__title" }, this.getMessage('snkConfigurator.titleConfigurations')), h("div", { class: "snk-configurator__button-close" }, h("ez-button", { mode: "icon", iconName: "close", size: "medium", onClick: () => this.closeConfig() }))), h("div", { class: "snk-configurator__main" }, h("ez-collapsible-box", { boxBordered: true, label: "Modo de visualiza\u00E7\u00E3o ", headerSize: "medium", class: "snk-configurator__collapsable-box" }, h("ez-radio-button", { value: this.getViewModeValue().toString(), onEzChange: (evt) => this.onViewModeChanged(evt), enabled: this.enableModeConfig() }, h("ez-radio-button-option", { label: this.getMessage('snkConfigurator.labelGrid'), value: VIEW_MODE.GRID }), h("ez-radio-button-option", { label: this.getMessage('snkConfigurator.labelForm'), value: VIEW_MODE.FORM })), h("div", { class: "snk-configurator__collsable-box-action" }, h("ez-button", { label: this.viewMode === VIEW_MODE.GRID ? this.getMessage('snkConfigurator.labelConfigGrid') : this.getMessage('snkConfigurator.labelConfigForm'), class: "snk-configurator__button-config ez-button--secondary", onClick: () => this.onClickOpenConfig(), id: "openConfigurator" }))), h("div", { class: "snk-configurator__outline" }, h("slot", { name: "SnkConfigContainerSlot" }))), this.showActionButtons && (h("div", { class: "snk-configurator__action-buttons" }, h("ez-button", { label: "Cancelar", onClick: () => this.cancel.emit() }), h("ez-button", { label: "Salvar", onClick: () => this.save.emit(), class: "ez-button--primary" }))))));
91
91
  }
92
92
  static get style() { return snkConfiguratorCss; }
93
93
  }, [6, "snk-configurator", {
@@ -33,6 +33,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
33
33
  super();
34
34
  this.__registerHost();
35
35
  this.actionClick = createEvent(this, "actionClick", 7);
36
+ this.configuratorSave = createEvent(this, "configuratorSave", 7);
37
+ this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
36
38
  this._viewHistory = [];
37
39
  this._dataUnit = undefined;
38
40
  this._dataState = undefined;
@@ -54,6 +56,20 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
54
56
  async goToView(mode) {
55
57
  this.executeAction(mode);
56
58
  }
59
+ /**
60
+ * Usado para abrir o configurator do CRUD
61
+ */
62
+ async openConfigurator() {
63
+ var _a;
64
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
65
+ }
66
+ /**
67
+ * Usado para fechar o configurator do CRUD
68
+ */
69
+ async closeConfigurator() {
70
+ var _a;
71
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
72
+ }
57
73
  currentViewModeWatcher(currentView) {
58
74
  this._viewHistory = [...this._viewHistory.slice(-1), currentView];
59
75
  }
@@ -146,8 +162,16 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
146
162
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
147
163
  }
148
164
  }
165
+ handleConfiguratorEvent(evt, type) {
166
+ evt.stopImmediatePropagation();
167
+ if (type === 'SAVE') {
168
+ this.configuratorSave.emit();
169
+ return;
170
+ }
171
+ this.configuratorCancel.emit();
172
+ }
149
173
  render() {
150
- return (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, "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 }, 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" }, 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 }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
174
+ return (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, "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 }, 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" }, 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') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
151
175
  }
152
176
  get _element() { return this; }
153
177
  static get watchers() { return {
@@ -168,7 +192,9 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
168
192
  "_dataState": [32],
169
193
  "attachmentRegisterKey": [32],
170
194
  "_currentViewMode": [32],
171
- "goToView": [64]
195
+ "goToView": [64],
196
+ "openConfigurator": [64],
197
+ "closeConfigurator": [64]
172
198
  }]);
173
199
  function defineCustomElement$1() {
174
200
  if (typeof customElements === "undefined") {