@sankhyalabs/sankhyablocks 8.15.0-dev.61 → 8.15.0-dev.63
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-7df9d3bb.js → ConfigStorage-9a53a42c.js} +12 -11
- package/dist/cjs/{form-config-fetcher-3c4daeb5.js → DataFetcher-515bda03.js} +0 -251
- package/dist/cjs/{IExporterProvider-c307e2b1.js → IExporterProvider-98a012a4.js} +55 -12
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-dda10d75.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-4a95fe86.js} +6 -12
- package/dist/cjs/{auth-fetcher-e6112be7.js → auth-fetcher-5acb0335.js} +1 -1
- package/dist/cjs/{pesquisa-fetcher-cbdaba63.js → dataunit-fetcher-e2109392.js} +68 -173
- package/dist/cjs/form-config-fetcher-3f430aee.js +256 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-916a935c.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +10 -8
- package/dist/cjs/snk-application.cjs.entry.js +49 -39
- package/dist/cjs/snk-attach.cjs.entry.js +19 -17
- package/dist/cjs/snk-crud.cjs.entry.js +43 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -7
- package/dist/cjs/snk-data-unit-dee38ccd.js +614 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +36 -0
- package/dist/cjs/snk-form.cjs.entry.js +28 -7
- package/dist/cjs/snk-grid.cjs.entry.js +55 -10
- package/dist/cjs/{snk-guides-viewer-b0c44e0c.js → snk-guides-viewer-af4a6ae5.js} +19 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +96 -14
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +37 -17
- package/dist/collection/components/snk-crud/snk-crud.js +109 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +79 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +41 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +14 -8
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +5 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +413 -165
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +50 -4
- package/dist/collection/components/snk-grid/snk-grid.js +96 -7
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +156 -8
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +51 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +25 -32
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/ConfigStorage.js +2 -1
- package/dist/components/DataFetcher.js +7024 -0
- package/dist/components/IExporterProvider.js +54 -12
- package/dist/components/SnkMessageBuilder.js +6 -12
- package/dist/components/dataunit-fetcher.js +58 -164
- package/dist/components/form-config-fetcher.js +3 -7023
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -2
- package/dist/components/snk-application2.js +26 -17
- package/dist/components/snk-attach2.js +4 -2
- package/dist/components/snk-crud.js +46 -9
- package/dist/components/snk-data-exporter2.js +4 -2
- package/dist/components/snk-data-unit2.js +356 -166
- package/dist/components/snk-detail-view2.js +21 -6
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-form-view2.js +39 -1
- package/dist/components/snk-form.js +26 -5
- package/dist/components/snk-grid2.js +58 -11
- package/dist/components/snk-simple-crud2.js +96 -10
- package/dist/esm/{ConfigStorage-928c3bf4.js → ConfigStorage-174101b9.js} +2 -1
- package/dist/esm/{form-config-fetcher-e3094014.js → DataFetcher-4b4b7beb.js} +1 -250
- package/dist/esm/{IExporterProvider-e2a1195d.js → IExporterProvider-8f085554.js} +54 -12
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-87bd8082.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-3a767111.js} +6 -12
- package/dist/esm/{auth-fetcher-e1cb288f.js → auth-fetcher-9f86c346.js} +1 -1
- package/dist/esm/{pesquisa-fetcher-6d8e50bb.js → dataunit-fetcher-87ecba4a.js} +57 -163
- package/dist/esm/form-config-fetcher-5d72aaf1.js +253 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-9cfab836.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -3
- package/dist/esm/snk-application.entry.js +30 -20
- package/dist/esm/snk-attach.entry.js +5 -3
- package/dist/esm/snk-crud.entry.js +43 -9
- package/dist/esm/snk-data-exporter.entry.js +6 -4
- package/dist/esm/snk-data-unit-1132e40b.js +612 -0
- package/dist/esm/snk-data-unit.entry.js +10 -2
- package/dist/esm/snk-detail-view.entry.js +8 -6
- package/dist/esm/snk-filter-bar.entry.js +3 -2
- package/dist/esm/snk-filter-modal-item.entry.js +3 -2
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form-view.entry.js +36 -0
- package/dist/esm/snk-form.entry.js +28 -7
- package/dist/esm/snk-grid.entry.js +56 -11
- package/dist/esm/{snk-guides-viewer-1fd41a25.js → snk-guides-viewer-359e39a7.js} +19 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-personalized-filter.entry.js +3 -2
- package/dist/esm/snk-simple-crud.entry.js +95 -13
- package/dist/sankhyablocks/p-00a7ede4.entry.js +1 -0
- package/dist/sankhyablocks/p-010d475f.js +1 -0
- package/dist/sankhyablocks/p-08fee6e8.js +60 -0
- package/dist/sankhyablocks/p-0bcc6e83.js +1 -0
- package/dist/sankhyablocks/p-2a84e45b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0e8702f0.js → p-2eb90860.js} +1 -1
- package/dist/sankhyablocks/p-33f695d6.entry.js +1 -0
- package/dist/sankhyablocks/p-4ce73e88.js +1 -0
- package/dist/sankhyablocks/p-4ef47eb8.entry.js +1 -0
- package/dist/sankhyablocks/{p-e27496ed.js → p-566f5f50.js} +6 -6
- package/dist/sankhyablocks/p-59dccb7a.entry.js +1 -0
- package/dist/sankhyablocks/p-66a31d30.entry.js +11 -0
- package/dist/sankhyablocks/p-6b2be902.js +6 -0
- package/dist/sankhyablocks/p-7ecaaea2.entry.js +1 -0
- package/dist/sankhyablocks/p-80031650.js +1 -0
- package/dist/sankhyablocks/p-83950924.entry.js +1 -0
- package/dist/sankhyablocks/p-873d2e6a.entry.js +1 -0
- package/dist/sankhyablocks/p-931343a1.entry.js +1 -0
- package/dist/sankhyablocks/p-a6dfa396.js +1 -0
- package/dist/sankhyablocks/p-aa854fa8.entry.js +1 -0
- package/dist/sankhyablocks/p-b11921ca.entry.js +1 -0
- package/dist/sankhyablocks/p-cb91634d.js +1 -0
- package/dist/sankhyablocks/p-cf9d2d1e.entry.js +1 -0
- package/dist/sankhyablocks/p-d799aa7f.entry.js +1 -0
- package/dist/sankhyablocks/p-da6e3dcf.entry.js +1 -0
- package/dist/sankhyablocks/p-e0c27486.js +26 -0
- package/dist/sankhyablocks/p-f72e8835.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +6 -2
- package/dist/types/components/snk-crud/snk-crud.d.ts +14 -1
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +13 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +45 -1
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-form/snk-form.d.ts +6 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +22 -0
- package/dist/types/components.d.ts +68 -4
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-abd2113f.js +0 -427
- package/dist/esm/snk-data-unit-29eba11a.js +0 -425
- package/dist/sankhyablocks/p-029bfc09.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07825198.js +0 -1
- package/dist/sankhyablocks/p-13ea113d.entry.js +0 -1
- package/dist/sankhyablocks/p-314e2d1a.entry.js +0 -1
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-3357af48.js +0 -1
- package/dist/sankhyablocks/p-3c2a1f4d.js +0 -65
- package/dist/sankhyablocks/p-3e7167dd.js +0 -1
- package/dist/sankhyablocks/p-536eeb16.js +0 -26
- package/dist/sankhyablocks/p-587f9dcf.entry.js +0 -1
- package/dist/sankhyablocks/p-61984566.entry.js +0 -1
- package/dist/sankhyablocks/p-65b6dba3.entry.js +0 -1
- package/dist/sankhyablocks/p-6a7bc5c8.entry.js +0 -1
- package/dist/sankhyablocks/p-6c9edfd8.entry.js +0 -1
- package/dist/sankhyablocks/p-89bde7d3.entry.js +0 -1
- package/dist/sankhyablocks/p-91dceecf.entry.js +0 -1
- package/dist/sankhyablocks/p-a40cbad8.entry.js +0 -1
- package/dist/sankhyablocks/p-b86ea293.entry.js +0 -1
- package/dist/sankhyablocks/p-d8ddb2a4.entry.js +0 -11
- package/dist/sankhyablocks/p-df73ac00.entry.js +0 -1
- package/dist/sankhyablocks/p-f92f1f5f.entry.js +0 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +0 -1
@@ -3,8 +3,9 @@ import { S as Sortable } from './Sortable-83960219.js';
|
|
3
3
|
import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-8457af36.js';
|
6
|
-
import {
|
6
|
+
import { U as UserConfigType } from './form-config-fetcher-5d72aaf1.js';
|
7
7
|
import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
8
|
+
import './DataFetcher-4b4b7beb.js';
|
8
9
|
import './PrintUtils-3e4ff0f5.js';
|
9
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
11
|
|
@@ -10,6 +10,7 @@ const SnkFormView = class {
|
|
10
10
|
this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
|
11
11
|
this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
|
12
12
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
13
|
+
this._fieldProps = new Map();
|
13
14
|
this.levelPath = undefined;
|
14
15
|
this.label = undefined;
|
15
16
|
this.name = undefined;
|
@@ -23,12 +24,29 @@ const SnkFormView = class {
|
|
23
24
|
this.canFix = true;
|
24
25
|
this.recordsValidator = undefined;
|
25
26
|
this.fieldToFocus = undefined;
|
27
|
+
this.fieldsProps = undefined;
|
26
28
|
}
|
27
29
|
async showUp() {
|
28
30
|
if (this._formView) {
|
29
31
|
this._formView.showUp();
|
30
32
|
}
|
31
33
|
}
|
34
|
+
/**
|
35
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
36
|
+
*/
|
37
|
+
async setFieldProp(fieldName, propName, value) {
|
38
|
+
const props = this._fieldProps.get(fieldName) || [];
|
39
|
+
this._fieldProps.set(fieldName, [...props, { propName, value }]);
|
40
|
+
}
|
41
|
+
async observeFieldsProps(newValue) {
|
42
|
+
for (const field in newValue) {
|
43
|
+
const fieldProps = newValue[field];
|
44
|
+
const propNames = Object.keys(fieldProps);
|
45
|
+
for (const propName of propNames) {
|
46
|
+
await this.setFieldProp(field, propName, fieldProps[propName]);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
32
50
|
changeFix() {
|
33
51
|
this.fixed = !this.fixed;
|
34
52
|
this.emitEvent("fixed");
|
@@ -87,7 +105,11 @@ const SnkFormView = class {
|
|
87
105
|
this._dataBinder.onDisconnectedCallback();
|
88
106
|
}
|
89
107
|
}
|
108
|
+
componentDidLoad() {
|
109
|
+
this.observeFieldsProps(this.fieldsProps);
|
110
|
+
}
|
90
111
|
componentDidRender() {
|
112
|
+
this.setFieldProps();
|
91
113
|
if (this.fieldToFocus == undefined) {
|
92
114
|
return;
|
93
115
|
}
|
@@ -99,6 +121,17 @@ const SnkFormView = class {
|
|
99
121
|
this.snkRequestClearFieldToFocus.emit();
|
100
122
|
});
|
101
123
|
}
|
124
|
+
setFieldProps() {
|
125
|
+
if (!this._formView) {
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
for (const [fieldName, propsToChange] of this._fieldProps) {
|
129
|
+
propsToChange.forEach(prop => {
|
130
|
+
this._formView.setFieldProp(fieldName, prop.propName, prop.value);
|
131
|
+
this._fieldProps.delete(fieldName);
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}
|
102
135
|
render() {
|
103
136
|
return (h(Host, { class: "ez-box__container" }, h("div", { class: "summary-header ez-flex ez-size-width--full" }, h("div", { class: "ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9" }, this.levelPath ? h("span", { class: "level-path" }, this.levelPath + " /") : undefined, this.label), h("div", { class: "ez-flex ez-flex--justify-end ez-col--sd-3" }, this.canFix &&
|
104
137
|
h("ez-button", { class: "ez-padding-left--medium", mode: "icon", size: "small", iconName: this.fixed ? "un-pin" : "push-pin", "data-element-id": ElementIDUtils.getInternalIDInfo("toggleFixed_ezFormCard"), onClick: () => this.changeFix(), title: this.fixed ? "Desafixar" : "Fixar" }), this.canExpand &&
|
@@ -108,6 +141,9 @@ const SnkFormView = class {
|
|
108
141
|
:
|
109
142
|
h("ez-form-view", { ref: ref => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), onFormItemsReady: (event) => this.handleFormItemsReady(event) })));
|
110
143
|
}
|
144
|
+
static get watchers() { return {
|
145
|
+
"fieldsProps": ["observeFieldsProps"]
|
146
|
+
}; }
|
111
147
|
};
|
112
148
|
SnkFormView.style = snkFormViewCss;
|
113
149
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-87bd8082.js';
|
4
4
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
5
|
-
import './ConfigStorage-
|
6
|
-
import './form-config-fetcher-
|
5
|
+
import './ConfigStorage-174101b9.js';
|
6
|
+
import './form-config-fetcher-5d72aaf1.js';
|
7
|
+
import './DataFetcher-4b4b7beb.js';
|
7
8
|
import './PrintUtils-3e4ff0f5.js';
|
8
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
9
10
|
import './filter-item-type.enum-d45e026f.js';
|
@@ -38,6 +39,12 @@ const SnkForm = class {
|
|
38
39
|
async hideConfig() {
|
39
40
|
this._showFormConfig = false;
|
40
41
|
}
|
42
|
+
/**
|
43
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
44
|
+
*/
|
45
|
+
async setFieldProp(fieldName, propName, value) {
|
46
|
+
await this._form.setFieldProp(fieldName, propName, value);
|
47
|
+
}
|
41
48
|
closeConfig() {
|
42
49
|
this.hideConfig();
|
43
50
|
}
|
@@ -60,9 +67,7 @@ const SnkForm = class {
|
|
60
67
|
this._dataUnit = evt.detail;
|
61
68
|
});
|
62
69
|
}
|
63
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
64
|
-
this._dataState = evt.detail;
|
65
|
-
});
|
70
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
66
71
|
break;
|
67
72
|
}
|
68
73
|
parent = parent.parentElement;
|
@@ -74,6 +79,22 @@ const SnkForm = class {
|
|
74
79
|
this.addFormLegacyConfig();
|
75
80
|
this._configManager.loadConfig();
|
76
81
|
}
|
82
|
+
async handleDataStateChange(evt) {
|
83
|
+
var _a;
|
84
|
+
this._dataState = evt.detail;
|
85
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
86
|
+
for (const field of fieldsWithRmPrecision || []) {
|
87
|
+
if (!field) {
|
88
|
+
continue;
|
89
|
+
}
|
90
|
+
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
91
|
+
if (!rmPrecision) {
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
95
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
96
|
+
}
|
97
|
+
}
|
77
98
|
addFormLegacyConfig() {
|
78
99
|
if (this.formLegacyConfigName) {
|
79
100
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
@@ -83,7 +104,7 @@ const SnkForm = class {
|
|
83
104
|
if (!this._dataUnit || !this._dataState) {
|
84
105
|
return undefined;
|
85
106
|
}
|
86
|
-
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
107
|
+
return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: ref => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataState.insertionMode, this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
87
108
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
88
109
|
}
|
89
110
|
get _element() { return getElement(this); }
|
@@ -1,18 +1,20 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
2
|
+
import { Action, ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
4
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
5
5
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
6
6
|
import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-efbe307f.js';
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils, R as RmPrecisionCustomValueFormatter } from './IExporterProvider-8f085554.js';
|
9
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
10
|
-
import './
|
11
|
-
import './pesquisa-fetcher-
|
10
|
+
import './DataFetcher-4b4b7beb.js';
|
11
|
+
import './pesquisa-fetcher-9cfab836.js';
|
12
12
|
import './ISave-d8c8bc59.js';
|
13
13
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
14
14
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
15
|
+
import './dataunit-fetcher-87ecba4a.js';
|
15
16
|
import './filter-item-type.enum-d45e026f.js';
|
17
|
+
import './form-config-fetcher-5d72aaf1.js';
|
16
18
|
import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
|
17
19
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
18
20
|
import './PrintUtils-3e4ff0f5.js';
|
@@ -100,6 +102,14 @@ const SnkGrid = class {
|
|
100
102
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
101
103
|
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
102
104
|
});
|
105
|
+
this.dataUnitInterceptor = {
|
106
|
+
interceptAction: async (action) => {
|
107
|
+
if (action.type === Action.METADATA_LOADED) {
|
108
|
+
return await this.interceptMetadataLoaded(action);
|
109
|
+
}
|
110
|
+
return action;
|
111
|
+
}
|
112
|
+
};
|
103
113
|
this._dataUnit = undefined;
|
104
114
|
this._dataState = undefined;
|
105
115
|
this._gridConfig = undefined;
|
@@ -170,6 +180,18 @@ const SnkGrid = class {
|
|
170
180
|
async findColumn() {
|
171
181
|
await openFieldSearch(this._moreOptions, this._columnSearch);
|
172
182
|
}
|
183
|
+
/**
|
184
|
+
* Registra um formatador de valores para uma coluna da grid.
|
185
|
+
*/
|
186
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
187
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
188
|
+
}
|
189
|
+
/**
|
190
|
+
* Remove o formatador de valores de uma coluna da grid.
|
191
|
+
*/
|
192
|
+
async removeCustomValueFormatter(columnName) {
|
193
|
+
this._grid.removeCustomValueFormatter(columnName);
|
194
|
+
}
|
173
195
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
174
196
|
if (!newLegacyConfig) {
|
175
197
|
return;
|
@@ -232,7 +254,23 @@ const SnkGrid = class {
|
|
232
254
|
const dataInfo = { dataUnit: this._dataUnit };
|
233
255
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
234
256
|
}
|
235
|
-
|
257
|
+
loadGridCustomFormatters(fields) {
|
258
|
+
if (!fields || !this._grid) {
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
fields.forEach((field) => {
|
262
|
+
var _a;
|
263
|
+
if ((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) {
|
264
|
+
this.addCustomValueFormatter(field.name, this._rmPrecisionCustomValueFormatter);
|
265
|
+
}
|
266
|
+
});
|
267
|
+
}
|
268
|
+
async interceptMetadataLoaded(action) {
|
269
|
+
this.loadGridCustomFormatters(action.payload.fields);
|
270
|
+
return action;
|
271
|
+
}
|
272
|
+
finishLoading() {
|
273
|
+
this._dataUnit.addInterceptor(this.dataUnitInterceptor);
|
236
274
|
CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
|
237
275
|
this.addElementID();
|
238
276
|
if (this.columnFilterDataSource != undefined) {
|
@@ -251,17 +289,15 @@ const SnkGrid = class {
|
|
251
289
|
if (!this._dataUnit) {
|
252
290
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
253
291
|
this._dataUnit = evt.detail;
|
254
|
-
this.
|
292
|
+
this.finishLoading();
|
255
293
|
});
|
256
294
|
}
|
257
295
|
else {
|
258
|
-
this.
|
296
|
+
this.finishLoading();
|
259
297
|
}
|
260
298
|
if (!this.messagesBuilder)
|
261
299
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
262
|
-
this._snkDataUnit.addEventListener("dataStateChange", (
|
263
|
-
this._dataState = evt.detail;
|
264
|
-
});
|
300
|
+
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
265
301
|
this._snkDataUnit.addEventListener("cancelEdition", () => {
|
266
302
|
var _a;
|
267
303
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
|
@@ -272,9 +308,18 @@ const SnkGrid = class {
|
|
272
308
|
}
|
273
309
|
parent = parent.parentElement;
|
274
310
|
}
|
311
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
275
312
|
this.addGridLegacyConfigName();
|
276
313
|
this.loadConfig();
|
277
314
|
}
|
315
|
+
componentDidRender() {
|
316
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
317
|
+
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
318
|
+
}
|
319
|
+
async handleDataStateChange(evt) {
|
320
|
+
this._dataState = evt.detail;
|
321
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this._dataState);
|
322
|
+
}
|
278
323
|
getHeaderDisabledButtons() {
|
279
324
|
var _a;
|
280
325
|
const disabledButtons = [];
|
@@ -1,17 +1,19 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
|
2
2
|
import { Action, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
3
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-87bd8082.js';
|
4
4
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
5
5
|
import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './field-search-efbe307f.js';
|
6
6
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
7
7
|
import { d as VIEW_MODE } from './constants-8457af36.js';
|
8
|
-
import './
|
9
|
-
import './pesquisa-fetcher-
|
8
|
+
import './DataFetcher-4b4b7beb.js';
|
9
|
+
import './pesquisa-fetcher-9cfab836.js';
|
10
10
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
11
11
|
import './ISave-d8c8bc59.js';
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
13
13
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
14
|
+
import './dataunit-fetcher-87ecba4a.js';
|
14
15
|
import './filter-item-type.enum-d45e026f.js';
|
16
|
+
import './form-config-fetcher-5d72aaf1.js';
|
15
17
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
16
18
|
|
17
19
|
const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
|
@@ -45,6 +47,7 @@ const SnkGuidesViewer = class {
|
|
45
47
|
this._formEditorConfigManager = undefined;
|
46
48
|
this._formEditorDataUnit = undefined;
|
47
49
|
this._fieldToGetFocus = undefined;
|
50
|
+
this._fieldsProps = {};
|
48
51
|
}
|
49
52
|
observeDataUnit() {
|
50
53
|
this.loadGuides(true);
|
@@ -75,6 +78,15 @@ const SnkGuidesViewer = class {
|
|
75
78
|
async findField() {
|
76
79
|
await openFieldSearch(this._moreOptions, this._fieldSearch);
|
77
80
|
}
|
81
|
+
/**
|
82
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
83
|
+
*/
|
84
|
+
async setFieldProp(fieldName, propName, value) {
|
85
|
+
const newFieldsProps = {
|
86
|
+
[fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
|
87
|
+
};
|
88
|
+
this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
|
89
|
+
}
|
78
90
|
exitViewer() {
|
79
91
|
if (this.dataUnit.isDirty()) {
|
80
92
|
this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
@@ -217,7 +229,7 @@ const SnkGuidesViewer = class {
|
|
217
229
|
if (sheet == undefined) {
|
218
230
|
return;
|
219
231
|
}
|
220
|
-
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); } });
|
232
|
+
return h("snk-form-view", { levelPath: params.levelPath, label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, contracted: (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.presentation) === "CONTRACTED", fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_b = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.summary) === null || _b === void 0 ? void 0 : _b.get(formName), fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, fieldsProps: params.fieldsProps });
|
221
233
|
})));
|
222
234
|
}
|
223
235
|
wrapDetail(levels, content) {
|
@@ -266,7 +278,7 @@ const SnkGuidesViewer = class {
|
|
266
278
|
const sheet = this._masterFormMetadata.getSheet(cardId);
|
267
279
|
if (sheet) {
|
268
280
|
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
269
|
-
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() }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
281
|
+
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(), fieldsProps: this._fieldsProps }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
270
282
|
}
|
271
283
|
}
|
272
284
|
return content;
|
@@ -472,7 +484,8 @@ const SnkGuidesViewer = class {
|
|
472
484
|
dataUnit: this.dataUnit,
|
473
485
|
recordsValidator: this.recordsValidator,
|
474
486
|
fieldToFocus: this._fieldToGetFocus,
|
475
|
-
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this)
|
487
|
+
onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
|
488
|
+
fieldsProps: this._fieldsProps
|
476
489
|
}), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
477
490
|
}
|
478
491
|
static get watchers() { return {
|
@@ -1,9 +1,10 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-359e39a7.js';
|
2
2
|
import './index-a7d3d3f1.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
|
-
import './SnkFormConfigManager-
|
5
|
-
import './ConfigStorage-
|
6
|
-
import './form-config-fetcher-
|
4
|
+
import './SnkFormConfigManager-87bd8082.js';
|
5
|
+
import './ConfigStorage-174101b9.js';
|
6
|
+
import './form-config-fetcher-5d72aaf1.js';
|
7
|
+
import './DataFetcher-4b4b7beb.js';
|
7
8
|
import './PrintUtils-3e4ff0f5.js';
|
8
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
9
10
|
import './filter-item-type.enum-d45e026f.js';
|
@@ -13,10 +14,11 @@ import './taskbar-elements-ad766858.js';
|
|
13
14
|
import './index-0ece87a6.js';
|
14
15
|
import './index-bdf75557.js';
|
15
16
|
import './constants-8457af36.js';
|
16
|
-
import './pesquisa-fetcher-
|
17
|
+
import './pesquisa-fetcher-9cfab836.js';
|
18
|
+
import './ISave-d8c8bc59.js';
|
17
19
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
20
|
+
import './dataunit-fetcher-87ecba4a.js';
|
18
21
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
19
22
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
20
23
|
import './ResourceIDUtils-a114189a.js';
|
21
|
-
import './ISave-d8c8bc59.js';
|
22
24
|
import '@sankhyalabs/core/dist/dataunit/DataUnit';
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
|
2
2
|
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
4
|
-
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-
|
4
|
+
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { a as FilterGroupCondition } from './index-ae591a44.js';
|
7
7
|
import { s as store } from './index-bdf75557.js';
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
9
|
-
import './form-config-fetcher-
|
9
|
+
import './form-config-fetcher-5d72aaf1.js';
|
10
|
+
import './DataFetcher-4b4b7beb.js';
|
10
11
|
import './PrintUtils-3e4ff0f5.js';
|
11
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
12
13
|
|
@@ -3,24 +3,26 @@ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType,
|
|
3
3
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
|
5
5
|
import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-
|
6
|
+
import './DataFetcher-4b4b7beb.js';
|
7
|
+
import './pesquisa-fetcher-9cfab836.js';
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-8f085554.js';
|
9
9
|
import { D as DataExporterOption, P as PresentationMode } from './index-0ece87a6.js';
|
10
10
|
import './ISave-d8c8bc59.js';
|
11
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
12
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
13
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-87ecba4a.js';
|
13
14
|
import './filter-item-type.enum-d45e026f.js';
|
15
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-5d72aaf1.js';
|
14
16
|
import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
|
15
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
16
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
17
|
+
import { C as ConfigStorage } from './ConfigStorage-174101b9.js';
|
18
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-87bd8082.js';
|
17
19
|
import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
|
18
20
|
import { s as store } from './index-bdf75557.js';
|
19
21
|
import './PrintUtils-3e4ff0f5.js';
|
22
|
+
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
20
23
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
21
24
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
22
25
|
import './ResourceIDUtils-a114189a.js';
|
23
|
-
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
24
26
|
|
25
27
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
26
28
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
@@ -71,6 +73,11 @@ class ClientSideExporterProvider extends CommonsExporter {
|
|
71
73
|
if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
|
72
74
|
return value.value;
|
73
75
|
}
|
76
|
+
if (column.customFormatter) {
|
77
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
78
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
79
|
+
return formattedValue;
|
80
|
+
}
|
74
81
|
return this.dataUnit.getFormattedValue(id, value);
|
75
82
|
}
|
76
83
|
}
|
@@ -109,6 +116,7 @@ const SnkSimpleCrud = class {
|
|
109
116
|
this.gridConfig = undefined;
|
110
117
|
this.formConfig = undefined;
|
111
118
|
this._formFields = [];
|
119
|
+
this._fieldsProps = new Map();
|
112
120
|
this.multipleSelection = undefined;
|
113
121
|
this.useCancelConfirm = true;
|
114
122
|
this.pageSize = 150;
|
@@ -133,6 +141,27 @@ const SnkSimpleCrud = class {
|
|
133
141
|
this.loadFormConfig(true);
|
134
142
|
this.loadGridConfig(true);
|
135
143
|
}
|
144
|
+
/**
|
145
|
+
* Registra um formatador de valores para uma coluna da grid.
|
146
|
+
*/
|
147
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
148
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* Remove o formatador de valores de uma coluna da grid.
|
152
|
+
*/
|
153
|
+
async removeCustomValueFormatter(columnName) {
|
154
|
+
this._grid.removeCustomValueFormatter(columnName);
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
158
|
+
*/
|
159
|
+
async setFieldProp(fieldName, propName, value) {
|
160
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
161
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
162
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
163
|
+
this._fieldsProps = newCustomFieldProps;
|
164
|
+
}
|
136
165
|
getButtons(selected, extraButtons) {
|
137
166
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
138
167
|
.concat(extraButtons));
|
@@ -187,9 +216,7 @@ const SnkSimpleCrud = class {
|
|
187
216
|
}
|
188
217
|
}
|
189
218
|
observeDataState(newValue, oldValue) {
|
190
|
-
|
191
|
-
this.dataStateChange.emit(newValue);
|
192
|
-
}
|
219
|
+
this.handleDataStateChange(newValue, oldValue);
|
193
220
|
}
|
194
221
|
async observeFormLegacy(newValue, oldValue) {
|
195
222
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
@@ -197,6 +224,28 @@ const SnkSimpleCrud = class {
|
|
197
224
|
async observeGridLegacy(newValue, oldValue) {
|
198
225
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
199
226
|
}
|
227
|
+
async handleDataStateChange(newValue, oldValue) {
|
228
|
+
if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
|
229
|
+
this.dataStateChange.emit(newValue);
|
230
|
+
}
|
231
|
+
await this.processRmPrecision();
|
232
|
+
}
|
233
|
+
async processRmPrecision() {
|
234
|
+
var _a, _b;
|
235
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
236
|
+
for (const field of fieldsWithRmPrecision || []) {
|
237
|
+
if (!field) {
|
238
|
+
continue;
|
239
|
+
}
|
240
|
+
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
241
|
+
if (!rmPrecision) {
|
242
|
+
continue;
|
243
|
+
}
|
244
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
245
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
246
|
+
}
|
247
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
248
|
+
}
|
200
249
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
201
250
|
if (newValue == undefined || newValue == oldValue) {
|
202
251
|
return;
|
@@ -305,10 +354,16 @@ const SnkSimpleCrud = class {
|
|
305
354
|
this.loadGridConfig();
|
306
355
|
this.loadFormConfig();
|
307
356
|
}
|
357
|
+
componentDidRender() {
|
358
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
359
|
+
this.addGridCustomValueFormattters();
|
360
|
+
this.setFieldsProps();
|
361
|
+
}
|
308
362
|
componentWillLoad() {
|
309
363
|
this.processMetadata();
|
310
364
|
this.onModeChange();
|
311
365
|
this.configDatasource();
|
366
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
312
367
|
}
|
313
368
|
componentDidLoad() {
|
314
369
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
@@ -317,6 +372,17 @@ const SnkSimpleCrud = class {
|
|
317
372
|
this._multiSelectionListDataSource.setApplication(this.application);
|
318
373
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
319
374
|
}
|
375
|
+
setFieldsProps() {
|
376
|
+
if (!this._form) {
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
380
|
+
for (const prop in props) {
|
381
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
382
|
+
}
|
383
|
+
this._fieldsProps.delete(fieldName);
|
384
|
+
}
|
385
|
+
}
|
320
386
|
getTaskBarId() {
|
321
387
|
var _a, _b;
|
322
388
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
@@ -369,12 +435,11 @@ const SnkSimpleCrud = class {
|
|
369
435
|
var _a;
|
370
436
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
371
437
|
}
|
372
|
-
updateConfig() {
|
438
|
+
async updateConfig() {
|
373
439
|
if (this._formConfigManager == undefined) {
|
374
440
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
375
441
|
}
|
376
442
|
this._formConfigManager.setConfig(this.formConfig);
|
377
|
-
return;
|
378
443
|
}
|
379
444
|
processMetadata() {
|
380
445
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
@@ -406,6 +471,23 @@ const SnkSimpleCrud = class {
|
|
406
471
|
};
|
407
472
|
}
|
408
473
|
}
|
474
|
+
addGridCustomValueFormattters() {
|
475
|
+
var _a, _b, _c;
|
476
|
+
const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
|
477
|
+
if (!metadataFields) {
|
478
|
+
return;
|
479
|
+
}
|
480
|
+
const fieldsWithRmPrecision = [];
|
481
|
+
metadataFields.forEach((field) => {
|
482
|
+
var _a;
|
483
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
484
|
+
fieldsWithRmPrecision.push(field.name);
|
485
|
+
}
|
486
|
+
});
|
487
|
+
fieldsWithRmPrecision.forEach(field => {
|
488
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
489
|
+
});
|
490
|
+
}
|
409
491
|
onDataStateChange(evt) {
|
410
492
|
this.dataState = Object.assign({}, evt.detail);
|
411
493
|
}
|
@@ -626,9 +708,9 @@ const SnkSimpleCrud = class {
|
|
626
708
|
if (this.dataUnit == undefined) {
|
627
709
|
return;
|
628
710
|
}
|
629
|
-
return (h("snk-data-unit", { 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 }, 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)
|
711
|
+
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 }, 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)
|
630
712
|
? undefined
|
631
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { 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() }))));
|
713
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: ref => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
632
714
|
}
|
633
715
|
get _element() { return getElement(this); }
|
634
716
|
static get watchers() { return {
|