@sankhyalabs/sankhyablocks 10.1.0-dev.46 → 10.1.0-dev.48
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/{SnkMultiSelectionListDataSource-b951ed91.js → SnkMultiSelectionListDataSource-293bc3d2.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-93f53260.js → dataunit-fetcher-b9822794.js} +40 -3
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +7 -4
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- 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 +2 -2
- package/dist/cjs/{snk-data-unit-6abc5efc.js → snk-data-unit-4b6dc396.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/snk-layout-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-actions-button/actions/executor/launch-screen.executor.js +6 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +4 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +40 -3
- package/dist/components/dataunit-fetcher.js +40 -3
- package/dist/components/snk-actions-button2.js +6 -3
- package/dist/components/snk-detail-view2.js +1 -1
- package/dist/components/snk-grid2.js +4 -4
- package/dist/esm/{SnkMultiSelectionListDataSource-7fe25a58.js → SnkMultiSelectionListDataSource-f6cabd15.js} +1 -1
- package/dist/esm/{dataunit-fetcher-050b6d31.js → dataunit-fetcher-c176e002.js} +40 -3
- package/dist/esm/pesquisa-grid_2.entry.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +7 -4
- package/dist/esm/snk-application.entry.js +1 -1
- 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 +2 -2
- package/dist/esm/{snk-data-unit-ca2c9858.js → snk-data-unit-d8cfa950.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/snk-layout-form-config.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-35317d9a.entry.js → p-0afc64df.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1086fb0c.entry.js → p-134702f6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-46f75667.entry.js → p-20f03230.entry.js} +1 -1
- package/dist/sankhyablocks/{p-20af4b6a.entry.js → p-4d04bc75.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b3b51693.entry.js → p-610cae75.entry.js} +1 -1
- package/dist/sankhyablocks/p-6e278003.js +60 -0
- package/dist/sankhyablocks/{p-95ff0ec9.entry.js → p-7ad91135.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ab12f544.entry.js → p-82bcb4cf.entry.js} +1 -1
- package/dist/sankhyablocks/{p-251aee41.entry.js → p-8fe740b7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-09ba6bd4.js → p-9e77e136.js} +1 -1
- package/dist/sankhyablocks/{p-7c8bf699.entry.js → p-a905712a.entry.js} +1 -1
- package/dist/sankhyablocks/p-b0a357b4.entry.js +1 -0
- package/dist/sankhyablocks/p-c0d6a821.entry.js +1 -0
- package/dist/sankhyablocks/{p-f185d5ad.js → p-f5ad0720.js} +1 -1
- package/dist/sankhyablocks/{p-ce3b284c.entry.js → p-fec88660.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-2b3c284c.entry.js +0 -1
- package/dist/sankhyablocks/p-ac384a1e.entry.js +0 -1
- package/dist/sankhyablocks/p-d972a9c1.js +0 -60
|
@@ -6,7 +6,7 @@ const core = require('@sankhyalabs/core');
|
|
|
6
6
|
const index = require('./index-e3e39724.js');
|
|
7
7
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
8
8
|
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
9
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
9
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
10
10
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
11
11
|
require('./form-config-fetcher-45d1964c.js');
|
|
12
12
|
require('./constants-6d82e405.js');
|
|
@@ -142,6 +142,9 @@ class PreloadManager {
|
|
|
142
142
|
const columnFilters = utils.ColumnFilterManager.getColumnFilters(request.filters, fieldName);
|
|
143
143
|
filterFunction = utils.ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
144
144
|
}
|
|
145
|
+
if (onlyLabel) {
|
|
146
|
+
return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
|
|
147
|
+
}
|
|
145
148
|
return new Promise((accept, reject) => {
|
|
146
149
|
PreloadManager.getRepository(dataUnit).distict(record => {
|
|
147
150
|
if (filterFunction != undefined && !filterFunction(record)) {
|
|
@@ -152,9 +155,6 @@ class PreloadManager {
|
|
|
152
155
|
return { key: null, value: null };
|
|
153
156
|
}
|
|
154
157
|
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
155
|
-
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
156
|
-
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
157
|
-
}
|
|
158
158
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
159
159
|
})
|
|
160
160
|
.then(result => {
|
|
@@ -167,6 +167,43 @@ class PreloadManager {
|
|
|
167
167
|
.catch(reason => reject(reason));
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
+
static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
|
|
171
|
+
const groupedOptions = new Map();
|
|
172
|
+
const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
|
|
173
|
+
cachedRecords.forEach(record => {
|
|
174
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const fieldValue = record[fieldName];
|
|
178
|
+
if (fieldValue == undefined) {
|
|
179
|
+
const nullKey = '';
|
|
180
|
+
if (!groupedOptions.has(nullKey)) {
|
|
181
|
+
groupedOptions.set(nullKey, {
|
|
182
|
+
values: new Set([null]),
|
|
183
|
+
option: { label: null, value: null, check: true },
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
189
|
+
const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
|
|
190
|
+
const key = String(label !== null && label !== void 0 ? label : '');
|
|
191
|
+
let grouped = groupedOptions.get(key);
|
|
192
|
+
if (!grouped) {
|
|
193
|
+
grouped = {
|
|
194
|
+
values: new Set(),
|
|
195
|
+
option: { label, value, check: true },
|
|
196
|
+
};
|
|
197
|
+
groupedOptions.set(key, grouped);
|
|
198
|
+
}
|
|
199
|
+
grouped.values.add(value);
|
|
200
|
+
});
|
|
201
|
+
return Array.from(groupedOptions.values()).map(grouped => {
|
|
202
|
+
const option = grouped.option;
|
|
203
|
+
option.__multiValues = Array.from(grouped.values.values());
|
|
204
|
+
return grouped.option;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
170
207
|
static async loadData(dataUnit, request, loadFromServer) {
|
|
171
208
|
try {
|
|
172
209
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1894343a.js');
|
|
6
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
6
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
7
7
|
require('./DataFetcher-384d2ce8.js');
|
|
8
8
|
const ISave = require('./ISave-ecbe9336.js');
|
|
9
9
|
require('@sankhyalabs/core');
|
|
@@ -10,7 +10,7 @@ require('./ISave-ecbe9336.js');
|
|
|
10
10
|
require('./index-e3e39724.js');
|
|
11
11
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
12
12
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
13
|
-
require('./dataunit-fetcher-
|
|
13
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
14
14
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
15
15
|
const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
|
|
16
16
|
const constants = require('./constants-6d82e405.js');
|
|
@@ -92,11 +92,14 @@ class LaunchScreenExecutor {
|
|
|
92
92
|
localFieldLabel = core.StringUtils.isEmpty(dataUnit.getField(localField).label) ? localField : localFieldLabel;
|
|
93
93
|
throw new core.ErrorException(this._application.messagesBuilder.getMessage("snkActionsButton.title.error", undefined), this._application.messagesBuilder.getMessage("snkActionsButton.launchScreen.emptyField", { description: action.description, localFieldLabel: localFieldLabel }));
|
|
94
94
|
}
|
|
95
|
-
value
|
|
96
|
-
|
|
95
|
+
if (value !== null && typeof value === 'object' && 'value' in value) {
|
|
96
|
+
value = value.value;
|
|
97
|
+
}
|
|
98
|
+
const finalValue = core.StringUtils.isEmpty(value === null || value === void 0 ? void 0 : value.toString()) ? undefined : value.toString();
|
|
99
|
+
launchObject[param.targetField] = finalValue;
|
|
97
100
|
processedParams.push({
|
|
98
101
|
fieldName: param.targetField,
|
|
99
|
-
value:
|
|
102
|
+
value: finalValue
|
|
100
103
|
});
|
|
101
104
|
});
|
|
102
105
|
launchObject.ACTION_PARAMETERS = processedParams;
|
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
|
8
8
|
const ConfigStorage = require('./ConfigStorage-a1fab5ca.js');
|
|
9
9
|
const DataFetcher = require('./DataFetcher-384d2ce8.js');
|
|
10
10
|
const authFetcher = require('./auth-fetcher-6b134ec4.js');
|
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
12
12
|
const ISave = require('./ISave-ecbe9336.js');
|
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-a9300ebe.js');
|
|
14
14
|
const constants = require('./constants-6d82e405.js');
|
|
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const DataFetcher = require('./DataFetcher-384d2ce8.js');
|
|
8
8
|
const ISave = require('./ISave-ecbe9336.js');
|
|
9
9
|
require('./index-e3e39724.js');
|
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
10
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
11
11
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
12
12
|
require('./form-config-fetcher-45d1964c.js');
|
|
13
13
|
const constants = require('./constants-6d82e405.js');
|
|
@@ -9,7 +9,7 @@ require('./ISave-ecbe9336.js');
|
|
|
9
9
|
const index = require('./index-e3e39724.js');
|
|
10
10
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
11
11
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
12
|
-
require('./dataunit-fetcher-
|
|
12
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
13
13
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
14
14
|
require('./form-config-fetcher-45d1964c.js');
|
|
15
15
|
const constants = require('./constants-6d82e405.js');
|
|
@@ -9,11 +9,11 @@ const IFetchDataExporterParams = require('./IFetchDataExporterParams-e78ec415.js
|
|
|
9
9
|
const index = require('./index-e3e39724.js');
|
|
10
10
|
const constants = require('./constants-6d82e405.js');
|
|
11
11
|
const DataFetcher = require('./DataFetcher-384d2ce8.js');
|
|
12
|
-
const snkDataUnit = require('./snk-data-unit-
|
|
12
|
+
const snkDataUnit = require('./snk-data-unit-4b6dc396.js');
|
|
13
13
|
require('./ISave-ecbe9336.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
|
-
require('./dataunit-fetcher-
|
|
16
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
require('./form-config-fetcher-45d1964c.js');
|
|
19
19
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -4,7 +4,7 @@ const index = require('./index-1894343a.js');
|
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
6
6
|
const SnkMessageBuilder = require('./SnkMessageBuilder-a9300ebe.js');
|
|
7
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
7
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
8
8
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
9
9
|
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
|
10
10
|
|
|
@@ -2,12 +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-4b6dc396.js');
|
|
6
6
|
require('./index-1894343a.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
9
|
require('./SnkMessageBuilder-a9300ebe.js');
|
|
10
|
-
require('./dataunit-fetcher-
|
|
10
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
11
11
|
require('./DataFetcher-384d2ce8.js');
|
|
12
12
|
require('./PrintUtils-bcaeb82f.js');
|
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
@@ -11,7 +11,7 @@ require('./ISave-ecbe9336.js');
|
|
|
11
11
|
const index$1 = require('./index-e3e39724.js');
|
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
14
|
-
require('./dataunit-fetcher-
|
|
14
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
16
16
|
require('./form-config-fetcher-45d1964c.js');
|
|
17
17
|
const constants = require('./constants-6d82e405.js');
|
|
@@ -372,7 +372,7 @@ const SnkDetailView = class {
|
|
|
372
372
|
render() {
|
|
373
373
|
this.updateLabel();
|
|
374
374
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
375
|
-
return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), index.h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
375
|
+
return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,ACTIONS_BUTTON,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), index.h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
376
376
|
}
|
|
377
377
|
get _element() { return index.getElement(this); }
|
|
378
378
|
static get watchers() { return {
|
|
@@ -8,11 +8,11 @@ const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
9
|
require('./DataFetcher-384d2ce8.js');
|
|
10
10
|
require('./ISave-ecbe9336.js');
|
|
11
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
|
11
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-293bc3d2.js');
|
|
12
12
|
const index$1 = require('./index-e3e39724.js');
|
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
15
|
-
require('./dataunit-fetcher-
|
|
15
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
16
16
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
17
|
require('./form-config-fetcher-45d1964c.js');
|
|
18
18
|
require('./constants-6d82e405.js');
|
|
@@ -106,12 +106,12 @@ const SnkGrid = class {
|
|
|
106
106
|
this._headerTaskbarProcessor = new SnkMultiSelectionListDataSource.TaskbarProcessor({
|
|
107
107
|
'snkGridHeaderTaskbar.unselected': ['REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
108
108
|
'snkGridHeaderTaskbar.selected': this.getGridHeaderSelectedBtns(),
|
|
109
|
-
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'MORE_OPTIONS'],
|
|
110
|
-
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH'],
|
|
109
|
+
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
110
|
+
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
111
111
|
'snkGridHeaderTaskbar.singleTaskbar.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
112
112
|
'snkGridHeaderTaskbar.singleTaskbar.selected': ['UPDATE', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'ATTACH', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON'],
|
|
113
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'MORE_OPTIONS'],
|
|
114
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH'],
|
|
113
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
114
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
115
115
|
'snkGridHeaderTaskbar.singleTaskbar.finish_edition': ['CANCEL', 'SAVE', this.handleAddFormMode()],
|
|
116
116
|
});
|
|
117
117
|
this.dataUnitInterceptor = {
|
|
@@ -9,7 +9,7 @@ const core = require('@sankhyalabs/core');
|
|
|
9
9
|
require('./index-e3e39724.js');
|
|
10
10
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
11
11
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
12
|
-
require('./dataunit-fetcher-
|
|
12
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
13
13
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
14
14
|
const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
|
|
15
15
|
require('./constants-6d82e405.js');
|
|
@@ -9,7 +9,7 @@ require('./DataFetcher-384d2ce8.js');
|
|
|
9
9
|
require('./index-e3e39724.js');
|
|
10
10
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
11
11
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
12
|
-
require('./dataunit-fetcher-
|
|
12
|
+
require('./dataunit-fetcher-b9822794.js');
|
|
13
13
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
14
14
|
require('./form-config-fetcher-45d1964c.js');
|
|
15
15
|
require('./constants-6d82e405.js');
|
|
@@ -9,11 +9,11 @@ const constants = require('./constants-6d82e405.js');
|
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-80eddec8.js');
|
|
10
10
|
require('./DataFetcher-384d2ce8.js');
|
|
11
11
|
require('./ISave-ecbe9336.js');
|
|
12
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
|
12
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-293bc3d2.js');
|
|
13
13
|
const index$1 = require('./index-e3e39724.js');
|
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
16
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
16
|
+
const dataunitFetcher = require('./dataunit-fetcher-b9822794.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
const formConfigFetcher = require('./form-config-fetcher-45d1964c.js');
|
|
19
19
|
const ConfigStorage = require('./ConfigStorage-a1fab5ca.js');
|
package/dist/collection/components/snk-actions-button/actions/executor/launch-screen.executor.js
CHANGED
|
@@ -25,11 +25,14 @@ export default class LaunchScreenExecutor {
|
|
|
25
25
|
localFieldLabel = StringUtils.isEmpty(dataUnit.getField(localField).label) ? localField : localFieldLabel;
|
|
26
26
|
throw new ErrorException(this._application.messagesBuilder.getMessage("snkActionsButton.title.error", undefined), this._application.messagesBuilder.getMessage("snkActionsButton.launchScreen.emptyField", { description: action.description, localFieldLabel: localFieldLabel }));
|
|
27
27
|
}
|
|
28
|
-
value
|
|
29
|
-
|
|
28
|
+
if (value !== null && typeof value === 'object' && 'value' in value) {
|
|
29
|
+
value = value.value;
|
|
30
|
+
}
|
|
31
|
+
const finalValue = StringUtils.isEmpty(value === null || value === void 0 ? void 0 : value.toString()) ? undefined : value.toString();
|
|
32
|
+
launchObject[param.targetField] = finalValue;
|
|
30
33
|
processedParams.push({
|
|
31
34
|
fieldName: param.targetField,
|
|
32
|
-
value:
|
|
35
|
+
value: finalValue
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
launchObject.ACTION_PARAMETERS = processedParams;
|
package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js
CHANGED
|
@@ -299,7 +299,7 @@ export class SnkDetailView {
|
|
|
299
299
|
render() {
|
|
300
300
|
this.updateLabel();
|
|
301
301
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
302
|
-
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
302
|
+
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,ACTIONS_BUTTON,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
303
303
|
}
|
|
304
304
|
static get is() { return "snk-detail-view"; }
|
|
305
305
|
static get encapsulation() { return "scoped"; }
|
|
@@ -30,12 +30,12 @@ export class SnkGrid {
|
|
|
30
30
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
|
31
31
|
'snkGridHeaderTaskbar.unselected': ['REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
32
32
|
'snkGridHeaderTaskbar.selected': this.getGridHeaderSelectedBtns(),
|
|
33
|
-
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'MORE_OPTIONS'],
|
|
34
|
-
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH'],
|
|
33
|
+
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
34
|
+
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
35
35
|
'snkGridHeaderTaskbar.singleTaskbar.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
36
36
|
'snkGridHeaderTaskbar.singleTaskbar.selected': ['UPDATE', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'ATTACH', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON'],
|
|
37
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'MORE_OPTIONS'],
|
|
38
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH'],
|
|
37
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
38
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
39
39
|
'snkGridHeaderTaskbar.singleTaskbar.finish_edition': ['CANCEL', 'SAVE', this.handleAddFormMode()],
|
|
40
40
|
});
|
|
41
41
|
this.dataUnitInterceptor = {
|
|
@@ -33,6 +33,9 @@ export default class PreloadManager {
|
|
|
33
33
|
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
|
|
34
34
|
filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
35
35
|
}
|
|
36
|
+
if (onlyLabel) {
|
|
37
|
+
return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
|
|
38
|
+
}
|
|
36
39
|
return new Promise((accept, reject) => {
|
|
37
40
|
PreloadManager.getRepository(dataUnit).distict(record => {
|
|
38
41
|
if (filterFunction != undefined && !filterFunction(record)) {
|
|
@@ -43,9 +46,6 @@ export default class PreloadManager {
|
|
|
43
46
|
return { key: null, value: null };
|
|
44
47
|
}
|
|
45
48
|
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
46
|
-
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
47
|
-
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
48
|
-
}
|
|
49
49
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
50
50
|
})
|
|
51
51
|
.then(result => {
|
|
@@ -58,6 +58,43 @@ export default class PreloadManager {
|
|
|
58
58
|
.catch(reason => reject(reason));
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
+
static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
|
|
62
|
+
const groupedOptions = new Map();
|
|
63
|
+
const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
|
|
64
|
+
cachedRecords.forEach(record => {
|
|
65
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const fieldValue = record[fieldName];
|
|
69
|
+
if (fieldValue == undefined) {
|
|
70
|
+
const nullKey = '';
|
|
71
|
+
if (!groupedOptions.has(nullKey)) {
|
|
72
|
+
groupedOptions.set(nullKey, {
|
|
73
|
+
values: new Set([null]),
|
|
74
|
+
option: { label: null, value: null, check: true },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
80
|
+
const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
|
|
81
|
+
const key = String(label !== null && label !== void 0 ? label : '');
|
|
82
|
+
let grouped = groupedOptions.get(key);
|
|
83
|
+
if (!grouped) {
|
|
84
|
+
grouped = {
|
|
85
|
+
values: new Set(),
|
|
86
|
+
option: { label, value, check: true },
|
|
87
|
+
};
|
|
88
|
+
groupedOptions.set(key, grouped);
|
|
89
|
+
}
|
|
90
|
+
grouped.values.add(value);
|
|
91
|
+
});
|
|
92
|
+
return Array.from(groupedOptions.values()).map(grouped => {
|
|
93
|
+
const option = grouped.option;
|
|
94
|
+
option.__multiValues = Array.from(grouped.values.values());
|
|
95
|
+
return grouped.option;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
61
98
|
static async loadData(dataUnit, request, loadFromServer) {
|
|
62
99
|
try {
|
|
63
100
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -164,6 +164,9 @@ class PreloadManager {
|
|
|
164
164
|
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
|
|
165
165
|
filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
166
166
|
}
|
|
167
|
+
if (onlyLabel) {
|
|
168
|
+
return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
|
|
169
|
+
}
|
|
167
170
|
return new Promise((accept, reject) => {
|
|
168
171
|
PreloadManager.getRepository(dataUnit).distict(record => {
|
|
169
172
|
if (filterFunction != undefined && !filterFunction(record)) {
|
|
@@ -174,9 +177,6 @@ class PreloadManager {
|
|
|
174
177
|
return { key: null, value: null };
|
|
175
178
|
}
|
|
176
179
|
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
177
|
-
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
178
|
-
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
179
|
-
}
|
|
180
180
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
181
181
|
})
|
|
182
182
|
.then(result => {
|
|
@@ -189,6 +189,43 @@ class PreloadManager {
|
|
|
189
189
|
.catch(reason => reject(reason));
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
+
static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
|
|
193
|
+
const groupedOptions = new Map();
|
|
194
|
+
const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
|
|
195
|
+
cachedRecords.forEach(record => {
|
|
196
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const fieldValue = record[fieldName];
|
|
200
|
+
if (fieldValue == undefined) {
|
|
201
|
+
const nullKey = '';
|
|
202
|
+
if (!groupedOptions.has(nullKey)) {
|
|
203
|
+
groupedOptions.set(nullKey, {
|
|
204
|
+
values: new Set([null]),
|
|
205
|
+
option: { label: null, value: null, check: true },
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
211
|
+
const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
|
|
212
|
+
const key = String(label !== null && label !== void 0 ? label : '');
|
|
213
|
+
let grouped = groupedOptions.get(key);
|
|
214
|
+
if (!grouped) {
|
|
215
|
+
grouped = {
|
|
216
|
+
values: new Set(),
|
|
217
|
+
option: { label, value, check: true },
|
|
218
|
+
};
|
|
219
|
+
groupedOptions.set(key, grouped);
|
|
220
|
+
}
|
|
221
|
+
grouped.values.add(value);
|
|
222
|
+
});
|
|
223
|
+
return Array.from(groupedOptions.values()).map(grouped => {
|
|
224
|
+
const option = grouped.option;
|
|
225
|
+
option.__multiValues = Array.from(grouped.values.values());
|
|
226
|
+
return grouped.option;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
192
229
|
static async loadData(dataUnit, request, loadFromServer) {
|
|
193
230
|
try {
|
|
194
231
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -80,11 +80,14 @@ class LaunchScreenExecutor {
|
|
|
80
80
|
localFieldLabel = StringUtils.isEmpty(dataUnit.getField(localField).label) ? localField : localFieldLabel;
|
|
81
81
|
throw new ErrorException(this._application.messagesBuilder.getMessage("snkActionsButton.title.error", undefined), this._application.messagesBuilder.getMessage("snkActionsButton.launchScreen.emptyField", { description: action.description, localFieldLabel: localFieldLabel }));
|
|
82
82
|
}
|
|
83
|
-
value
|
|
84
|
-
|
|
83
|
+
if (value !== null && typeof value === 'object' && 'value' in value) {
|
|
84
|
+
value = value.value;
|
|
85
|
+
}
|
|
86
|
+
const finalValue = StringUtils.isEmpty(value === null || value === void 0 ? void 0 : value.toString()) ? undefined : value.toString();
|
|
87
|
+
launchObject[param.targetField] = finalValue;
|
|
85
88
|
processedParams.push({
|
|
86
89
|
fieldName: param.targetField,
|
|
87
|
-
value:
|
|
90
|
+
value: finalValue
|
|
88
91
|
});
|
|
89
92
|
});
|
|
90
93
|
launchObject.ACTION_PARAMETERS = processedParams;
|
|
@@ -1196,7 +1196,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
1196
1196
|
render() {
|
|
1197
1197
|
this.updateLabel();
|
|
1198
1198
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
|
1199
|
-
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
1199
|
+
return (h(Host, null, h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), h("snk-grid", { class: "ez-size-width--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: false, enableGridInsert: true, autoLoad: true }))), h("stack-item", null, h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems), onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch, entityPath: this.entityName }, h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,ACTIONS_BUTTON,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm() }, h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))))), h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName }))));
|
|
1200
1200
|
}
|
|
1201
1201
|
get _element() { return this; }
|
|
1202
1202
|
static get watchers() { return {
|
|
@@ -115,12 +115,12 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
115
115
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
|
116
116
|
'snkGridHeaderTaskbar.unselected': ['REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
117
117
|
'snkGridHeaderTaskbar.selected': this.getGridHeaderSelectedBtns(),
|
|
118
|
-
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'MORE_OPTIONS'],
|
|
119
|
-
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH'],
|
|
118
|
+
'snkGridHeaderTaskbar.detail.unselected': ['REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
119
|
+
'snkGridHeaderTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
120
120
|
'snkGridHeaderTaskbar.singleTaskbar.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
121
121
|
'snkGridHeaderTaskbar.singleTaskbar.selected': ['UPDATE', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'ATTACH', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'DATA_EXPORTER', 'ACTIONS_BUTTON'],
|
|
122
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'MORE_OPTIONS'],
|
|
123
|
-
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH'],
|
|
122
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.unselected': ['INSERT', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON', 'MORE_OPTIONS'],
|
|
123
|
+
'snkGridHeaderTaskbar.singleTaskbar.detail.selected': ['UPDATE', 'ATTACH', 'CLONE', 'REMOVE', 'MORE_OPTIONS', 'DIVIDER', 'FORM_MODE', 'CONFIGURATOR', 'REFRESH', 'ACTIONS_BUTTON'],
|
|
124
124
|
'snkGridHeaderTaskbar.singleTaskbar.finish_edition': ['CANCEL', 'SAVE', this.handleAddFormMode()],
|
|
125
125
|
});
|
|
126
126
|
this.dataUnitInterceptor = {
|
|
@@ -4,7 +4,7 @@ import { SortMode, ApplicationContext, ObjectUtils, StringUtils, NumberUtils, Da
|
|
|
4
4
|
import { D as DataExporterOption } from './index-b40568ff.js';
|
|
5
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
6
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
|
7
|
+
import { P as PreloadManager } from './dataunit-fetcher-c176e002.js';
|
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
|
9
9
|
import './form-config-fetcher-b44b2727.js';
|
|
10
10
|
import './constants-7b422de0.js';
|
|
@@ -136,6 +136,9 @@ class PreloadManager {
|
|
|
136
136
|
const columnFilters = ColumnFilterManager.getColumnFilters(request.filters, fieldName);
|
|
137
137
|
filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
|
138
138
|
}
|
|
139
|
+
if (onlyLabel) {
|
|
140
|
+
return Promise.resolve(this.compileDistinctByLabel(dataUnit, fieldName, filterFunction));
|
|
141
|
+
}
|
|
139
142
|
return new Promise((accept, reject) => {
|
|
140
143
|
PreloadManager.getRepository(dataUnit).distict(record => {
|
|
141
144
|
if (filterFunction != undefined && !filterFunction(record)) {
|
|
@@ -146,9 +149,6 @@ class PreloadManager {
|
|
|
146
149
|
return { key: null, value: null };
|
|
147
150
|
}
|
|
148
151
|
let value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
149
|
-
if ((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) && onlyLabel) {
|
|
150
|
-
return { key: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label, value: dataUnit.getFormattedValue(fieldName, value) };
|
|
151
|
-
}
|
|
152
152
|
return { key: dataUnit.getFormattedValue(fieldName, fieldValue), value };
|
|
153
153
|
})
|
|
154
154
|
.then(result => {
|
|
@@ -161,6 +161,43 @@ class PreloadManager {
|
|
|
161
161
|
.catch(reason => reject(reason));
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
+
static compileDistinctByLabel(dataUnit, fieldName, filterFunction) {
|
|
165
|
+
const groupedOptions = new Map();
|
|
166
|
+
const cachedRecords = PreloadManager.getRepository(dataUnit).getFromCache();
|
|
167
|
+
cachedRecords.forEach(record => {
|
|
168
|
+
if (filterFunction != undefined && !filterFunction(record)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const fieldValue = record[fieldName];
|
|
172
|
+
if (fieldValue == undefined) {
|
|
173
|
+
const nullKey = '';
|
|
174
|
+
if (!groupedOptions.has(nullKey)) {
|
|
175
|
+
groupedOptions.set(nullKey, {
|
|
176
|
+
values: new Set([null]),
|
|
177
|
+
option: { label: null, value: null, check: true },
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const value = fieldValue.value != undefined ? fieldValue.value : fieldValue;
|
|
183
|
+
const label = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.label) ? fieldValue.label : dataUnit.getFormattedValue(fieldName, fieldValue);
|
|
184
|
+
const key = String(label !== null && label !== void 0 ? label : '');
|
|
185
|
+
let grouped = groupedOptions.get(key);
|
|
186
|
+
if (!grouped) {
|
|
187
|
+
grouped = {
|
|
188
|
+
values: new Set(),
|
|
189
|
+
option: { label, value, check: true },
|
|
190
|
+
};
|
|
191
|
+
groupedOptions.set(key, grouped);
|
|
192
|
+
}
|
|
193
|
+
grouped.values.add(value);
|
|
194
|
+
});
|
|
195
|
+
return Array.from(groupedOptions.values()).map(grouped => {
|
|
196
|
+
const option = grouped.option;
|
|
197
|
+
option.__multiValues = Array.from(grouped.values.values());
|
|
198
|
+
return grouped.option;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
164
201
|
static async loadData(dataUnit, request, loadFromServer) {
|
|
165
202
|
try {
|
|
166
203
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, e as createEvent, h, f as Host, F as Fragment } from './index-04f73a26.js';
|
|
2
|
-
import { I as InMemoryLoader } from './dataunit-fetcher-
|
|
2
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-c176e002.js';
|
|
3
3
|
import './DataFetcher-e60f8d53.js';
|
|
4
4
|
import { P as PesquisaFetcher } from './ISave-4929c071.js';
|
|
5
5
|
import '@sankhyalabs/core';
|