@sankhyalabs/sankhyablocks 8.16.0-rc.1 → 8.16.0-rc.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-ecc0ed20.js} +2 -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-166cbd1f.js → SnkFormConfigManager-f1c92f79.js} +72 -16
- 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 +12 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
- package/dist/cjs/{snk-data-unit-04df81bf.js → snk-data-unit-47202e42.js} +20 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +11 -11
- 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 +15 -4
- 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-bdc41281.js → snk-guides-viewer-68777d37.js} +23 -11
- 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 +53 -21
- 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 +59 -1
- 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 +50 -5
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- 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/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +18 -9
- 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 +70 -14
- package/dist/collection/components/snk-form-config/snk-form-config.js +13 -2
- 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 +62 -29
- 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/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/{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 +70 -14
- 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 +9 -1
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +21 -49
- package/dist/components/snk-detail-view2.js +22 -8
- 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 +13 -2
- 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 +45 -10
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-7b36d041.js} +2 -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-31b24066.js → SnkFormConfigManager-139f09fa.js} +72 -16
- 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 +12 -6
- package/dist/esm/snk-data-exporter.entry.js +9 -9
- package/dist/esm/{snk-data-unit-8eec78bd.js → snk-data-unit-de45e0e1.js} +20 -11
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +11 -11
- 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 +15 -4
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +56 -16
- package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-b5dd30e6.js} +23 -11
- 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 +49 -17
- 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-0911e61a.entry.js +1 -0
- 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-47db7e88.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-52920496.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/p-50779ad3.entry.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-62e048c6.entry.js +1 -0
- package/dist/sankhyablocks/{p-c1d57831.entry.js → p-694e1c4a.entry.js} +1 -1
- package/dist/sankhyablocks/p-73185e58.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-045eae4d.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-bccfc262.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-da34270e.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-2c68b3ae.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 +9 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +11 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -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 +7 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +12 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -4
- 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 +67 -2
- 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/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-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-2a408684.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
- package/dist/sankhyablocks/p-46d38387.entry.js +0 -1
- package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
- package/dist/sankhyablocks/p-547eeac8.entry.js +0 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
- package/dist/sankhyablocks/p-7b08d0f8.entry.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-e549f7d1.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -0,0 +1,31 @@
|
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
import { StringUtils } from '@sankhyalabs/core';
|
3
|
+
export class ContinuousInsertUtils {
|
4
|
+
constructor(snkApplication, resourceID, configName) {
|
5
|
+
this.snkApplication = snkApplication;
|
6
|
+
this.keyConfigEnableContinuousInsert = `${resourceID}enableContinuousInsert${configName ? configName : ''}`;
|
7
|
+
}
|
8
|
+
handleSaveConfig(enableContinuousInsert) {
|
9
|
+
return this.snkApplication.saveConfig(this.keyConfigEnableContinuousInsert, enableContinuousInsert);
|
10
|
+
}
|
11
|
+
getConfig() {
|
12
|
+
return this.snkApplication.getConfig(this.keyConfigEnableContinuousInsert).then(value => {
|
13
|
+
if (value) {
|
14
|
+
return value == "true" ? true : false;
|
15
|
+
}
|
16
|
+
return false;
|
17
|
+
}).catch(() => {
|
18
|
+
return false;
|
19
|
+
});
|
20
|
+
}
|
21
|
+
actionContinuousInsert(enableContinuousInsert, handleEnableContinuousInsert) {
|
22
|
+
return {
|
23
|
+
value: StringUtils.generateUUID(),
|
24
|
+
label: enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua',
|
25
|
+
enabled: true,
|
26
|
+
itemBuilder: () => {
|
27
|
+
return (h("div", { class: "ez-dropdown__item-wrapper", onClick: () => handleEnableContinuousInsert() }, h("span", { class: "ez-dropdown__item-label" }, enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua')));
|
28
|
+
},
|
29
|
+
};
|
30
|
+
}
|
31
|
+
}
|
@@ -1,29 +1,29 @@
|
|
1
1
|
import { DataType, JSUtils } from "@sankhyalabs/core";
|
2
|
-
export
|
3
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
2
|
+
export function getSelectedRecordsIDsInfo(dataUnit) {
|
3
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
4
4
|
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
5
5
|
return [];
|
6
6
|
}
|
7
7
|
const selectedRecordsIDsInfo = [];
|
8
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.
|
8
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
9
9
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
10
|
-
selectedRecords.forEach(
|
11
|
-
if (!dataUnit.isNewRecord(
|
10
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
11
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
12
12
|
/*
|
13
13
|
Esse if foi necessário para tratar corretamente o ID
|
14
14
|
do record quando está sendo utilizado no modo standAlone
|
15
15
|
isso não faz a exportação da grid funcionar no modo standAlone
|
16
16
|
mas deixa de causar erro nas oprações de CRUD.
|
17
17
|
*/
|
18
|
-
if (!JSUtils.isBase64(
|
18
|
+
if (!JSUtils.isBase64(__record__id__)) {
|
19
19
|
selectedRecordsIDsInfo.push({
|
20
20
|
name: "__record__id__",
|
21
21
|
type: DataType.TEXT,
|
22
|
-
value:
|
22
|
+
value: __record__id__
|
23
23
|
});
|
24
24
|
return;
|
25
25
|
}
|
26
|
-
const revertBase64ToObject = JSON.parse(window.atob(
|
26
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
27
27
|
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
28
28
|
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
29
29
|
if (metadataField == undefined) {
|
@@ -35,4 +35,4 @@ export const getSelectedIDs = (dataUnit) => {
|
|
35
35
|
});
|
36
36
|
}
|
37
37
|
return selectedRecordsIDsInfo;
|
38
|
-
}
|
38
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher.js';
|
2
2
|
import './pesquisa-fetcher.js';
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
4
4
|
import './ISave.js';
|
5
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
6
6
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -124,12 +124,16 @@ class TaskbarProcessor {
|
|
124
124
|
});
|
125
125
|
}
|
126
126
|
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
127
|
-
const defaults = this.
|
127
|
+
const defaults = this.getButtonsFromKey(taskbarId);
|
128
128
|
if (taskbarManager) {
|
129
129
|
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
130
130
|
}
|
131
131
|
return defaults;
|
132
132
|
}
|
133
|
+
getButtonsFromKey(taskbarId) {
|
134
|
+
const btnsValue = this._defaultButtons[taskbarId];
|
135
|
+
return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
|
136
|
+
}
|
133
137
|
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
134
138
|
const originalValue = disabled.includes(buttonName) ? false : true;
|
135
139
|
if (taskbarManager && taskbarManager.isEnabled) {
|
@@ -217,7 +221,7 @@ class RmPrecisionCustomValueFormatter {
|
|
217
221
|
this.refreshSelectedRows();
|
218
222
|
}
|
219
223
|
setDataState(dataState) {
|
220
|
-
if (ObjectUtils.
|
224
|
+
if (this._dataState && ObjectUtils.equals(dataState === null || dataState === void 0 ? void 0 : dataState.metadataByRow, this._dataState.metadataByRow)) {
|
221
225
|
return;
|
222
226
|
}
|
223
227
|
this._dataState = dataState;
|
@@ -225,7 +229,7 @@ class RmPrecisionCustomValueFormatter {
|
|
225
229
|
}
|
226
230
|
format(currentValue, column, recordId) {
|
227
231
|
var _a;
|
228
|
-
if (
|
232
|
+
if (StringUtils.isEmpty(currentValue)) {
|
229
233
|
return currentValue;
|
230
234
|
}
|
231
235
|
const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
|
@@ -295,4 +299,35 @@ class CommonsExporter {
|
|
295
299
|
}
|
296
300
|
}
|
297
301
|
|
298
|
-
|
302
|
+
class ContinuousInsertUtils {
|
303
|
+
constructor(snkApplication, resourceID, configName) {
|
304
|
+
this.snkApplication = snkApplication;
|
305
|
+
this.keyConfigEnableContinuousInsert = `${resourceID}enableContinuousInsert${configName ? configName : ''}`;
|
306
|
+
}
|
307
|
+
handleSaveConfig(enableContinuousInsert) {
|
308
|
+
return this.snkApplication.saveConfig(this.keyConfigEnableContinuousInsert, enableContinuousInsert);
|
309
|
+
}
|
310
|
+
getConfig() {
|
311
|
+
return this.snkApplication.getConfig(this.keyConfigEnableContinuousInsert).then(value => {
|
312
|
+
if (value) {
|
313
|
+
return value == "true" ? true : false;
|
314
|
+
}
|
315
|
+
return false;
|
316
|
+
}).catch(() => {
|
317
|
+
return false;
|
318
|
+
});
|
319
|
+
}
|
320
|
+
actionContinuousInsert(enableContinuousInsert, handleEnableContinuousInsert) {
|
321
|
+
return {
|
322
|
+
value: StringUtils.generateUUID(),
|
323
|
+
label: enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua',
|
324
|
+
enabled: true,
|
325
|
+
itemBuilder: () => {
|
326
|
+
return (h("div", { class: "ez-dropdown__item-wrapper", onClick: () => handleEnableContinuousInsert() },
|
327
|
+
h("span", { class: "ez-dropdown__item-label" }, enableContinuousInsert ? 'Desativar inclusão contínua' : 'Ativar inclusão contínua')));
|
328
|
+
},
|
329
|
+
};
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
export { CommonsExporter as C, RmPrecisionCustomValueFormatter as R, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, CrudUtils as a, buildFieldSearch as b, ContinuousInsertUtils as c, openFieldSearch as o };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
1
|
+
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, ServiceCanceledException } from '@sankhyalabs/core';
|
2
2
|
import { P as PrintUtils } from './PrintUtils.js';
|
3
3
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
|
@@ -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,31 +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
|
-
(((_a = watingRequestsById.get(
|
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));
|
6889
6891
|
}
|
6890
|
-
|
6891
|
-
|
6892
|
-
|
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
|
+
}
|
6893
6898
|
//Resolve promises with data from query
|
6894
|
-
|
6895
|
-
Object.entries(data)
|
6899
|
+
for (const data of dataResponse) {
|
6900
|
+
const entries = Object.entries(data);
|
6901
|
+
for (const [key, val] of entries) {
|
6896
6902
|
const waitingRequest = watingRequestsById.get(key);
|
6897
6903
|
await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6898
6904
|
((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
|
6899
|
-
}
|
6900
|
-
}
|
6905
|
+
}
|
6906
|
+
}
|
6901
6907
|
}
|
6902
6908
|
buildGraphQlURL(quietMode) {
|
6903
6909
|
const urlParams = UrlUtils.getQueryParams(location.search);
|
@@ -1,30 +1,30 @@
|
|
1
1
|
import { JSUtils, DataType } from '@sankhyalabs/core';
|
2
2
|
|
3
|
-
|
4
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
3
|
+
function getSelectedRecordsIDsInfo(dataUnit) {
|
4
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
5
5
|
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
6
6
|
return [];
|
7
7
|
}
|
8
8
|
const selectedRecordsIDsInfo = [];
|
9
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.
|
9
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
10
10
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
11
|
-
selectedRecords.forEach(
|
12
|
-
if (!dataUnit.isNewRecord(
|
11
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
12
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
13
13
|
/*
|
14
14
|
Esse if foi necessário para tratar corretamente o ID
|
15
15
|
do record quando está sendo utilizado no modo standAlone
|
16
16
|
isso não faz a exportação da grid funcionar no modo standAlone
|
17
17
|
mas deixa de causar erro nas oprações de CRUD.
|
18
18
|
*/
|
19
|
-
if (!JSUtils.isBase64(
|
19
|
+
if (!JSUtils.isBase64(__record__id__)) {
|
20
20
|
selectedRecordsIDsInfo.push({
|
21
21
|
name: "__record__id__",
|
22
22
|
type: DataType.TEXT,
|
23
|
-
value:
|
23
|
+
value: __record__id__
|
24
24
|
});
|
25
25
|
return;
|
26
26
|
}
|
27
|
-
const revertBase64ToObject = JSON.parse(window.atob(
|
27
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
28
28
|
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
29
29
|
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
30
30
|
if (metadataField == undefined) {
|
@@ -36,6 +36,6 @@ const getSelectedIDs = (dataUnit) => {
|
|
36
36
|
});
|
37
37
|
}
|
38
38
|
return selectedRecordsIDsInfo;
|
39
|
-
}
|
39
|
+
}
|
40
40
|
|
41
|
-
export {
|
41
|
+
export { getSelectedRecordsIDsInfo as g };
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
3
3
|
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
4
|
+
import { c as TAB_NAMES } from './constants.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 };
|
@@ -8,7 +8,7 @@ const snkDataUnitMessages = {
|
|
8
8
|
},
|
9
9
|
cancelInfo: {
|
10
10
|
clone: "Duplicação descartada!",
|
11
|
-
insert: "A inclusão descartada!",
|
11
|
+
insert: "A inclusão foi descartada!",
|
12
12
|
update: "A edição foi descartada!"
|
13
13
|
},
|
14
14
|
confirm: {
|
@@ -122,7 +122,7 @@ const snkExporterMessages = {
|
|
122
122
|
emailSenderOptStep_subtitle: "Primeiro, escolha o formato do arquivo",
|
123
123
|
emailSenderOptStep_lblFormat: "Formato:",
|
124
124
|
emailSenderOptStep_formatPDF: "PDF (.pdf)",
|
125
|
-
|
125
|
+
emailSenderOptStep_formatXLS: "Planilha (.xls)",
|
126
126
|
emailSenderOptStep_export: "Exportar:",
|
127
127
|
emailSenderOptStep_allData: "Toda a grade",
|
128
128
|
emailSenderOptStep_currentPage: "Somente a página atual",
|
@@ -245,7 +245,11 @@ const snkConfiguratorMessages = {
|
|
245
245
|
};
|
246
246
|
|
247
247
|
const snkGridMessages = {
|
248
|
-
findColumn: "Busca de colunas"
|
248
|
+
findColumn: "Busca de colunas",
|
249
|
+
cancelConfirmation: {
|
250
|
+
title: "Aviso",
|
251
|
+
message: "As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?</b>",
|
252
|
+
}
|
249
253
|
};
|
250
254
|
const snkGridConfigMessages = {
|
251
255
|
gridConfiguration: "Configuração da Grade",
|
@@ -235,6 +235,21 @@ function applyFilter(records, dataUnit, filters) {
|
|
235
235
|
}
|
236
236
|
return records.filter(filterFunction);
|
237
237
|
}
|
238
|
+
function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
239
|
+
let records = recordsIn ? [...recordsIn] : [];
|
240
|
+
records = applyFilter(records, dataUnit, request.filters);
|
241
|
+
records = applySorting(records, dataUnit, request.sort);
|
242
|
+
const { offset, limit } = request;
|
243
|
+
const paginationInfoBuilderParams = {
|
244
|
+
recordsLength: records.length,
|
245
|
+
offset,
|
246
|
+
recordsPerPage: limit,
|
247
|
+
};
|
248
|
+
return Promise.resolve({
|
249
|
+
records: getPagesByRecords(records, offset, limit),
|
250
|
+
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
251
|
+
});
|
252
|
+
}
|
238
253
|
function applySorting(records, dataUnit, sorting) {
|
239
254
|
if (sorting == undefined || sorting.length == 0) {
|
240
255
|
return records;
|
@@ -245,18 +260,28 @@ function applySorting(records, dataUnit, sorting) {
|
|
245
260
|
}
|
246
261
|
return records.sort(sortingFunction);
|
247
262
|
}
|
248
|
-
function
|
249
|
-
|
250
|
-
|
263
|
+
function hasValidLimitAndOffset(offset, limit) {
|
264
|
+
return offset >= 0 && limit >= 0;
|
265
|
+
}
|
266
|
+
function getPagesByRecords(records, offset = 0, limit = 0) {
|
267
|
+
if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
|
268
|
+
return [];
|
269
|
+
if (limit === 0 && offset === 0)
|
270
|
+
return records;
|
271
|
+
return records.slice(offset, offset + limit);
|
272
|
+
}
|
273
|
+
function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
274
|
+
if (!recordsLength) {
|
275
|
+
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
251
276
|
}
|
252
|
-
const
|
253
|
-
const lastRecord = Math.min(
|
277
|
+
const lastRecordIndex = offset + recordsPerPage;
|
278
|
+
const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
|
254
279
|
return {
|
255
|
-
currentPage:
|
256
|
-
firstRecord: offset,
|
280
|
+
currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
|
281
|
+
firstRecord: offset + 1,
|
257
282
|
lastRecord: lastRecord,
|
258
|
-
total:
|
259
|
-
hasMore:
|
283
|
+
total: recordsLength,
|
284
|
+
hasMore: lastRecord < recordsLength,
|
260
285
|
};
|
261
286
|
}
|
262
287
|
|
@@ -342,9 +367,7 @@ class InMemoryLoader {
|
|
342
367
|
return StringUtils.generateUUID();
|
343
368
|
}
|
344
369
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
345
|
-
|
346
|
-
records = applySorting(records, dataUnit, request.sort);
|
347
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
370
|
+
return buildLoadDataResponse(recordsIn, dataUnit, request);
|
348
371
|
}
|
349
372
|
metadaLoader() {
|
350
373
|
return Promise.resolve(this._metadata);
|
@@ -424,12 +447,19 @@ class DatasetStrategy {
|
|
424
447
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
425
448
|
const loadingInProgress = pagerId != undefined;
|
426
449
|
const count = loadingInfo.count + records.length;
|
450
|
+
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
427
451
|
const needReload = !loadingInProgress && localSorting.length > 0;
|
452
|
+
/**
|
453
|
+
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
454
|
+
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
455
|
+
*/
|
456
|
+
if (needReload && isInsertingNewRecord) {
|
457
|
+
dataUnit.setWaitingToReload(true);
|
458
|
+
}
|
428
459
|
return Promise.resolve({
|
429
460
|
records,
|
430
461
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
431
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count,
|
432
|
-
needReload })
|
462
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord })
|
433
463
|
});
|
434
464
|
}
|
435
465
|
catch (error) {
|
@@ -1052,4 +1082,4 @@ class DataUnitFetcher {
|
|
1052
1082
|
}
|
1053
1083
|
}
|
1054
1084
|
|
1055
|
-
export { DataUnitFetcher as D, InMemoryLoader as I, PreloadManager as P,
|
1085
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PreloadManager as P, DatasetStrategy as a, buildLoadDataResponse as b, getRecordValue as g };
|
@@ -217,7 +217,10 @@ class FormConfigFetcher extends ResourceFetcher {
|
|
217
217
|
query: this.queryConfig.get("fetchDefaultConfig"),
|
218
218
|
})
|
219
219
|
.then((result) => {
|
220
|
-
|
220
|
+
if (!(result === null || result === void 0 ? void 0 : result.resource)) {
|
221
|
+
resolve(null);
|
222
|
+
}
|
223
|
+
resolve(ObjectUtils.stringToObject(result === null || result === void 0 ? void 0 : result.resource));
|
221
224
|
})
|
222
225
|
.catch((error) => {
|
223
226
|
reject(error);
|
@@ -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);
|