@sankhyalabs/sankhyablocks 5.13.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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +33 -56
- package/dist/cjs/snk-tab-config.cjs.entry.js +13 -21
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +33 -56
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +32 -21
- package/dist/components/snk-form-config2.js +33 -56
- package/dist/components/snk-tab-config2.js +14 -21
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-form-config.entry.js +33 -56
- package/dist/esm/snk-tab-config.entry.js +13 -21
- package/dist/sankhyablocks/p-584a315a.entry.js +1 -0
- package/dist/sankhyablocks/p-72e78de0.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -1
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +4 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0409d41b.entry.js +0 -1
- package/dist/sankhyablocks/p-1c0ee011.entry.js +0 -1
package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js
CHANGED
@@ -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(
|
42
|
+
this.loadConfig();
|
44
43
|
}
|
45
|
-
loadFields(
|
44
|
+
loadFields() {
|
46
45
|
this._layoutFormConfig = [];
|
47
|
-
|
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(
|
52
|
+
loadFormConfig() {
|
70
53
|
var _a;
|
71
54
|
this._formConfig = this.getConfig();
|
72
|
-
this.loadFields(
|
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(
|
98
|
+
this.loadFormConfig();
|
116
99
|
this.clearTempGroups();
|
117
100
|
}
|
118
101
|
resetChangeOptionConfig() {
|
119
102
|
this._formConfigChanged = false;
|
120
|
-
this.loadConfig(
|
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
|
-
|
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
|
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
|
-
|
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(
|
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(
|
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(
|
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(
|
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(
|
530
|
+
this.loadFields();
|
554
531
|
this.controlFieldConfig();
|
555
532
|
this.clearTempGroups();
|
556
533
|
}
|
557
534
|
}
|
558
|
-
loadConfig(
|
559
|
-
this.loadFormConfig(
|
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(
|
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(
|
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
|
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(
|
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
|
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
|
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(
|
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(
|
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(
|
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()
|
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
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
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,
|
@@ -24,7 +24,6 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
24
24
|
this.configClose = createEvent(this, "configClose", 7);
|
25
25
|
this._listEnabledFields = [];
|
26
26
|
this._renderTimer = 500;
|
27
|
-
this._sortableTimer = 100;
|
28
27
|
this._tabSelected = 1;
|
29
28
|
this._labelNewGroup = "Novo grupo";
|
30
29
|
this._mouseOnFieldConfig = false;
|
@@ -49,36 +48,20 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
49
48
|
this.messagesBuilder = undefined;
|
50
49
|
}
|
51
50
|
observeConfigManager() {
|
52
|
-
this.loadConfig(
|
51
|
+
this.loadConfig();
|
53
52
|
}
|
54
|
-
loadFields(
|
53
|
+
loadFields() {
|
55
54
|
this._layoutFormConfig = [];
|
56
|
-
|
57
|
-
/*
|
58
|
-
TODO: Validar a possibilidade de fazer diretamente this._layoutFormConfig.length = 0
|
59
|
-
sem a necessidade do ternario abaixo, para isso definir um default para o this._layoutFormConfig
|
60
|
-
na declaração da variavel
|
61
|
-
- Impactou:
|
62
|
-
- Inserir um field, alterar a tab de lugar e inserir um novo campo
|
63
|
-
- Ocultar/Deletar sequencialmente mais de uma aba
|
64
|
-
*/
|
65
|
-
if (updateTimer > 0) {
|
66
|
-
setTimeout(() => {
|
67
|
-
this.buildFields();
|
68
|
-
}, updateTimer);
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
this.buildFields();
|
72
|
-
}
|
55
|
+
this.buildFields();
|
73
56
|
}
|
74
57
|
buildFields() {
|
75
58
|
this.buildFormConfig();
|
76
59
|
this.buildAvailableFields();
|
77
60
|
}
|
78
|
-
loadFormConfig(
|
61
|
+
loadFormConfig() {
|
79
62
|
var _a;
|
80
63
|
this._formConfig = this.getConfig();
|
81
|
-
this.loadFields(
|
64
|
+
this.loadFields();
|
82
65
|
this.controlFieldConfig();
|
83
66
|
if (((_a = this._filterFieldsAvailable) === null || _a === void 0 ? void 0 : _a.value) != undefined) {
|
84
67
|
this._filterFieldsAvailable.value = "";
|
@@ -121,12 +104,12 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
121
104
|
}
|
122
105
|
}
|
123
106
|
resetChangeConfig() {
|
124
|
-
this.loadFormConfig(
|
107
|
+
this.loadFormConfig();
|
125
108
|
this.clearTempGroups();
|
126
109
|
}
|
127
110
|
resetChangeOptionConfig() {
|
128
111
|
this._formConfigChanged = false;
|
129
|
-
this.loadConfig(
|
112
|
+
this.loadConfig();
|
130
113
|
this.clearTempGroups();
|
131
114
|
}
|
132
115
|
getTabsToSave() {
|
@@ -251,7 +234,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
251
234
|
var _a;
|
252
235
|
return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
|
253
236
|
var _a, _b;
|
254
|
-
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 &&
|
237
|
+
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 &&
|
255
238
|
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) })));
|
256
239
|
}) : 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")))));
|
257
240
|
}
|
@@ -341,9 +324,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
341
324
|
&& oldContainer.id === newContainer.id) {
|
342
325
|
evt.cancel();
|
343
326
|
this._fieldsAvailable = [];
|
344
|
-
|
345
|
-
this.buildAvailableFields();
|
346
|
-
}, this._sortableTimer);
|
327
|
+
this.buildAvailableFields();
|
347
328
|
return true;
|
348
329
|
}
|
349
330
|
return false;
|
@@ -362,7 +343,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
362
343
|
}
|
363
344
|
};
|
364
345
|
setTimeout(() => {
|
365
|
-
this.handleFieldConfigChange(eventDetail
|
346
|
+
this.handleFieldConfigChange(eventDetail);
|
366
347
|
}, this._renderTimer);
|
367
348
|
return true;
|
368
349
|
}
|
@@ -386,11 +367,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
386
367
|
if (isNewGroup) {
|
387
368
|
this.clearTempGroups(true);
|
388
369
|
}
|
389
|
-
|
390
|
-
|| (newContainer.id === CONTAINER_ID.withoutGroup && oldContainer.id === CONTAINER_ID.fieldsAvailable)
|
391
|
-
? this._sortableTimer
|
392
|
-
: 0;
|
393
|
-
this.updateFieldsToSave(sortableTimer);
|
370
|
+
this.updateFieldsToSave();
|
394
371
|
}, this._renderTimer);
|
395
372
|
return true;
|
396
373
|
}
|
@@ -420,12 +397,12 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
420
397
|
return;
|
421
398
|
}
|
422
399
|
}
|
423
|
-
updateFieldsToSave(
|
400
|
+
updateFieldsToSave() {
|
424
401
|
const fields = this.getFieldsToSave();
|
425
402
|
if ((fields === null || fields === void 0 ? void 0 : fields.length) > 0) {
|
426
403
|
this._formConfig.fields = fields;
|
427
404
|
}
|
428
|
-
this.loadFields(
|
405
|
+
this.loadFields();
|
429
406
|
this._formConfigChanged = true;
|
430
407
|
}
|
431
408
|
controlSortableField() {
|
@@ -454,7 +431,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
454
431
|
controlStopDraggingGroup(evt) {
|
455
432
|
if (evt.data.newIndex !== evt.data.oldIndex) {
|
456
433
|
setTimeout(() => {
|
457
|
-
this.updateFieldsToSave(
|
434
|
+
this.updateFieldsToSave();
|
458
435
|
}, this._renderTimer);
|
459
436
|
}
|
460
437
|
}
|
@@ -529,7 +506,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
529
506
|
});
|
530
507
|
if (tabs.length > 0) {
|
531
508
|
this._formConfig.tabs = tabs;
|
532
|
-
this.loadFields(
|
509
|
+
this.loadFields();
|
533
510
|
this.controlFieldConfig();
|
534
511
|
this._formConfigChanged = true;
|
535
512
|
}
|
@@ -556,13 +533,13 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
556
533
|
if (config != undefined) {
|
557
534
|
this._formConfig = config;
|
558
535
|
this._tabSelected = 1;
|
559
|
-
this.loadFields(
|
536
|
+
this.loadFields();
|
560
537
|
this.controlFieldConfig();
|
561
538
|
this.clearTempGroups();
|
562
539
|
}
|
563
540
|
}
|
564
|
-
loadConfig(
|
565
|
-
this.loadFormConfig(
|
541
|
+
loadConfig() {
|
542
|
+
this.loadFormConfig();
|
566
543
|
this.loadUserConfig();
|
567
544
|
}
|
568
545
|
addNewGroup() {
|
@@ -603,7 +580,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
603
580
|
});
|
604
581
|
}
|
605
582
|
else {
|
606
|
-
this.updateFieldsToSave(
|
583
|
+
this.updateFieldsToSave();
|
607
584
|
}
|
608
585
|
}
|
609
586
|
checkGroupExists(newLabel, indexGroup, isTempGroup = false) {
|
@@ -614,11 +591,11 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
614
591
|
if (tabGroupsNames === null || tabGroupsNames === void 0 ? void 0 : tabGroupsNames.includes(newLabel === null || newLabel === void 0 ? void 0 : newLabel.toLowerCase())) {
|
615
592
|
const title = this.getMessage("snkFormConfig.confirm.title");
|
616
593
|
const message = `
|
617
|
-
${this.getMessage("snkFormConfig.alert.titleGroupExists")}
|
618
|
-
<b>${newLabel}</b>
|
619
|
-
${this.getMessage("snkFormConfig.alert.inTab")}
|
620
|
-
<b>${tabName === TAB_NAMES.main ? this.getMessage("snkFormConfig.form.mainArea") : tabName}</b>.
|
621
|
-
<br/><br/>
|
594
|
+
${this.getMessage("snkFormConfig.alert.titleGroupExists")}
|
595
|
+
<b>${newLabel}</b>
|
596
|
+
${this.getMessage("snkFormConfig.alert.inTab")}
|
597
|
+
<b>${tabName === TAB_NAMES.main ? this.getMessage("snkFormConfig.form.mainArea") : tabName}</b>.
|
598
|
+
<br/><br/>
|
622
599
|
${this.getMessage("snkFormConfig.alert.infoValidTitle")}
|
623
600
|
`;
|
624
601
|
ApplicationUtils.alert(title, message)
|
@@ -649,7 +626,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
649
626
|
field.group = newLabel;
|
650
627
|
}
|
651
628
|
});
|
652
|
-
this.loadFields(
|
629
|
+
this.loadFields();
|
653
630
|
this.controlFieldConfig();
|
654
631
|
this._formConfigChanged = true;
|
655
632
|
}
|
@@ -863,14 +840,14 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
863
840
|
this._formConfigChanged = true;
|
864
841
|
this.resetSortables();
|
865
842
|
}
|
866
|
-
controlRemoveFieldConfig(fieldConfig
|
843
|
+
controlRemoveFieldConfig(fieldConfig) {
|
867
844
|
var _a;
|
868
845
|
this._formConfigChanged = false;
|
869
846
|
if (fieldConfig == undefined) {
|
870
847
|
return;
|
871
848
|
}
|
872
849
|
this._formConfig.fields = (_a = this._formConfig.fields) === null || _a === void 0 ? void 0 : _a.filter((field) => field.name !== fieldConfig.name);
|
873
|
-
this.loadFields(
|
850
|
+
this.loadFields();
|
874
851
|
this.controlFieldConfig();
|
875
852
|
this._formConfigChanged = true;
|
876
853
|
this.resetSortables();
|
@@ -879,14 +856,14 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
879
856
|
this.controlSortableField();
|
880
857
|
this.controlSortableGroup();
|
881
858
|
}
|
882
|
-
handleFieldConfigChange(evt
|
859
|
+
handleFieldConfigChange(evt) {
|
883
860
|
const { field: fieldConfig, type: actionType } = evt.detail;
|
884
861
|
if (actionType === ACTION_CONFIG.configuration) {
|
885
862
|
this.controlFieldConfig(fieldConfig);
|
886
863
|
return;
|
887
864
|
}
|
888
865
|
if (actionType === ACTION_CONFIG.remove) {
|
889
|
-
this.controlRemoveFieldConfig(fieldConfig
|
866
|
+
this.controlRemoveFieldConfig(fieldConfig);
|
890
867
|
return;
|
891
868
|
}
|
892
869
|
if (actionType === ACTION_CONFIG.add) {
|
@@ -907,7 +884,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
907
884
|
tab.label = newLabel;
|
908
885
|
}
|
909
886
|
});
|
910
|
-
this.loadFields(
|
887
|
+
this.loadFields();
|
911
888
|
this.controlFieldConfig();
|
912
889
|
this._formConfigChanged = true;
|
913
890
|
}
|
@@ -927,7 +904,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
927
904
|
this._formConfig.tabs = (_a = this._formConfig.tabs) === null || _a === void 0 ? void 0 : _a.filter((tab) => {
|
928
905
|
return tab.label !== tabSelected.detail.label;
|
929
906
|
});
|
930
|
-
this.loadFields(
|
907
|
+
this.loadFields();
|
931
908
|
this.controlFieldConfig();
|
932
909
|
this._formConfigChanged = true;
|
933
910
|
}
|
@@ -940,7 +917,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
940
917
|
tab.visible = !tab.visible;
|
941
918
|
}
|
942
919
|
});
|
943
|
-
this.loadFields(
|
920
|
+
this.loadFields();
|
944
921
|
this.controlFieldConfig();
|
945
922
|
this._formConfigChanged = true;
|
946
923
|
}
|
@@ -984,7 +961,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
984
961
|
}), 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 &&
|
985
962
|
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 &&
|
986
963
|
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 &&
|
987
|
-
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()
|
964
|
+
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
|
988
965
|
? "form-config__tab-content ez-flex ez-flex--column ez-size-width--full ez-padding--medium"
|
989
966
|
: "form-config__hide-content" }, tab.groups.map((group, indexGroup) => {
|
990
967
|
if (group.group) {
|