@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-71601.0 → 0.0.0-bugfix-dev-KB-72026.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-e49214c6.js → ConfigStorage-ecc0ed20.js} +2 -2
- package/dist/cjs/{DataFetcher-77729a93.js → DataFetcher-cadeef8e.js} +21 -20
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{IExporterProvider-a6e2acaa.js → IExporterProvider-9ac15aaf.js} +4 -4
- package/dist/cjs/{SnkFormConfigManager-beebf47a.js → SnkFormConfigManager-f1c92f79.js} +72 -16
- package/dist/cjs/{auth-fetcher-29bb791c.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-4c0d1485.js → dataunit-fetcher-4b12f70c.js} +12 -26
- package/dist/cjs/{form-config-fetcher-feb08214.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-a1d0353f.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 +6 -6
- package/dist/cjs/snk-attach.cjs.entry.js +6 -12
- package/dist/cjs/snk-crud.cjs.entry.js +5 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-054841d2.js → snk-data-unit-2f2e6f8c.js} +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
- package/dist/cjs/snk-filter-bar.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +15 -4
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +8 -8
- package/dist/cjs/{snk-guides-viewer-58907f8d.js → snk-guides-viewer-866447ab.js} +10 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -10
- 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/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -8
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +5 -2
- 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-unit/snk-data-unit.js +2 -2
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +70 -14
- package/dist/collection/components/snk-form-config/snk-form-config.js +13 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +1 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +3 -17
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +9 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +21 -20
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/components/DataFetcher.js +21 -20
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +70 -14
- package/dist/components/dataunit-fetcher.js +11 -25
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-attach2.js +1 -7
- package/dist/components/snk-data-unit2.js +4 -41
- package/dist/components/snk-detail-view2.js +7 -4
- package/dist/components/snk-form-config2.js +13 -2
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +2 -2
- package/dist/components/snk-simple-crud2.js +4 -3
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-e476378d.js → ConfigStorage-7b36d041.js} +2 -2
- package/dist/esm/{DataFetcher-773a3e4b.js → DataFetcher-a9c598f2.js} +21 -20
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{IExporterProvider-66c83d70.js → IExporterProvider-09df2e3e.js} +4 -4
- package/dist/esm/{SnkFormConfigManager-298cd647.js → SnkFormConfigManager-139f09fa.js} +72 -16
- package/dist/esm/{auth-fetcher-a411f73c.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{dataunit-fetcher-1c1cdd90.js → dataunit-fetcher-3aac1a53.js} +12 -26
- package/dist/esm/{form-config-fetcher-e0382e5a.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-a87445a0.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 +6 -6
- package/dist/esm/snk-attach.entry.js +6 -12
- package/dist/esm/snk-crud.entry.js +5 -5
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-a0a8b82a.js → snk-data-unit-acf3dd64.js} +3 -3
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-filter-bar.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +15 -4
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +8 -8
- package/dist/esm/{snk-guides-viewer-5fe10c89.js → snk-guides-viewer-cb8a0b48.js} +10 -7
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +10 -10
- package/dist/esm/snk-taskbar.entry.js +23 -1
- package/dist/sankhyablocks/{p-181975f1.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/{p-b6f1135c.entry.js → p-0e9a872d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7a0d7901.entry.js → p-16969508.entry.js} +1 -1
- package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-c0b3a683.js → p-1ab19772.js} +1 -1
- package/dist/sankhyablocks/{p-25f1fc39.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-8c8ad7b9.entry.js → p-1f47a0b2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9dfda04a.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-3757394b.entry.js +1 -0
- package/dist/sankhyablocks/p-3d542b58.entry.js +1 -0
- package/dist/sankhyablocks/{p-3287a6cc.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/p-53c1d25d.entry.js +1 -0
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/{p-9c5e0d8a.entry.js → p-640140b3.entry.js} +2 -2
- package/dist/sankhyablocks/p-73185e58.entry.js +1 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-42bd6a34.entry.js → p-8862ba4a.entry.js} +1 -1
- package/dist/sankhyablocks/p-8d7e2747.entry.js +1 -0
- package/dist/sankhyablocks/{p-1b64a684.js → p-a31e761f.js} +1 -1
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/{p-5b26cc7c.entry.js → p-b2caaaf9.entry.js} +1 -1
- package/dist/sankhyablocks/p-bc4b94d2.entry.js +1 -0
- package/dist/sankhyablocks/{p-0cd3c0a9.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-ce6eed2c.js +1 -0
- package/dist/sankhyablocks/{p-594bc21d.js → p-f3434fc4.js} +1 -1
- package/dist/sankhyablocks/p-f8698ad3.js +60 -0
- package/dist/sankhyablocks/{p-bd008859.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-crud/subcomponents/snk-guides-viewer.d.ts +1 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +1 -6
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-2e9c764c.entry.js +0 -1
- package/dist/sankhyablocks/p-449df4bf.entry.js +0 -1
- package/dist/sankhyablocks/p-5f016aed.js +0 -1
- package/dist/sankhyablocks/p-67525bf6.entry.js +0 -1
- package/dist/sankhyablocks/p-812e5d2e.entry.js +0 -1
- package/dist/sankhyablocks/p-939e15d3.entry.js +0 -1
- package/dist/sankhyablocks/p-959fdc87.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-a4c04730.js +0 -60
- package/dist/sankhyablocks/p-e6ab759c.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fb5798b4.entry.js +0 -1
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
|
@@ -9,6 +9,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
|
9
9
|
import './dataunit-fetcher.js';
|
|
10
10
|
import './filter-item-type.enum.js';
|
|
11
11
|
import './form-config-fetcher.js';
|
|
12
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
12
13
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
|
13
14
|
|
|
14
15
|
const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
|
|
@@ -161,7 +162,6 @@ var RefreshType;
|
|
|
161
162
|
|
|
162
163
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
|
163
164
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
|
164
|
-
const NUFIN_COLUMN = 'NUFIN';
|
|
165
165
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
|
166
166
|
class Actions {
|
|
167
167
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
|
@@ -173,6 +173,10 @@ class Actions {
|
|
|
173
173
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
174
174
|
this._appResourceId = appResourceId;
|
|
175
175
|
}
|
|
176
|
+
getPrimaryKeys() {
|
|
177
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
|
178
|
+
return ids.map(({ name }) => name);
|
|
179
|
+
}
|
|
176
180
|
apply(action, hasParamsToSave) {
|
|
177
181
|
this._application.closePopUp();
|
|
178
182
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
|
@@ -441,6 +445,7 @@ class Actions {
|
|
|
441
445
|
executeAction(execSource);
|
|
442
446
|
}
|
|
443
447
|
addRows(execSource) {
|
|
448
|
+
const primaryKeys = this.getPrimaryKeys();
|
|
444
449
|
const rows = {
|
|
445
450
|
row: []
|
|
446
451
|
};
|
|
@@ -454,15 +459,13 @@ class Actions {
|
|
|
454
459
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
|
455
460
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
|
456
461
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
row.field = [];
|
|
462
|
-
}
|
|
462
|
+
if (!row.field) {
|
|
463
|
+
row.field = [];
|
|
464
|
+
}
|
|
465
|
+
for (const primaryKey of primaryKeys) {
|
|
463
466
|
row.field.push({
|
|
464
|
-
fieldName:
|
|
465
|
-
$: sourceRow[
|
|
467
|
+
fieldName: primaryKey,
|
|
468
|
+
$: sourceRow[primaryKey]
|
|
466
469
|
});
|
|
467
470
|
}
|
|
468
471
|
rows.row.push(row);
|
|
@@ -468,13 +468,7 @@ class AttachFetcherDataUnitFactory {
|
|
|
468
468
|
}
|
|
469
469
|
let records = applyFilter(this._records, dataUnit, request.filters);
|
|
470
470
|
records = applySorting(records, dataUnit, request.sort);
|
|
471
|
-
|
|
472
|
-
const paginationInfoBuilderParams = {
|
|
473
|
-
recordsLength: records.length,
|
|
474
|
-
offset: request.offset,
|
|
475
|
-
recordsPerPage: request.limit
|
|
476
|
-
};
|
|
477
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(paginationInfoBuilderParams) });
|
|
471
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
|
478
472
|
}
|
|
479
473
|
saveLoader(changes, fetcher) {
|
|
480
474
|
return new Promise((resolve) => {
|
|
@@ -1,47 +1,10 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
|
5
5
|
import { g as getRecordValue, d as DatasetStrategy } from './dataunit-fetcher.js';
|
|
6
6
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
7
|
-
|
|
8
|
-
const getSelectedIDs = (dataUnit) => {
|
|
9
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
|
10
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const selectedRecordsIDsInfo = [];
|
|
14
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
|
15
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
16
|
-
selectedRecords.forEach(recordId => {
|
|
17
|
-
if (!dataUnit.isNewRecord(recordId)) {
|
|
18
|
-
/*
|
|
19
|
-
Esse if foi necessário para tratar corretamente o ID
|
|
20
|
-
do record quando está sendo utilizado no modo standAlone
|
|
21
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
|
22
|
-
mas deixa de causar erro nas oprações de CRUD.
|
|
23
|
-
*/
|
|
24
|
-
if (!JSUtils.isBase64(recordId)) {
|
|
25
|
-
selectedRecordsIDsInfo.push({
|
|
26
|
-
name: "__record__id__",
|
|
27
|
-
type: DataType.TEXT,
|
|
28
|
-
value: recordId
|
|
29
|
-
});
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
|
33
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
34
|
-
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
|
35
|
-
if (metadataField == undefined) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return selectedRecordsIDsInfo;
|
|
44
|
-
};
|
|
7
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
45
8
|
|
|
46
9
|
const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
47
10
|
constructor() {
|
|
@@ -153,7 +116,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
116
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
|
154
117
|
*/
|
|
155
118
|
async getSelectedRecordsIDsInfo() {
|
|
156
|
-
return
|
|
119
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
|
157
120
|
}
|
|
158
121
|
/**
|
|
159
122
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
|
@@ -757,4 +720,4 @@ function defineCustomElement() {
|
|
|
757
720
|
} });
|
|
758
721
|
}
|
|
759
722
|
|
|
760
|
-
export { SnkDataUnit as S, defineCustomElement as d
|
|
723
|
+
export { SnkDataUnit as S, defineCustomElement as d };
|
|
@@ -404,11 +404,14 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
404
404
|
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
+
setMasterFormConfig(config) {
|
|
408
|
+
this.masterFormConfig = config;
|
|
409
|
+
}
|
|
407
410
|
componentWillLoad() {
|
|
408
411
|
if (this.resourceID == undefined) {
|
|
409
412
|
throw new Error("Erro interno: resourceID não informado");
|
|
410
413
|
}
|
|
411
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID,
|
|
414
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
|
|
412
415
|
this.addFormLegacyConfigName();
|
|
413
416
|
this._configManager.loadConfig();
|
|
414
417
|
}
|
|
@@ -436,7 +439,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
436
439
|
return this._fieldSearch;
|
|
437
440
|
}
|
|
438
441
|
fieldsOptionLoader(argument) {
|
|
439
|
-
return Promise.resolve(this._configManager.getFieldsList(
|
|
442
|
+
return Promise.resolve(this._configManager.getFieldsList(argument)
|
|
440
443
|
.map(field => ({ value: field.name, label: field.label })));
|
|
441
444
|
}
|
|
442
445
|
onSelectField(option, actionButton) {
|
|
@@ -984,7 +987,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
984
987
|
this.emitSwitchEvent(VIEW_MODE.GRID);
|
|
985
988
|
evt.stopPropagation();
|
|
986
989
|
}
|
|
987
|
-
if (evt.detail === TaskbarElement.FORM_MODE) {
|
|
990
|
+
if (evt.detail === TaskbarElement.FORM_MODE || evt.detail === TaskbarElement.UPDATE) {
|
|
988
991
|
this.emitSwitchEvent(VIEW_MODE.FORM);
|
|
989
992
|
evt.stopPropagation();
|
|
990
993
|
}
|
|
@@ -1008,7 +1011,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
1008
1011
|
}
|
|
1009
1012
|
componentWillLoad() {
|
|
1010
1013
|
this._configName = `dynaform.${this.entityName}`;
|
|
1011
|
-
this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
|
|
1014
|
+
this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata(), this.dataUnit);
|
|
1012
1015
|
this.formConfigManager.loadConfig();
|
|
1013
1016
|
if (this.messagesBuilder == undefined) {
|
|
1014
1017
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
|
@@ -202,6 +202,11 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
202
202
|
this.configManager.saveConfig(this.buildConfigToSave())
|
|
203
203
|
.then(savedConfig => {
|
|
204
204
|
ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
|
205
|
+
const userOption = this._formConfigOptions
|
|
206
|
+
.find((config) => {
|
|
207
|
+
return config.origin === UserConfigType.USER;
|
|
208
|
+
});
|
|
209
|
+
this.setFormConfig(userOption);
|
|
205
210
|
this.configChange.emit(savedConfig);
|
|
206
211
|
});
|
|
207
212
|
}
|
|
@@ -535,9 +540,12 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
535
540
|
switch (this._optionFormConfigSelected.origin) {
|
|
536
541
|
case UserConfigType.DEFAULT:
|
|
537
542
|
config = await this.configManager.fetchDefaultConfig();
|
|
543
|
+
if (!config) {
|
|
544
|
+
config = this.configManager.getEmptyConfig();
|
|
545
|
+
}
|
|
538
546
|
break;
|
|
539
|
-
|
|
540
|
-
config =
|
|
547
|
+
default:
|
|
548
|
+
config = this.getConfig();
|
|
541
549
|
break;
|
|
542
550
|
}
|
|
543
551
|
if (config != undefined) {
|
|
@@ -740,6 +748,9 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
740
748
|
if (layoutFormConfig == undefined) {
|
|
741
749
|
layoutFormConfig = [];
|
|
742
750
|
}
|
|
751
|
+
if (this._formConfig.defaultConfiguration) {
|
|
752
|
+
return layoutFormConfig;
|
|
753
|
+
}
|
|
743
754
|
return this._formConfig.tabs.map((tab) => {
|
|
744
755
|
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()); })
|
|
745
756
|
|| { tab: tab.label, groups: [], visible: tab.visible };
|
|
@@ -99,7 +99,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
99
99
|
if (this.resourceID == undefined) {
|
|
100
100
|
this.resourceID = await ResourceIDUtils.getResourceID();
|
|
101
101
|
}
|
|
102
|
-
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
|
102
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, undefined, this._dataUnit);
|
|
103
103
|
this.addFormLegacyConfig();
|
|
104
104
|
await this._configManager.loadConfig();
|
|
105
105
|
}
|
|
@@ -128,7 +128,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
128
|
if (!this._dataUnit || !this._dataState) {
|
|
129
129
|
return undefined;
|
|
130
130
|
}
|
|
131
|
-
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.
|
|
131
|
+
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._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
132
132
|
h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
|
133
133
|
}
|
|
134
134
|
get _element() { return this; }
|
|
@@ -13,7 +13,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
|
13
13
|
import './dataunit-fetcher.js';
|
|
14
14
|
import './filter-item-type.enum.js';
|
|
15
15
|
import './form-config-fetcher.js';
|
|
16
|
-
import { g as
|
|
16
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
17
17
|
import { d as defineCustomElement$i } from './snk-actions-button2.js';
|
|
18
18
|
import { d as defineCustomElement$h } from './snk-data-exporter2.js';
|
|
19
19
|
import { d as defineCustomElement$g } from './snk-exporter-email-sender2.js';
|
|
@@ -54,7 +54,7 @@ class ServerSideExporterProvider extends CommonsExporter {
|
|
|
54
54
|
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
55
55
|
}
|
|
56
56
|
getSelectedIDs() {
|
|
57
|
-
return
|
|
57
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
|
58
58
|
}
|
|
59
59
|
getOffset() {
|
|
60
60
|
return this.getExporterOffset(this.getPaginationInfo());
|
|
@@ -14,12 +14,13 @@ import './filter-item-type.enum.js';
|
|
|
14
14
|
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
|
15
15
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
16
16
|
import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
|
|
17
|
-
import { g as
|
|
17
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
|
18
18
|
import { s as store } from './index2.js';
|
|
19
19
|
import { d as defineCustomElement$d } from './snk-actions-button2.js';
|
|
20
20
|
import { d as defineCustomElement$c } from './snk-config-options2.js';
|
|
21
21
|
import { d as defineCustomElement$b } from './snk-configurator2.js';
|
|
22
22
|
import { d as defineCustomElement$a } from './snk-data-exporter2.js';
|
|
23
|
+
import { d as defineCustomElement$9 } from './snk-data-unit2.js';
|
|
23
24
|
import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
|
|
24
25
|
import { d as defineCustomElement$7 } from './snk-field-config2.js';
|
|
25
26
|
import { d as defineCustomElement$6 } from './snk-form-config2.js';
|
|
@@ -41,7 +42,7 @@ class ClientSideExporterProvider extends CommonsExporter {
|
|
|
41
42
|
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
42
43
|
}
|
|
43
44
|
getSelectedIDs() {
|
|
44
|
-
return
|
|
45
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
|
45
46
|
}
|
|
46
47
|
getRecordID() {
|
|
47
48
|
var _a, _b, _c;
|
|
@@ -360,7 +361,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
360
361
|
return;
|
|
361
362
|
}
|
|
362
363
|
if (this._formConfigManager == undefined) {
|
|
363
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
364
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
|
|
364
365
|
this._formConfigManager.setConfig(this.formConfig);
|
|
365
366
|
}
|
|
366
367
|
if (this.formConfigIsLoaded() && !forceLoad) {
|
|
@@ -128,6 +128,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
128
|
super();
|
|
129
129
|
this.__registerHost();
|
|
130
130
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
131
|
+
this.taskbarSaveLocker = createEvent(this, "taskbarSaveLocker", 7);
|
|
132
|
+
this.taskbarSaveUnlocker = createEvent(this, "taskbarSaveUnlocker", 7);
|
|
131
133
|
this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
|
|
132
134
|
this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME = 'taskbar-custom-elements-container';
|
|
133
135
|
this.ACTIONS_BUTTON_TAG = 'TASKBAR-ACTIONS-BUTTON';
|
|
@@ -151,6 +153,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
151
153
|
this.onSaveEvent = (action) => {
|
|
152
154
|
switch (action.type) {
|
|
153
155
|
case Action.FIELD_INVALIDATED:
|
|
156
|
+
case Action.INVALIDATE_CLEAN:
|
|
154
157
|
case Action.DATA_SAVED:
|
|
155
158
|
case Action.SAVING_ERROR:
|
|
156
159
|
this._isWaitingForSave = false;
|
|
@@ -189,6 +192,16 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
189
192
|
this.getCustomElements(true);
|
|
190
193
|
}
|
|
191
194
|
}
|
|
195
|
+
handleTaskbarSaveLocker() {
|
|
196
|
+
if (this._isWaitingForSave !== true) {
|
|
197
|
+
this._isWaitingForSave = true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
handleTaskbarSaveUnlocker() {
|
|
201
|
+
if (this._isWaitingForSave === true) {
|
|
202
|
+
this._isWaitingForSave = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
192
205
|
hasToSearchCustomElements(event) {
|
|
193
206
|
return this.customSlotId === event.detail && !this._slotContainer;
|
|
194
207
|
}
|
|
@@ -207,6 +220,14 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
207
220
|
this._hasToUpdateOverFlow = true;
|
|
208
221
|
}
|
|
209
222
|
}
|
|
223
|
+
observeIsWaitingForSave(newValue, oldValue) {
|
|
224
|
+
if (newValue == true && oldValue == false) {
|
|
225
|
+
this.taskbarSaveLocker.emit();
|
|
226
|
+
}
|
|
227
|
+
if (newValue == false && oldValue == true) {
|
|
228
|
+
this.taskbarSaveUnlocker.emit();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
210
231
|
// Internal methods
|
|
211
232
|
elementsFromString(strButtons) {
|
|
212
233
|
const elements = [];
|
|
@@ -535,7 +556,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
535
556
|
static get watchers() { return {
|
|
536
557
|
"buttons": ["observeButtons"],
|
|
537
558
|
"disabledButtons": ["observeDisabledButtons"],
|
|
538
|
-
"_lastWidth": ["observeLastWidth"]
|
|
559
|
+
"_lastWidth": ["observeLastWidth"],
|
|
560
|
+
"_isWaitingForSave": ["observeIsWaitingForSave"]
|
|
539
561
|
}; }
|
|
540
562
|
static get style() { return snkTaskbarCss; }
|
|
541
563
|
}, [6, "snk-taskbar", {
|
|
@@ -562,7 +584,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
562
584
|
"_lastWidth": [32],
|
|
563
585
|
"_hasToUpdateOverFlow": [32],
|
|
564
586
|
"_isWaitingForSave": [32]
|
|
565
|
-
}, [[8, "snkCustomSlotElementsLoaded", "handleCustomSlotElementsLoaded"]]]);
|
|
587
|
+
}, [[8, "snkCustomSlotElementsLoaded", "handleCustomSlotElementsLoaded"], [8, "taskbarSaveLocker", "handleTaskbarSaveLocker"], [8, "taskbarSaveUnlocker", "handleTaskbarSaveUnlocker"]]]);
|
|
566
588
|
function defineCustomElement() {
|
|
567
589
|
if (typeof customElements === "undefined") {
|
|
568
590
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-adbe5d34.js';
|
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
|
4
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-a9c598f2.js';
|
|
5
5
|
|
|
6
6
|
class GridConfigFetcher extends ResourceFetcher {
|
|
7
7
|
constructor() {
|
|
@@ -6863,6 +6863,7 @@ class DataFetcher {
|
|
|
6863
6863
|
}
|
|
6864
6864
|
}
|
|
6865
6865
|
async executePendingRequest(watingRequestsById) {
|
|
6866
|
+
var _a, _b;
|
|
6866
6867
|
const requestsBatch = [];
|
|
6867
6868
|
let quietMode = true;
|
|
6868
6869
|
watingRequestsById.forEach((waitingReq) => {
|
|
@@ -6873,36 +6874,36 @@ class DataFetcher {
|
|
|
6873
6874
|
const response = await this.fecthGraphQL(requestsBatch, quietMode);
|
|
6874
6875
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
|
6875
6876
|
//Reject promises with errors from query
|
|
6876
|
-
|
|
6877
|
-
Object.
|
|
6878
|
-
|
|
6877
|
+
for (const errorResponse of errorsResponse) {
|
|
6878
|
+
const values = Object.values(errorResponse);
|
|
6879
|
+
for (const value of values) {
|
|
6880
|
+
const waitingRequest = watingRequestsById.get(value.request.variables[value.index].queryID);
|
|
6879
6881
|
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
|
6880
|
-
Promise.race([
|
|
6882
|
+
const data = await Promise.race([
|
|
6881
6883
|
waitingRequest.promise,
|
|
6882
6884
|
new Promise((resolve) => {
|
|
6883
6885
|
resolve(false);
|
|
6884
6886
|
})
|
|
6885
|
-
])
|
|
6886
|
-
|
|
6887
|
-
if (
|
|
6888
|
-
|
|
6889
|
-
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", val.message));
|
|
6890
|
-
}
|
|
6891
|
-
else {
|
|
6892
|
-
(((_b = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
|
6893
|
-
}
|
|
6887
|
+
]);
|
|
6888
|
+
if (!hasClientEvent || data === false) {
|
|
6889
|
+
if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
|
|
6890
|
+
(((_a = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", value.message));
|
|
6894
6891
|
}
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6892
|
+
else {
|
|
6893
|
+
(((_b = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", value.message));
|
|
6894
|
+
}
|
|
6895
|
+
}
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6898
6898
|
//Resolve promises with data from query
|
|
6899
|
-
|
|
6900
|
-
Object.entries(data)
|
|
6899
|
+
for (const data of dataResponse) {
|
|
6900
|
+
const entries = Object.entries(data);
|
|
6901
|
+
for (const [key, val] of entries) {
|
|
6901
6902
|
const waitingRequest = watingRequestsById.get(key);
|
|
6902
6903
|
await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
|
6903
6904
|
((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
|
|
6904
|
-
}
|
|
6905
|
-
}
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6906
6907
|
}
|
|
6907
6908
|
buildGraphQlURL(quietMode) {
|
|
6908
6909
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { JSUtils, DataType } from '@sankhyalabs/core';
|
|
2
|
+
|
|
3
|
+
function getSelectedRecordsIDsInfo(dataUnit) {
|
|
4
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
|
5
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
const selectedRecordsIDsInfo = [];
|
|
9
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
|
10
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
11
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
|
12
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
|
13
|
+
/*
|
|
14
|
+
Esse if foi necessário para tratar corretamente o ID
|
|
15
|
+
do record quando está sendo utilizado no modo standAlone
|
|
16
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
|
17
|
+
mas deixa de causar erro nas oprações de CRUD.
|
|
18
|
+
*/
|
|
19
|
+
if (!JSUtils.isBase64(__record__id__)) {
|
|
20
|
+
selectedRecordsIDsInfo.push({
|
|
21
|
+
name: "__record__id__",
|
|
22
|
+
type: DataType.TEXT,
|
|
23
|
+
value: __record__id__
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
28
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
29
|
+
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
|
30
|
+
if (metadataField == undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return selectedRecordsIDsInfo;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { getSelectedRecordsIDsInfo as g };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { D as DataFetcher } from './DataFetcher-
|
|
2
|
-
import './pesquisa-fetcher-
|
|
1
|
+
import { D as DataFetcher } from './DataFetcher-a9c598f2.js';
|
|
2
|
+
import './pesquisa-fetcher-8edaa8cd.js';
|
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
4
4
|
import './index-3aa4977a.js';
|
|
5
5
|
import './ISave-d8c8bc59.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
|
8
|
+
import { P as PreloadManager } from './dataunit-fetcher-3aac1a53.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
|
-
import './form-config-fetcher-
|
|
10
|
+
import './form-config-fetcher-adbe5d34.js';
|
|
11
11
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
12
12
|
|
|
13
13
|
class CrudUtils {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-7b36d041.js';
|
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-adbe5d34.js';
|
|
4
|
+
import { T as TAB_NAMES } from './constants-8457af36.js';
|
|
4
5
|
|
|
5
6
|
class SnkFormConfigManager {
|
|
6
|
-
constructor(configName, resourceID, onConfigChange) {
|
|
7
|
+
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
|
7
8
|
this._resourceID = resourceID;
|
|
8
9
|
this._configName = configName;
|
|
9
10
|
this._onConfigChange = onConfigChange;
|
|
11
|
+
this._dataUnit = dataUnit;
|
|
10
12
|
}
|
|
11
13
|
addFormLegacyConfig(legacyConfigName) {
|
|
12
14
|
if (this._configName) {
|
|
@@ -17,6 +19,7 @@ class SnkFormConfigManager {
|
|
|
17
19
|
return new Promise(resolve => {
|
|
18
20
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
|
19
21
|
.then((config) => {
|
|
22
|
+
config = this.buildFormMetadataUITabs(config);
|
|
20
23
|
this.setConfig(config);
|
|
21
24
|
resolve(config);
|
|
22
25
|
})
|
|
@@ -25,6 +28,10 @@ class SnkFormConfigManager {
|
|
|
25
28
|
});
|
|
26
29
|
});
|
|
27
30
|
}
|
|
31
|
+
getEmptyConfig() {
|
|
32
|
+
const config = this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
28
35
|
saveConfig(config) {
|
|
29
36
|
const configToSave = ObjectUtils.copy(config);
|
|
30
37
|
return new Promise(accept => {
|
|
@@ -68,25 +75,36 @@ class SnkFormConfigManager {
|
|
|
68
75
|
}
|
|
69
76
|
return updatingCardConfig;
|
|
70
77
|
}
|
|
71
|
-
|
|
78
|
+
hasConfig(config) {
|
|
79
|
+
var _a;
|
|
80
|
+
const currentConfig = config !== null && config !== void 0 ? config : this._config;
|
|
81
|
+
if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
getFieldsList(descriptionFilter, forceEmptyConfig = false) {
|
|
72
87
|
var _a;
|
|
73
88
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
const hasConfig = this.hasConfig();
|
|
90
|
+
if (hasConfig && !forceEmptyConfig) {
|
|
91
|
+
return fields.map(({ label, name, readOnly, visible, required, tab }) => {
|
|
92
|
+
var _a;
|
|
76
93
|
if (label == undefined) {
|
|
77
|
-
const currentField =
|
|
78
|
-
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required });
|
|
94
|
+
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
95
|
+
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 });
|
|
79
96
|
}
|
|
80
|
-
return { name, label, readOnly, visible, required };
|
|
97
|
+
return { name, label, readOnly, visible, required, tab };
|
|
81
98
|
})
|
|
82
99
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
83
100
|
}
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
86
|
-
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
|
87
|
-
.map(({ label, name, readOnly }) => { return { label, name, readOnly }; });
|
|
101
|
+
if (!this._dataUnit) {
|
|
102
|
+
return [];
|
|
88
103
|
}
|
|
89
|
-
|
|
104
|
+
const filteredFields = this._dataUnit.metadata.fields
|
|
105
|
+
.filter(field => this.isFieldVisible(field, descriptionFilter))
|
|
106
|
+
.map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
|
|
107
|
+
return filteredFields;
|
|
90
108
|
}
|
|
91
109
|
isFieldVisible(field, descriptionFilter) {
|
|
92
110
|
if (field.visible === false) {
|
|
@@ -99,8 +117,8 @@ class SnkFormConfigManager {
|
|
|
99
117
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
|
100
118
|
return normalizedText.includes(normalizedFilter);
|
|
101
119
|
}
|
|
102
|
-
getFormConfig(dataUnit, ignoreReadOnlyFormFields) {
|
|
103
|
-
let fields = this.getFieldsList(
|
|
120
|
+
getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
|
|
121
|
+
let fields = this.getFieldsList(undefined, forceEmptyConfig);
|
|
104
122
|
if (ignoreReadOnlyFormFields) {
|
|
105
123
|
fields = fields.filter(field => {
|
|
106
124
|
if (dataUnit) {
|
|
@@ -153,6 +171,44 @@ class SnkFormConfigManager {
|
|
|
153
171
|
async fetchDefaultConfig() {
|
|
154
172
|
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
|
155
173
|
}
|
|
174
|
+
parseObjectList(object) {
|
|
175
|
+
if (!object) {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
return Array.isArray(object) ? object : [object];
|
|
179
|
+
}
|
|
180
|
+
buildFormMetadataUITabs(config, forceEmptyConfig = false) {
|
|
181
|
+
var _a;
|
|
182
|
+
const hasConfig = this.hasConfig(config);
|
|
183
|
+
if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
|
|
184
|
+
return config;
|
|
185
|
+
}
|
|
186
|
+
config = this.getFormConfig(this._dataUnit, false, true);
|
|
187
|
+
config.tabs = this.parseObjectList(config.tabs);
|
|
188
|
+
config.emptyConfig = false;
|
|
189
|
+
config.defaultConfiguration = true;
|
|
190
|
+
const fields = this._dataUnit.metadata.fields;
|
|
191
|
+
for (const currentField of fields) {
|
|
192
|
+
const field = config.fields.find(field => field.name === currentField.name);
|
|
193
|
+
const uiTabName = (_a = currentField.properties) === null || _a === void 0 ? void 0 : _a.UITabName;
|
|
194
|
+
if (!uiTabName || uiTabName === TAB_NAMES.main) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
|
|
198
|
+
if (!haveTab) {
|
|
199
|
+
config.tabs.push({
|
|
200
|
+
label: uiTabName,
|
|
201
|
+
name: uiTabName,
|
|
202
|
+
order: 0,
|
|
203
|
+
visible: true,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (field) {
|
|
207
|
+
field.tab = uiTabName;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return config;
|
|
211
|
+
}
|
|
156
212
|
}
|
|
157
213
|
|
|
158
214
|
export { SnkFormConfigManager as S };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-adbe5d34.js';
|
|
3
3
|
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
|
5
5
|
getData(resourceID) {
|