@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-56414.2 → 0.0.0-bugfix-dev-KB-55400.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{IExporterProvider-91e8acd9.js → IExporterProvider-8687eea9.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-4259edbe.js → SnkFormConfigManager-df34d678.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-9b3c2a2d.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-d15951b1.js → pesquisa-fetcher-610c2d29.js} +6 -11
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +2 -1
- package/dist/cjs/snk-application.cjs.entry.js +3 -2
- package/dist/cjs/snk-attach.cjs.entry.js +22 -12
- package/dist/cjs/snk-crud.cjs.entry.js +2 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -3
- package/dist/cjs/{snk-data-unit-7798c5c4.js → snk-data-unit-63589ae8.js} +81 -23
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +5 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -5
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +3 -2
- package/dist/cjs/{snk-guides-viewer-eee0b978.js → snk-guides-viewer-bef9ca55.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -4
- package/dist/collection/components/snk-attach/snk-attach.js +20 -11
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +100 -23
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +3 -12
- package/dist/collection/lib/message/SnkMessageBuilder.js +21 -21
- package/dist/components/SnkFormConfigManager.js +2 -2
- package/dist/components/SnkMessageBuilder.js +1 -1
- package/dist/components/dataunit-fetcher.js +3 -12
- package/dist/components/snk-attach2.js +20 -11
- package/dist/components/snk-data-unit2.js +82 -23
- package/dist/components/snk-filter-bar2.js +0 -5
- package/dist/components/snk-simple-crud2.js +9 -1
- package/dist/esm/{IExporterProvider-c3bd60f3.js → IExporterProvider-0af5ebd3.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-a87ade7a.js → SnkFormConfigManager-02e9bdcd.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-a26aa279.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-9e18940f.js → pesquisa-fetcher-253715e4.js} +3 -12
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +2 -1
- package/dist/esm/snk-application.entry.js +3 -2
- package/dist/esm/snk-attach.entry.js +22 -12
- package/dist/esm/snk-crud.entry.js +2 -1
- package/dist/esm/snk-data-exporter.entry.js +4 -3
- package/dist/esm/{snk-data-unit-592a8ed3.js → snk-data-unit-0252289c.js} +82 -24
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +5 -4
- package/dist/esm/snk-filter-bar.entry.js +0 -5
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +3 -2
- package/dist/esm/{snk-guides-viewer-4fd4e25a.js → snk-guides-viewer-96253964.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -3
- package/dist/esm/snk-simple-crud.entry.js +13 -4
- package/dist/sankhyablocks/p-41c05011.js +1 -0
- package/dist/sankhyablocks/{p-65b6dba3.entry.js → p-4a16dc22.entry.js} +1 -1
- package/dist/sankhyablocks/p-4d10e705.entry.js +1 -0
- package/dist/sankhyablocks/p-5447a6a6.entry.js +1 -0
- package/dist/sankhyablocks/p-5e7fa584.entry.js +1 -0
- package/dist/sankhyablocks/p-61984566.entry.js +1 -0
- package/dist/sankhyablocks/p-674e142a.js +1 -0
- package/dist/sankhyablocks/p-69bf12f9.js +65 -0
- package/dist/sankhyablocks/p-74eed0fd.entry.js +1 -0
- package/dist/sankhyablocks/p-79bae662.entry.js +1 -0
- package/dist/sankhyablocks/p-89b544c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-9b94aaa9.js → p-93b9da9b.js} +1 -1
- package/dist/sankhyablocks/{p-52ec26b8.entry.js → p-accfaecf.entry.js} +3 -3
- package/dist/sankhyablocks/p-ad73e9d7.entry.js +1 -0
- package/dist/sankhyablocks/{p-32556aa6.js → p-bc51e7ca.js} +1 -1
- package/dist/sankhyablocks/{p-e0649a17.js → p-e8bbd578.js} +1 -1
- package/dist/sankhyablocks/{p-388d00f5.entry.js → p-ea89c934.entry.js} +1 -1
- package/dist/sankhyablocks/p-ecfa87e8.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +16 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-07d324ba.entry.js +0 -1
- package/dist/sankhyablocks/p-0e8702f0.js +0 -1
- package/dist/sankhyablocks/p-1e5dffbf.js +0 -1
- package/dist/sankhyablocks/p-2345687c.entry.js +0 -1
- package/dist/sankhyablocks/p-3de247d1.entry.js +0 -1
- package/dist/sankhyablocks/p-595e7068.entry.js +0 -1
- package/dist/sankhyablocks/p-775253f7.entry.js +0 -1
- package/dist/sankhyablocks/p-7d6897ec.entry.js +0 -1
- package/dist/sankhyablocks/p-81abd586.entry.js +0 -1
- package/dist/sankhyablocks/p-8fadeb65.entry.js +0 -1
- package/dist/sankhyablocks/p-ac2fc78d.entry.js +0 -1
- package/dist/sankhyablocks/p-f678bffa.js +0 -65
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
6
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
6
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-9b3c2a2d.js');
|
|
7
7
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
8
8
|
|
|
9
9
|
const SnkDataUnit = class {
|
|
@@ -12,10 +12,12 @@ const SnkDataUnit = class {
|
|
|
12
12
|
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
|
13
13
|
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
|
14
14
|
this.messagesBuilderUpdated = index.createEvent(this, "messagesBuilderUpdated", 3);
|
|
15
|
+
this.dataUnitFieldsHidded = index.createEvent(this, "dataUnitFieldsHidded", 7);
|
|
15
16
|
this.insertionMode = index.createEvent(this, "insertionMode", 3);
|
|
16
17
|
this.cancelEdition = index.createEvent(this, "cancelEdition", 3);
|
|
17
18
|
this._onDataUnitResolve = [];
|
|
18
19
|
this._openedAlert = false;
|
|
20
|
+
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
19
21
|
this._dataUnitObserver = (action) => {
|
|
20
22
|
var _a, _b;
|
|
21
23
|
const duState = this.buildDataState();
|
|
@@ -60,6 +62,7 @@ const SnkDataUnit = class {
|
|
|
60
62
|
}
|
|
61
63
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
62
64
|
};
|
|
65
|
+
this.fieldsToLink = [];
|
|
63
66
|
this.dataState = undefined;
|
|
64
67
|
this.messagesBuilder = undefined;
|
|
65
68
|
this.dataUnitName = undefined;
|
|
@@ -101,7 +104,6 @@ const SnkDataUnit = class {
|
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
observeDataUnit() {
|
|
104
|
-
this.loadDataUnit();
|
|
105
107
|
this.handlerLinkFields();
|
|
106
108
|
this.dataUnitReady.emit(this.dataUnit);
|
|
107
109
|
}
|
|
@@ -140,7 +142,7 @@ const SnkDataUnit = class {
|
|
|
140
142
|
switch (action.type) {
|
|
141
143
|
case core.Action.RECORDS_ADDED:
|
|
142
144
|
if (this.isAllowed("INSERT")) {
|
|
143
|
-
resolve(action);
|
|
145
|
+
resolve(new core.DataUnitAction(core.Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload)));
|
|
144
146
|
}
|
|
145
147
|
else {
|
|
146
148
|
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
@@ -148,21 +150,15 @@ const SnkDataUnit = class {
|
|
|
148
150
|
break;
|
|
149
151
|
case core.Action.RECORDS_COPIED:
|
|
150
152
|
if (this.isAllowed("CLONE")) {
|
|
151
|
-
|
|
152
|
-
if (cleanFields.length > 0) {
|
|
153
|
-
const records = action.payload;
|
|
154
|
-
action = new core.DataUnitAction(core.Action.RECORDS_COPIED, records.map(record => {
|
|
155
|
-
const newRecord = Object.assign({}, record);
|
|
156
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
157
|
-
return newRecord;
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
resolve(action);
|
|
153
|
+
resolve(new core.DataUnitAction(core.Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload)));
|
|
161
154
|
}
|
|
162
155
|
else {
|
|
163
156
|
utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
164
157
|
}
|
|
165
158
|
break;
|
|
159
|
+
case core.Action.METADATA_LOADED:
|
|
160
|
+
resolve(new core.DataUnitAction(core.Action.METADATA_LOADED, this.handleMetadataLoaded(action.payload)));
|
|
161
|
+
break;
|
|
166
162
|
case core.Action.DATA_CHANGED:
|
|
167
163
|
case core.Action.CHANGING_DATA:
|
|
168
164
|
if (this.isAllowed("UPDATE"))
|
|
@@ -256,6 +252,47 @@ const SnkDataUnit = class {
|
|
|
256
252
|
}
|
|
257
253
|
});
|
|
258
254
|
}
|
|
255
|
+
handleMetadataLoaded(payload) {
|
|
256
|
+
const metadata = Object.assign({}, payload);
|
|
257
|
+
this.processLinks(metadata);
|
|
258
|
+
return metadata;
|
|
259
|
+
}
|
|
260
|
+
handleRecordsCopied(initialRecords) {
|
|
261
|
+
let records = [...initialRecords];
|
|
262
|
+
records = this.handleCleanOnCopy(records);
|
|
263
|
+
return this.handleLinksWithParent(records);
|
|
264
|
+
}
|
|
265
|
+
handleLinksWithParent(records) {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
268
|
+
if (!parentDataUnit)
|
|
269
|
+
return records;
|
|
270
|
+
const parentSelectedRecord = parentDataUnit.getSelectedRecord();
|
|
271
|
+
const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
|
|
272
|
+
const { links } = selfInfo;
|
|
273
|
+
if (!links || links.length === 0)
|
|
274
|
+
return records;
|
|
275
|
+
return records.map(record => {
|
|
276
|
+
return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
|
|
280
|
+
const newRecord = Object.assign({}, record);
|
|
281
|
+
links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
|
|
282
|
+
return newRecord;
|
|
283
|
+
}
|
|
284
|
+
handleCleanOnCopy(records) {
|
|
285
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
286
|
+
if (cleanFields.length > 0) {
|
|
287
|
+
records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
|
|
288
|
+
}
|
|
289
|
+
return records;
|
|
290
|
+
}
|
|
291
|
+
buildCopyWithCleanedFields(record, cleanFields) {
|
|
292
|
+
const newRecord = Object.assign({}, record);
|
|
293
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
294
|
+
return newRecord;
|
|
295
|
+
}
|
|
259
296
|
showSuccessMessage(message) {
|
|
260
297
|
utils.ApplicationUtils.info(message, { iconName: "check" });
|
|
261
298
|
}
|
|
@@ -346,20 +383,40 @@ const SnkDataUnit = class {
|
|
|
346
383
|
return;
|
|
347
384
|
}
|
|
348
385
|
handlerLinkFields() {
|
|
349
|
-
var _a, _b;
|
|
350
|
-
const
|
|
351
|
-
if (!
|
|
386
|
+
var _a, _b, _c, _d;
|
|
387
|
+
const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
388
|
+
if (!parentDU)
|
|
352
389
|
return;
|
|
353
|
-
const
|
|
390
|
+
const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
|
|
391
|
+
const child = parentDU.getChildInfo(childName);
|
|
354
392
|
if (!child)
|
|
355
393
|
return;
|
|
356
|
-
const
|
|
357
|
-
(
|
|
358
|
-
|
|
394
|
+
const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
|
|
395
|
+
this.handleDUWithLinks(links);
|
|
396
|
+
}
|
|
397
|
+
handleDUWithLinks(fieldsToLink) {
|
|
398
|
+
this.fieldsToLink = fieldsToLink;
|
|
399
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
400
|
+
this.processLinks(metadata);
|
|
401
|
+
this.dataUnit.metadata = metadata;
|
|
402
|
+
this.dataUnitFieldsHidded.emit();
|
|
403
|
+
}
|
|
404
|
+
processLinks(metadata) {
|
|
405
|
+
var _a;
|
|
406
|
+
(_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
407
|
+
var _a;
|
|
408
|
+
if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
|
|
359
409
|
field.visible = false;
|
|
360
410
|
}
|
|
361
411
|
});
|
|
362
|
-
|
|
412
|
+
}
|
|
413
|
+
getCleanDataUnitName() {
|
|
414
|
+
var _a;
|
|
415
|
+
const uri = this.dataUnit.name;
|
|
416
|
+
if (core.StringUtils.isEmpty(uri))
|
|
417
|
+
return uri;
|
|
418
|
+
const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
|
|
419
|
+
return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
|
|
363
420
|
}
|
|
364
421
|
static getNearestInstance(element) {
|
|
365
422
|
let parent = element.parentElement;
|
|
@@ -386,8 +443,9 @@ const SnkDataUnit = class {
|
|
|
386
443
|
this.dataUnit.releaseCallbacks();
|
|
387
444
|
}
|
|
388
445
|
}
|
|
389
|
-
componentDidLoad() {
|
|
390
|
-
this.loadDataUnit();
|
|
446
|
+
async componentDidLoad() {
|
|
447
|
+
await this.loadDataUnit();
|
|
448
|
+
this.handlerLinkFields();
|
|
391
449
|
}
|
|
392
450
|
render() {
|
|
393
451
|
return (index.h(index.Host, null));
|
|
@@ -2,11 +2,11 @@
|
|
|
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-63589ae8.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
|
-
require('./SnkMessageBuilder-
|
|
9
|
+
require('./SnkMessageBuilder-9b3c2a2d.js');
|
|
10
10
|
require('./RecordIDUtils-3735135c.js');
|
|
11
11
|
|
|
12
12
|
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
7
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-df34d678.js');
|
|
8
8
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
9
9
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
10
|
-
require('./pesquisa-fetcher-
|
|
10
|
+
require('./pesquisa-fetcher-610c2d29.js');
|
|
11
11
|
const index$1 = require('./index-0922807b.js');
|
|
12
12
|
require('./ISave-e91b70a7.js');
|
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
@@ -15,11 +15,12 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
16
16
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
17
17
|
const constants = require('./constants-35ddd366.js');
|
|
18
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
19
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
18
|
+
const snkGuidesViewer = require('./snk-guides-viewer-bef9ca55.js');
|
|
19
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-9b3c2a2d.js');
|
|
20
20
|
require('./ConfigStorage-7df9d3bb.js');
|
|
21
21
|
require('./PrintUtils-bcaeb82f.js');
|
|
22
22
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
23
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
23
24
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
24
25
|
require('./index-102ba62d.js');
|
|
25
26
|
require('./field-search-f56aa7d6.js');
|
|
@@ -296,11 +296,6 @@ const SnkFilterBar = class {
|
|
|
296
296
|
this.handleFilterConfigsChanged(oldValue, newValue);
|
|
297
297
|
}
|
|
298
298
|
handleFilterConfigsChanged(oldValue, newValue) {
|
|
299
|
-
const isEmptyPersonalizedFilter = newValue && newValue.length === 1 ? (newValue[0].id === 'PERSONALIZED_FILTER_GROUP' && newValue[0].groupedItems.length === 0) : false;
|
|
300
|
-
if (oldValue === undefined && isEmptyPersonalizedFilter) {
|
|
301
|
-
this.configUpdated.emit(newValue);
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
299
|
if (oldValue != undefined && newValue == undefined) {
|
|
305
300
|
this._loadingPending = true;
|
|
306
301
|
this._configUpdated = true;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
7
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-df34d678.js');
|
|
8
8
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
|
9
9
|
require('./ConfigStorage-7df9d3bb.js');
|
|
10
10
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
@@ -9,10 +9,10 @@ const ConfigStorage = require('./ConfigStorage-7df9d3bb.js');
|
|
|
9
9
|
const index$1 = require('./index-0922807b.js');
|
|
10
10
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-8687eea9.js');
|
|
13
13
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
14
14
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
15
|
-
require('./pesquisa-fetcher-
|
|
15
|
+
require('./pesquisa-fetcher-610c2d29.js');
|
|
16
16
|
require('./ISave-e91b70a7.js');
|
|
17
17
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
18
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
@@ -21,6 +21,7 @@ const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
|
21
21
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
24
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
24
25
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
25
26
|
|
|
26
27
|
class ServerSideExporterProvider extends IExporterProvider.CommonsExporter {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
5
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-df34d678.js');
|
|
6
6
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
7
7
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
8
8
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
|
10
10
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
11
|
-
require('./pesquisa-fetcher-
|
|
11
|
+
require('./pesquisa-fetcher-610c2d29.js');
|
|
12
12
|
const index$1 = require('./index-0922807b.js');
|
|
13
13
|
require('./ISave-e91b70a7.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-bef9ca55.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
|
-
require('./SnkFormConfigManager-
|
|
8
|
+
require('./SnkFormConfigManager-df34d678.js');
|
|
9
9
|
require('./ConfigStorage-7df9d3bb.js');
|
|
10
10
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
11
11
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -17,9 +17,10 @@ require('./taskbar-elements-d9392685.js');
|
|
|
17
17
|
require('./index-0922807b.js');
|
|
18
18
|
require('./index-102ba62d.js');
|
|
19
19
|
require('./constants-35ddd366.js');
|
|
20
|
-
require('./pesquisa-fetcher-
|
|
20
|
+
require('./pesquisa-fetcher-610c2d29.js');
|
|
21
21
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
22
22
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
23
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
23
24
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
24
25
|
require('./ISave-e91b70a7.js');
|
|
25
26
|
require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
@@ -8,8 +8,8 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
|
8
8
|
const constants = require('./constants-35ddd366.js');
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-d9392685.js');
|
|
10
10
|
const formConfigFetcher = require('./form-config-fetcher-3c4daeb5.js');
|
|
11
|
-
const pesquisaFetcher = require('./pesquisa-fetcher-
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
11
|
+
const pesquisaFetcher = require('./pesquisa-fetcher-610c2d29.js');
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-8687eea9.js');
|
|
13
13
|
const index = require('./index-0922807b.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
@@ -17,11 +17,12 @@ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
19
19
|
const ConfigStorage = require('./ConfigStorage-7df9d3bb.js');
|
|
20
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
|
20
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-df34d678.js');
|
|
21
21
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
22
22
|
const index$2 = require('./index-102ba62d.js');
|
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
|
24
24
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
25
|
+
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
25
26
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
26
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
27
28
|
|
|
@@ -623,13 +624,21 @@ const SnkSimpleCrud = class {
|
|
|
623
624
|
}
|
|
624
625
|
return configFromManager;
|
|
625
626
|
}
|
|
627
|
+
updateFormConfig() {
|
|
628
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
629
|
+
this.setFormConfig(newConfig, true);
|
|
630
|
+
if (this._formConfigManager == undefined) {
|
|
631
|
+
this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
632
|
+
}
|
|
633
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
634
|
+
}
|
|
626
635
|
/* istanbul ignore next */
|
|
627
636
|
render() {
|
|
628
637
|
var _a;
|
|
629
638
|
if (this.dataUnit == undefined) {
|
|
630
639
|
return;
|
|
631
640
|
}
|
|
632
|
-
return (index$1.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
641
|
+
return (index$1.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
633
642
|
? undefined
|
|
634
643
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
635
644
|
}
|
|
@@ -117,15 +117,13 @@ export class SnkAttach {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
loadAnexoSistema() {
|
|
120
|
-
var _a;
|
|
121
120
|
this._currentDataUnit = this._currentDataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
122
|
-
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
123
121
|
if (!this._currentDataUnit.metadata) {
|
|
124
122
|
this._currentDataUnit
|
|
125
123
|
.loadMetadata()
|
|
126
124
|
.then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
|
|
127
125
|
}
|
|
128
|
-
this.
|
|
126
|
+
this.initDataUnitLoaders();
|
|
129
127
|
this._currentDataUnit.addFilterProvider({
|
|
130
128
|
getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
|
|
131
129
|
});
|
|
@@ -135,9 +133,9 @@ export class SnkAttach {
|
|
|
135
133
|
this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
|
|
136
134
|
}
|
|
137
135
|
loadAttach() {
|
|
138
|
-
var _a, _b
|
|
139
|
-
this._currentFetcher = new AttachFetcher();
|
|
136
|
+
var _a, _b;
|
|
140
137
|
this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
|
138
|
+
this.initDataUnitLoaders();
|
|
141
139
|
this._currentDataUnit.addInterceptor({
|
|
142
140
|
interceptAction: (action) => {
|
|
143
141
|
var _a;
|
|
@@ -148,19 +146,30 @@ export class SnkAttach {
|
|
|
148
146
|
return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
|
|
149
147
|
}
|
|
150
148
|
});
|
|
151
|
-
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
152
|
-
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
153
|
-
this.returnToGridMode();
|
|
154
|
-
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
155
|
-
});
|
|
156
149
|
if (!this._currentDataUnit.metadata) {
|
|
157
|
-
(
|
|
150
|
+
(_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata()) === null || _b === void 0 ? void 0 : _b.then(() => {
|
|
158
151
|
var _a, _b;
|
|
159
152
|
this.crudConfig = Object.assign({}, attachCrudConfig);
|
|
160
153
|
(_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
|
|
161
154
|
});
|
|
162
155
|
}
|
|
163
156
|
}
|
|
157
|
+
initDataUnitLoaders() {
|
|
158
|
+
var _a, _b, _c;
|
|
159
|
+
if (this.fetcherType === "AnexoSistema") {
|
|
160
|
+
this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
161
|
+
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
162
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
163
|
+
}
|
|
164
|
+
if (this.fetcherType === "Attach") {
|
|
165
|
+
this._currentFetcher = new AttachFetcher();
|
|
166
|
+
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
167
|
+
(_c = this._currentDataUnitBuilder) === null || _c === void 0 ? void 0 : _c.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
168
|
+
this.returnToGridMode();
|
|
169
|
+
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
164
173
|
disableEditFieldsNotInForm() {
|
|
165
174
|
var _a;
|
|
166
175
|
(_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
|
-
import { Action, ApplicationContext, DataUnitAction, ObjectUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { Action, ApplicationContext, DataUnitAction, ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
|
|
5
5
|
import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
|
|
@@ -7,6 +7,7 @@ export class SnkDataUnit {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this._onDataUnitResolve = [];
|
|
9
9
|
this._openedAlert = false;
|
|
10
|
+
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
10
11
|
this._dataUnitObserver = (action) => {
|
|
11
12
|
var _a, _b;
|
|
12
13
|
const duState = this.buildDataState();
|
|
@@ -51,6 +52,7 @@ export class SnkDataUnit {
|
|
|
51
52
|
}
|
|
52
53
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
53
54
|
};
|
|
55
|
+
this.fieldsToLink = [];
|
|
54
56
|
this.dataState = undefined;
|
|
55
57
|
this.messagesBuilder = undefined;
|
|
56
58
|
this.dataUnitName = undefined;
|
|
@@ -92,7 +94,6 @@ export class SnkDataUnit {
|
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
observeDataUnit() {
|
|
95
|
-
this.loadDataUnit();
|
|
96
97
|
this.handlerLinkFields();
|
|
97
98
|
this.dataUnitReady.emit(this.dataUnit);
|
|
98
99
|
}
|
|
@@ -131,7 +132,7 @@ export class SnkDataUnit {
|
|
|
131
132
|
switch (action.type) {
|
|
132
133
|
case Action.RECORDS_ADDED:
|
|
133
134
|
if (this.isAllowed("INSERT")) {
|
|
134
|
-
resolve(action);
|
|
135
|
+
resolve(new DataUnitAction(Action.RECORDS_ADDED, this.handleLinksWithParent(action.payload)));
|
|
135
136
|
}
|
|
136
137
|
else {
|
|
137
138
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
@@ -139,21 +140,15 @@ export class SnkDataUnit {
|
|
|
139
140
|
break;
|
|
140
141
|
case Action.RECORDS_COPIED:
|
|
141
142
|
if (this.isAllowed("CLONE")) {
|
|
142
|
-
|
|
143
|
-
if (cleanFields.length > 0) {
|
|
144
|
-
const records = action.payload;
|
|
145
|
-
action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
146
|
-
const newRecord = Object.assign({}, record);
|
|
147
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
148
|
-
return newRecord;
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
resolve(action);
|
|
143
|
+
resolve(new DataUnitAction(Action.RECORDS_COPIED, this.handleRecordsCopied(action.payload)));
|
|
152
144
|
}
|
|
153
145
|
else {
|
|
154
146
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
155
147
|
}
|
|
156
148
|
break;
|
|
149
|
+
case Action.METADATA_LOADED:
|
|
150
|
+
resolve(new DataUnitAction(Action.METADATA_LOADED, this.handleMetadataLoaded(action.payload)));
|
|
151
|
+
break;
|
|
157
152
|
case Action.DATA_CHANGED:
|
|
158
153
|
case Action.CHANGING_DATA:
|
|
159
154
|
if (this.isAllowed("UPDATE"))
|
|
@@ -247,6 +242,47 @@ export class SnkDataUnit {
|
|
|
247
242
|
}
|
|
248
243
|
});
|
|
249
244
|
}
|
|
245
|
+
handleMetadataLoaded(payload) {
|
|
246
|
+
const metadata = Object.assign({}, payload);
|
|
247
|
+
this.processLinks(metadata);
|
|
248
|
+
return metadata;
|
|
249
|
+
}
|
|
250
|
+
handleRecordsCopied(initialRecords) {
|
|
251
|
+
let records = [...initialRecords];
|
|
252
|
+
records = this.handleCleanOnCopy(records);
|
|
253
|
+
return this.handleLinksWithParent(records);
|
|
254
|
+
}
|
|
255
|
+
handleLinksWithParent(records) {
|
|
256
|
+
var _a, _b;
|
|
257
|
+
const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
258
|
+
if (!parentDataUnit)
|
|
259
|
+
return records;
|
|
260
|
+
const parentSelectedRecord = parentDataUnit.getSelectedRecord();
|
|
261
|
+
const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
|
|
262
|
+
const { links } = selfInfo;
|
|
263
|
+
if (!links || links.length === 0)
|
|
264
|
+
return records;
|
|
265
|
+
return records.map(record => {
|
|
266
|
+
return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
|
|
270
|
+
const newRecord = Object.assign({}, record);
|
|
271
|
+
links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
|
|
272
|
+
return newRecord;
|
|
273
|
+
}
|
|
274
|
+
handleCleanOnCopy(records) {
|
|
275
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
276
|
+
if (cleanFields.length > 0) {
|
|
277
|
+
records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
|
|
278
|
+
}
|
|
279
|
+
return records;
|
|
280
|
+
}
|
|
281
|
+
buildCopyWithCleanedFields(record, cleanFields) {
|
|
282
|
+
const newRecord = Object.assign({}, record);
|
|
283
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
284
|
+
return newRecord;
|
|
285
|
+
}
|
|
250
286
|
showSuccessMessage(message) {
|
|
251
287
|
ApplicationUtils.info(message, { iconName: "check" });
|
|
252
288
|
}
|
|
@@ -337,20 +373,40 @@ export class SnkDataUnit {
|
|
|
337
373
|
return;
|
|
338
374
|
}
|
|
339
375
|
handlerLinkFields() {
|
|
340
|
-
var _a, _b;
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
376
|
+
var _a, _b, _c, _d;
|
|
377
|
+
const parentDU = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
378
|
+
if (!parentDU)
|
|
343
379
|
return;
|
|
344
|
-
const
|
|
380
|
+
const childName = (_c = this.entityName) !== null && _c !== void 0 ? _c : this.getCleanDataUnitName();
|
|
381
|
+
const child = parentDU.getChildInfo(childName);
|
|
345
382
|
if (!child)
|
|
346
383
|
return;
|
|
347
|
-
const
|
|
348
|
-
(
|
|
349
|
-
|
|
384
|
+
const links = (_d = child === null || child === void 0 ? void 0 : child.links) === null || _d === void 0 ? void 0 : _d.map(link => link.target);
|
|
385
|
+
this.handleDUWithLinks(links);
|
|
386
|
+
}
|
|
387
|
+
handleDUWithLinks(fieldsToLink) {
|
|
388
|
+
this.fieldsToLink = fieldsToLink;
|
|
389
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
390
|
+
this.processLinks(metadata);
|
|
391
|
+
this.dataUnit.metadata = metadata;
|
|
392
|
+
this.dataUnitFieldsHidded.emit();
|
|
393
|
+
}
|
|
394
|
+
processLinks(metadata) {
|
|
395
|
+
var _a;
|
|
396
|
+
(_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
397
|
+
var _a;
|
|
398
|
+
if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
|
|
350
399
|
field.visible = false;
|
|
351
400
|
}
|
|
352
401
|
});
|
|
353
|
-
|
|
402
|
+
}
|
|
403
|
+
getCleanDataUnitName() {
|
|
404
|
+
var _a;
|
|
405
|
+
const uri = this.dataUnit.name;
|
|
406
|
+
if (StringUtils.isEmpty(uri))
|
|
407
|
+
return uri;
|
|
408
|
+
const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
|
|
409
|
+
return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
|
|
354
410
|
}
|
|
355
411
|
static getNearestInstance(element) {
|
|
356
412
|
let parent = element.parentElement;
|
|
@@ -377,8 +433,9 @@ export class SnkDataUnit {
|
|
|
377
433
|
this.dataUnit.releaseCallbacks();
|
|
378
434
|
}
|
|
379
435
|
}
|
|
380
|
-
componentDidLoad() {
|
|
381
|
-
this.loadDataUnit();
|
|
436
|
+
async componentDidLoad() {
|
|
437
|
+
await this.loadDataUnit();
|
|
438
|
+
this.handlerLinkFields();
|
|
382
439
|
}
|
|
383
440
|
render() {
|
|
384
441
|
return (h(Host, null));
|
|
@@ -612,6 +669,11 @@ export class SnkDataUnit {
|
|
|
612
669
|
}
|
|
613
670
|
};
|
|
614
671
|
}
|
|
672
|
+
static get states() {
|
|
673
|
+
return {
|
|
674
|
+
"fieldsToLink": {}
|
|
675
|
+
};
|
|
676
|
+
}
|
|
615
677
|
static get events() {
|
|
616
678
|
return [{
|
|
617
679
|
"method": "dataStateChange",
|
|
@@ -672,6 +734,21 @@ export class SnkDataUnit {
|
|
|
672
734
|
}
|
|
673
735
|
}
|
|
674
736
|
}
|
|
737
|
+
}, {
|
|
738
|
+
"method": "dataUnitFieldsHidded",
|
|
739
|
+
"name": "dataUnitFieldsHidded",
|
|
740
|
+
"bubbles": true,
|
|
741
|
+
"cancelable": true,
|
|
742
|
+
"composed": true,
|
|
743
|
+
"docs": {
|
|
744
|
+
"tags": [],
|
|
745
|
+
"text": "Emitido quando h\u00E1 campos no DataUnit que devem ser ocultados."
|
|
746
|
+
},
|
|
747
|
+
"complexType": {
|
|
748
|
+
"original": "void",
|
|
749
|
+
"resolved": "void",
|
|
750
|
+
"references": {}
|
|
751
|
+
}
|
|
675
752
|
}, {
|
|
676
753
|
"method": "insertionMode",
|
|
677
754
|
"name": "insertionMode",
|
|
@@ -47,11 +47,6 @@ export class SnkFilterBar {
|
|
|
47
47
|
this.handleFilterConfigsChanged(oldValue, newValue);
|
|
48
48
|
}
|
|
49
49
|
handleFilterConfigsChanged(oldValue, newValue) {
|
|
50
|
-
const isEmptyPersonalizedFilter = newValue && newValue.length === 1 ? (newValue[0].id === 'PERSONALIZED_FILTER_GROUP' && newValue[0].groupedItems.length === 0) : false;
|
|
51
|
-
if (oldValue === undefined && isEmptyPersonalizedFilter) {
|
|
52
|
-
this.configUpdated.emit(newValue);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
50
|
if (oldValue != undefined && newValue == undefined) {
|
|
56
51
|
this._loadingPending = true;
|
|
57
52
|
this._configUpdated = true;
|