@sankhyalabs/sankhyablocks 8.16.0-rc.8 → 8.16.0-rc.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +12 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-8af43aa3.js → snk-data-unit-486c7ac4.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- 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-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-data-unit2.js +4 -41
- package/dist/components/snk-grid2.js +2 -2
- package/dist/components/snk-simple-crud2.js +3 -2
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/snk-actions-button_4.entry.js +12 -9
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-008cb9aa.js → snk-data-unit-ac3423fa.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/p-1e596b15.entry.js +1 -0
- package/dist/sankhyablocks/{p-89451692.entry.js → p-27b57eb7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-684a2590.entry.js → p-2d6dc51d.entry.js} +1 -1
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-53eb35c1.entry.js → p-81f6d043.entry.js} +1 -1
- package/dist/sankhyablocks/p-e8bd4c15.js +1 -0
- package/dist/sankhyablocks/{p-3c50e9d4.entry.js → p-fa155ad6.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/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-421bec84.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-cc935517.js +0 -1
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -2,31 +2,31 @@
|
|
2
2
|
|
3
3
|
const core = require('@sankhyalabs/core');
|
4
4
|
|
5
|
-
|
6
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
5
|
+
function getSelectedRecordsIDsInfo(dataUnit) {
|
6
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
7
7
|
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
8
8
|
return [];
|
9
9
|
}
|
10
10
|
const selectedRecordsIDsInfo = [];
|
11
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.
|
11
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
12
12
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
13
|
-
selectedRecords.forEach(
|
14
|
-
if (!dataUnit.isNewRecord(
|
13
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
14
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
15
15
|
/*
|
16
16
|
Esse if foi necessário para tratar corretamente o ID
|
17
17
|
do record quando está sendo utilizado no modo standAlone
|
18
18
|
isso não faz a exportação da grid funcionar no modo standAlone
|
19
19
|
mas deixa de causar erro nas oprações de CRUD.
|
20
20
|
*/
|
21
|
-
if (!core.JSUtils.isBase64(
|
21
|
+
if (!core.JSUtils.isBase64(__record__id__)) {
|
22
22
|
selectedRecordsIDsInfo.push({
|
23
23
|
name: "__record__id__",
|
24
24
|
type: core.DataType.TEXT,
|
25
|
-
value:
|
25
|
+
value: __record__id__
|
26
26
|
});
|
27
27
|
return;
|
28
28
|
}
|
29
|
-
const revertBase64ToObject = JSON.parse(window.atob(
|
29
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
30
30
|
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
31
31
|
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
32
32
|
if (metadataField == undefined) {
|
@@ -38,6 +38,6 @@ const getSelectedIDs = (dataUnit) => {
|
|
38
38
|
});
|
39
39
|
}
|
40
40
|
return selectedRecordsIDsInfo;
|
41
|
-
}
|
41
|
+
}
|
42
42
|
|
43
|
-
exports.
|
43
|
+
exports.getSelectedRecordsIDsInfo = getSelectedRecordsIDsInfo;
|
@@ -14,6 +14,7 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
14
14
|
require('./dataunit-fetcher-d4873076.js');
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
16
16
|
require('./form-config-fetcher-feb08214.js');
|
17
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
17
18
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
18
19
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
19
20
|
const CheckMode = require('@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode');
|
@@ -173,7 +174,6 @@ var RefreshType;
|
|
173
174
|
|
174
175
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
175
176
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
176
|
-
const NUFIN_COLUMN = 'NUFIN';
|
177
177
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
178
178
|
class Actions {
|
179
179
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -185,6 +185,10 @@ class Actions {
|
|
185
185
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
186
186
|
this._appResourceId = appResourceId;
|
187
187
|
}
|
188
|
+
getPrimaryKeys() {
|
189
|
+
const ids = GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this._dataUnit);
|
190
|
+
return ids.map(({ name }) => name);
|
191
|
+
}
|
188
192
|
apply(action, hasParamsToSave) {
|
189
193
|
this._application.closePopUp();
|
190
194
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -453,6 +457,7 @@ class Actions {
|
|
453
457
|
executeAction(execSource);
|
454
458
|
}
|
455
459
|
addRows(execSource) {
|
460
|
+
const primaryKeys = this.getPrimaryKeys();
|
456
461
|
const rows = {
|
457
462
|
row: []
|
458
463
|
};
|
@@ -466,15 +471,13 @@ class Actions {
|
|
466
471
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
467
472
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
468
473
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
row.field = [];
|
474
|
-
}
|
474
|
+
if (!row.field) {
|
475
|
+
row.field = [];
|
476
|
+
}
|
477
|
+
for (const primaryKey of primaryKeys) {
|
475
478
|
row.field.push({
|
476
|
-
fieldName:
|
477
|
-
$: sourceRow[
|
479
|
+
fieldName: primaryKey,
|
480
|
+
$: sourceRow[primaryKey]
|
478
481
|
});
|
479
482
|
}
|
480
483
|
rows.row.push(row);
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const index = require('./index-1dfc7a6e.js');
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
10
10
|
const DataFetcher = require('./DataFetcher-77729a93.js');
|
11
|
-
const snkDataUnit = require('./snk-data-unit-
|
11
|
+
const snkDataUnit = require('./snk-data-unit-486c7ac4.js');
|
12
12
|
require('./pesquisa-fetcher-a1d0353f.js');
|
13
13
|
require('./ISave-e91b70a7.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
@@ -18,8 +18,8 @@ require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
require('./form-config-fetcher-feb08214.js');
|
19
19
|
require('./PrintUtils-bcaeb82f.js');
|
20
20
|
require('./SnkMessageBuilder-cceebbae.js');
|
21
|
-
require('./RecordIDUtils-3735135c.js');
|
22
21
|
require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
22
|
+
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
24
24
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
25
25
|
require('./ResourceIDUtils-5ff86aa7.js');
|
@@ -5,8 +5,8 @@ const core = require('@sankhyalabs/core');
|
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
6
|
const SnkMessageBuilder = require('./SnkMessageBuilder-cceebbae.js');
|
7
7
|
const dataunitFetcher = require('./dataunit-fetcher-d4873076.js');
|
8
|
-
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
9
8
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
9
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
10
10
|
|
11
11
|
const SnkDataUnit = class {
|
12
12
|
constructor(hostRef) {
|
@@ -117,7 +117,7 @@ const SnkDataUnit = class {
|
|
117
117
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
118
118
|
*/
|
119
119
|
async getSelectedRecordsIDsInfo() {
|
120
|
-
return
|
120
|
+
return GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this.dataUnit);
|
121
121
|
}
|
122
122
|
/**
|
123
123
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
5
|
+
const snkDataUnit = require('./snk-data-unit-486c7ac4.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
@@ -15,8 +15,8 @@ require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
16
16
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
17
17
|
require('./ResourceIDUtils-5ff86aa7.js');
|
18
|
-
require('./RecordIDUtils-3735135c.js');
|
19
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
19
|
+
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
20
20
|
|
21
21
|
|
22
22
|
|
@@ -19,7 +19,7 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
19
19
|
require('./dataunit-fetcher-d4873076.js');
|
20
20
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
21
21
|
require('./form-config-fetcher-feb08214.js');
|
22
|
-
const
|
22
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
24
24
|
require('./PrintUtils-bcaeb82f.js');
|
25
25
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
@@ -48,7 +48,7 @@ class ServerSideExporterProvider extends IExporterProvider.CommonsExporter {
|
|
48
48
|
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;
|
49
49
|
}
|
50
50
|
getSelectedIDs() {
|
51
|
-
return
|
51
|
+
return GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this.dataUnit);
|
52
52
|
}
|
53
53
|
getOffset() {
|
54
54
|
return this.getExporterOffset(this.getPaginationInfo());
|
@@ -20,7 +20,7 @@ const formConfigFetcher = require('./form-config-fetcher-feb08214.js');
|
|
20
20
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
21
21
|
const ConfigStorage = require('./ConfigStorage-e49214c6.js');
|
22
22
|
const SnkFormConfigManager = require('./SnkFormConfigManager-beebf47a.js');
|
23
|
-
const
|
23
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
24
24
|
const index$2 = require('./index-102ba62d.js');
|
25
25
|
require('./PrintUtils-bcaeb82f.js');
|
26
26
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
@@ -41,7 +41,7 @@ class ClientSideExporterProvider extends IExporterProvider.CommonsExporter {
|
|
41
41
|
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
42
|
}
|
43
43
|
getSelectedIDs() {
|
44
|
-
return
|
44
|
+
return GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this.dataUnit);
|
45
45
|
}
|
46
46
|
getRecordID() {
|
47
47
|
var _a, _b, _c;
|
@@ -3,9 +3,9 @@ import { RefreshType } from "./enum/RefreshType";
|
|
3
3
|
import { ParamType } from "./enum/ParamType";
|
4
4
|
import { DataFetcher } from "../../../lib";
|
5
5
|
import { ActionsType } from "./enum/ActionsType";
|
6
|
+
import { getSelectedRecordsIDsInfo } from "../../../lib/utils/GetSelectedRecordsIDsInfo";
|
6
7
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
7
8
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
8
|
-
const NUFIN_COLUMN = 'NUFIN';
|
9
9
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
10
10
|
export default class Actions {
|
11
11
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -17,6 +17,10 @@ export default class Actions {
|
|
17
17
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
18
18
|
this._appResourceId = appResourceId;
|
19
19
|
}
|
20
|
+
getPrimaryKeys() {
|
21
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
22
|
+
return ids.map(({ name }) => name);
|
23
|
+
}
|
20
24
|
apply(action, hasParamsToSave) {
|
21
25
|
this._application.closePopUp();
|
22
26
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -285,6 +289,7 @@ export default class Actions {
|
|
285
289
|
executeAction(execSource);
|
286
290
|
}
|
287
291
|
addRows(execSource) {
|
292
|
+
const primaryKeys = this.getPrimaryKeys();
|
288
293
|
const rows = {
|
289
294
|
row: []
|
290
295
|
};
|
@@ -298,15 +303,13 @@ export default class Actions {
|
|
298
303
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
299
304
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
300
305
|
}
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
row.field = [];
|
306
|
-
}
|
306
|
+
if (!row.field) {
|
307
|
+
row.field = [];
|
308
|
+
}
|
309
|
+
for (const primaryKey of primaryKeys) {
|
307
310
|
row.field.push({
|
308
|
-
fieldName:
|
309
|
-
$: sourceRow[
|
311
|
+
fieldName: primaryKey,
|
312
|
+
$: sourceRow[primaryKey]
|
310
313
|
});
|
311
314
|
}
|
312
315
|
rows.row.push(row);
|
package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CommonsExporter } from "../interfaces/IExporterProvider";
|
2
2
|
import { UserInterface } from "@sankhyalabs/core";
|
3
|
-
import { getSelectedIDs } from
|
3
|
+
import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
|
4
4
|
import { DataExporterOption } from "../../../lib/@types";
|
5
5
|
export default class ClientSideExporterProvider extends CommonsExporter {
|
6
6
|
getSelectedNumber() {
|
package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { CommonsExporter } from "../interfaces/IExporterProvider";
|
2
|
-
import { getSelectedIDs } from
|
2
|
+
import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
|
3
3
|
export default class ServerSideExporterProvider extends CommonsExporter {
|
4
4
|
getFilters() {
|
5
5
|
var _a;
|
@@ -4,8 +4,8 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
|
|
4
4
|
import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
|
5
5
|
import { DatasetStrategy } from '../../lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy';
|
6
6
|
import { getRecordValue } from '../../lib/dataUnit/ValueFormatter';
|
7
|
-
import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
|
8
7
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
8
|
+
import { getSelectedRecordsIDsInfo } from '../../lib/utils/GetSelectedRecordsIDsInfo';
|
9
9
|
export class SnkDataUnit {
|
10
10
|
constructor() {
|
11
11
|
this._onDataUnitResolve = [];
|
@@ -110,7 +110,7 @@ export class SnkDataUnit {
|
|
110
110
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
111
111
|
*/
|
112
112
|
async getSelectedRecordsIDsInfo() {
|
113
|
-
return
|
113
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
114
114
|
}
|
115
115
|
/**
|
116
116
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
@@ -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,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 };
|
@@ -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);
|
@@ -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).
|
@@ -755,4 +718,4 @@ function defineCustomElement() {
|
|
755
718
|
} });
|
756
719
|
}
|
757
720
|
|
758
|
-
export { SnkDataUnit as S, defineCustomElement as d
|
721
|
+
export { SnkDataUnit as S, defineCustomElement as d };
|
@@ -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;
|
@@ -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 };
|
@@ -10,6 +10,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
10
|
import './dataunit-fetcher-3d2ec959.js';
|
11
11
|
import './filter-item-type.enum-d45e026f.js';
|
12
12
|
import './form-config-fetcher-e0382e5a.js';
|
13
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
|
13
14
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
14
15
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
15
16
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
|
@@ -169,7 +170,6 @@ var RefreshType;
|
|
169
170
|
|
170
171
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
171
172
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
172
|
-
const NUFIN_COLUMN = 'NUFIN';
|
173
173
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
174
174
|
class Actions {
|
175
175
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -181,6 +181,10 @@ class Actions {
|
|
181
181
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
182
182
|
this._appResourceId = appResourceId;
|
183
183
|
}
|
184
|
+
getPrimaryKeys() {
|
185
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
186
|
+
return ids.map(({ name }) => name);
|
187
|
+
}
|
184
188
|
apply(action, hasParamsToSave) {
|
185
189
|
this._application.closePopUp();
|
186
190
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -449,6 +453,7 @@ class Actions {
|
|
449
453
|
executeAction(execSource);
|
450
454
|
}
|
451
455
|
addRows(execSource) {
|
456
|
+
const primaryKeys = this.getPrimaryKeys();
|
452
457
|
const rows = {
|
453
458
|
row: []
|
454
459
|
};
|
@@ -462,15 +467,13 @@ class Actions {
|
|
462
467
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
463
468
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
464
469
|
}
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
row.field = [];
|
470
|
-
}
|
470
|
+
if (!row.field) {
|
471
|
+
row.field = [];
|
472
|
+
}
|
473
|
+
for (const primaryKey of primaryKeys) {
|
471
474
|
row.field.push({
|
472
|
-
fieldName:
|
473
|
-
$: sourceRow[
|
475
|
+
fieldName: primaryKey,
|
476
|
+
$: sourceRow[primaryKey]
|
474
477
|
});
|
475
478
|
}
|
476
479
|
rows.row.push(row);
|