@sankhyalabs/sankhyablocks 10.1.0-dev.4 → 10.1.0-dev.5
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/{ConfigStorage-b29e31be.js → ConfigStorage-72f34bd4.js} +2 -2
- package/dist/cjs/{DataFetcher-ed9d97ea.js → DataFetcher-991b0349.js} +19 -1
- package/dist/cjs/{FormConfigHelper-ebb77625.js → FormConfigHelper-e253a418.js} +42 -0
- package/dist/cjs/{ISave-81eb2fbc.js → ISave-ebf6b4ed.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-6838389c.js → SnkFormConfigManager-cdbb29d4.js} +4 -4
- package/dist/cjs/{SnkMultiSelectionListDataSource-1e804147.js → SnkMultiSelectionListDataSource-011bec79.js} +4 -4
- package/dist/cjs/{auth-fetcher-cc28d847.js → auth-fetcher-c3cac878.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-ab1cc071.js → dataunit-fetcher-8bf469e7.js} +1 -1
- package/dist/cjs/field-config_2.cjs.entry.js +1 -1
- package/dist/cjs/fields-layout.cjs.entry.js +4 -1
- package/dist/cjs/fields-selector.cjs.entry.js +1 -1
- package/dist/cjs/{form-config-fetcher-f0897eb5.js → form-config-fetcher-c7af90d8.js} +1 -1
- package/dist/cjs/guides-configurator.cjs.entry.js +3 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +6 -6
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-crud.cjs.entry.js +9 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-68992932.js → snk-data-unit-7d587ad5.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form_2.cjs.entry.js +22 -9
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/{snk-guides-viewer-8b841753.js → snk-guides-viewer-366d5c32.js} +90 -28
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
- package/dist/cjs/snk-taskbar.cjs.entry.js +56 -44
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +29 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +124 -23
- package/dist/collection/components/snk-form-config/FormConfigHelper.js +40 -0
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
- package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +3 -0
- package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +3 -1
- package/dist/collection/components/snk-form-config/snk-form-config.js +43 -6
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +58 -44
- package/dist/collection/lib/message/resources/en-us/snk-form.msg.js +6 -0
- package/dist/collection/lib/message/resources/es-es/snk-form.msg.js +6 -0
- package/dist/collection/lib/message/resources/pt-br/snk-form.msg.js +7 -1
- package/dist/components/DataFetcher.js +19 -1
- package/dist/components/SnkFormConfigManager.js +3 -3
- package/dist/components/field-config2.js +41 -1
- package/dist/components/fields-layout2.js +3 -0
- package/dist/components/guides-configurator2.js +3 -1
- package/dist/components/snk-crud.js +6 -2
- package/dist/components/snk-detail-view2.js +86 -23
- package/dist/components/snk-form-config2.js +19 -5
- package/dist/components/snk-taskbar2.js +57 -45
- package/dist/esm/{ConfigStorage-13d80e36.js → ConfigStorage-22324b6b.js} +2 -2
- package/dist/esm/{DataFetcher-f4ccd9f3.js → DataFetcher-450828a0.js} +19 -1
- package/dist/esm/{FormConfigHelper-4e42f0b6.js → FormConfigHelper-e89ca25c.js} +41 -1
- package/dist/esm/{ISave-288fa9df.js → ISave-61153166.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-3ee2937b.js → SnkFormConfigManager-b5a92e12.js} +4 -4
- package/dist/esm/{SnkMultiSelectionListDataSource-5d3a93f2.js → SnkMultiSelectionListDataSource-d7ce2e54.js} +4 -4
- package/dist/esm/{auth-fetcher-59ab0c67.js → auth-fetcher-eef9d01e.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c4f9f222.js → dataunit-fetcher-da9596f6.js} +1 -1
- package/dist/esm/field-config_2.entry.js +1 -1
- package/dist/esm/fields-layout.entry.js +4 -1
- package/dist/esm/fields-selector.entry.js +1 -1
- package/dist/esm/{form-config-fetcher-6a00fe9e.js → form-config-fetcher-8d0a5e1c.js} +1 -1
- package/dist/esm/guides-configurator.entry.js +3 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +6 -6
- package/dist/esm/snk-attach.entry.js +5 -5
- package/dist/esm/snk-crud.entry.js +9 -7
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-0edeb967.js → snk-data-unit-99616a07.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +7 -7
- package/dist/esm/snk-filter-bar_4.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form_2.entry.js +22 -9
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/{snk-guides-viewer-9cd4d20f.js → snk-guides-viewer-240de636.js} +90 -28
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +4 -4
- package/dist/esm/snk-simple-crud.entry.js +7 -7
- package/dist/esm/snk-taskbar.entry.js +57 -45
- package/dist/sankhyablocks/{p-1c2971e4.js → p-002d4d2b.js} +1 -1
- package/dist/sankhyablocks/{p-ae108ffd.entry.js → p-0948dc0a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7b3ca294.entry.js → p-0b9a42ad.entry.js} +1 -1
- package/dist/sankhyablocks/p-118c221e.js +1 -0
- package/dist/sankhyablocks/{p-dc851b6e.entry.js → p-1a9c5684.entry.js} +1 -1
- package/dist/sankhyablocks/p-1d589380.entry.js +1 -0
- package/dist/sankhyablocks/{p-d9c54991.js → p-28f50632.js} +1 -1
- package/dist/sankhyablocks/p-39be771c.js +1 -0
- package/dist/sankhyablocks/{p-26e0f63c.entry.js → p-4963dd2a.entry.js} +1 -1
- package/dist/sankhyablocks/p-55f6fef2.entry.js +1 -0
- package/dist/sankhyablocks/p-56f16390.entry.js +1 -0
- package/dist/sankhyablocks/{p-5304753a.js → p-58683e28.js} +2 -2
- package/dist/sankhyablocks/{p-11346b8d.entry.js → p-5ea893c5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f15478a1.js → p-62aef37a.js} +1 -1
- package/dist/sankhyablocks/{p-34f447ba.entry.js → p-62e9b9b8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e9021f79.entry.js → p-669bb869.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6180de07.entry.js → p-6ee2ca7a.entry.js} +1 -1
- package/dist/sankhyablocks/p-7cac3870.entry.js +1 -0
- package/dist/sankhyablocks/{p-78ff8734.js → p-7d6f1285.js} +1 -1
- package/dist/sankhyablocks/{p-53599b26.js → p-840fb68c.js} +1 -1
- package/dist/sankhyablocks/{p-b4322b87.entry.js → p-86e54841.entry.js} +1 -1
- package/dist/sankhyablocks/{p-34df7eca.entry.js → p-88b337fe.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3d021bef.entry.js → p-91005a00.entry.js} +1 -1
- package/dist/sankhyablocks/p-92cfc028.js +1 -0
- package/dist/sankhyablocks/{p-44939a0e.entry.js → p-ada013c0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9317942f.js → p-c35fc941.js} +1 -1
- package/dist/sankhyablocks/p-c98c79c3.entry.js +1 -0
- package/dist/sankhyablocks/{p-1858c023.entry.js → p-cadf4846.entry.js} +1 -1
- package/dist/sankhyablocks/{p-38e56b68.entry.js → p-e91c3c57.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f8f29e1a.entry.js → p-ea729922.entry.js} +1 -1
- package/dist/sankhyablocks/p-ec5fbad8.js +1 -0
- package/dist/sankhyablocks/{p-80014119.entry.js → p-f5e942b7.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +22 -0
- package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +8 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -3
- package/dist/types/components.d.ts +30 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0e279e7a.js +0 -1
- package/dist/sankhyablocks/p-3abeeefa.entry.js +0 -1
- package/dist/sankhyablocks/p-557368df.entry.js +0 -1
- package/dist/sankhyablocks/p-583151c5.entry.js +0 -1
- package/dist/sankhyablocks/p-8f73da95.js +0 -1
- package/dist/sankhyablocks/p-a2ed1ebd.entry.js +0 -1
- package/dist/sankhyablocks/p-a5108625.entry.js +0 -1
- package/dist/sankhyablocks/p-a644a956.js +0 -1
- package/dist/sankhyablocks/p-bb2f5f38.js +0 -1
@@ -7438,6 +7438,7 @@ const snkFormConfigMessages$2 = {
|
|
7438
7438
|
labelNewGroup: "Adicionar novo grupo",
|
7439
7439
|
mainArea: "Área principal",
|
7440
7440
|
tabGeneral: "Geral",
|
7441
|
+
canNotEditCustomGuide: "Não é possível editar guias detalhe e guias personalizadas",
|
7441
7442
|
createNewGroup: "Criar novo grupo",
|
7442
7443
|
newGroup: "Criar novo grupo",
|
7443
7444
|
noGuideSelected: "Selecione uma guia e comece a configurar",
|
@@ -7465,6 +7466,10 @@ const snkFormConfigMessages$2 = {
|
|
7465
7466
|
title: "Atenção",
|
7466
7467
|
message: "Selecione uma guia para iniciar a configuração!"
|
7467
7468
|
},
|
7469
|
+
canNotAddFieldToGuide: {
|
7470
|
+
title: "Atenção",
|
7471
|
+
message: "Não é possível adicionar campos à guias customizadas ou guias detalhe!"
|
7472
|
+
},
|
7468
7473
|
alert: {
|
7469
7474
|
titleGroupExists: "Já existe um grupo com título",
|
7470
7475
|
titleGroupEditing: "Há um <b>grupo<b/> em edição. <br/> Finalize a edição para salvar as configurações.",
|
@@ -7495,10 +7500,11 @@ const snkFormConfigMessages$2 = {
|
|
7495
7500
|
createNewGuide: "Criar nova guia",
|
7496
7501
|
noHiddenGuides: "Nenhuma guia oculta",
|
7497
7502
|
noVisibleGuides: "Nenhuma guia visível",
|
7503
|
+
canNotDeleteCustomGuide: "Não é possível excluir guias detalhe e guias personalizadas",
|
7498
7504
|
actions: {
|
7499
7505
|
hide: "Ocultar",
|
7500
7506
|
show: "Tornar visível",
|
7501
|
-
delete: "Excluir"
|
7507
|
+
delete: "Excluir",
|
7502
7508
|
}
|
7503
7509
|
}
|
7504
7510
|
};
|
@@ -8296,6 +8302,7 @@ const snkFormConfigMessages$1 = {
|
|
8296
8302
|
labelNewGroup: "Add new group",
|
8297
8303
|
mainArea: "Main area",
|
8298
8304
|
tabGeneral: "General",
|
8305
|
+
canNotEditCustomGuide: "It is not possible to edit detail tabs and custom tabs",
|
8299
8306
|
createNewGroup: "Create new group",
|
8300
8307
|
newGroup: "New group",
|
8301
8308
|
noGuideSelected: "Select a tab and start configuring",
|
@@ -8323,6 +8330,10 @@ const snkFormConfigMessages$1 = {
|
|
8323
8330
|
title: "Attention",
|
8324
8331
|
message: "Select a guide to start configuration!"
|
8325
8332
|
},
|
8333
|
+
canNotAddFieldToGuide: {
|
8334
|
+
title: "Attention",
|
8335
|
+
message: "It is not possible to add fields to detail tabs or custom tabs!"
|
8336
|
+
},
|
8326
8337
|
alert: {
|
8327
8338
|
titleGroupExists: "A group with this title already exists",
|
8328
8339
|
titleGroupEditing: "There is a <b>group<b/> being edited. <br/> Finish editing to save the settings.",
|
@@ -8353,6 +8364,7 @@ const snkFormConfigMessages$1 = {
|
|
8353
8364
|
createNewGuide: "Create new tab",
|
8354
8365
|
noHiddenGuides: "No hidden tabs",
|
8355
8366
|
noVisibleGuides: "No visible tabs",
|
8367
|
+
canNotDeleteCustomGuide: "Is not possible to detail detail tabs os a custom tabs",
|
8356
8368
|
actions: {
|
8357
8369
|
hide: "Hide",
|
8358
8370
|
show: "Make visible",
|
@@ -9154,6 +9166,7 @@ const snkFormConfigMessages = {
|
|
9154
9166
|
labelNewGroup: "Añadir nuevo grupo",
|
9155
9167
|
mainArea: "Área principal",
|
9156
9168
|
tabGeneral: "General",
|
9169
|
+
canNotEditCustomGuide: "No es posible editar pestañas de detalles y pestañas personalizadas",
|
9157
9170
|
createNewGroup: "Crear nuevo grupo",
|
9158
9171
|
newGroup: "Nuevo grupo",
|
9159
9172
|
noGuideSelected: "Seleccione una pestaña y comience a configurar",
|
@@ -9181,6 +9194,10 @@ const snkFormConfigMessages = {
|
|
9181
9194
|
title: "Atención",
|
9182
9195
|
message: "¡Seleccione una guía para iniciar la configuración!"
|
9183
9196
|
},
|
9197
|
+
canNotAddFieldToGuide: {
|
9198
|
+
title: "Atención",
|
9199
|
+
message: "¡No es posible agregar campos a pestañas de detalles o pestañas personalizadas!"
|
9200
|
+
},
|
9184
9201
|
alert: {
|
9185
9202
|
titleGroupExists: "Ya existe un grupo con título",
|
9186
9203
|
titleGroupEditing: "Hay un <b>grupo<b/> en edición. <br/> Finalice la edición para guardar las configuraciones.",
|
@@ -9211,6 +9228,7 @@ const snkFormConfigMessages = {
|
|
9211
9228
|
createNewGuide: "Crear nueva pestaña",
|
9212
9229
|
noHiddenGuides: "No hay pestañas ocultas",
|
9213
9230
|
noVisibleGuides: "No hay pestañas visibles",
|
9231
|
+
canNotDeleteCustomGuide: "No es posible eliminar pestañas de detalles o pestañas personalizadas",
|
9214
9232
|
actions: {
|
9215
9233
|
hide: "Ocultar",
|
9216
9234
|
show: "Hacer visible",
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage.js';
|
2
1
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
2
|
+
import { C as ConfigStorage } from './ConfigStorage.js';
|
3
3
|
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
4
4
|
import { T as TAB_NAMES } from './constants.js';
|
5
5
|
|
@@ -83,7 +83,7 @@ class SnkFormConfigManager {
|
|
83
83
|
return false;
|
84
84
|
}
|
85
85
|
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
86
|
-
var _a;
|
86
|
+
var _a, _b;
|
87
87
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
88
88
|
const hasConfig = this.hasConfig();
|
89
89
|
if (hasConfig && !forceEmptyConfig) {
|
@@ -99,7 +99,7 @@ class SnkFormConfigManager {
|
|
99
99
|
})
|
100
100
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
101
101
|
}
|
102
|
-
if (!this._dataUnit) {
|
102
|
+
if (!this._dataUnit || !((_b = this._dataUnit.metadata) === null || _b === void 0 ? void 0 : _b.fields)) {
|
103
103
|
return [];
|
104
104
|
}
|
105
105
|
const filteredFields = this._dataUnit.metadata.fields
|
@@ -112,6 +112,46 @@ function buildGuides(config, mainArea) {
|
|
112
112
|
tabs = initializeTabsNames(tabs);
|
113
113
|
return handleMainTab(tabs, mainArea);
|
114
114
|
}
|
115
|
+
function buildChildrenGuides(dataUnit, initialOrderIndex = 0, guidesList) {
|
116
|
+
var _a;
|
117
|
+
if (!dataUnit || !dataUnit.metadata) {
|
118
|
+
return [];
|
119
|
+
}
|
120
|
+
const children = ((_a = dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.children) || [];
|
121
|
+
const childrenWithNoGuide = [];
|
122
|
+
for (const child of children) {
|
123
|
+
if (guidesList.some((guide) => child.label === guide.label)) {
|
124
|
+
continue;
|
125
|
+
}
|
126
|
+
childrenWithNoGuide.push({
|
127
|
+
label: child.label,
|
128
|
+
name: child.name,
|
129
|
+
visible: true,
|
130
|
+
isCustom: true,
|
131
|
+
order: initialOrderIndex++
|
132
|
+
});
|
133
|
+
}
|
134
|
+
return childrenWithNoGuide;
|
135
|
+
}
|
136
|
+
function buildCustomGuides(customGuidesList, guidesList) {
|
137
|
+
let initialOrderIndex = guidesList.length;
|
138
|
+
const customGuidesToAdd = getCustomGuidesNotIncludedInList(customGuidesList, guidesList);
|
139
|
+
return customGuidesToAdd.map(guide => {
|
140
|
+
return {
|
141
|
+
name: guide.id,
|
142
|
+
label: guide.label,
|
143
|
+
visible: true,
|
144
|
+
isCustom: true,
|
145
|
+
order: initialOrderIndex++
|
146
|
+
};
|
147
|
+
});
|
148
|
+
}
|
149
|
+
function isCustomGuideIncludedInList(guidesList, guide) {
|
150
|
+
return guidesList.some(fromList => fromList.name === guide.id || fromList.label === guide.label);
|
151
|
+
}
|
152
|
+
function getCustomGuidesNotIncludedInList(customGuidesList, guidesList) {
|
153
|
+
return customGuidesList.filter(guide => !isCustomGuideIncludedInList(guidesList, guide));
|
154
|
+
}
|
115
155
|
function handleFieldsTabNames(allFields) {
|
116
156
|
// Campos que não fazem parte de nenhuma aba ou da aba "Geral", devem ser movidos para a aba __main.
|
117
157
|
return allFields.map(field => {
|
@@ -521,4 +561,4 @@ function defineCustomElement() {
|
|
521
561
|
} });
|
522
562
|
}
|
523
563
|
|
524
|
-
export { FieldConfig as F, ID_AVAILABLE_FIELDS as I, SORTABLE_PATH as S, getFieldsStructure as a, buildGuides as b,
|
564
|
+
export { FieldConfig as F, ID_AVAILABLE_FIELDS as I, SORTABLE_PATH as S, getFieldsStructure as a, buildGuides as b, buildChildrenGuides as c, defineCustomElement as d, buildCustomGuides as e, buildGuidesMap as f, getIconName as g, getFieldsToSave as h, buildNewGuideName as i, updateTabInFieldsFromGroupList as u };
|
@@ -331,6 +331,9 @@ const FieldLayoutComponent = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
331
331
|
if (!this.selectedGuide) {
|
332
332
|
return (h(Host, { class: 'ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container' }, h("span", { class: 'no-guide-selected' }, this.getMessage('snkFormConfig.form.noGuideSelected'))));
|
333
333
|
}
|
334
|
+
if (this.selectedGuide.isCustom || this.selectedGuide.isDetail) {
|
335
|
+
return (h(Host, { class: 'ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container' }, h("span", { class: 'no-guide-selected' }, this.getMessage('snkFormConfig.form.canNotEditCustomGuide'))));
|
336
|
+
}
|
334
337
|
return (h(Host, { class: 'ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container' }, this.renderGuideName(), h("div", { class: 'layout-container' }, h("ez-scroller", { direction: 'vertical', activeShadow: true }, h("div", { class: 'no-group-container' }, h("div", { id: GROUP_NAMES.noGroup, class: 'group-content', "data-group-name": GROUP_NAMES.noGroup }, this.renderFixedFields())), h("hr", null), h("div", { id: this.ID_GROUPS, class: 'groups-container' }, this.renderDraggableGroups()))), h("div", { class: 'add-group-container', onClick: this.handleAddGroup.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus" }), h("span", null, this.getMessage('snkFormConfig.form.createNewGroup')))));
|
335
338
|
}
|
336
339
|
get el() { return this; }
|
@@ -101,7 +101,9 @@ const GuidesConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
101
101
|
var _a;
|
102
102
|
return (h("div", { key: guide.name, "data-guide-name": guide.name, title: guide.label, class: `guide-item ${((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.label) === guide.label ? 'selected' : ''} ${this.filterTerm.length ? 'disable-sort' : ''}`, onClick: e => this.handleSelectGuide(guide, e) }, h("span", null, h("ez-icon", { iconName: "drag-indicator", class: 'ez-margin-right--small' })), h("span", { class: 'item-label' }, guide.label), h("div", { class: 'actions' }, h("ez-button", { mode: "icon", class: "ez-button--tertiary", onClick: e => this.toggleGuideVisibility(guide, e), size: "medium", iconName: guide.visible ? 'eye-off' : 'eye', title: guide.visible ?
|
103
103
|
this.getMessage('snkFormConfig.guidesConfigurator.actions.hide') :
|
104
|
-
this.getMessage('snkFormConfig.guidesConfigurator.actions.show') }), h("ez-button", { mode: "icon", class: "ez-button--tertiary", onClick: e => this.handleDeleteGuide(guide, e), size: "medium", iconName: 'delete', title:
|
104
|
+
this.getMessage('snkFormConfig.guidesConfigurator.actions.show') }), h("ez-button", { mode: "icon", class: "ez-button--tertiary", onClick: e => this.handleDeleteGuide(guide, e), size: "medium", isDisabled: guide.isCustom || guide.isDetail, iconName: 'delete', title: guide.isCustom || guide.isDetail ?
|
105
|
+
this.getMessage('snkFormConfig.guidesConfigurator.canNotDeleteCustomGuide') :
|
106
|
+
this.getMessage('snkFormConfig.guidesConfigurator.actions.delete') }))));
|
105
107
|
});
|
106
108
|
}
|
107
109
|
getContainerElement(id) {
|
@@ -109,6 +109,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
109
109
|
};
|
110
110
|
this._dataUnit = undefined;
|
111
111
|
this._dataState = undefined;
|
112
|
+
this._suppressEntitySearch = false;
|
112
113
|
this.attachmentRegisterKey = undefined;
|
113
114
|
this._currentViewMode = VIEW_MODE.GRID;
|
114
115
|
this._canEdit = undefined;
|
@@ -145,6 +146,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
145
146
|
this.layoutFormConfig = true;
|
146
147
|
this.multipleEditionEnabled = true;
|
147
148
|
this.paginationCounterMode = 'auto';
|
149
|
+
this.customGuidesConfig = [];
|
148
150
|
this.showEntitySearch = true;
|
149
151
|
this.disableNumberingConfig = false;
|
150
152
|
}
|
@@ -592,7 +594,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
592
594
|
}
|
593
595
|
renderDynamicSearch(slotName) {
|
594
596
|
var _a;
|
595
|
-
if (!this.showEntitySearch || ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) === true)
|
597
|
+
if (this._suppressEntitySearch || !this.showEntitySearch || ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) === true)
|
596
598
|
return;
|
597
599
|
return (h("div", { slot: slotName, class: "entity-search-container", style: { position: 'relative', display: 'inline-block', marginLeft: '10px', minWidth: '200px' } }, h("ez-search", { label: "Buscar registros", optionLoader: this.loadEntitySuggestions, onEzChange: (evt) => this.searchEntitySelect(evt.detail), mode: "slim", showMore: this._showMoreOnSearch, suppressEmptyOption: true, suppressInputPersist: true })));
|
598
600
|
}
|
@@ -601,7 +603,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
601
603
|
return;
|
602
604
|
}
|
603
605
|
this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
|
604
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', 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, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled, paginationCounterMode: this.paginationCounterMode }, 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" }), this.renderDynamicSearch("GRID_HEADER_DYNAMIC_SEARCH"))), 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, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), this.renderDynamicSearch("GUIDES_VIEWER_DYNAMIC_SEARCH"), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", { tabIndex: "0" }, 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, entityName: this._snkDataUnit.entityName, 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, layoutFormConfig: this.layoutFormConfig })), 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" }))));
|
606
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", { class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium' }, h("snk-grid", { ref: (ref) => this._snkGrid = ref, class: 'ez-flex ez-flex--column ez-size-height--full ez-size-width--full', 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, enableGridInsert: this.enableGridInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, strategyExporter: this.strategyExporter, multipleEditionEnabled: this.multipleEditionEnabled, paginationCounterMode: this.paginationCounterMode }, 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" }), this.renderDynamicSearch("GRID_HEADER_DYNAMIC_SEARCH"))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, customGuidesConfig: this.customGuidesConfig, 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), onFormConfigVisibilityChanged: evt => this._suppressEntitySearch = 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, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), this.renderDynamicSearch("GUIDES_VIEWER_DYNAMIC_SEARCH"), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", { tabIndex: "0" }, 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, entityName: this._snkDataUnit.entityName, 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, layoutFormConfig: this.layoutFormConfig })), 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" }))));
|
605
607
|
}
|
606
608
|
get _element() { return this; }
|
607
609
|
static get watchers() { return {
|
@@ -637,10 +639,12 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
637
639
|
"layoutFormConfig": [4, "layout-form-config"],
|
638
640
|
"multipleEditionEnabled": [4, "multiple-edition-enabled"],
|
639
641
|
"paginationCounterMode": [1, "pagination-counter-mode"],
|
642
|
+
"customGuidesConfig": [16],
|
640
643
|
"showEntitySearch": [4, "show-entity-search"],
|
641
644
|
"disableNumberingConfig": [4, "disable-numbering-config"],
|
642
645
|
"_dataUnit": [32],
|
643
646
|
"_dataState": [32],
|
647
|
+
"_suppressEntitySearch": [32],
|
644
648
|
"attachmentRegisterKey": [32],
|
645
649
|
"_currentViewMode": [32],
|
646
650
|
"_canEdit": [32],
|
@@ -63,10 +63,13 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
63
63
|
super();
|
64
64
|
this.__registerHost();
|
65
65
|
this.snkMasterFormConfigChange = createEvent(this, "snkMasterFormConfigChange", 7);
|
66
|
+
this.formConfigVisibilityChanged = createEvent(this, "formConfigVisibilityChanged", 7);
|
66
67
|
this.exit = createEvent(this, "exit", 7);
|
67
68
|
this.actionClick = createEvent(this, "actionClick", 7);
|
68
69
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
69
70
|
this._guideBuilders = new Map();
|
71
|
+
this.CUSTOM_GUIDE_ID_PREFIX = "CUSTOM_GUIDE_";
|
72
|
+
this.CUSTOM_GUIDE_DATA_CUSTOM_ID = "CUSTOM_GUIDE";
|
70
73
|
this.dataUnit = undefined;
|
71
74
|
this.dataState = undefined;
|
72
75
|
this.configName = undefined;
|
@@ -85,6 +88,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
85
88
|
this.enableGridInsert = false;
|
86
89
|
this.ignoreReadOnlyFormFields = undefined;
|
87
90
|
this.getCustomTitle = undefined;
|
91
|
+
this.customGuidesConfig = [];
|
88
92
|
this._hasToCreateFieldSearch = true;
|
89
93
|
this._breadcrumbItems = [];
|
90
94
|
this._guides = undefined;
|
@@ -99,6 +103,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
99
103
|
observeDataUnit() {
|
100
104
|
this.loadGuides(true);
|
101
105
|
}
|
106
|
+
observeFormConfigManager(value) {
|
107
|
+
this.formConfigVisibilityChanged.emit(!!value);
|
108
|
+
}
|
102
109
|
observeDataState(newValue, oldValue) {
|
103
110
|
var _a, _b, _c, _d, _e, _f;
|
104
111
|
const newRecordsIds = (_b = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.selectionInfo) === null || _a === void 0 ? void 0 : _a.recordIds) !== null && _b !== void 0 ? _b : (_c = newValue === null || newValue === void 0 ? void 0 : newValue.selectedRecord) === null || _c === void 0 ? void 0 : _c['__record__id__'];
|
@@ -197,7 +204,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
197
204
|
if (!this._configManager.isLoaded) {
|
198
205
|
return;
|
199
206
|
}
|
200
|
-
this._masterFormMetadata = buildFormMetadata(this.masterFormConfig, this.dataUnit, true);
|
207
|
+
this._masterFormMetadata = buildFormMetadata(this.masterFormConfig, this.dataUnit, true, this.customGuidesConfig);
|
201
208
|
const allSheets = this._masterFormMetadata.getAllSheets();
|
202
209
|
const currentRecord = this.dataUnit.getSelectedRecord();
|
203
210
|
const disableDetails = this.hasToDisableDetails(currentRecord);
|
@@ -343,38 +350,67 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
343
350
|
return `${this.entityPath}/${entityName}`;
|
344
351
|
}
|
345
352
|
getContent() {
|
346
|
-
var _a, _b, _c, _d, _e;
|
347
353
|
if (!this.selectedGuide) {
|
348
354
|
return;
|
349
355
|
}
|
350
356
|
const guideId = this.selectedGuide.id;
|
351
|
-
|
357
|
+
if (this.isCustomGuide(guideId)) {
|
358
|
+
return h("div", { "data-custom-id": `${this.CUSTOM_GUIDE_DATA_CUSTOM_ID}`, "data-reserved-slot-id": guideId, id: this.buildCustomGuideContainerId(guideId) });
|
359
|
+
}
|
352
360
|
const levels = guideId.split("::");
|
353
361
|
const currentLevel = levels.pop();
|
354
362
|
const childEntityName = FormMetadata.getDetailName(currentLevel);
|
355
363
|
let detailId = guideId;
|
356
|
-
if (childEntityName
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
364
|
+
if (this.isDetailGuide(childEntityName, levels)) {
|
365
|
+
return this.buildDetailGuideContent(guideId, detailId, levels, childEntityName);
|
366
|
+
}
|
367
|
+
return this.buildFormViewGuideContent(guideId);
|
368
|
+
}
|
369
|
+
buildCustomGuideContainerId(guideId) {
|
370
|
+
return `${this.CUSTOM_GUIDE_ID_PREFIX}${guideId}`;
|
371
|
+
}
|
372
|
+
buildFormViewGuideContent(cardId) {
|
373
|
+
var _a, _b, _c, _d;
|
374
|
+
const sheet = this._masterFormMetadata.getSheet(cardId);
|
375
|
+
if (!sheet)
|
376
|
+
return;
|
377
|
+
const cardConfig = (_b = (_a = this.masterFormConfig) === null || _a === void 0 ? void 0 : _a.cardsState) === null || _b === void 0 ? void 0 : _b.get(cardId);
|
378
|
+
return (h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar()));
|
379
|
+
}
|
380
|
+
isDetailGuide(childEntityName, levels) {
|
381
|
+
return childEntityName || levels.length > 0;
|
382
|
+
}
|
383
|
+
buildDetailGuideContent(guideId, detailId, levels, childEntityName) {
|
384
|
+
var _a;
|
385
|
+
let formName;
|
386
|
+
let detailBranch;
|
387
|
+
if (guideId.includes(FORM_NAME_PREFIX)) {
|
388
|
+
[detailId, formName] = guideId.split(FORM_NAME_PREFIX);
|
389
|
+
const pathSize = ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
390
|
+
detailBranch = pathSize > 1 ? this._breadcrumbItems[pathSize - 2] : this.selectedGuide;
|
368
391
|
}
|
369
392
|
else {
|
370
|
-
|
371
|
-
const sheet = this._masterFormMetadata.getSheet(cardId);
|
372
|
-
if (sheet) {
|
373
|
-
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
374
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
375
|
-
}
|
393
|
+
detailBranch = this.selectedGuide;
|
376
394
|
}
|
377
|
-
return
|
395
|
+
return this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders, presentationMode: this.presentationMode }));
|
396
|
+
}
|
397
|
+
isCustomGuide(guideId) {
|
398
|
+
var _a;
|
399
|
+
return (_a = this.customGuidesConfig) === null || _a === void 0 ? void 0 : _a.map(g => g.id).includes(guideId);
|
400
|
+
}
|
401
|
+
attachCustomGuideInView() {
|
402
|
+
//As guias customizadas ficam em slots reservados na DOM e
|
403
|
+
// precisam ser acessadas via querySelector e colocadas no container correto na view.
|
404
|
+
var _a;
|
405
|
+
const guideId = (_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id;
|
406
|
+
if (!this.isCustomGuide(guideId))
|
407
|
+
return;
|
408
|
+
const customGuideSlot = document.querySelector(`#${guideId}`);
|
409
|
+
const customGuideElement = customGuideSlot === null || customGuideSlot === void 0 ? void 0 : customGuideSlot.firstElementChild;
|
410
|
+
const customGuideViewContainer = document.querySelector(`#${this.buildCustomGuideContainerId(guideId)}`);
|
411
|
+
if (!customGuideElement || !customGuideViewContainer)
|
412
|
+
return;
|
413
|
+
customGuideViewContainer.appendChild(customGuideElement);
|
378
414
|
}
|
379
415
|
onBreadcrumbClickHandler(item) {
|
380
416
|
if ((item === null || item === void 0 ? void 0 : item.id) == undefined) {
|
@@ -457,7 +493,29 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
457
493
|
this.addFormLegacyConfigName();
|
458
494
|
this._configManager.loadConfig();
|
459
495
|
}
|
496
|
+
componentWillRender() {
|
497
|
+
this.detachCustomGuideFromView();
|
498
|
+
}
|
499
|
+
detachCustomGuideFromView() {
|
500
|
+
// Antes de cada renderização, o componente remove a guia customizada da view
|
501
|
+
// e a coloca de volta no slot reservado na DOM para que não seja perdida sua referência.
|
502
|
+
if (!this.customGuidesConfig || this.customGuidesConfig.length === 0)
|
503
|
+
return;
|
504
|
+
const viewCustomGuideContainer = this._element.querySelector(`[data-custom-id="${this.CUSTOM_GUIDE_DATA_CUSTOM_ID}"]`);
|
505
|
+
const reservedSlotId = viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.getAttribute('data-reserved-slot-id');
|
506
|
+
if (!(viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.hasChildNodes()) || !reservedSlotId)
|
507
|
+
return;
|
508
|
+
const customGuideReservedSlot = document.querySelector(`#${reservedSlotId}`);
|
509
|
+
const customGuideElement = viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.firstElementChild;
|
510
|
+
if (!customGuideReservedSlot || !customGuideElement)
|
511
|
+
return;
|
512
|
+
customGuideReservedSlot.appendChild(customGuideElement);
|
513
|
+
}
|
460
514
|
componentDidRender() {
|
515
|
+
var _a;
|
516
|
+
if (this.isCustomGuide((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id)) {
|
517
|
+
this.attachCustomGuideInView();
|
518
|
+
}
|
461
519
|
if (!this._guideHasChanged) {
|
462
520
|
return;
|
463
521
|
}
|
@@ -586,6 +644,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
586
644
|
const labels = selectedRecords.map(record => this.messagesBuilder.getMessage("snkCrud.title", record));
|
587
645
|
return `[${labels.join(", ")}]`;
|
588
646
|
}
|
647
|
+
getCustomGuidesConfig() {
|
648
|
+
return this._currentDetail ? [] : this.customGuidesConfig;
|
649
|
+
}
|
589
650
|
componentDidLoad() {
|
590
651
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
591
652
|
this.initKeyboardManager();
|
@@ -605,7 +666,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
605
666
|
render() {
|
606
667
|
var _a, _b;
|
607
668
|
if (this._formEditorConfigManager != undefined) {
|
608
|
-
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
|
669
|
+
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null, customGuidesConfig: this.getCustomGuidesConfig() }));
|
609
670
|
}
|
610
671
|
if (!this.dataUnit || !this._configManager.isLoaded) {
|
611
672
|
return;
|
@@ -631,6 +692,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
631
692
|
get _element() { return this; }
|
632
693
|
static get watchers() { return {
|
633
694
|
"dataUnit": ["observeDataUnit"],
|
695
|
+
"_formEditorConfigManager": ["observeFormConfigManager"],
|
634
696
|
"dataState": ["observeDataState"],
|
635
697
|
"masterFormConfig": ["observeMasterFormConfig"]
|
636
698
|
}; }
|
@@ -654,6 +716,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
654
716
|
"enableGridInsert": [4, "enable-grid-insert"],
|
655
717
|
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
656
718
|
"getCustomTitle": [16],
|
719
|
+
"customGuidesConfig": [16],
|
657
720
|
"_hasToCreateFieldSearch": [32],
|
658
721
|
"_breadcrumbItems": [32],
|
659
722
|
"_guides": [32],
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
2
|
import { ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
4
|
-
import { b as buildGuides, c as buildGuidesMap, e as getFieldsToSave, u as updateTabInFieldsFromGroupList, f as buildNewGuideName, d as defineCustomElement$5 } from './field-config2.js';
|
5
|
-
import { T as TAB_NAMES, G as GROUP_NAMES } from './constants.js';
|
6
4
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
7
5
|
import { U as UserConfigType } from './form-config-fetcher.js';
|
6
|
+
import { T as TAB_NAMES, G as GROUP_NAMES } from './constants.js';
|
7
|
+
import { b as buildGuides, c as buildChildrenGuides, e as buildCustomGuides, f as buildGuidesMap, h as getFieldsToSave, u as updateTabInFieldsFromGroupList, i as buildNewGuideName, d as defineCustomElement$5 } from './field-config2.js';
|
8
8
|
import { d as defineCustomElement$7 } from './config-header2.js';
|
9
9
|
import { d as defineCustomElement$6 } from './configs-button2.js';
|
10
10
|
import { d as defineCustomElement$4 } from './field-item2.js';
|
@@ -35,6 +35,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
35
35
|
this.configManager = undefined;
|
36
36
|
this.ignoreReadOnlyFormFields = undefined;
|
37
37
|
this.messagesBuilder = undefined;
|
38
|
+
this.customGuidesConfig = [];
|
38
39
|
}
|
39
40
|
handleFieldConfigChanged() {
|
40
41
|
this.hasChanges = true;
|
@@ -54,6 +55,10 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
54
55
|
this.showNoGuideSelectedDialog();
|
55
56
|
return;
|
56
57
|
}
|
58
|
+
if (this.selectedGuide.isCustom || this.selectedGuide.isDetail) {
|
59
|
+
this.showCanNotAddFieldToGuideDialog();
|
60
|
+
return;
|
61
|
+
}
|
57
62
|
this.availableFields = [...this.availableFields.filter(f => f.name !== fieldItem.name)];
|
58
63
|
await ((_a = this.refFieldsLayout) === null || _a === void 0 ? void 0 : _a.addFieldToLayout(fieldItem));
|
59
64
|
}
|
@@ -79,6 +84,11 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
79
84
|
const message = this.getMessage('snkFormConfig.noGuideSelected.message');
|
80
85
|
ApplicationUtils.alert(title, message);
|
81
86
|
}
|
87
|
+
showCanNotAddFieldToGuideDialog() {
|
88
|
+
const title = this.getMessage('snkFormConfig.canNotAddFieldToGuide.title');
|
89
|
+
const message = this.getMessage('snkFormConfig.canNotAddFieldToGuide.message');
|
90
|
+
ApplicationUtils.alert(title, message);
|
91
|
+
}
|
82
92
|
/**
|
83
93
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
84
94
|
* através de um pequeno modulo na estrutura da aplicação:
|
@@ -151,9 +161,12 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
151
161
|
});
|
152
162
|
}
|
153
163
|
loadGuides() {
|
154
|
-
var _a;
|
155
|
-
this.guidesList = [
|
156
|
-
this.
|
164
|
+
var _a, _b, _c, _d;
|
165
|
+
this.guidesList = [];
|
166
|
+
this.guidesList.push(...buildGuides(this._formConfig, this.getMessage('snkFormConfig.form.mainArea')));
|
167
|
+
this.guidesList.push(...buildChildrenGuides(this.dataUnit, (_c = (_b = (_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.tabs) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0, this.guidesList));
|
168
|
+
this.guidesList.push(...buildCustomGuides(this.customGuidesConfig, this.guidesList));
|
169
|
+
this.guidesMap = buildGuidesMap((_d = this._formConfig) === null || _d === void 0 ? void 0 : _d.fields, this.guidesList, this.dataUnit, this.getMessage('snkFormConfig.form.tabGeneral'));
|
157
170
|
}
|
158
171
|
getConfig() {
|
159
172
|
let config = this.configManager.getConfig(this.dataUnit, false);
|
@@ -301,6 +314,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
301
314
|
"configManager": [16],
|
302
315
|
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
303
316
|
"messagesBuilder": [1040],
|
317
|
+
"customGuidesConfig": [16],
|
304
318
|
"availableFields": [32],
|
305
319
|
"guidesList": [32],
|
306
320
|
"groupsList": [32],
|