@sankhyalabs/sankhyablocks 8.16.0-dev.1 → 8.16.0-dev.11
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-942ce74b.js → ConfigStorage-e49214c6.js} +3 -2
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
- package/dist/cjs/{IExporterProvider-c78cb1b8.js → IExporterProvider-10b7fed5.js} +4 -4
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-beebf47a.js} +7 -9
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-897ffd08.js} +1 -1
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-620b29a1.js → dataunit-fetcher-d4873076.js} +9 -4
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-a1d0353f.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-crud.cjs.entry.js +11 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-82dea87e.js → snk-data-unit-ece44c4a.js} +17 -7
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-form.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/{snk-guides-viewer-05a1ba27.js → snk-guides-viewer-aafc3073.js} +12 -7
- 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-simple-crud.cjs.entry.js +11 -10
- package/dist/collection/components/snk-crud/snk-crud.js +57 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +22 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +32 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +5 -7
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +21 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/DataFetcher.js +8 -3
- package/dist/components/SnkFormConfigManager.js +5 -7
- package/dist/components/SnkMessageBuilder.js +1 -1
- package/dist/components/dataunit-fetcher.js +8 -3
- package/dist/components/snk-crud.js +8 -1
- package/dist/components/snk-data-unit2.js +16 -5
- package/dist/components/snk-detail-view2.js +9 -4
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-simple-crud2.js +5 -3
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-e476378d.js} +3 -2
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
- package/dist/esm/{IExporterProvider-343272b3.js → IExporterProvider-d597f27d.js} +4 -4
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-298cd647.js} +7 -9
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-571462fb.js} +1 -1
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
- package/dist/esm/{dataunit-fetcher-3fbf9d12.js → dataunit-fetcher-3d2ec959.js} +9 -4
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-a87445a0.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +5 -5
- package/dist/esm/snk-crud.entry.js +11 -6
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-8f98b45f.js → snk-data-unit-2a1d5d09.js} +17 -7
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +9 -10
- package/dist/esm/snk-filter-bar.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/{snk-guides-viewer-aee2cafe.js → snk-guides-viewer-62124f3d.js} +12 -7
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +11 -10
- package/dist/sankhyablocks/{p-672302c3.js → p-091ce761.js} +1 -1
- package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
- package/dist/sankhyablocks/p-14b8b656.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
- package/dist/sankhyablocks/{p-5539ecb4.entry.js → p-1e971cb0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-af8efd95.js → p-25f1fc39.js} +1 -1
- package/dist/sankhyablocks/{p-8fc470e5.entry.js → p-2e9c764c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aff76a53.js → p-3287a6cc.js} +2 -2
- package/dist/sankhyablocks/{p-4f72727a.entry.js → p-421bec84.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2d649237.entry.js → p-42f7b05d.entry.js} +1 -1
- package/dist/sankhyablocks/p-51999ab5.entry.js +1 -0
- package/dist/sankhyablocks/p-594bc21d.js +1 -0
- package/dist/sankhyablocks/p-5f016aed.js +1 -0
- package/dist/sankhyablocks/{p-47b60deb.entry.js → p-62f34e6f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-44767378.entry.js → p-631954eb.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8a5910a7.entry.js → p-65f8c11c.entry.js} +1 -1
- package/dist/sankhyablocks/p-684a2590.entry.js +1 -0
- package/dist/sankhyablocks/p-70001ac1.js +1 -0
- package/dist/sankhyablocks/{p-9e99a92a.js → p-76a65660.js} +1 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
- package/dist/sankhyablocks/p-939e15d3.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-9dfda04a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-bd008859.entry.js} +1 -1
- package/dist/sankhyablocks/p-d65d98ed.entry.js +1 -0
- package/dist/sankhyablocks/{p-e95b3b93.entry.js → p-d6610d11.entry.js} +2 -2
- package/dist/sankhyablocks/p-ffa5e4ff.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components.d.ts +41 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0d91b10f.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-26394a01.entry.js +0 -1
- package/dist/sankhyablocks/p-550fee49.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-8cc64963.entry.js +0 -1
- package/dist/sankhyablocks/p-be603a24.js +0 -1
- package/dist/sankhyablocks/p-d09feef1.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
@@ -27,6 +27,7 @@ export class SnkGuidesViewer {
|
|
27
27
|
this.resourceID = undefined;
|
28
28
|
this.detailTaskbarCustomContainerId = undefined;
|
29
29
|
this.formLegacyConfigName = undefined;
|
30
|
+
this.getCustomTitle = undefined;
|
30
31
|
this._hasToCreateFieldSearch = true;
|
31
32
|
this._breadcrumbItems = [];
|
32
33
|
this._guides = undefined;
|
@@ -113,7 +114,7 @@ export class SnkGuidesViewer {
|
|
113
114
|
}
|
114
115
|
onContentCardChanged(evt) {
|
115
116
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
116
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
117
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
117
118
|
}
|
118
119
|
/**
|
119
120
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -464,6 +465,10 @@ export class SnkGuidesViewer {
|
|
464
465
|
}
|
465
466
|
return "";
|
466
467
|
}
|
468
|
+
getTitle() {
|
469
|
+
var _a, _b;
|
470
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
471
|
+
}
|
467
472
|
componentDidLoad() {
|
468
473
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
469
474
|
}
|
@@ -477,7 +482,7 @@ export class SnkGuidesViewer {
|
|
477
482
|
}
|
478
483
|
this.loadTaskbarProcessor();
|
479
484
|
const showGuides = this._guides && (this._guides.length > 1);
|
480
|
-
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.
|
485
|
+
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
481
486
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
482
487
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
483
488
|
:
|
@@ -794,6 +799,21 @@ export class SnkGuidesViewer {
|
|
794
799
|
},
|
795
800
|
"attribute": "form-legacy-config-name",
|
796
801
|
"reflect": false
|
802
|
+
},
|
803
|
+
"getCustomTitle": {
|
804
|
+
"type": "unknown",
|
805
|
+
"mutable": false,
|
806
|
+
"complexType": {
|
807
|
+
"original": "() => string",
|
808
|
+
"resolved": "() => string",
|
809
|
+
"references": {}
|
810
|
+
},
|
811
|
+
"required": false,
|
812
|
+
"optional": false,
|
813
|
+
"docs": {
|
814
|
+
"tags": [],
|
815
|
+
"text": "Fornece uma fun\u00E7\u00E3o para obter um t\u00EDtulo customizado do formul\u00E1rio."
|
816
|
+
}
|
797
817
|
}
|
798
818
|
};
|
799
819
|
}
|
@@ -54,6 +54,7 @@ export class SnkDataUnit {
|
|
54
54
|
this.ignoreSaveMessage = undefined;
|
55
55
|
this.configName = undefined;
|
56
56
|
this.resourceID = undefined;
|
57
|
+
this.domainMessagesBuilder = undefined;
|
57
58
|
}
|
58
59
|
observePageSize() {
|
59
60
|
if (this.dataUnit) {
|
@@ -470,7 +471,8 @@ export class SnkDataUnit {
|
|
470
471
|
if (this.ignoreSaveMessage) {
|
471
472
|
return;
|
472
473
|
}
|
473
|
-
const
|
474
|
+
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
475
|
+
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
474
476
|
if (msg != undefined) {
|
475
477
|
this.showSuccessMessage(msg);
|
476
478
|
}
|
@@ -501,10 +503,13 @@ export class SnkDataUnit {
|
|
501
503
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
502
504
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
503
505
|
*/
|
504
|
-
getMessage(key, params = undefined) {
|
506
|
+
getMessage(key, params = undefined, customOperation) {
|
505
507
|
if (!params) {
|
506
508
|
params = this.getMessageParams();
|
507
509
|
}
|
510
|
+
if (customOperation) {
|
511
|
+
this.messagesBuilder.currentOperation = customOperation;
|
512
|
+
}
|
508
513
|
return this.messagesBuilder.getMessage(key, params);
|
509
514
|
}
|
510
515
|
getMessageParams() {
|
@@ -611,6 +616,13 @@ export class SnkDataUnit {
|
|
611
616
|
parent = parent.parentElement;
|
612
617
|
}
|
613
618
|
}
|
619
|
+
instanceMessagesBuilder() {
|
620
|
+
var _a;
|
621
|
+
if (this.messagesBuilder) {
|
622
|
+
return;
|
623
|
+
}
|
624
|
+
this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
|
625
|
+
}
|
614
626
|
//---------------------------------------------
|
615
627
|
// Lifecycle web component
|
616
628
|
//---------------------------------------------
|
@@ -618,9 +630,7 @@ export class SnkDataUnit {
|
|
618
630
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
619
631
|
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
620
632
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
621
|
-
|
622
|
-
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
623
|
-
}
|
633
|
+
this.instanceMessagesBuilder();
|
624
634
|
}
|
625
635
|
disconnectedCallback() {
|
626
636
|
if (this.dataUnit) {
|
@@ -860,6 +870,23 @@ export class SnkDataUnit {
|
|
860
870
|
},
|
861
871
|
"attribute": "resource-i-d",
|
862
872
|
"reflect": false
|
873
|
+
},
|
874
|
+
"domainMessagesBuilder": {
|
875
|
+
"type": "string",
|
876
|
+
"mutable": false,
|
877
|
+
"complexType": {
|
878
|
+
"original": "string",
|
879
|
+
"resolved": "string",
|
880
|
+
"references": {}
|
881
|
+
},
|
882
|
+
"required": false,
|
883
|
+
"optional": false,
|
884
|
+
"docs": {
|
885
|
+
"tags": [],
|
886
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
887
|
+
},
|
888
|
+
"attribute": "domain-messages-builder",
|
889
|
+
"reflect": false
|
863
890
|
}
|
864
891
|
};
|
865
892
|
}
|
@@ -73,10 +73,8 @@ export class SnkFormConfigManager {
|
|
73
73
|
if (fields != undefined && fields.length > 0) {
|
74
74
|
return fields.map(({ label, name, readOnly, visible, required }) => {
|
75
75
|
if (label == undefined) {
|
76
|
-
|
77
|
-
|
78
|
-
visible,
|
79
|
-
required });
|
76
|
+
const currentField = dataUnit.getField(name);
|
77
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
80
78
|
}
|
81
79
|
return { name, label, readOnly, visible, required };
|
82
80
|
})
|
@@ -100,7 +98,7 @@ export class SnkFormConfigManager {
|
|
100
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
101
99
|
return normalizedText.includes(normalizedFilter);
|
102
100
|
}
|
103
|
-
|
101
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
104
102
|
let fields = this.getFieldsList(dataUnit);
|
105
103
|
if (ignoreReadOnlyFormFields) {
|
106
104
|
fields = fields.filter(field => {
|
@@ -132,8 +130,8 @@ export class SnkFormConfigManager {
|
|
132
130
|
this._onConfigChange(Object.assign({}, this._config));
|
133
131
|
}
|
134
132
|
}
|
135
|
-
getConfig(
|
136
|
-
return
|
133
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
134
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
137
135
|
}
|
138
136
|
getFormConfigFetcher() {
|
139
137
|
if (this._formConfigFetcher == undefined) {
|
@@ -67,7 +67,7 @@ export class SnkFormConfig {
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
getConfig() {
|
70
|
-
let config = this.configManager.getConfig(
|
70
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
71
71
|
if (config.fields && config.fields.length === 0) {
|
72
72
|
config = undefined;
|
73
73
|
}
|
@@ -56,6 +56,7 @@ export class SnkSimpleCrud {
|
|
56
56
|
this.formLegacyConfigName = undefined;
|
57
57
|
this.ignoreReadOnlyFormFields = false;
|
58
58
|
this.autoFocus = true;
|
59
|
+
this.domainMessagesBuilder = undefined;
|
59
60
|
this.autoLoad = undefined;
|
60
61
|
}
|
61
62
|
/**
|
@@ -672,8 +673,8 @@ export class SnkSimpleCrud {
|
|
672
673
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
673
674
|
}
|
674
675
|
getFormConfig() {
|
675
|
-
var _a
|
676
|
-
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(
|
676
|
+
var _a;
|
677
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
|
677
678
|
if (!this.configName && !configFromManager) {
|
678
679
|
return this.formConfig;
|
679
680
|
}
|
@@ -693,7 +694,7 @@ export class SnkSimpleCrud {
|
|
693
694
|
if (this.dataUnit == undefined) {
|
694
695
|
return;
|
695
696
|
}
|
696
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
697
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
697
698
|
? undefined
|
698
699
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
699
700
|
}
|
@@ -1086,6 +1087,23 @@ export class SnkSimpleCrud {
|
|
1086
1087
|
"reflect": false,
|
1087
1088
|
"defaultValue": "true"
|
1088
1089
|
},
|
1090
|
+
"domainMessagesBuilder": {
|
1091
|
+
"type": "string",
|
1092
|
+
"mutable": false,
|
1093
|
+
"complexType": {
|
1094
|
+
"original": "string",
|
1095
|
+
"resolved": "string",
|
1096
|
+
"references": {}
|
1097
|
+
},
|
1098
|
+
"required": false,
|
1099
|
+
"optional": false,
|
1100
|
+
"docs": {
|
1101
|
+
"tags": [],
|
1102
|
+
"text": "Define a chave customizada para sobrescrever as mensagens (N\u00E3o pegando pela entidade)"
|
1103
|
+
},
|
1104
|
+
"attribute": "domain-messages-builder",
|
1105
|
+
"reflect": false
|
1106
|
+
},
|
1089
1107
|
"autoLoad": {
|
1090
1108
|
"type": "boolean",
|
1091
1109
|
"mutable": false,
|
@@ -71,6 +71,7 @@ export class ConfigStorage {
|
|
71
71
|
if (config == undefined) {
|
72
72
|
return;
|
73
73
|
}
|
74
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
74
75
|
await this.deleteGridConfigCache(name, resourceID);
|
75
76
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
76
77
|
}
|
@@ -5,6 +5,7 @@ export default class InMemoryLoader {
|
|
5
5
|
this.metadata = metadata;
|
6
6
|
this.records = records;
|
7
7
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
8
|
+
this._dataUnit.pageSize = 150;
|
8
9
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
9
10
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
10
11
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
@@ -22,12 +22,16 @@ export function applySorting(records, dataUnit, sorting) {
|
|
22
22
|
return records.sort(sortingFunction);
|
23
23
|
}
|
24
24
|
export function buildPaginationInfo(records, offset = 0, limit = 0) {
|
25
|
-
|
25
|
+
if (records === undefined) {
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
29
|
+
const lastRecord = Math.min(offset + limit, total);
|
26
30
|
return {
|
27
31
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
28
32
|
firstRecord: offset,
|
29
33
|
lastRecord: lastRecord,
|
30
|
-
total:
|
31
|
-
hasMore: !!(
|
34
|
+
total: total,
|
35
|
+
hasMore: !!(total - lastRecord),
|
32
36
|
};
|
33
37
|
}
|
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
6
6
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
7
7
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
8
8
|
};
|
9
|
-
import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
9
|
+
import { ApplicationContext, ErrorException, ServiceCanceledException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
10
10
|
import { batchRequests } from 'graphql-request';
|
11
11
|
import UrlUtils from "../../../lib/utils/urlutils";
|
12
12
|
import { PrintUtils } from '../../utils/PrintUtils';
|
@@ -372,9 +372,14 @@ export class DataFetcher {
|
|
372
372
|
resolve(false);
|
373
373
|
})
|
374
374
|
]).then((data) => {
|
375
|
-
var _a;
|
375
|
+
var _a, _b;
|
376
376
|
if (!hasClientEvent || data === false) {
|
377
|
-
(
|
377
|
+
if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
|
378
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
(((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
382
|
+
}
|
378
383
|
}
|
379
384
|
});
|
380
385
|
});
|
@@ -423,6 +423,7 @@ class ConfigStorage {
|
|
423
423
|
if (config == undefined) {
|
424
424
|
return;
|
425
425
|
}
|
426
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
426
427
|
await this.deleteGridConfigCache(name, resourceID);
|
427
428
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
428
429
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
1
|
+
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, ServiceCanceledException } from '@sankhyalabs/core';
|
2
2
|
import { P as PrintUtils } from './PrintUtils.js';
|
3
3
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
|
@@ -6883,9 +6883,14 @@ class DataFetcher {
|
|
6883
6883
|
resolve(false);
|
6884
6884
|
})
|
6885
6885
|
]).then((data) => {
|
6886
|
-
var _a;
|
6886
|
+
var _a, _b;
|
6887
6887
|
if (!hasClientEvent || data === false) {
|
6888
|
-
(
|
6888
|
+
if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
|
6889
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
|
6890
|
+
}
|
6891
|
+
else {
|
6892
|
+
(((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
6893
|
+
}
|
6889
6894
|
}
|
6890
6895
|
});
|
6891
6896
|
});
|
@@ -74,10 +74,8 @@ class SnkFormConfigManager {
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
75
75
|
return fields.map(({ label, name, readOnly, visible, required }) => {
|
76
76
|
if (label == undefined) {
|
77
|
-
|
78
|
-
|
79
|
-
visible,
|
80
|
-
required });
|
77
|
+
const currentField = dataUnit.getField(name);
|
78
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
81
79
|
}
|
82
80
|
return { name, label, readOnly, visible, required };
|
83
81
|
})
|
@@ -101,7 +99,7 @@ class SnkFormConfigManager {
|
|
101
99
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
102
100
|
return normalizedText.includes(normalizedFilter);
|
103
101
|
}
|
104
|
-
|
102
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
105
103
|
let fields = this.getFieldsList(dataUnit);
|
106
104
|
if (ignoreReadOnlyFormFields) {
|
107
105
|
fields = fields.filter(field => {
|
@@ -133,8 +131,8 @@ class SnkFormConfigManager {
|
|
133
131
|
this._onConfigChange(Object.assign({}, this._config));
|
134
132
|
}
|
135
133
|
}
|
136
|
-
getConfig(
|
137
|
-
return
|
134
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
135
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
138
136
|
}
|
139
137
|
getFormConfigFetcher() {
|
140
138
|
if (this._formConfigFetcher == undefined) {
|
@@ -246,13 +246,17 @@ function applySorting(records, dataUnit, sorting) {
|
|
246
246
|
return records.sort(sortingFunction);
|
247
247
|
}
|
248
248
|
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
249
|
-
|
249
|
+
if (records === undefined) {
|
250
|
+
return undefined;
|
251
|
+
}
|
252
|
+
const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
|
253
|
+
const lastRecord = Math.min(offset + limit, total);
|
250
254
|
return {
|
251
255
|
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
252
256
|
firstRecord: offset,
|
253
257
|
lastRecord: lastRecord,
|
254
|
-
total:
|
255
|
-
hasMore: !!(
|
258
|
+
total: total,
|
259
|
+
hasMore: !!(total - lastRecord),
|
256
260
|
};
|
257
261
|
}
|
258
262
|
|
@@ -261,6 +265,7 @@ class InMemoryLoader {
|
|
261
265
|
this.metadata = metadata;
|
262
266
|
this.records = records;
|
263
267
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
268
|
+
this._dataUnit.pageSize = 150;
|
264
269
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
265
270
|
this._dataUnit.dataLoader = (dataUnit, request) => this.inMemoryLoader(dataUnit, request, this.getRecordsToLoad());
|
266
271
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
@@ -51,6 +51,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
51
|
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
52
52
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
53
53
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
54
|
+
this.viewModeChanged = createEvent(this, "viewModeChanged", 7);
|
54
55
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
55
56
|
this._viewHistory = [];
|
56
57
|
this._customEditors = new Map();
|
@@ -79,6 +80,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
79
80
|
this.disablePersonalizedFilter = undefined;
|
80
81
|
this.autoLoad = undefined;
|
81
82
|
this.autoFocus = true;
|
83
|
+
this.domainMessagesBuilder = undefined;
|
84
|
+
this.setCustomFormTitle = undefined;
|
82
85
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
83
86
|
}
|
84
87
|
/**
|
@@ -187,6 +190,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
187
190
|
else if (viewMode === VIEW_MODE.FORM) {
|
188
191
|
this._guidesViewer.setFocus();
|
189
192
|
}
|
193
|
+
this.viewModeChanged.emit(viewMode);
|
190
194
|
}
|
191
195
|
openConfig(viewMode) {
|
192
196
|
this._snkConfigurator.close();
|
@@ -250,6 +254,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
250
254
|
this._snkDataUnit = parent;
|
251
255
|
this._snkDataUnit.addEventListener("insertionMode", () => this.insertionModeHandler());
|
252
256
|
this._snkDataUnit.addEventListener("cancelEdition", () => this.cancelHandler());
|
257
|
+
this._snkDataUnit.domainMessagesBuilder = this.domainMessagesBuilder;
|
253
258
|
this._dataUnit = this._snkDataUnit.dataUnit;
|
254
259
|
this._dataState = this._snkDataUnit.dataState;
|
255
260
|
if (!this._dataUnit) {
|
@@ -415,7 +420,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
415
420
|
return;
|
416
421
|
}
|
417
422
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
418
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
423
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, getCustomTitle: this.setCustomFormTitle }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
419
424
|
}
|
420
425
|
get _element() { return this; }
|
421
426
|
static get watchers() { return {
|
@@ -441,6 +446,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
441
446
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
442
447
|
"autoLoad": [4, "auto-load"],
|
443
448
|
"autoFocus": [4, "auto-focus"],
|
449
|
+
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
450
|
+
"setCustomFormTitle": [16],
|
444
451
|
"_dataUnit": [32],
|
445
452
|
"_dataState": [32],
|
446
453
|
"attachmentRegisterKey": [32],
|
@@ -97,6 +97,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
97
97
|
this.ignoreSaveMessage = undefined;
|
98
98
|
this.configName = undefined;
|
99
99
|
this.resourceID = undefined;
|
100
|
+
this.domainMessagesBuilder = undefined;
|
100
101
|
}
|
101
102
|
observePageSize() {
|
102
103
|
if (this.dataUnit) {
|
@@ -513,7 +514,8 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
513
514
|
if (this.ignoreSaveMessage) {
|
514
515
|
return;
|
515
516
|
}
|
516
|
-
const
|
517
|
+
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
518
|
+
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
517
519
|
if (msg != undefined) {
|
518
520
|
this.showSuccessMessage(msg);
|
519
521
|
}
|
@@ -544,10 +546,13 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
544
546
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
545
547
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
|
546
548
|
*/
|
547
|
-
getMessage(key, params = undefined) {
|
549
|
+
getMessage(key, params = undefined, customOperation) {
|
548
550
|
if (!params) {
|
549
551
|
params = this.getMessageParams();
|
550
552
|
}
|
553
|
+
if (customOperation) {
|
554
|
+
this.messagesBuilder.currentOperation = customOperation;
|
555
|
+
}
|
551
556
|
return this.messagesBuilder.getMessage(key, params);
|
552
557
|
}
|
553
558
|
getMessageParams() {
|
@@ -654,6 +659,13 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
654
659
|
parent = parent.parentElement;
|
655
660
|
}
|
656
661
|
}
|
662
|
+
instanceMessagesBuilder() {
|
663
|
+
var _a;
|
664
|
+
if (this.messagesBuilder) {
|
665
|
+
return;
|
666
|
+
}
|
667
|
+
this.messagesBuilder = new SnkMessageBuilder((_a = this.domainMessagesBuilder) !== null && _a !== void 0 ? _a : this.entityName);
|
668
|
+
}
|
657
669
|
//---------------------------------------------
|
658
670
|
// Lifecycle web component
|
659
671
|
//---------------------------------------------
|
@@ -661,9 +673,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
661
673
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
662
674
|
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
663
675
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
664
|
-
|
665
|
-
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
666
|
-
}
|
676
|
+
this.instanceMessagesBuilder();
|
667
677
|
}
|
668
678
|
disconnectedCallback() {
|
669
679
|
if (this.dataUnit) {
|
@@ -699,6 +709,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
699
709
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
700
710
|
"configName": [1, "config-name"],
|
701
711
|
"resourceID": [1, "resource-i-d"],
|
712
|
+
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
702
713
|
"fieldsToLink": [32],
|
703
714
|
"getDataUnit": [64],
|
704
715
|
"getSelectedRecordsIDsInfo": [64],
|
@@ -70,6 +70,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
70
70
|
this.resourceID = undefined;
|
71
71
|
this.detailTaskbarCustomContainerId = undefined;
|
72
72
|
this.formLegacyConfigName = undefined;
|
73
|
+
this.getCustomTitle = undefined;
|
73
74
|
this._hasToCreateFieldSearch = true;
|
74
75
|
this._breadcrumbItems = [];
|
75
76
|
this._guides = undefined;
|
@@ -156,7 +157,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
156
157
|
}
|
157
158
|
onContentCardChanged(evt) {
|
158
159
|
SnkGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
|
159
|
-
.then(() => this.masterFormConfig = this._configManager.getConfig(this.
|
160
|
+
.then(() => this.masterFormConfig = this._configManager.getConfig(this.dataUnit));
|
160
161
|
}
|
161
162
|
/**
|
162
163
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -507,6 +508,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
507
508
|
}
|
508
509
|
return "";
|
509
510
|
}
|
511
|
+
getTitle() {
|
512
|
+
var _a, _b;
|
513
|
+
return (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title");
|
514
|
+
}
|
510
515
|
componentDidLoad() {
|
511
516
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
512
517
|
}
|
@@ -520,7 +525,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
520
525
|
}
|
521
526
|
this.loadTaskbarProcessor();
|
522
527
|
const showGuides = this._guides && (this._guides.length > 1);
|
523
|
-
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.
|
528
|
+
return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getTitle()), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
|
524
529
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
525
530
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
526
531
|
:
|
@@ -558,6 +563,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
558
563
|
"resourceID": [1, "resource-i-d"],
|
559
564
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
560
565
|
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
566
|
+
"getCustomTitle": [16],
|
561
567
|
"_hasToCreateFieldSearch": [32],
|
562
568
|
"_breadcrumbItems": [32],
|
563
569
|
"_guides": [32],
|
@@ -938,14 +944,13 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
938
944
|
return guideId.replace(SnkDetailView.REGEX_FORM_ID, "");
|
939
945
|
}
|
940
946
|
loadMetadata() {
|
941
|
-
var _a;
|
942
947
|
if (!this.dataUnit) {
|
943
948
|
return;
|
944
949
|
}
|
945
950
|
if (!this.formConfigManager.isLoaded) {
|
946
951
|
return;
|
947
952
|
}
|
948
|
-
const formConfig = this.formConfigManager.getConfig(
|
953
|
+
const formConfig = this.formConfigManager.getConfig(this.dataUnit);
|
949
954
|
//this._cardsState = formConfig?.cardsState;
|
950
955
|
this._formMetadata = buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
|
951
956
|
}
|
@@ -76,7 +76,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
getConfig() {
|
79
|
-
let config = this.configManager.getConfig(
|
79
|
+
let config = this.configManager.getConfig(this.dataUnit);
|
80
80
|
if (config.fields && config.fields.length === 0) {
|
81
81
|
config = undefined;
|
82
82
|
}
|