@sankhyalabs/sankhyablocks 8.16.0-dev.3 → 8.16.0-dev.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-ecc0ed20.js} +3 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-807730a8.js} +39 -6
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-bae64d0d.js} +7 -3
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-f89461c1.js} +46 -18
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-ca89181c.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +37 -28
- package/dist/cjs/snk-crud.cjs.entry.js +14 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +19 -18
- package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-668dc5e8.js} +42 -22
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +12 -13
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +37 -25
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +61 -21
- package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-68777d37.js} +24 -12
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +64 -26
- package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-attach/snk-attach.js +24 -15
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +78 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +51 -6
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +4 -4
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +5 -5
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +57 -20
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +59 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +72 -18
- package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
- package/dist/collection/components/snk-form-config/snk-form-config.js +14 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +68 -8
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +89 -15
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
- package/dist/components/DataFetcher.js +22 -16
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +72 -18
- package/dist/components/SnkMessageBuilder.js +7 -3
- package/dist/components/dataunit-fetcher.js +45 -15
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-attach2.js +33 -24
- package/dist/components/snk-crud.js +12 -1
- package/dist/components/snk-data-exporter2.js +12 -11
- package/dist/components/snk-data-unit2.js +44 -60
- package/dist/components/snk-detail-view2.js +24 -11
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +35 -22
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +15 -4
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +53 -11
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +57 -15
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-1a82a768.js} +40 -8
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-139f09fa.js} +74 -20
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-6fff4a4c.js} +7 -3
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-c24c76c6.js} +46 -16
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-8edaa8cd.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +17 -14
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +37 -28
- package/dist/esm/snk-crud.entry.js +14 -6
- package/dist/esm/snk-data-exporter.entry.js +19 -18
- package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-0fdfb6c2.js} +42 -22
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +12 -13
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +37 -25
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +17 -6
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +56 -16
- package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-b5dd30e6.js} +24 -12
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +60 -22
- package/dist/esm/snk-taskbar.entry.js +23 -1
- package/dist/sankhyablocks/p-0035ad6e.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-3ae9d08a.js +1 -0
- package/dist/sankhyablocks/p-3e3cc017.js +1 -0
- package/dist/sankhyablocks/p-430e4d3c.entry.js +1 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
- package/dist/sankhyablocks/p-50779ad3.entry.js +1 -0
- package/dist/sankhyablocks/p-5dd8cf4f.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/p-694e1c4a.entry.js +1 -0
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/p-7eef0898.entry.js +1 -0
- package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-a42e7a1e.entry.js} +2 -2
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
- package/dist/sankhyablocks/p-b9c67e45.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-d80a84fd.entry.js +1 -0
- package/dist/sankhyablocks/p-d836f72b.entry.js +1 -0
- package/dist/sankhyablocks/p-e16e87fc.entry.js +1 -0
- package/dist/sankhyablocks/p-eb9f0407.entry.js +1 -0
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +13 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +11 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +12 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +14 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -1
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +2 -2
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-3a216b81.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
- package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
- package/dist/sankhyablocks/p-cefba299.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fcac4dfc.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -1,11 +1,13 @@
|
|
1
1
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
2
2
|
import { ObjectUtils, StringUtils } from "@sankhyalabs/core";
|
3
3
|
import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
4
|
+
import { TAB_NAMES } from "../../lib/utils/constants";
|
4
5
|
export class SnkFormConfigManager {
|
5
|
-
constructor(configName, resourceID, onConfigChange) {
|
6
|
+
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
6
7
|
this._resourceID = resourceID;
|
7
8
|
this._configName = configName;
|
8
9
|
this._onConfigChange = onConfigChange;
|
10
|
+
this._dataUnit = dataUnit;
|
9
11
|
}
|
10
12
|
addFormLegacyConfig(legacyConfigName) {
|
11
13
|
if (this._configName) {
|
@@ -16,6 +18,7 @@ export class SnkFormConfigManager {
|
|
16
18
|
return new Promise(resolve => {
|
17
19
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
18
20
|
.then((config) => {
|
21
|
+
config = this.buildFormMetadataUITabs(config);
|
19
22
|
this.setConfig(config);
|
20
23
|
resolve(config);
|
21
24
|
})
|
@@ -24,6 +27,10 @@ export class SnkFormConfigManager {
|
|
24
27
|
});
|
25
28
|
});
|
26
29
|
}
|
30
|
+
getEmptyConfig() {
|
31
|
+
const config = this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
|
32
|
+
return config;
|
33
|
+
}
|
27
34
|
saveConfig(config) {
|
28
35
|
const configToSave = ObjectUtils.copy(config);
|
29
36
|
return new Promise(accept => {
|
@@ -67,27 +74,36 @@ export class SnkFormConfigManager {
|
|
67
74
|
}
|
68
75
|
return updatingCardConfig;
|
69
76
|
}
|
70
|
-
|
77
|
+
hasConfig(config) {
|
78
|
+
var _a;
|
79
|
+
const currentConfig = config !== null && config !== void 0 ? config : this._config;
|
80
|
+
if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
|
81
|
+
return true;
|
82
|
+
}
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
71
86
|
var _a;
|
72
87
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
73
|
-
|
74
|
-
|
88
|
+
const hasConfig = this.hasConfig();
|
89
|
+
if (hasConfig && !forceEmptyConfig) {
|
90
|
+
return fields.map(({ label, name, readOnly, visible, required, tab }) => {
|
91
|
+
var _a;
|
75
92
|
if (label == undefined) {
|
76
|
-
|
77
|
-
|
78
|
-
visible,
|
79
|
-
required });
|
93
|
+
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
94
|
+
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, tab: tab });
|
80
95
|
}
|
81
|
-
return { name, label, readOnly, visible, required };
|
96
|
+
return { name, label, readOnly, visible, required, tab };
|
82
97
|
})
|
83
98
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
84
99
|
}
|
85
|
-
if (
|
86
|
-
return
|
87
|
-
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
88
|
-
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
100
|
+
if (!this._dataUnit) {
|
101
|
+
return [];
|
89
102
|
}
|
90
|
-
|
103
|
+
const filteredFields = this._dataUnit.metadata.fields
|
104
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
105
|
+
.map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
|
106
|
+
return filteredFields;
|
91
107
|
}
|
92
108
|
isFieldVisible(field, descriptionFilter) {
|
93
109
|
if (field.visible === false) {
|
@@ -100,8 +116,8 @@ export class SnkFormConfigManager {
|
|
100
116
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
101
117
|
return normalizedText.includes(normalizedFilter);
|
102
118
|
}
|
103
|
-
|
104
|
-
let fields = this.getFieldsList(
|
119
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
120
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
105
121
|
if (ignoreReadOnlyFormFields) {
|
106
122
|
fields = fields.filter(field => {
|
107
123
|
if (dataUnit) {
|
@@ -132,8 +148,8 @@ export class SnkFormConfigManager {
|
|
132
148
|
this._onConfigChange(Object.assign({}, this._config));
|
133
149
|
}
|
134
150
|
}
|
135
|
-
getConfig(
|
136
|
-
return
|
151
|
+
getConfig(dataUnit, ignoreReadOnlyFormFields) {
|
152
|
+
return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true);
|
137
153
|
}
|
138
154
|
getFormConfigFetcher() {
|
139
155
|
if (this._formConfigFetcher == undefined) {
|
@@ -154,4 +170,42 @@ export class SnkFormConfigManager {
|
|
154
170
|
async fetchDefaultConfig() {
|
155
171
|
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
156
172
|
}
|
173
|
+
parseObjectList(object) {
|
174
|
+
if (!object) {
|
175
|
+
return [];
|
176
|
+
}
|
177
|
+
return Array.isArray(object) ? object : [object];
|
178
|
+
}
|
179
|
+
buildFormMetadataUITabs(config, forceEmptyConfig = false) {
|
180
|
+
var _a;
|
181
|
+
const hasConfig = this.hasConfig(config);
|
182
|
+
if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
|
183
|
+
return config;
|
184
|
+
}
|
185
|
+
config = this.getFormConfig(this._dataUnit, false, true);
|
186
|
+
config.tabs = this.parseObjectList(config.tabs);
|
187
|
+
config.emptyConfig = false;
|
188
|
+
config.defaultConfiguration = true;
|
189
|
+
const fields = this._dataUnit.metadata.fields;
|
190
|
+
for (const currentField of fields) {
|
191
|
+
const field = config.fields.find(field => field.name === currentField.name);
|
192
|
+
const uiTabName = (_a = currentField.properties) === null || _a === void 0 ? void 0 : _a.UITabName;
|
193
|
+
if (!uiTabName || uiTabName === TAB_NAMES.main) {
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
|
197
|
+
if (!haveTab) {
|
198
|
+
config.tabs.push({
|
199
|
+
label: uiTabName,
|
200
|
+
name: uiTabName,
|
201
|
+
order: 0,
|
202
|
+
visible: true,
|
203
|
+
});
|
204
|
+
}
|
205
|
+
if (field) {
|
206
|
+
field.tab = uiTabName;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return config;
|
210
|
+
}
|
157
211
|
}
|
@@ -44,6 +44,11 @@
|
|
44
44
|
background-color: var(--snk-form-config--background-color);
|
45
45
|
}
|
46
46
|
|
47
|
+
div:focus-visible,
|
48
|
+
div:focus {
|
49
|
+
outline: none;
|
50
|
+
}
|
51
|
+
|
47
52
|
.form-config__header-container {
|
48
53
|
/*private*/
|
49
54
|
display: flex;
|
@@ -58,7 +63,7 @@
|
|
58
63
|
.form-config__hide-content {
|
59
64
|
/*private*/
|
60
65
|
display: none;
|
61
|
-
}
|
66
|
+
}
|
62
67
|
|
63
68
|
ez-icon .left-icon {
|
64
69
|
/*public*/
|
@@ -229,9 +234,9 @@ ez-collapsible-box{
|
|
229
234
|
/*private*/
|
230
235
|
left: calc(100% / 1 * -1);
|
231
236
|
}
|
232
|
-
|
237
|
+
|
233
238
|
.form-config__field-config--selected:nth-child(3n+3) .ez-flex.form-config__config-options {
|
234
239
|
/*private*/
|
235
240
|
left: calc(100% / 1 * -2);
|
236
241
|
}
|
237
|
-
}
|
242
|
+
}
|
@@ -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
|
}
|
@@ -193,6 +193,11 @@ export class SnkFormConfig {
|
|
193
193
|
this.configManager.saveConfig(this.buildConfigToSave())
|
194
194
|
.then(savedConfig => {
|
195
195
|
ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
196
|
+
const userOption = this._formConfigOptions
|
197
|
+
.find((config) => {
|
198
|
+
return config.origin === UserConfigType.USER;
|
199
|
+
});
|
200
|
+
this.setFormConfig(userOption);
|
196
201
|
this.configChange.emit(savedConfig);
|
197
202
|
});
|
198
203
|
}
|
@@ -529,9 +534,12 @@ export class SnkFormConfig {
|
|
529
534
|
switch (this._optionFormConfigSelected.origin) {
|
530
535
|
case UserConfigType.DEFAULT:
|
531
536
|
config = await this.configManager.fetchDefaultConfig();
|
537
|
+
if (!config) {
|
538
|
+
config = this.configManager.getEmptyConfig();
|
539
|
+
}
|
532
540
|
break;
|
533
|
-
|
534
|
-
config =
|
541
|
+
default:
|
542
|
+
config = this.getConfig();
|
535
543
|
break;
|
536
544
|
}
|
537
545
|
if (config != undefined) {
|
@@ -734,6 +742,9 @@ export class SnkFormConfig {
|
|
734
742
|
if (layoutFormConfig == undefined) {
|
735
743
|
layoutFormConfig = [];
|
736
744
|
}
|
745
|
+
if (this._formConfig.defaultConfiguration) {
|
746
|
+
return layoutFormConfig;
|
747
|
+
}
|
737
748
|
return this._formConfig.tabs.map((tab) => {
|
738
749
|
return layoutFormConfig.find(config => { var _a, _b; return ((_a = tab.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = config.tab) === null || _b === void 0 ? void 0 : _b.toLowerCase()); })
|
739
750
|
|| { tab: tab.label, groups: [], visible: tab.visible };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { h, Fragment } from '@stencil/core';
|
1
|
+
import { h, Fragment, } from '@stencil/core';
|
2
2
|
import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
@@ -11,6 +11,7 @@ import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/
|
|
11
11
|
import { CrudUtils } from '../../lib';
|
12
12
|
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
13
13
|
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
14
|
+
import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
|
14
15
|
export class SnkGrid {
|
15
16
|
constructor() {
|
16
17
|
this._customEditors = new Map();
|
@@ -19,7 +20,7 @@ export class SnkGrid {
|
|
19
20
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
20
21
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
21
22
|
"snkGridTopTaskbar.regular.singleTaskbar": [],
|
22
|
-
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
|
23
|
+
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()],
|
23
24
|
"snkGridTopTaskbar.finish_edition.secondary": [],
|
24
25
|
"snkGridTopTaskbar.finish_edition.singleTaskbar": [],
|
25
26
|
});
|
@@ -32,7 +33,7 @@ export class SnkGrid {
|
|
32
33
|
"snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
33
34
|
"snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
|
34
35
|
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
35
|
-
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
36
|
+
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE", this.handleAddFormMode()]
|
36
37
|
});
|
37
38
|
this.dataUnitInterceptor = {
|
38
39
|
interceptAction: async (action) => {
|
@@ -47,6 +48,7 @@ export class SnkGrid {
|
|
47
48
|
this._gridConfig = undefined;
|
48
49
|
this._popUpGridConfig = false;
|
49
50
|
this._showSnkFilterBar = true;
|
51
|
+
this._enableContinuousInsert = false;
|
50
52
|
this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
|
51
53
|
this.configName = undefined;
|
52
54
|
this.filterBarTitle = undefined;
|
@@ -70,6 +72,7 @@ export class SnkGrid {
|
|
70
72
|
this.filterBarLegacyConfigName = undefined;
|
71
73
|
this.autoLoad = undefined;
|
72
74
|
this.autoFocus = true;
|
75
|
+
this.enableGridInsert = false;
|
73
76
|
}
|
74
77
|
/**
|
75
78
|
* Exibe a janela de configurações da grade.
|
@@ -156,6 +159,16 @@ export class SnkGrid {
|
|
156
159
|
async setFocus() {
|
157
160
|
this._grid.setFocus();
|
158
161
|
}
|
162
|
+
async handleClick(event) {
|
163
|
+
if (this.hasToBlockEvent(event)) {
|
164
|
+
event.preventDefault();
|
165
|
+
event.stopPropagation();
|
166
|
+
await this._dataUnit.cancelEdition();
|
167
|
+
}
|
168
|
+
}
|
169
|
+
hasToBlockEvent(event) {
|
170
|
+
return this._snkFilterBar.contains(event.target) && this.enableGridInsert && this._dataUnit.hasNewRecord();
|
171
|
+
}
|
159
172
|
async handleGridLegacyConfigName(newLegacyConfig, oldLegacyConfig) {
|
160
173
|
if (!newLegacyConfig) {
|
161
174
|
return;
|
@@ -166,6 +179,9 @@ export class SnkGrid {
|
|
166
179
|
this.addGridLegacyConfigName();
|
167
180
|
this.loadConfig();
|
168
181
|
}
|
182
|
+
handleAddFormMode() {
|
183
|
+
return this.enableGridInsert ? TaskbarElement.FORM_MODE : "";
|
184
|
+
}
|
169
185
|
openGridConfig() {
|
170
186
|
this._grid.getColumnsState()
|
171
187
|
.then((gridColumns) => {
|
@@ -290,13 +306,21 @@ export class SnkGrid {
|
|
290
306
|
}
|
291
307
|
parent = parent.parentElement;
|
292
308
|
}
|
309
|
+
if (this._snkFilterBar) {
|
310
|
+
this._snkFilterBar.addEventListener('click', this.handleClick);
|
311
|
+
}
|
293
312
|
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
294
313
|
this.addGridLegacyConfigName();
|
295
314
|
this.loadConfig();
|
315
|
+
this._continuousInsertUtils = new ContinuousInsertUtils(this._application, this.resourceID, this.configName);
|
316
|
+
if (this.enableGridInsert) {
|
317
|
+
this._continuousInsertUtils.getConfig().then(value => this._enableContinuousInsert = value);
|
318
|
+
}
|
296
319
|
}
|
297
320
|
componentDidRender() {
|
321
|
+
var _a, _b;
|
298
322
|
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
299
|
-
this.loadGridCustomFormatters(this._dataUnit.metadata.fields);
|
323
|
+
this.loadGridCustomFormatters((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields);
|
300
324
|
this.setCustomRenders();
|
301
325
|
this.setCustomEditors();
|
302
326
|
}
|
@@ -309,7 +333,7 @@ export class SnkGrid {
|
|
309
333
|
const disabledButtons = [];
|
310
334
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
|
311
335
|
if (this._dataState.selectionInfo.length > 1) {
|
312
|
-
disabledButtons.push(TaskbarElement.CLONE, "ATTACH");
|
336
|
+
disabledButtons.push(TaskbarElement.CLONE, "ATTACH", TaskbarElement.UPDATE);
|
313
337
|
}
|
314
338
|
if (this._dataState.selectionInfo.isAllRecords()) {
|
315
339
|
disabledButtons.push("REMOVE");
|
@@ -394,12 +418,21 @@ export class SnkGrid {
|
|
394
418
|
eagerInitialize: true,
|
395
419
|
itemBuilder: (actionButton, item) => this.getColumnSearch(actionButton, item)
|
396
420
|
}];
|
421
|
+
if (this.enableGridInsert) {
|
422
|
+
hardList.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert, this.handleEnableContinuousInsert));
|
423
|
+
}
|
424
|
+
if (this.isGridInsertActive())
|
425
|
+
return hardList;
|
397
426
|
if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
|
398
427
|
const taskbarID = this.getTopTaskBarId();
|
399
428
|
return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this._dataState, this.actionsList));
|
400
429
|
}
|
401
430
|
return hardList.concat(this.actionsList);
|
402
431
|
}
|
432
|
+
handleEnableContinuousInsert() {
|
433
|
+
this._enableContinuousInsert = !this._enableContinuousInsert;
|
434
|
+
this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert);
|
435
|
+
}
|
403
436
|
handleFilterConfigUpdated(filterConfig) {
|
404
437
|
if (!filterConfig.length) {
|
405
438
|
this._showSnkFilterBar = false;
|
@@ -411,12 +444,20 @@ export class SnkGrid {
|
|
411
444
|
}
|
412
445
|
this._showSnkFilterBar = true;
|
413
446
|
}
|
447
|
+
getGridHeaderButtons() {
|
448
|
+
if (this.isGridInsertActive())
|
449
|
+
return TaskbarElement.MORE_OPTIONS;
|
450
|
+
return this._headerTaskbarProcessor.buttons;
|
451
|
+
}
|
452
|
+
isGridInsertActive() {
|
453
|
+
return this.enableGridInsert && this._dataUnit.hasNewRecord();
|
454
|
+
}
|
414
455
|
render() {
|
415
456
|
if (!this._dataUnit) {
|
416
457
|
return undefined;
|
417
458
|
}
|
418
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--
|
419
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.
|
459
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
|
460
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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.resourceID }))));
|
420
461
|
}
|
421
462
|
static get is() { return "snk-grid"; }
|
422
463
|
static get encapsulation() { return "scoped"; }
|
@@ -862,6 +903,24 @@ export class SnkGrid {
|
|
862
903
|
"attribute": "auto-focus",
|
863
904
|
"reflect": false,
|
864
905
|
"defaultValue": "true"
|
906
|
+
},
|
907
|
+
"enableGridInsert": {
|
908
|
+
"type": "boolean",
|
909
|
+
"mutable": false,
|
910
|
+
"complexType": {
|
911
|
+
"original": "boolean",
|
912
|
+
"resolved": "boolean",
|
913
|
+
"references": {}
|
914
|
+
},
|
915
|
+
"required": false,
|
916
|
+
"optional": true,
|
917
|
+
"docs": {
|
918
|
+
"tags": [],
|
919
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
920
|
+
},
|
921
|
+
"attribute": "enable-grid-insert",
|
922
|
+
"reflect": false,
|
923
|
+
"defaultValue": "false"
|
865
924
|
}
|
866
925
|
};
|
867
926
|
}
|
@@ -871,7 +930,8 @@ export class SnkGrid {
|
|
871
930
|
"_dataState": {},
|
872
931
|
"_gridConfig": {},
|
873
932
|
"_popUpGridConfig": {},
|
874
|
-
"_showSnkFilterBar": {}
|
933
|
+
"_showSnkFilterBar": {},
|
934
|
+
"_enableContinuousInsert": {}
|
875
935
|
};
|
876
936
|
}
|
877
937
|
static get events() {
|
@@ -26,7 +26,7 @@ export class SnkSimpleBar {
|
|
26
26
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
27
27
|
}
|
28
28
|
render() {
|
29
|
-
return (h("div", { class: "simple-bar__container ez-margin-vertical--
|
29
|
+
return (h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
30
30
|
}
|
31
31
|
static get is() { return "snk-simple-bar"; }
|
32
32
|
static get encapsulation() { return "scoped"; }
|