@sankhyalabs/sankhyablocks 0.0.0-feat-dev-KB-14960.3 → 0.0.0-feat-dev-KB-14960.4
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-8711ff82.js → SnkMultiSelectionListDataSource-58665402.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-67ef8df2.js → dataunit-fetcher-193dcb90.js} +11 -14
- package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
- 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-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +16 -9
- package/dist/cjs/{snk-guides-viewer-daf6c7d8.js → snk-guides-viewer-85b03362.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +15 -7
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +1 -6
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +3 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +7 -4
- package/dist/components/dataunit-fetcher.js +11 -14
- package/dist/components/snk-grid2.js +15 -8
- package/dist/esm/{SnkMultiSelectionListDataSource-04010e28.js → SnkMultiSelectionListDataSource-8c78e0a5.js} +1 -1
- package/dist/esm/{dataunit-fetcher-57e6f9a2.js → dataunit-fetcher-f15a773b.js} +11 -14
- package/dist/esm/snk-actions-button.entry.js +1 -1
- 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-detail-view.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +17 -10
- package/dist/esm/{snk-guides-viewer-bc8c3167.js → snk-guides-viewer-59a16925.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-0d039e62.js → p-1071e0b6.js} +1 -1
- package/dist/sankhyablocks/{p-4606d486.entry.js → p-24488ca2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d670c445.entry.js → p-30d6cd96.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1f173bc2.entry.js → p-63f9e3fb.entry.js} +1 -1
- package/dist/sankhyablocks/p-6ba39be6.js +59 -0
- package/dist/sankhyablocks/{p-16eb467b.entry.js → p-6f9fe2c1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6e0891da.js → p-87c26f15.js} +1 -1
- package/dist/sankhyablocks/p-9a01221a.entry.js +1 -0
- package/dist/sankhyablocks/{p-89d5cbbc.entry.js → p-a8a214e5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c7a8b21e.entry.js → p-af3b57f0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ae5a6fde.entry.js → p-c6226865.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +0 -1
- package/package.json +5 -5
- package/dist/sankhyablocks/p-642953bd.js +0 -59
- package/dist/sankhyablocks/p-c40c1c4a.entry.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const core = require('@sankhyalabs/core');
|
|
4
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
4
|
+
const dataunitFetcher = require('./dataunit-fetcher-193dcb90.js');
|
|
5
5
|
|
|
6
6
|
class SnkMultiSelectionListDataSource {
|
|
7
7
|
setDataUnit(dataUnit) {
|
|
@@ -28,10 +28,9 @@ class ArrayRepository {
|
|
|
28
28
|
return Promise.resolve({ result, count });
|
|
29
29
|
}
|
|
30
30
|
async distict(itemProcessor) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})));
|
|
31
|
+
const processedItems = this._list.map(item => itemProcessor(item));
|
|
32
|
+
return Promise.resolve(new Map(processedItems.filter(item => item != undefined)
|
|
33
|
+
.map(item => [item.key, item.value])));
|
|
35
34
|
}
|
|
36
35
|
async push(items) {
|
|
37
36
|
this._list.push(...items);
|
|
@@ -360,7 +359,7 @@ class DatasetStrategy {
|
|
|
360
359
|
return Promise.resolve({
|
|
361
360
|
records,
|
|
362
361
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
363
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count
|
|
362
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count })
|
|
364
363
|
});
|
|
365
364
|
}
|
|
366
365
|
catch (error) {
|
|
@@ -414,10 +413,13 @@ class DatasetStrategy {
|
|
|
414
413
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnitName
|
|
415
414
|
};
|
|
416
415
|
const serverSideFilters = request.filters.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"));
|
|
417
|
-
if (serverSideFilters.length
|
|
418
|
-
|
|
416
|
+
if (serverSideFilters.length !== 0) {
|
|
417
|
+
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
418
|
+
}
|
|
419
|
+
const sorting = request.sort;
|
|
420
|
+
if (sorting != undefined && sorting.length !== 0) {
|
|
421
|
+
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
|
419
422
|
}
|
|
420
|
-
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
421
423
|
return txProperties;
|
|
422
424
|
}
|
|
423
425
|
processRecords(dataUnit, fields, responseRecords) {
|
|
@@ -476,7 +478,7 @@ class DataUnitDataLoader {
|
|
|
476
478
|
DataUnitDataLoader._debouncingTimeouts[duName] = setTimeout(() => {
|
|
477
479
|
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
478
480
|
callBack();
|
|
479
|
-
},
|
|
481
|
+
}, 100);
|
|
480
482
|
}
|
|
481
483
|
static async loadData(dataUnit, request) {
|
|
482
484
|
return new Promise((resolve, reject) => {
|
|
@@ -539,11 +541,6 @@ class DataUnitDataLoader {
|
|
|
539
541
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
540
542
|
return;
|
|
541
543
|
}
|
|
542
|
-
if (loadingInfo.needReload) {
|
|
543
|
-
//Ir para a primeira página, faz com que o loadData seja chamado novamente
|
|
544
|
-
dataUnit.gotoPage(0);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
544
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
548
545
|
}
|
|
549
546
|
static registryLoading(dataUnit, loadingInfo) {
|
|
@@ -11,7 +11,7 @@ require('./index-0e663819.js');
|
|
|
11
11
|
require('./ISave-d68ce3cd.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-193dcb90.js');
|
|
15
15
|
require('./filter-item-type.enum-aa823a00.js');
|
|
16
16
|
require('./form-config-fetcher-ad090dd1.js');
|
|
17
17
|
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
|
8
8
|
const ConfigStorage = require('./ConfigStorage-2f4b9934.js');
|
|
9
9
|
const DataFetcher = require('./DataFetcher-adb2beb4.js');
|
|
10
10
|
const authFetcher = require('./auth-fetcher-e1d8c26b.js');
|
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-193dcb90.js');
|
|
12
12
|
const pesquisaFetcher = require('./pesquisa-fetcher-64473c9f.js');
|
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-d0abb63d.js');
|
|
14
14
|
require('./form-config-fetcher-ad090dd1.js');
|
|
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
|
7
7
|
const DataFetcher = require('./DataFetcher-adb2beb4.js');
|
|
8
8
|
const ISave = require('./ISave-d68ce3cd.js');
|
|
9
9
|
const constants = require('./constants-d187e03e.js');
|
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
10
|
+
const dataunitFetcher = require('./dataunit-fetcher-193dcb90.js');
|
|
11
11
|
const taskbarElements = require('./taskbar-elements-39949c7a.js');
|
|
12
12
|
require('./_commonjsHelpers-537d719a.js');
|
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
@@ -11,7 +11,7 @@ const index$1 = require('./index-0e663819.js');
|
|
|
11
11
|
require('./ISave-d68ce3cd.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-193dcb90.js');
|
|
15
15
|
require('./filter-item-type.enum-aa823a00.js');
|
|
16
16
|
require('./form-config-fetcher-ad090dd1.js');
|
|
17
17
|
const constants = require('./constants-d187e03e.js');
|
|
@@ -12,12 +12,12 @@ const index$1 = require('./index-0e663819.js');
|
|
|
12
12
|
require('./ISave-d68ce3cd.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-193dcb90.js');
|
|
16
16
|
require('./filter-item-type.enum-aa823a00.js');
|
|
17
17
|
require('./form-config-fetcher-ad090dd1.js');
|
|
18
18
|
const taskbarElements = require('./taskbar-elements-39949c7a.js');
|
|
19
19
|
const constants = require('./constants-d187e03e.js');
|
|
20
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
|
20
|
+
const snkGuidesViewer = require('./snk-guides-viewer-85b03362.js');
|
|
21
21
|
const SnkMessageBuilder = require('./SnkMessageBuilder-d0abb63d.js');
|
|
22
22
|
require('./ConfigStorage-2f4b9934.js');
|
|
23
23
|
require('./_commonjsHelpers-537d719a.js');
|
|
@@ -10,14 +10,14 @@ const ConfigStorage = require('./ConfigStorage-2f4b9934.js');
|
|
|
10
10
|
const index$1 = require('./index-0e663819.js');
|
|
11
11
|
const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
|
|
12
12
|
const index$2 = require('./index-102ba62d.js');
|
|
13
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
|
13
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-58665402.js');
|
|
14
14
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
15
15
|
require('./form-config-fetcher-ad090dd1.js');
|
|
16
16
|
require('./DataFetcher-adb2beb4.js');
|
|
17
17
|
require('./_commonjsHelpers-537d719a.js');
|
|
18
18
|
require('./PrintUtils-bcaeb82f.js');
|
|
19
19
|
require('./filter-item-type.enum-aa823a00.js');
|
|
20
|
-
require('./dataunit-fetcher-
|
|
20
|
+
require('./dataunit-fetcher-193dcb90.js');
|
|
21
21
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
22
22
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
23
23
|
|
|
@@ -106,6 +106,18 @@ const SnkGrid = class {
|
|
|
106
106
|
}
|
|
107
107
|
setGridConfig(config) {
|
|
108
108
|
this._gridConfig = config;
|
|
109
|
+
this.assertDefaultSorting();
|
|
110
|
+
}
|
|
111
|
+
assertDefaultSorting() {
|
|
112
|
+
if (this._gridConfig && this._dataUnit) {
|
|
113
|
+
this._dataUnit.defaultSorting = this._gridConfig
|
|
114
|
+
.columns
|
|
115
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
|
116
|
+
.map(({ name: field, ascending }) => {
|
|
117
|
+
const { dataType } = this._dataUnit.getField(field);
|
|
118
|
+
return { field, dataType, mode: ascending ? core.SortMode.ASC : core.SortMode.DESC };
|
|
119
|
+
});
|
|
120
|
+
}
|
|
109
121
|
}
|
|
110
122
|
loadConfig() {
|
|
111
123
|
ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.resourceID)
|
|
@@ -231,7 +243,7 @@ const SnkGrid = class {
|
|
|
231
243
|
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
232
244
|
}
|
|
233
245
|
finshLoading() {
|
|
234
|
-
this.
|
|
246
|
+
this.assertDefaultSorting();
|
|
235
247
|
this.addElementID();
|
|
236
248
|
if (this.columnFilterDataSource != undefined) {
|
|
237
249
|
this.columnFilterDataSource.setApplication(this._application);
|
|
@@ -317,18 +329,13 @@ const SnkGrid = class {
|
|
|
317
329
|
getPrimaryButton() {
|
|
318
330
|
return this.presentationMode === index$1.PresentationMode.PRIMARY ? "INSERT" : "";
|
|
319
331
|
}
|
|
320
|
-
onEzGridReady() {
|
|
321
|
-
var _a;
|
|
322
|
-
(_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
323
|
-
this._dataUnitLoadLockerResolver = undefined;
|
|
324
|
-
}
|
|
325
332
|
render() {
|
|
326
333
|
var _a, _b;
|
|
327
334
|
if (!this._dataUnit) {
|
|
328
335
|
return undefined;
|
|
329
336
|
}
|
|
330
337
|
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
331
|
-
index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection,
|
|
338
|
+
index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, index.h("slot", { name: this.topTaskbarCustomSlotId }))), index.h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === index$1.PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, index.h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, index.h("slot", { name: this.gridHeaderCustomSlotId }))), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" })), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
332
339
|
}
|
|
333
340
|
get _element() { return index.getElement(this); }
|
|
334
341
|
};
|
|
@@ -13,7 +13,7 @@ const index$1 = require('./index-0e663819.js');
|
|
|
13
13
|
require('./ISave-d68ce3cd.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-193dcb90.js');
|
|
17
17
|
require('./filter-item-type.enum-aa823a00.js');
|
|
18
18
|
require('./form-config-fetcher-ad090dd1.js');
|
|
19
19
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
@@ -2,7 +2,7 @@
|
|
|
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-85b03362.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('./SnkFormConfigManager-2c711d00.js');
|
|
@@ -22,7 +22,7 @@ require('./constants-d187e03e.js');
|
|
|
22
22
|
require('./pesquisa-fetcher-64473c9f.js');
|
|
23
23
|
require('./ISave-d68ce3cd.js');
|
|
24
24
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
25
|
-
require('./dataunit-fetcher-
|
|
25
|
+
require('./dataunit-fetcher-193dcb90.js');
|
|
26
26
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
27
27
|
require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
28
28
|
|
|
@@ -12,11 +12,11 @@ const index$1 = require('./index-0e663819.js');
|
|
|
12
12
|
require('./ISave-d68ce3cd.js');
|
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
15
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
15
|
+
const dataunitFetcher = require('./dataunit-fetcher-193dcb90.js');
|
|
16
16
|
require('./filter-item-type.enum-aa823a00.js');
|
|
17
17
|
require('./form-config-fetcher-ad090dd1.js');
|
|
18
18
|
const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
|
|
19
|
-
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-
|
|
19
|
+
const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-58665402.js');
|
|
20
20
|
require('./index-102ba62d.js');
|
|
21
21
|
require('./_commonjsHelpers-537d719a.js');
|
|
22
22
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -8,6 +8,7 @@ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
|
8
8
|
import store from "../../lib/store";
|
|
9
9
|
import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionListDataSource';
|
|
10
10
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
11
|
+
import { SortMode } from '@sankhyalabs/core';
|
|
11
12
|
export class SnkGrid {
|
|
12
13
|
constructor() {
|
|
13
14
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
|
@@ -88,6 +89,18 @@ export class SnkGrid {
|
|
|
88
89
|
}
|
|
89
90
|
setGridConfig(config) {
|
|
90
91
|
this._gridConfig = config;
|
|
92
|
+
this.assertDefaultSorting();
|
|
93
|
+
}
|
|
94
|
+
assertDefaultSorting() {
|
|
95
|
+
if (this._gridConfig && this._dataUnit) {
|
|
96
|
+
this._dataUnit.defaultSorting = this._gridConfig
|
|
97
|
+
.columns
|
|
98
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
|
99
|
+
.map(({ name: field, ascending }) => {
|
|
100
|
+
const { dataType } = this._dataUnit.getField(field);
|
|
101
|
+
return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
91
104
|
}
|
|
92
105
|
loadConfig() {
|
|
93
106
|
ConfigStorage.loadGridConfig(this.configName, this.resourceID)
|
|
@@ -213,7 +226,7 @@ export class SnkGrid {
|
|
|
213
226
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
214
227
|
}
|
|
215
228
|
finshLoading() {
|
|
216
|
-
this.
|
|
229
|
+
this.assertDefaultSorting();
|
|
217
230
|
this.addElementID();
|
|
218
231
|
if (this.columnFilterDataSource != undefined) {
|
|
219
232
|
this.columnFilterDataSource.setApplication(this._application);
|
|
@@ -299,18 +312,13 @@ export class SnkGrid {
|
|
|
299
312
|
getPrimaryButton() {
|
|
300
313
|
return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
|
|
301
314
|
}
|
|
302
|
-
onEzGridReady() {
|
|
303
|
-
var _a;
|
|
304
|
-
(_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
305
|
-
this._dataUnitLoadLockerResolver = undefined;
|
|
306
|
-
}
|
|
307
315
|
render() {
|
|
308
316
|
var _a, _b;
|
|
309
317
|
if (!this._dataUnit) {
|
|
310
318
|
return undefined;
|
|
311
319
|
}
|
|
312
320
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
313
|
-
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection,
|
|
321
|
+
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
314
322
|
}
|
|
315
323
|
static get is() { return "snk-grid"; }
|
|
316
324
|
static get encapsulation() { return "scoped"; }
|
|
@@ -10,7 +10,7 @@ export default class DataUnitDataLoader {
|
|
|
10
10
|
DataUnitDataLoader._debouncingTimeouts[duName] = setTimeout(() => {
|
|
11
11
|
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
12
12
|
callBack();
|
|
13
|
-
},
|
|
13
|
+
}, 100);
|
|
14
14
|
}
|
|
15
15
|
static async loadData(dataUnit, request) {
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
@@ -73,11 +73,6 @@ export default class DataUnitDataLoader {
|
|
|
73
73
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
if (loadingInfo.needReload) {
|
|
77
|
-
//Ir para a primeira página, faz com que o loadData seja chamado novamente
|
|
78
|
-
dataUnit.gotoPage(0);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
76
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
82
77
|
}
|
|
83
78
|
static registryLoading(dataUnit, loadingInfo) {
|
|
@@ -20,10 +20,9 @@ export class ArrayRepository {
|
|
|
20
20
|
return Promise.resolve({ result, count });
|
|
21
21
|
}
|
|
22
22
|
async distict(itemProcessor) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})));
|
|
23
|
+
const processedItems = this._list.map(item => itemProcessor(item));
|
|
24
|
+
return Promise.resolve(new Map(processedItems.filter(item => item != undefined)
|
|
25
|
+
.map(item => [item.key, item.value])));
|
|
27
26
|
}
|
|
28
27
|
async push(items) {
|
|
29
28
|
this._list.push(...items);
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
|
@@ -21,7 +21,7 @@ export class DatasetStrategy {
|
|
|
21
21
|
return Promise.resolve({
|
|
22
22
|
records,
|
|
23
23
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
24
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count
|
|
24
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count })
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
catch (error) {
|
|
@@ -75,10 +75,13 @@ export class DatasetStrategy {
|
|
|
75
75
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnitName
|
|
76
76
|
};
|
|
77
77
|
const serverSideFilters = request.filters.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"));
|
|
78
|
-
if (serverSideFilters.length
|
|
79
|
-
|
|
78
|
+
if (serverSideFilters.length !== 0) {
|
|
79
|
+
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
80
|
+
}
|
|
81
|
+
const sorting = request.sort;
|
|
82
|
+
if (sorting != undefined && sorting.length !== 0) {
|
|
83
|
+
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
|
80
84
|
}
|
|
81
|
-
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
82
85
|
return txProperties;
|
|
83
86
|
}
|
|
84
87
|
processRecords(dataUnit, fields, responseRecords) {
|
|
@@ -187,10 +187,9 @@ class ArrayRepository {
|
|
|
187
187
|
return Promise.resolve({ result, count });
|
|
188
188
|
}
|
|
189
189
|
async distict(itemProcessor) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
})));
|
|
190
|
+
const processedItems = this._list.map(item => itemProcessor(item));
|
|
191
|
+
return Promise.resolve(new Map(processedItems.filter(item => item != undefined)
|
|
192
|
+
.map(item => [item.key, item.value])));
|
|
194
193
|
}
|
|
195
194
|
async push(items) {
|
|
196
195
|
this._list.push(...items);
|
|
@@ -519,7 +518,7 @@ class DatasetStrategy {
|
|
|
519
518
|
return Promise.resolve({
|
|
520
519
|
records,
|
|
521
520
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
522
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count
|
|
521
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count })
|
|
523
522
|
});
|
|
524
523
|
}
|
|
525
524
|
catch (error) {
|
|
@@ -573,10 +572,13 @@ class DatasetStrategy {
|
|
|
573
572
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnitName
|
|
574
573
|
};
|
|
575
574
|
const serverSideFilters = request.filters.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"));
|
|
576
|
-
if (serverSideFilters.length
|
|
577
|
-
|
|
575
|
+
if (serverSideFilters.length !== 0) {
|
|
576
|
+
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
577
|
+
}
|
|
578
|
+
const sorting = request.sort;
|
|
579
|
+
if (sorting != undefined && sorting.length !== 0) {
|
|
580
|
+
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
|
578
581
|
}
|
|
579
|
-
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
580
582
|
return txProperties;
|
|
581
583
|
}
|
|
582
584
|
processRecords(dataUnit, fields, responseRecords) {
|
|
@@ -635,7 +637,7 @@ class DataUnitDataLoader {
|
|
|
635
637
|
DataUnitDataLoader._debouncingTimeouts[duName] = setTimeout(() => {
|
|
636
638
|
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
637
639
|
callBack();
|
|
638
|
-
},
|
|
640
|
+
}, 100);
|
|
639
641
|
}
|
|
640
642
|
static async loadData(dataUnit, request) {
|
|
641
643
|
return new Promise((resolve, reject) => {
|
|
@@ -698,11 +700,6 @@ class DataUnitDataLoader {
|
|
|
698
700
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
699
701
|
return;
|
|
700
702
|
}
|
|
701
|
-
if (loadingInfo.needReload) {
|
|
702
|
-
//Ir para a primeira página, faz com que o loadData seja chamado novamente
|
|
703
|
-
dataUnit.gotoPage(0);
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
703
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
707
704
|
}
|
|
708
705
|
static registryLoading(dataUnit, loadingInfo) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
|
2
|
+
import { SortMode, ElementIDUtils, ApplicationContext, DataType } from '@sankhyalabs/core';
|
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
4
4
|
import { d as defineCustomElement$1, T as TaskbarElement } from './snk-taskbar2.js';
|
|
5
5
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
@@ -110,6 +110,18 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
110
110
|
}
|
|
111
111
|
setGridConfig(config) {
|
|
112
112
|
this._gridConfig = config;
|
|
113
|
+
this.assertDefaultSorting();
|
|
114
|
+
}
|
|
115
|
+
assertDefaultSorting() {
|
|
116
|
+
if (this._gridConfig && this._dataUnit) {
|
|
117
|
+
this._dataUnit.defaultSorting = this._gridConfig
|
|
118
|
+
.columns
|
|
119
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
|
120
|
+
.map(({ name: field, ascending }) => {
|
|
121
|
+
const { dataType } = this._dataUnit.getField(field);
|
|
122
|
+
return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
|
|
123
|
+
});
|
|
124
|
+
}
|
|
113
125
|
}
|
|
114
126
|
loadConfig() {
|
|
115
127
|
ConfigStorage.loadGridConfig(this.configName, this.resourceID)
|
|
@@ -235,7 +247,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
235
247
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
236
248
|
}
|
|
237
249
|
finshLoading() {
|
|
238
|
-
this.
|
|
250
|
+
this.assertDefaultSorting();
|
|
239
251
|
this.addElementID();
|
|
240
252
|
if (this.columnFilterDataSource != undefined) {
|
|
241
253
|
this.columnFilterDataSource.setApplication(this._application);
|
|
@@ -321,18 +333,13 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
321
333
|
getPrimaryButton() {
|
|
322
334
|
return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
|
|
323
335
|
}
|
|
324
|
-
onEzGridReady() {
|
|
325
|
-
var _a;
|
|
326
|
-
(_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
327
|
-
this._dataUnitLoadLockerResolver = undefined;
|
|
328
|
-
}
|
|
329
336
|
render() {
|
|
330
337
|
var _a, _b;
|
|
331
338
|
if (!this._dataUnit) {
|
|
332
339
|
return undefined;
|
|
333
340
|
}
|
|
334
341
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
335
|
-
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection,
|
|
342
|
+
h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
336
343
|
}
|
|
337
344
|
get _element() { return this; }
|
|
338
345
|
static get style() { return snkGridCss; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UserInterface, DateUtils } from '@sankhyalabs/core';
|
|
2
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
|
2
|
+
import { P as PreloadManager } from './dataunit-fetcher-f15a773b.js';
|
|
3
3
|
|
|
4
4
|
class SnkMultiSelectionListDataSource {
|
|
5
5
|
setDataUnit(dataUnit) {
|
|
@@ -26,10 +26,9 @@ class ArrayRepository {
|
|
|
26
26
|
return Promise.resolve({ result, count });
|
|
27
27
|
}
|
|
28
28
|
async distict(itemProcessor) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})));
|
|
29
|
+
const processedItems = this._list.map(item => itemProcessor(item));
|
|
30
|
+
return Promise.resolve(new Map(processedItems.filter(item => item != undefined)
|
|
31
|
+
.map(item => [item.key, item.value])));
|
|
33
32
|
}
|
|
34
33
|
async push(items) {
|
|
35
34
|
this._list.push(...items);
|
|
@@ -358,7 +357,7 @@ class DatasetStrategy {
|
|
|
358
357
|
return Promise.resolve({
|
|
359
358
|
records,
|
|
360
359
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
361
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count
|
|
360
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count })
|
|
362
361
|
});
|
|
363
362
|
}
|
|
364
363
|
catch (error) {
|
|
@@ -412,10 +411,13 @@ class DatasetStrategy {
|
|
|
412
411
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnitName
|
|
413
412
|
};
|
|
414
413
|
const serverSideFilters = request.filters.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"));
|
|
415
|
-
if (serverSideFilters.length
|
|
416
|
-
|
|
414
|
+
if (serverSideFilters.length !== 0) {
|
|
415
|
+
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
416
|
+
}
|
|
417
|
+
const sorting = request.sort;
|
|
418
|
+
if (sorting != undefined && sorting.length !== 0) {
|
|
419
|
+
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
|
417
420
|
}
|
|
418
|
-
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
|
419
421
|
return txProperties;
|
|
420
422
|
}
|
|
421
423
|
processRecords(dataUnit, fields, responseRecords) {
|
|
@@ -474,7 +476,7 @@ class DataUnitDataLoader {
|
|
|
474
476
|
DataUnitDataLoader._debouncingTimeouts[duName] = setTimeout(() => {
|
|
475
477
|
delete DataUnitDataLoader._debouncingTimeouts[duName];
|
|
476
478
|
callBack();
|
|
477
|
-
},
|
|
479
|
+
}, 100);
|
|
478
480
|
}
|
|
479
481
|
static async loadData(dataUnit, request) {
|
|
480
482
|
return new Promise((resolve, reject) => {
|
|
@@ -537,11 +539,6 @@ class DataUnitDataLoader {
|
|
|
537
539
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
538
540
|
return;
|
|
539
541
|
}
|
|
540
|
-
if (loadingInfo.needReload) {
|
|
541
|
-
//Ir para a primeira página, faz com que o loadData seja chamado novamente
|
|
542
|
-
dataUnit.gotoPage(0);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
542
|
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
546
543
|
}
|
|
547
544
|
static registryLoading(dataUnit, loadingInfo) {
|
|
@@ -7,7 +7,7 @@ import './index-1564817d.js';
|
|
|
7
7
|
import './ISave-4412b20c.js';
|
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
|
-
import './dataunit-fetcher-
|
|
10
|
+
import './dataunit-fetcher-f15a773b.js';
|
|
11
11
|
import './filter-item-type.enum-5028ed3f.js';
|
|
12
12
|
import './form-config-fetcher-cfd32134.js';
|
|
13
13
|
import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
|
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage-e6764b0c.js';
|
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-942f617d.js';
|
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-08a26786.js';
|
|
7
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher-
|
|
7
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher-f15a773b.js';
|
|
8
8
|
import { P as PesquisaFetcher } from './pesquisa-fetcher-87ae964a.js';
|
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-68c1c25a.js';
|
|
10
10
|
import './form-config-fetcher-cfd32134.js';
|
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
|
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher-942f617d.js';
|
|
4
4
|
import { S as SaveErrorsEnum } from './ISave-4412b20c.js';
|
|
5
5
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
|
6
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher-
|
|
6
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher-f15a773b.js';
|
|
7
7
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
|
8
8
|
import './_commonjsHelpers-9943807e.js';
|
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
@@ -7,7 +7,7 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
|
7
7
|
import './ISave-4412b20c.js';
|
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
10
|
-
import './dataunit-fetcher-
|
|
10
|
+
import './dataunit-fetcher-f15a773b.js';
|
|
11
11
|
import './filter-item-type.enum-5028ed3f.js';
|
|
12
12
|
import './form-config-fetcher-cfd32134.js';
|
|
13
13
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
|
@@ -8,12 +8,12 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
|
8
8
|
import './ISave-4412b20c.js';
|
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
11
|
-
import './dataunit-fetcher-
|
|
11
|
+
import './dataunit-fetcher-f15a773b.js';
|
|
12
12
|
import './filter-item-type.enum-5028ed3f.js';
|
|
13
13
|
import './form-config-fetcher-cfd32134.js';
|
|
14
14
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
|
15
15
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
|
16
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
|
16
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-59a16925.js';
|
|
17
17
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-68c1c25a.js';
|
|
18
18
|
import './ConfigStorage-e6764b0c.js';
|
|
19
19
|
import './_commonjsHelpers-9943807e.js';
|