@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-55400.0 → 0.0.0-bugfix-dev-KB-55396.1
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-8687eea9.js → IExporterProvider-e895a65b.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-df34d678.js → SnkFormConfigManager-4259edbe.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-9b3c2a2d.js → SnkMessageBuilder-66aa2557.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-610c2d29.js → pesquisa-fetcher-007b0b20.js} +2 -3
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-63589ae8.js → snk-data-unit-abd2113f.js} +22 -81
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-bef9ca55.js → snk-guides-viewer-4b9325a1.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -12
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -100
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +2 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +1 -9
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +2 -3
- 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 +2 -3
- package/dist/components/snk-data-unit2.js +22 -82
- package/dist/components/snk-simple-crud2.js +1 -9
- package/dist/esm/{IExporterProvider-0af5ebd3.js → IExporterProvider-95e5915d.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-02e9bdcd.js → SnkFormConfigManager-a87ade7a.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-a26aa279.js → SnkMessageBuilder-0a4becdd.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-253715e4.js → pesquisa-fetcher-45514372.js} +2 -3
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-0252289c.js → snk-data-unit-29eba11a.js} +23 -82
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-96253964.js → snk-guides-viewer-dd85bafc.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +4 -12
- package/dist/sankhyablocks/p-07825198.js +1 -0
- package/dist/sankhyablocks/p-0e8702f0.js +1 -0
- package/dist/sankhyablocks/{p-ad73e9d7.entry.js → p-1a57b813.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bc51e7ca.js → p-32556aa6.js} +1 -1
- package/dist/sankhyablocks/{p-79bae662.entry.js → p-5c705ea6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e8bbd578.js → p-5d9145ba.js} +1 -1
- package/dist/sankhyablocks/{p-4a16dc22.entry.js → p-65b6dba3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5447a6a6.entry.js → p-66c0768a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-69bf12f9.js → p-6d1044f2.js} +3 -3
- package/dist/sankhyablocks/{p-accfaecf.entry.js → p-a7094d19.entry.js} +3 -3
- package/dist/sankhyablocks/{p-ecfa87e8.entry.js → p-c1396626.entry.js} +1 -1
- package/dist/sankhyablocks/{p-93b9da9b.js → p-d8711aff.js} +1 -1
- package/dist/sankhyablocks/{p-89b544c9.entry.js → p-daace51f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4d10e705.entry.js → p-edb61a19.entry.js} +1 -1
- package/dist/sankhyablocks/{p-74eed0fd.entry.js → p-f08071e0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ea89c934.entry.js → p-f5450592.entry.js} +1 -1
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -16
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -1
- package/dist/types/components.d.ts +0 -4
- package/package.json +1 -1
- package/dist/sankhyablocks/p-41c05011.js +0 -1
- package/dist/sankhyablocks/p-5e7fa584.entry.js +0 -1
- package/dist/sankhyablocks/p-674e142a.js +0 -1
|
@@ -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-4b9325a1.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
|
-
require('./SnkFormConfigManager-
|
|
8
|
+
require('./SnkFormConfigManager-4259edbe.js');
|
|
9
9
|
require('./ConfigStorage-7df9d3bb.js');
|
|
10
10
|
require('./form-config-fetcher-3c4daeb5.js');
|
|
11
11
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -17,7 +17,7 @@ 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-007b0b20.js');
|
|
21
21
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
22
22
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
23
23
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
@@ -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-007b0b20.js');
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-e895a65b.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,7 +17,7 @@ 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-4259edbe.js');
|
|
21
21
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
22
22
|
const index$2 = require('./index-102ba62d.js');
|
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -624,21 +624,13 @@ const SnkSimpleCrud = class {
|
|
|
624
624
|
}
|
|
625
625
|
return configFromManager;
|
|
626
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
|
-
}
|
|
635
627
|
/* istanbul ignore next */
|
|
636
628
|
render() {
|
|
637
629
|
var _a;
|
|
638
630
|
if (this.dataUnit == undefined) {
|
|
639
631
|
return;
|
|
640
632
|
}
|
|
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
|
|
633
|
+
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)
|
|
642
634
|
? undefined
|
|
643
635
|
: 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() }))));
|
|
644
636
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
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
5
|
import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
|
|
@@ -7,7 +7,6 @@ export class SnkDataUnit {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this._onDataUnitResolve = [];
|
|
9
9
|
this._openedAlert = false;
|
|
10
|
-
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
11
10
|
this._dataUnitObserver = (action) => {
|
|
12
11
|
var _a, _b;
|
|
13
12
|
const duState = this.buildDataState();
|
|
@@ -52,7 +51,6 @@ export class SnkDataUnit {
|
|
|
52
51
|
}
|
|
53
52
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
54
53
|
};
|
|
55
|
-
this.fieldsToLink = [];
|
|
56
54
|
this.dataState = undefined;
|
|
57
55
|
this.messagesBuilder = undefined;
|
|
58
56
|
this.dataUnitName = undefined;
|
|
@@ -132,7 +130,7 @@ export class SnkDataUnit {
|
|
|
132
130
|
switch (action.type) {
|
|
133
131
|
case Action.RECORDS_ADDED:
|
|
134
132
|
if (this.isAllowed("INSERT")) {
|
|
135
|
-
resolve(
|
|
133
|
+
resolve(action);
|
|
136
134
|
}
|
|
137
135
|
else {
|
|
138
136
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
@@ -140,15 +138,21 @@ export class SnkDataUnit {
|
|
|
140
138
|
break;
|
|
141
139
|
case Action.RECORDS_COPIED:
|
|
142
140
|
if (this.isAllowed("CLONE")) {
|
|
143
|
-
|
|
141
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
142
|
+
if (cleanFields.length > 0) {
|
|
143
|
+
const records = action.payload;
|
|
144
|
+
action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
145
|
+
const newRecord = Object.assign({}, record);
|
|
146
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
147
|
+
return newRecord;
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
resolve(action);
|
|
144
151
|
}
|
|
145
152
|
else {
|
|
146
153
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
147
154
|
}
|
|
148
155
|
break;
|
|
149
|
-
case Action.METADATA_LOADED:
|
|
150
|
-
resolve(new DataUnitAction(Action.METADATA_LOADED, this.handleMetadataLoaded(action.payload)));
|
|
151
|
-
break;
|
|
152
156
|
case Action.DATA_CHANGED:
|
|
153
157
|
case Action.CHANGING_DATA:
|
|
154
158
|
if (this.isAllowed("UPDATE"))
|
|
@@ -242,47 +246,6 @@ export class SnkDataUnit {
|
|
|
242
246
|
}
|
|
243
247
|
});
|
|
244
248
|
}
|
|
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
|
-
}
|
|
286
249
|
showSuccessMessage(message) {
|
|
287
250
|
ApplicationUtils.info(message, { iconName: "check" });
|
|
288
251
|
}
|
|
@@ -373,40 +336,20 @@ export class SnkDataUnit {
|
|
|
373
336
|
return;
|
|
374
337
|
}
|
|
375
338
|
handlerLinkFields() {
|
|
376
|
-
var _a, _b
|
|
377
|
-
const
|
|
378
|
-
if (!
|
|
339
|
+
var _a, _b;
|
|
340
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
341
|
+
if (!this._parentDataUnit)
|
|
379
342
|
return;
|
|
380
|
-
const
|
|
381
|
-
const child = parentDU.getChildInfo(childName);
|
|
343
|
+
const child = this._parentDataUnit.getChildInfo(this.entityName);
|
|
382
344
|
if (!child)
|
|
383
345
|
return;
|
|
384
|
-
const
|
|
385
|
-
|
|
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)) {
|
|
346
|
+
const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
|
|
347
|
+
(_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
348
|
+
if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
|
|
399
349
|
field.visible = false;
|
|
400
350
|
}
|
|
401
351
|
});
|
|
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;
|
|
352
|
+
this.dataUnit.metadata = metadata;
|
|
410
353
|
}
|
|
411
354
|
static getNearestInstance(element) {
|
|
412
355
|
let parent = element.parentElement;
|
|
@@ -433,9 +376,8 @@ export class SnkDataUnit {
|
|
|
433
376
|
this.dataUnit.releaseCallbacks();
|
|
434
377
|
}
|
|
435
378
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
this.handlerLinkFields();
|
|
379
|
+
componentDidLoad() {
|
|
380
|
+
this.loadDataUnit();
|
|
439
381
|
}
|
|
440
382
|
render() {
|
|
441
383
|
return (h(Host, null));
|
|
@@ -669,11 +611,6 @@ export class SnkDataUnit {
|
|
|
669
611
|
}
|
|
670
612
|
};
|
|
671
613
|
}
|
|
672
|
-
static get states() {
|
|
673
|
-
return {
|
|
674
|
-
"fieldsToLink": {}
|
|
675
|
-
};
|
|
676
|
-
}
|
|
677
614
|
static get events() {
|
|
678
615
|
return [{
|
|
679
616
|
"method": "dataStateChange",
|
|
@@ -734,21 +671,6 @@ export class SnkDataUnit {
|
|
|
734
671
|
}
|
|
735
672
|
}
|
|
736
673
|
}
|
|
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
|
-
}
|
|
752
674
|
}, {
|
|
753
675
|
"method": "insertionMode",
|
|
754
676
|
"name": "insertionMode",
|
|
@@ -71,11 +71,11 @@ export class SnkFormConfigManager {
|
|
|
71
71
|
var _a;
|
|
72
72
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
73
73
|
if (fields != undefined && fields.length > 0) {
|
|
74
|
-
return fields.map(({ label, name, readOnly
|
|
74
|
+
return fields.map(({ label, name, readOnly }) => {
|
|
75
75
|
if (label == undefined) {
|
|
76
76
|
return dataUnit.getField(name);
|
|
77
77
|
}
|
|
78
|
-
return { name, label, readOnly
|
|
78
|
+
return { name, label, readOnly };
|
|
79
79
|
})
|
|
80
80
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
81
81
|
}
|
|
@@ -549,21 +549,13 @@ export class SnkSimpleCrud {
|
|
|
549
549
|
}
|
|
550
550
|
return configFromManager;
|
|
551
551
|
}
|
|
552
|
-
updateFormConfig() {
|
|
553
|
-
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
|
554
|
-
this.setFormConfig(newConfig, true);
|
|
555
|
-
if (this._formConfigManager == undefined) {
|
|
556
|
-
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
|
557
|
-
}
|
|
558
|
-
this._formConfigManager.setConfig(this.formConfig);
|
|
559
|
-
}
|
|
560
552
|
/* istanbul ignore next */
|
|
561
553
|
render() {
|
|
562
554
|
var _a;
|
|
563
555
|
if (this.dataUnit == undefined) {
|
|
564
556
|
return;
|
|
565
557
|
}
|
|
566
|
-
return (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(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail
|
|
558
|
+
return (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(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, 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: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, 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(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
567
559
|
? undefined
|
|
568
560
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && 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 })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
569
561
|
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
|
@@ -7,6 +7,7 @@ export class DatasetStrategy {
|
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
9
|
processSortingSide(request, dataUnit, serverSideFilters) {
|
|
10
|
+
var _a;
|
|
10
11
|
const localSorting = [];
|
|
11
12
|
const serverSorting = [];
|
|
12
13
|
if (request.sort != undefined) {
|
|
@@ -15,9 +16,7 @@ export class DatasetStrategy {
|
|
|
15
16
|
}
|
|
16
17
|
for (const sort of request.sort) {
|
|
17
18
|
const descriptor = dataUnit.getField(sort.field);
|
|
18
|
-
const local = descriptor
|
|
19
|
-
&& descriptor.properties != undefined
|
|
20
|
-
&& descriptor.properties.calculated === "true";
|
|
19
|
+
const local = ((_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.properties) === null || _a === void 0 ? void 0 : _a.calculated) === "true" || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === UserInterface.LONGTEXT;
|
|
21
20
|
if (local) {
|
|
22
21
|
localSorting.push(sort);
|
|
23
22
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import snkDataUnitMessages from "./resources/snk-data-unit.msg";
|
|
2
|
-
import snkFilterBarMessages from "./resources/snk-filter-bar.msg";
|
|
3
|
-
import snkTaskbarMessages from "./resources/snk-taskbar.msg";
|
|
4
|
-
import crudUtilsMessages from "./resources/crud-utils.msg";
|
|
5
|
-
import snkExporterMessages from "./resources/snk-exporter.msg";
|
|
6
|
-
import snkCrudMessages from "./resources/snk-crud.msg";
|
|
7
|
-
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg";
|
|
8
|
-
import fileViewerMessages from "./resources/file-viewer.msg";
|
|
9
|
-
import snkApplicationMessages from "./resources/snk-application.msg";
|
|
10
|
-
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg";
|
|
11
|
-
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg";
|
|
12
|
-
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg";
|
|
13
|
-
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg";
|
|
14
|
-
import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg";
|
|
15
|
-
import { snkFilterFieldSearchMessages } from "./resources/snk-filter-field-search.msg";
|
|
16
|
-
import { snkSimpleBarMessages } from './resources/snk-simple-bar.msg';
|
|
1
|
+
import snkDataUnitMessages from "./resources/snk-data-unit.msg.js";
|
|
2
|
+
import snkFilterBarMessages from "./resources/snk-filter-bar.msg.js";
|
|
3
|
+
import snkTaskbarMessages from "./resources/snk-taskbar.msg.js";
|
|
4
|
+
import crudUtilsMessages from "./resources/crud-utils.msg.js";
|
|
5
|
+
import snkExporterMessages from "./resources/snk-exporter.msg.js";
|
|
6
|
+
import snkCrudMessages from "./resources/snk-crud.msg.js";
|
|
7
|
+
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg.js";
|
|
8
|
+
import fileViewerMessages from "./resources/file-viewer.msg.js";
|
|
9
|
+
import snkApplicationMessages from "./resources/snk-application.msg.js";
|
|
10
|
+
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg.js";
|
|
11
|
+
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg.js";
|
|
12
|
+
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg.js";
|
|
13
|
+
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg.js";
|
|
14
|
+
import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg.js";
|
|
15
|
+
import { snkFilterFieldSearchMessages } from "./resources/snk-filter-field-search.msg.js";
|
|
16
|
+
import { snkSimpleBarMessages } from './resources/snk-simple-bar.msg.js';
|
|
17
17
|
import { snkAttachMessages } from "./resources/snk-attach.msg";
|
|
18
|
-
import { snkPersonalizedFilterMessages } from "./resources/snk-personalized-filter.msg";
|
|
19
|
-
import { snkEntityListMessages } from "./resources/snk-entity-list.msg";
|
|
20
|
-
import { snkActionsButtonMessages } from "./resources/snk-actions-button.msg";
|
|
21
|
-
import { snkPrintSelectorMessages } from "./resources/snk-print-selector.msg";
|
|
18
|
+
import { snkPersonalizedFilterMessages } from "./resources/snk-personalized-filter.msg.js";
|
|
19
|
+
import { snkEntityListMessages } from "./resources/snk-entity-list.msg.js";
|
|
20
|
+
import { snkActionsButtonMessages } from "./resources/snk-actions-button.msg.js";
|
|
21
|
+
import { snkPrintSelectorMessages } from "./resources/snk-print-selector.msg.js";
|
|
22
22
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
23
23
|
export class SnkMessageBuilder {
|
|
24
24
|
constructor(domainName) {
|
|
@@ -55,7 +55,7 @@ export class SnkMessageBuilder {
|
|
|
55
55
|
this.loadAppMessages().then((msgs) => {
|
|
56
56
|
this._appMessages = msgs;
|
|
57
57
|
}, error => {
|
|
58
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
|
58
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages.js', error);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -72,11 +72,11 @@ class SnkFormConfigManager {
|
|
|
72
72
|
var _a;
|
|
73
73
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
74
74
|
if (fields != undefined && fields.length > 0) {
|
|
75
|
-
return fields.map(({ label, name, readOnly
|
|
75
|
+
return fields.map(({ label, name, readOnly }) => {
|
|
76
76
|
if (label == undefined) {
|
|
77
77
|
return dataUnit.getField(name);
|
|
78
78
|
}
|
|
79
|
-
return { name, label, readOnly
|
|
79
|
+
return { name, label, readOnly };
|
|
80
80
|
})
|
|
81
81
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
82
82
|
}
|
|
@@ -552,7 +552,7 @@ class SnkMessageBuilder {
|
|
|
552
552
|
this.loadAppMessages().then((msgs) => {
|
|
553
553
|
this._appMessages = msgs;
|
|
554
554
|
}, error => {
|
|
555
|
-
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages', error);
|
|
555
|
+
console.info('O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages.js', error);
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
@@ -534,6 +534,7 @@ class DatasetStrategy {
|
|
|
534
534
|
return false;
|
|
535
535
|
}
|
|
536
536
|
processSortingSide(request, dataUnit, serverSideFilters) {
|
|
537
|
+
var _a;
|
|
537
538
|
const localSorting = [];
|
|
538
539
|
const serverSorting = [];
|
|
539
540
|
if (request.sort != undefined) {
|
|
@@ -542,9 +543,7 @@ class DatasetStrategy {
|
|
|
542
543
|
}
|
|
543
544
|
for (const sort of request.sort) {
|
|
544
545
|
const descriptor = dataUnit.getField(sort.field);
|
|
545
|
-
const local = descriptor
|
|
546
|
-
&& descriptor.properties != undefined
|
|
547
|
-
&& descriptor.properties.calculated === "true";
|
|
546
|
+
const local = ((_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.properties) === null || _a === void 0 ? void 0 : _a.calculated) === "true" || (descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === UserInterface.LONGTEXT;
|
|
548
547
|
if (local) {
|
|
549
548
|
localSorting.push(sort);
|
|
550
549
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction,
|
|
2
|
+
import { JSUtils, DataType, 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
5
|
|
|
@@ -48,12 +48,10 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
48
48
|
this.dataStateChange = createEvent(this, "dataStateChange", 3);
|
|
49
49
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
|
50
50
|
this.messagesBuilderUpdated = createEvent(this, "messagesBuilderUpdated", 3);
|
|
51
|
-
this.dataUnitFieldsHidded = createEvent(this, "dataUnitFieldsHidded", 7);
|
|
52
51
|
this.insertionMode = createEvent(this, "insertionMode", 3);
|
|
53
52
|
this.cancelEdition = createEvent(this, "cancelEdition", 3);
|
|
54
53
|
this._onDataUnitResolve = [];
|
|
55
54
|
this._openedAlert = false;
|
|
56
|
-
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
57
55
|
this._dataUnitObserver = (action) => {
|
|
58
56
|
var _a, _b;
|
|
59
57
|
const duState = this.buildDataState();
|
|
@@ -98,7 +96,6 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
98
96
|
}
|
|
99
97
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
100
98
|
};
|
|
101
|
-
this.fieldsToLink = [];
|
|
102
99
|
this.dataState = undefined;
|
|
103
100
|
this.messagesBuilder = undefined;
|
|
104
101
|
this.dataUnitName = undefined;
|
|
@@ -178,7 +175,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
178
175
|
switch (action.type) {
|
|
179
176
|
case Action.RECORDS_ADDED:
|
|
180
177
|
if (this.isAllowed("INSERT")) {
|
|
181
|
-
resolve(
|
|
178
|
+
resolve(action);
|
|
182
179
|
}
|
|
183
180
|
else {
|
|
184
181
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
|
|
@@ -186,15 +183,21 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
186
183
|
break;
|
|
187
184
|
case Action.RECORDS_COPIED:
|
|
188
185
|
if (this.isAllowed("CLONE")) {
|
|
189
|
-
|
|
186
|
+
const cleanFields = this.getCleanOnCopyFields();
|
|
187
|
+
if (cleanFields.length > 0) {
|
|
188
|
+
const records = action.payload;
|
|
189
|
+
action = new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
190
|
+
const newRecord = Object.assign({}, record);
|
|
191
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
192
|
+
return newRecord;
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
resolve(action);
|
|
190
196
|
}
|
|
191
197
|
else {
|
|
192
198
|
ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
|
|
193
199
|
}
|
|
194
200
|
break;
|
|
195
|
-
case Action.METADATA_LOADED:
|
|
196
|
-
resolve(new DataUnitAction(Action.METADATA_LOADED, this.handleMetadataLoaded(action.payload)));
|
|
197
|
-
break;
|
|
198
201
|
case Action.DATA_CHANGED:
|
|
199
202
|
case Action.CHANGING_DATA:
|
|
200
203
|
if (this.isAllowed("UPDATE"))
|
|
@@ -288,47 +291,6 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
288
291
|
}
|
|
289
292
|
});
|
|
290
293
|
}
|
|
291
|
-
handleMetadataLoaded(payload) {
|
|
292
|
-
const metadata = Object.assign({}, payload);
|
|
293
|
-
this.processLinks(metadata);
|
|
294
|
-
return metadata;
|
|
295
|
-
}
|
|
296
|
-
handleRecordsCopied(initialRecords) {
|
|
297
|
-
let records = [...initialRecords];
|
|
298
|
-
records = this.handleCleanOnCopy(records);
|
|
299
|
-
return this.handleLinksWithParent(records);
|
|
300
|
-
}
|
|
301
|
-
handleLinksWithParent(records) {
|
|
302
|
-
var _a, _b;
|
|
303
|
-
const parentDataUnit = (_a = this._parentDataUnit) !== null && _a !== void 0 ? _a : (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.getParentDataUnit();
|
|
304
|
-
if (!parentDataUnit)
|
|
305
|
-
return records;
|
|
306
|
-
const parentSelectedRecord = parentDataUnit.getSelectedRecord();
|
|
307
|
-
const selfInfo = parentDataUnit === null || parentDataUnit === void 0 ? void 0 : parentDataUnit.getChildInfo(this.getCleanDataUnitName());
|
|
308
|
-
const { links } = selfInfo;
|
|
309
|
-
if (!links || links.length === 0)
|
|
310
|
-
return records;
|
|
311
|
-
return records.map(record => {
|
|
312
|
-
return this.buildRecordWithLinkedFields(record, links, parentSelectedRecord);
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
buildRecordWithLinkedFields(record, links, parentSelectedRecord) {
|
|
316
|
-
const newRecord = Object.assign({}, record);
|
|
317
|
-
links.forEach(link => newRecord[link.target] = parentSelectedRecord[link.source]);
|
|
318
|
-
return newRecord;
|
|
319
|
-
}
|
|
320
|
-
handleCleanOnCopy(records) {
|
|
321
|
-
const cleanFields = this.getCleanOnCopyFields();
|
|
322
|
-
if (cleanFields.length > 0) {
|
|
323
|
-
records = records.map(record => this.buildCopyWithCleanedFields(record, cleanFields));
|
|
324
|
-
}
|
|
325
|
-
return records;
|
|
326
|
-
}
|
|
327
|
-
buildCopyWithCleanedFields(record, cleanFields) {
|
|
328
|
-
const newRecord = Object.assign({}, record);
|
|
329
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
330
|
-
return newRecord;
|
|
331
|
-
}
|
|
332
294
|
showSuccessMessage(message) {
|
|
333
295
|
ApplicationUtils.info(message, { iconName: "check" });
|
|
334
296
|
}
|
|
@@ -419,40 +381,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
419
381
|
return;
|
|
420
382
|
}
|
|
421
383
|
handlerLinkFields() {
|
|
422
|
-
var _a, _b
|
|
423
|
-
const
|
|
424
|
-
if (!
|
|
384
|
+
var _a, _b;
|
|
385
|
+
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
386
|
+
if (!this._parentDataUnit)
|
|
425
387
|
return;
|
|
426
|
-
const
|
|
427
|
-
const child = parentDU.getChildInfo(childName);
|
|
388
|
+
const child = this._parentDataUnit.getChildInfo(this.entityName);
|
|
428
389
|
if (!child)
|
|
429
390
|
return;
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
handleDUWithLinks(fieldsToLink) {
|
|
434
|
-
this.fieldsToLink = fieldsToLink;
|
|
435
|
-
const metadata = Object.assign({}, this.dataUnit.metadata);
|
|
436
|
-
this.processLinks(metadata);
|
|
437
|
-
this.dataUnit.metadata = metadata;
|
|
438
|
-
this.dataUnitFieldsHidded.emit();
|
|
439
|
-
}
|
|
440
|
-
processLinks(metadata) {
|
|
441
|
-
var _a;
|
|
442
|
-
(_a = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
443
|
-
var _a;
|
|
444
|
-
if ((_a = this.fieldsToLink) === null || _a === void 0 ? void 0 : _a.includes(field.name)) {
|
|
391
|
+
const fieldsLink = (_a = child === null || child === void 0 ? void 0 : child.links) === null || _a === void 0 ? void 0 : _a.map(link => link.target);
|
|
392
|
+
(_b = metadata === null || metadata === void 0 ? void 0 : metadata.fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
393
|
+
if (fieldsLink === null || fieldsLink === void 0 ? void 0 : fieldsLink.includes(field.name)) {
|
|
445
394
|
field.visible = false;
|
|
446
395
|
}
|
|
447
396
|
});
|
|
448
|
-
|
|
449
|
-
getCleanDataUnitName() {
|
|
450
|
-
var _a;
|
|
451
|
-
const uri = this.dataUnit.name;
|
|
452
|
-
if (StringUtils.isEmpty(uri))
|
|
453
|
-
return uri;
|
|
454
|
-
const matcher = this.REGEX_DATAUNIT_NAME.exec(uri);
|
|
455
|
-
return (_a = matcher === null || matcher === void 0 ? void 0 : matcher[1]) !== null && _a !== void 0 ? _a : uri;
|
|
397
|
+
this.dataUnit.metadata = metadata;
|
|
456
398
|
}
|
|
457
399
|
static getNearestInstance(element) {
|
|
458
400
|
let parent = element.parentElement;
|
|
@@ -479,9 +421,8 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
479
421
|
this.dataUnit.releaseCallbacks();
|
|
480
422
|
}
|
|
481
423
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
this.handlerLinkFields();
|
|
424
|
+
componentDidLoad() {
|
|
425
|
+
this.loadDataUnit();
|
|
485
426
|
}
|
|
486
427
|
render() {
|
|
487
428
|
return (h(Host, null));
|
|
@@ -508,7 +449,6 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
508
449
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
|
509
450
|
"configName": [1, "config-name"],
|
|
510
451
|
"resourceID": [1, "resource-i-d"],
|
|
511
|
-
"fieldsToLink": [32],
|
|
512
452
|
"getDataUnit": [64],
|
|
513
453
|
"getSelectedRecordsIDsInfo": [64]
|
|
514
454
|
}]);
|