@sankhyalabs/sankhyablocks 10.1.0-dev.46 → 10.1.0-dev.47
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 +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-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 +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- 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/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +40 -3
- package/dist/components/dataunit-fetcher.js +40 -3
- 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 +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-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 +1 -1
- package/dist/esm/snk-grid.entry.js +2 -2
- 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-ac384a1e.entry.js → p-4b238673.entry.js} +1 -1
- package/dist/sankhyablocks/{p-20af4b6a.entry.js → p-4d04bc75.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2b3c284c.entry.js → p-57e37f81.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b3b51693.entry.js → p-610cae75.entry.js} +1 -1
- package/dist/sankhyablocks/{p-95ff0ec9.entry.js → p-6d775eb9.entry.js} +1 -1
- package/dist/sankhyablocks/p-6e278003.js +60 -0
- 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-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-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');
|
|
@@ -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');
|
|
@@ -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');
|
|
@@ -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');
|
|
@@ -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)) {
|
|
@@ -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';
|
|
@@ -6,7 +6,7 @@ import './ISave-4929c071.js';
|
|
|
6
6
|
import './index-b40568ff.js';
|
|
7
7
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
8
8
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
9
|
-
import './dataunit-fetcher-
|
|
9
|
+
import './dataunit-fetcher-c176e002.js';
|
|
10
10
|
import './filter-item-type.enum-d45e026f.js';
|
|
11
11
|
import { F as FormConfigFetcher } from './form-config-fetcher-b44b2727.js';
|
|
12
12
|
import { O as ORDER_VALUES } from './constants-7b422de0.js';
|
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage-76872695.js';
|
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-e60f8d53.js';
|
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-1a31c1e4.js';
|
|
7
|
-
import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-
|
|
7
|
+
import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher-c176e002.js';
|
|
8
8
|
import { P as PesquisaFetcher } from './ISave-4929c071.js';
|
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-1eb7a1af.js';
|
|
10
10
|
import { T as TEMPLATES_SKELETON } from './constants-7b422de0.js';
|
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataU
|
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher-e60f8d53.js';
|
|
4
4
|
import { S as SaveErrorsEnum } from './ISave-4929c071.js';
|
|
5
5
|
import './index-b40568ff.js';
|
|
6
|
-
import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-
|
|
6
|
+
import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-c176e002.js';
|
|
7
7
|
import './filter-item-type.enum-d45e026f.js';
|
|
8
8
|
import './form-config-fetcher-b44b2727.js';
|
|
9
9
|
import { V as VIEW_MODE } from './constants-7b422de0.js';
|
|
@@ -5,7 +5,7 @@ import './ISave-4929c071.js';
|
|
|
5
5
|
import { P as PresentationMode, E as ExporterStrategy } from './index-b40568ff.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import './dataunit-fetcher-
|
|
8
|
+
import './dataunit-fetcher-c176e002.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
10
|
import './form-config-fetcher-b44b2727.js';
|
|
11
11
|
import { V as VIEW_MODE } from './constants-7b422de0.js';
|
|
@@ -5,11 +5,11 @@ import { I as IExportType } from './IFetchDataExporterParams-d73bed3d.js';
|
|
|
5
5
|
import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './index-b40568ff.js';
|
|
6
6
|
import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-7b422de0.js';
|
|
7
7
|
import { D as DataFetcher } from './DataFetcher-e60f8d53.js';
|
|
8
|
-
import { S as SnkDataUnit } from './snk-data-unit-
|
|
8
|
+
import { S as SnkDataUnit } from './snk-data-unit-d8cfa950.js';
|
|
9
9
|
import './ISave-4929c071.js';
|
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
|
-
import './dataunit-fetcher-
|
|
12
|
+
import './dataunit-fetcher-c176e002.js';
|
|
13
13
|
import './filter-item-type.enum-d45e026f.js';
|
|
14
14
|
import './form-config-fetcher-b44b2727.js';
|
|
15
15
|
import './PrintUtils-3e4ff0f5.js';
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, e as createEvent, h, g as getElement, f as Host
|
|
|
2
2
|
import { ApplicationContext, Action, ObjectUtils, DataUnitAction, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder-1eb7a1af.js';
|
|
5
|
-
import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-
|
|
5
|
+
import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher-c176e002.js';
|
|
6
6
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
7
7
|
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo-9fa41508.js';
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { S as snk_data_unit } from './snk-data-unit-
|
|
1
|
+
export { S as snk_data_unit } from './snk-data-unit-d8cfa950.js';
|
|
2
2
|
import './index-04f73a26.js';
|
|
3
3
|
import '@sankhyalabs/core';
|
|
4
4
|
import '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import './SnkMessageBuilder-1eb7a1af.js';
|
|
6
|
-
import './dataunit-fetcher-
|
|
6
|
+
import './dataunit-fetcher-c176e002.js';
|
|
7
7
|
import './DataFetcher-e60f8d53.js';
|
|
8
8
|
import './PrintUtils-3e4ff0f5.js';
|
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
@@ -7,7 +7,7 @@ import './ISave-4929c071.js';
|
|
|
7
7
|
import { P as PresentationMode } from './index-b40568ff.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-c176e002.js';
|
|
11
11
|
import './filter-item-type.enum-d45e026f.js';
|
|
12
12
|
import './form-config-fetcher-b44b2727.js';
|
|
13
13
|
import { V as VIEW_MODE } from './constants-7b422de0.js';
|
|
@@ -4,11 +4,11 @@ import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
|
4
4
|
import { buildFieldSearch } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import './DataFetcher-e60f8d53.js';
|
|
6
6
|
import './ISave-4929c071.js';
|
|
7
|
-
import { C as CommonsExporter, T as TaskbarProcessor, a as CrudUtils, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-
|
|
7
|
+
import { C as CommonsExporter, T as TaskbarProcessor, a as CrudUtils, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-f6cabd15.js';
|
|
8
8
|
import { P as PresentationMode, E as ExporterStrategy } from './index-b40568ff.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-c176e002.js';
|
|
12
12
|
import './filter-item-type.enum-d45e026f.js';
|
|
13
13
|
import './form-config-fetcher-b44b2727.js';
|
|
14
14
|
import './constants-7b422de0.js';
|
|
@@ -5,7 +5,7 @@ import { ApplicationContext } from '@sankhyalabs/core';
|
|
|
5
5
|
import './index-b40568ff.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import './dataunit-fetcher-
|
|
8
|
+
import './dataunit-fetcher-c176e002.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
10
|
import { F as FormConfigFetcher } from './form-config-fetcher-b44b2727.js';
|
|
11
11
|
import './constants-7b422de0.js';
|
|
@@ -5,7 +5,7 @@ import './DataFetcher-e60f8d53.js';
|
|
|
5
5
|
import './index-b40568ff.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import './dataunit-fetcher-
|
|
8
|
+
import './dataunit-fetcher-c176e002.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
10
|
import './form-config-fetcher-b44b2727.js';
|
|
11
11
|
import './constants-7b422de0.js';
|
|
@@ -5,11 +5,11 @@ import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7b422de0.js';
|
|
|
5
5
|
import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
|
|
6
6
|
import './DataFetcher-e60f8d53.js';
|
|
7
7
|
import './ISave-4929c071.js';
|
|
8
|
-
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, a as CrudUtils, b as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-
|
|
8
|
+
import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, a as CrudUtils, b as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-f6cabd15.js';
|
|
9
9
|
import { P as PresentationMode } from './index-b40568ff.js';
|
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
12
|
-
import { I as InMemoryLoader } from './dataunit-fetcher-
|
|
12
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-c176e002.js';
|
|
13
13
|
import './filter-item-type.enum-d45e026f.js';
|
|
14
14
|
import { F as FormConfigFetcher } from './form-config-fetcher-b44b2727.js';
|
|
15
15
|
import { C as ConfigStorage } from './ConfigStorage-76872695.js';
|