@sankhyalabs/sankhyablocks 8.15.8 → 8.15.10
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/GetSelectedRecordsIDsInfo-bd50caf1.js +43 -0
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +12 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -1
- package/dist/cjs/{snk-data-unit-559ac55c.js → snk-data-unit-735a1ee5.js} +2 -37
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +3 -1
- package/dist/collection/lib/utils/GetSelectedRecordsIDsInfo.js +38 -0
- package/dist/components/GetSelectedRecordsIDsInfo.js +41 -0
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-data-unit2.js +3 -38
- package/dist/components/snk-simple-crud2.js +3 -1
- 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 -1
- package/dist/esm/{snk-data-unit-44215df7.js → snk-data-unit-e85c0088.js} +3 -38
- package/dist/esm/snk-data-unit.entry.js +2 -1
- package/dist/esm/snk-simple-crud.entry.js +3 -1
- package/dist/sankhyablocks/p-2f3b59b4.entry.js +1 -0
- package/dist/sankhyablocks/p-3961b3ee.entry.js +1 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-cb0147ab.entry.js → p-863351fd.entry.js} +1 -1
- package/dist/sankhyablocks/p-9fc8dc5c.entry.js +1 -0
- package/dist/sankhyablocks/p-edb806ca.js +1 -0
- 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-5571bdfe.js +0 -1
- package/dist/sankhyablocks/p-5f8c0426.entry.js +0 -1
- package/dist/sankhyablocks/p-a1832166.entry.js +0 -1
- package/dist/sankhyablocks/p-f607db63.entry.js +0 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const core = require('@sankhyalabs/core');
|
4
|
+
|
5
|
+
function getSelectedRecordsIDsInfo(dataUnit) {
|
6
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
7
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
8
|
+
return [];
|
9
|
+
}
|
10
|
+
const selectedRecordsIDsInfo = [];
|
11
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
12
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
13
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
14
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
15
|
+
/*
|
16
|
+
Esse if foi necessário para tratar corretamente o ID
|
17
|
+
do record quando está sendo utilizado no modo standAlone
|
18
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
19
|
+
mas deixa de causar erro nas oprações de CRUD.
|
20
|
+
*/
|
21
|
+
if (!core.JSUtils.isBase64(__record__id__)) {
|
22
|
+
selectedRecordsIDsInfo.push({
|
23
|
+
name: "__record__id__",
|
24
|
+
type: core.DataType.TEXT,
|
25
|
+
value: __record__id__
|
26
|
+
});
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
30
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
31
|
+
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
32
|
+
if (metadataField == undefined) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
36
|
+
});
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
return selectedRecordsIDsInfo;
|
41
|
+
}
|
42
|
+
|
43
|
+
exports.getSelectedRecordsIDsInfo = getSelectedRecordsIDsInfo;
|
@@ -13,6 +13,7 @@ require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
14
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
15
15
|
require('./form-config-fetcher-feb08214.js');
|
16
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
16
17
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
17
18
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
18
19
|
const CheckMode = require('@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode');
|
@@ -171,7 +172,6 @@ var RefreshType;
|
|
171
172
|
|
172
173
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
173
174
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
174
|
-
const NUFIN_COLUMN = 'NUFIN';
|
175
175
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
176
176
|
class Actions {
|
177
177
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -183,6 +183,10 @@ class Actions {
|
|
183
183
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
184
184
|
this._appResourceId = appResourceId;
|
185
185
|
}
|
186
|
+
getPrimaryKeys() {
|
187
|
+
const ids = GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this._dataUnit);
|
188
|
+
return ids.map(({ name }) => name);
|
189
|
+
}
|
186
190
|
apply(action, hasParamsToSave) {
|
187
191
|
this._application.closePopUp();
|
188
192
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -451,6 +455,7 @@ class Actions {
|
|
451
455
|
executeAction(execSource);
|
452
456
|
}
|
453
457
|
addRows(execSource) {
|
458
|
+
const primaryKeys = this.getPrimaryKeys();
|
454
459
|
const rows = {
|
455
460
|
row: []
|
456
461
|
};
|
@@ -464,15 +469,13 @@ class Actions {
|
|
464
469
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
465
470
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
466
471
|
}
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
row.field = [];
|
472
|
-
}
|
472
|
+
if (!row.field) {
|
473
|
+
row.field = [];
|
474
|
+
}
|
475
|
+
for (const primaryKey of primaryKeys) {
|
473
476
|
row.field.push({
|
474
|
-
fieldName:
|
475
|
-
$: sourceRow[
|
477
|
+
fieldName: primaryKey,
|
478
|
+
$: sourceRow[primaryKey]
|
476
479
|
});
|
477
480
|
}
|
478
481
|
rows.row.push(row);
|
@@ -8,10 +8,11 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const index = require('./index-0922807b.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-735a1ee5.js');
|
12
12
|
require('./PrintUtils-bcaeb82f.js');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
14
|
require('./SnkMessageBuilder-96b0f549.js');
|
15
|
+
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
15
16
|
|
16
17
|
class ItemBuilder {
|
17
18
|
constructor(getMessage, selectedNumber) {
|
@@ -4,6 +4,7 @@ const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
6
|
const SnkMessageBuilder = require('./SnkMessageBuilder-96b0f549.js');
|
7
|
+
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
7
8
|
|
8
9
|
const SnkDataUnit = class {
|
9
10
|
constructor(hostRef) {
|
@@ -126,43 +127,7 @@ const SnkDataUnit = class {
|
|
126
127
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
127
128
|
*/
|
128
129
|
async getSelectedRecordsIDsInfo() {
|
129
|
-
|
130
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
131
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
132
|
-
return [];
|
133
|
-
}
|
134
|
-
const selectedRecordsIDsInfo = [];
|
135
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
136
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
137
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
138
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
139
|
-
/*
|
140
|
-
Esse if foi necessário para tratar corretamente o ID
|
141
|
-
do record quando está sendo utilizado no modo standAlone
|
142
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
143
|
-
mas deixa de causar erro nas oprações de CRUD.
|
144
|
-
*/
|
145
|
-
if (!core.JSUtils.isBase64(__record__id__)) {
|
146
|
-
selectedRecordsIDsInfo.push({
|
147
|
-
name: "__record__id__",
|
148
|
-
type: core.DataType.TEXT,
|
149
|
-
value: __record__id__
|
150
|
-
});
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
154
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
155
|
-
var _a;
|
156
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
157
|
-
if (metadataField == undefined) {
|
158
|
-
return;
|
159
|
-
}
|
160
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
161
|
-
});
|
162
|
-
}
|
163
|
-
});
|
164
|
-
}
|
165
|
-
return selectedRecordsIDsInfo;
|
130
|
+
return GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this.dataUnit);
|
166
131
|
}
|
167
132
|
getCleanOnCopyFields() {
|
168
133
|
var _a;
|
@@ -2,11 +2,12 @@
|
|
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-735a1ee5.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
9
9
|
require('./SnkMessageBuilder-96b0f549.js');
|
10
|
+
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
10
11
|
|
11
12
|
|
12
13
|
|
@@ -498,9 +498,11 @@ const SnkSimpleCrud = class {
|
|
498
498
|
window.removeEventListener("keydown", this._keyDownHandler);
|
499
499
|
}
|
500
500
|
gridConfigChangeHandler(evt) {
|
501
|
+
evt.stopPropagation();
|
502
|
+
if (!this.configName)
|
503
|
+
return;
|
501
504
|
const config = evt.detail;
|
502
505
|
ConfigStorage.ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
503
|
-
evt.stopPropagation();
|
504
506
|
}
|
505
507
|
modalConfigChangeHandler(evt) {
|
506
508
|
const config = evt.detail;
|
@@ -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);
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
2
|
-
import { Action, ApplicationContext, DataUnitAction, ObjectUtils
|
2
|
+
import { Action, ApplicationContext, DataUnitAction, ObjectUtils } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
|
5
|
+
import { getSelectedRecordsIDsInfo } from '../../lib/utils/GetSelectedRecordsIDsInfo';
|
5
6
|
export class SnkDataUnit {
|
6
7
|
constructor() {
|
7
8
|
this._onDataUnitResolve = [];
|
@@ -117,43 +118,7 @@ export class SnkDataUnit {
|
|
117
118
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
118
119
|
*/
|
119
120
|
async getSelectedRecordsIDsInfo() {
|
120
|
-
|
121
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
122
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
123
|
-
return [];
|
124
|
-
}
|
125
|
-
const selectedRecordsIDsInfo = [];
|
126
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
127
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
128
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
129
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
130
|
-
/*
|
131
|
-
Esse if foi necessário para tratar corretamente o ID
|
132
|
-
do record quando está sendo utilizado no modo standAlone
|
133
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
134
|
-
mas deixa de causar erro nas oprações de CRUD.
|
135
|
-
*/
|
136
|
-
if (!JSUtils.isBase64(__record__id__)) {
|
137
|
-
selectedRecordsIDsInfo.push({
|
138
|
-
name: "__record__id__",
|
139
|
-
type: DataType.TEXT,
|
140
|
-
value: __record__id__
|
141
|
-
});
|
142
|
-
return;
|
143
|
-
}
|
144
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
145
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
146
|
-
var _a;
|
147
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
148
|
-
if (metadataField == undefined) {
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
152
|
-
});
|
153
|
-
}
|
154
|
-
});
|
155
|
-
}
|
156
|
-
return selectedRecordsIDsInfo;
|
121
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
157
122
|
}
|
158
123
|
getCleanOnCopyFields() {
|
159
124
|
var _a;
|
@@ -774,10 +739,6 @@ export class SnkDataUnit {
|
|
774
739
|
},
|
775
740
|
"Array": {
|
776
741
|
"location": "global"
|
777
|
-
},
|
778
|
-
"Record": {
|
779
|
-
"location": "import",
|
780
|
-
"path": "@sankhyalabs/core"
|
781
742
|
}
|
782
743
|
},
|
783
744
|
"return": "Promise<IRecordID[]>"
|
@@ -472,9 +472,11 @@ export class SnkSimpleCrud {
|
|
472
472
|
window.removeEventListener("keydown", this._keyDownHandler);
|
473
473
|
}
|
474
474
|
gridConfigChangeHandler(evt) {
|
475
|
+
evt.stopPropagation();
|
476
|
+
if (!this.configName)
|
477
|
+
return;
|
475
478
|
const config = evt.detail;
|
476
479
|
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
477
|
-
evt.stopPropagation();
|
478
480
|
}
|
479
481
|
modalConfigChangeHandler(evt) {
|
480
482
|
const config = evt.detail;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { DataType, JSUtils } from "@sankhyalabs/core";
|
2
|
+
export function getSelectedRecordsIDsInfo(dataUnit) {
|
3
|
+
const selectionInfo = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo();
|
4
|
+
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
5
|
+
return [];
|
6
|
+
}
|
7
|
+
const selectedRecordsIDsInfo = [];
|
8
|
+
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
9
|
+
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
10
|
+
selectedRecords.forEach(({ __record__id__ }) => {
|
11
|
+
if (!dataUnit.isNewRecord(__record__id__)) {
|
12
|
+
/*
|
13
|
+
Esse if foi necessário para tratar corretamente o ID
|
14
|
+
do record quando está sendo utilizado no modo standAlone
|
15
|
+
isso não faz a exportação da grid funcionar no modo standAlone
|
16
|
+
mas deixa de causar erro nas oprações de CRUD.
|
17
|
+
*/
|
18
|
+
if (!JSUtils.isBase64(__record__id__)) {
|
19
|
+
selectedRecordsIDsInfo.push({
|
20
|
+
name: "__record__id__",
|
21
|
+
type: DataType.TEXT,
|
22
|
+
value: __record__id__
|
23
|
+
});
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
27
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
28
|
+
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
29
|
+
if (metadataField == undefined) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
33
|
+
});
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
return selectedRecordsIDsInfo;
|
38
|
+
}
|
@@ -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 };
|
@@ -8,6 +8,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
9
9
|
import './filter-item-type.enum.js';
|
10
10
|
import './form-config-fetcher.js';
|
11
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
11
12
|
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
12
13
|
|
13
14
|
const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
|
@@ -168,7 +169,6 @@ var SaveErrorsEnum;
|
|
168
169
|
|
169
170
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
170
171
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
171
|
-
const NUFIN_COLUMN = 'NUFIN';
|
172
172
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
173
173
|
class Actions {
|
174
174
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -180,6 +180,10 @@ class Actions {
|
|
180
180
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
181
181
|
this._appResourceId = appResourceId;
|
182
182
|
}
|
183
|
+
getPrimaryKeys() {
|
184
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
185
|
+
return ids.map(({ name }) => name);
|
186
|
+
}
|
183
187
|
apply(action, hasParamsToSave) {
|
184
188
|
this._application.closePopUp();
|
185
189
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -448,6 +452,7 @@ class Actions {
|
|
448
452
|
executeAction(execSource);
|
449
453
|
}
|
450
454
|
addRows(execSource) {
|
455
|
+
const primaryKeys = this.getPrimaryKeys();
|
451
456
|
const rows = {
|
452
457
|
row: []
|
453
458
|
};
|
@@ -461,15 +466,13 @@ class Actions {
|
|
461
466
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
462
467
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
463
468
|
}
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
row.field = [];
|
469
|
-
}
|
469
|
+
if (!row.field) {
|
470
|
+
row.field = [];
|
471
|
+
}
|
472
|
+
for (const primaryKey of primaryKeys) {
|
470
473
|
row.field.push({
|
471
|
-
fieldName:
|
472
|
-
$: sourceRow[
|
474
|
+
fieldName: primaryKey,
|
475
|
+
$: sourceRow[primaryKey]
|
473
476
|
});
|
474
477
|
}
|
475
478
|
rows.row.push(row);
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { Action, ObjectUtils,
|
2
|
+
import { Action, ObjectUtils, DataUnitAction, 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
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
5
6
|
|
6
7
|
const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
7
8
|
constructor() {
|
@@ -125,43 +126,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
125
126
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
126
127
|
*/
|
127
128
|
async getSelectedRecordsIDsInfo() {
|
128
|
-
|
129
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
130
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
131
|
-
return [];
|
132
|
-
}
|
133
|
-
const selectedRecordsIDsInfo = [];
|
134
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
135
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
136
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
137
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
138
|
-
/*
|
139
|
-
Esse if foi necessário para tratar corretamente o ID
|
140
|
-
do record quando está sendo utilizado no modo standAlone
|
141
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
142
|
-
mas deixa de causar erro nas oprações de CRUD.
|
143
|
-
*/
|
144
|
-
if (!JSUtils.isBase64(__record__id__)) {
|
145
|
-
selectedRecordsIDsInfo.push({
|
146
|
-
name: "__record__id__",
|
147
|
-
type: DataType.TEXT,
|
148
|
-
value: __record__id__
|
149
|
-
});
|
150
|
-
return;
|
151
|
-
}
|
152
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
153
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
154
|
-
var _a;
|
155
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
156
|
-
if (metadataField == undefined) {
|
157
|
-
return;
|
158
|
-
}
|
159
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
160
|
-
});
|
161
|
-
}
|
162
|
-
});
|
163
|
-
}
|
164
|
-
return selectedRecordsIDsInfo;
|
129
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
165
130
|
}
|
166
131
|
getCleanOnCopyFields() {
|
167
132
|
var _a;
|
@@ -500,9 +500,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
500
500
|
window.removeEventListener("keydown", this._keyDownHandler);
|
501
501
|
}
|
502
502
|
gridConfigChangeHandler(evt) {
|
503
|
+
evt.stopPropagation();
|
504
|
+
if (!this.configName)
|
505
|
+
return;
|
503
506
|
const config = evt.detail;
|
504
507
|
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
505
|
-
evt.stopPropagation();
|
506
508
|
}
|
507
509
|
modalConfigChangeHandler(evt) {
|
508
510
|
const config = evt.detail;
|
@@ -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 };
|
@@ -9,6 +9,7 @@ import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
10
|
import './filter-item-type.enum-d45e026f.js';
|
11
11
|
import './form-config-fetcher-e0382e5a.js';
|
12
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
|
12
13
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
13
14
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
14
15
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
|
@@ -167,7 +168,6 @@ var RefreshType;
|
|
167
168
|
|
168
169
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
169
170
|
const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
170
|
-
const NUFIN_COLUMN = 'NUFIN';
|
171
171
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
172
172
|
class Actions {
|
173
173
|
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
@@ -179,6 +179,10 @@ class Actions {
|
|
179
179
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
180
180
|
this._appResourceId = appResourceId;
|
181
181
|
}
|
182
|
+
getPrimaryKeys() {
|
183
|
+
const ids = getSelectedRecordsIDsInfo(this._dataUnit);
|
184
|
+
return ids.map(({ name }) => name);
|
185
|
+
}
|
182
186
|
apply(action, hasParamsToSave) {
|
183
187
|
this._application.closePopUp();
|
184
188
|
this._actionsExecuteInterface.execute(action, this._dataUnit)
|
@@ -447,6 +451,7 @@ class Actions {
|
|
447
451
|
executeAction(execSource);
|
448
452
|
}
|
449
453
|
addRows(execSource) {
|
454
|
+
const primaryKeys = this.getPrimaryKeys();
|
450
455
|
const rows = {
|
451
456
|
row: []
|
452
457
|
};
|
@@ -460,15 +465,13 @@ class Actions {
|
|
460
465
|
delete sourceRow[MASTER_ROW_PROPERTY];
|
461
466
|
delete sourceRow[ENTITY_NAME_PROPERTY];
|
462
467
|
}
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
row.field = [];
|
468
|
-
}
|
468
|
+
if (!row.field) {
|
469
|
+
row.field = [];
|
470
|
+
}
|
471
|
+
for (const primaryKey of primaryKeys) {
|
469
472
|
row.field.push({
|
470
|
-
fieldName:
|
471
|
-
$: sourceRow[
|
473
|
+
fieldName: primaryKey,
|
474
|
+
$: sourceRow[primaryKey]
|
472
475
|
});
|
473
476
|
}
|
474
477
|
rows.row.push(row);
|
@@ -4,10 +4,11 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
|
|
4
4
|
import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './index-0ece87a6.js';
|
5
5
|
import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-8457af36.js';
|
6
6
|
import { D as DataFetcher } from './DataFetcher-773a3e4b.js';
|
7
|
-
import { S as SnkDataUnit } from './snk-data-unit-
|
7
|
+
import { S as SnkDataUnit } from './snk-data-unit-e85c0088.js';
|
8
8
|
import './PrintUtils-3e4ff0f5.js';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
10
|
import './SnkMessageBuilder-72423074.js';
|
11
|
+
import './GetSelectedRecordsIDsInfo-9fa41508.js';
|
11
12
|
|
12
13
|
class ItemBuilder {
|
13
14
|
constructor(getMessage, selectedNumber) {
|