@sankhyalabs/sankhyablocks 8.16.0-dev.23 → 8.16.0-dev.25
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ContinuousInsertUtils-e8d801ee.js → ContinuousInsertUtils-b32220f0.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-c1119754.js → dataunit-fetcher-f89461c1.js} +36 -15
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +2 -4
- 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-3f5acfd1.js → snk-data-unit-004f781a.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-filter-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +4 -4
- package/dist/cjs/{snk-guides-viewer-c29b6316.js → snk-guides-viewer-68777d37.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -4
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-grid/snk-grid.css +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +1 -1
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +1 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/components/dataunit-fetcher.js +36 -13
- package/dist/components/snk-attach2.js +2 -4
- package/dist/components/snk-data-unit2.js +1 -1
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-grid2.js +2 -2
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +2 -2
- package/dist/esm/{ContinuousInsertUtils-042cdd90.js → ContinuousInsertUtils-aae77a37.js} +1 -1
- package/dist/esm/{dataunit-fetcher-f80e80a6.js → dataunit-fetcher-c24c76c6.js} +36 -13
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +2 -4
- 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-cc1d8b4e.js → snk-data-unit-a90ce6f2.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-filter-bar.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +4 -4
- package/dist/esm/{snk-guides-viewer-292473eb.js → snk-guides-viewer-b5dd30e6.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +4 -4
- package/dist/sankhyablocks/{p-12e2c750.js → p-3e3cc017.js} +1 -1
- package/dist/sankhyablocks/{p-d7837f33.entry.js → p-43a73838.entry.js} +1 -1
- package/dist/sankhyablocks/{p-39edee2a.js → p-47a038a3.js} +1 -1
- package/dist/sankhyablocks/{p-6bd7e6e4.entry.js → p-50779ad3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4fbd8c74.entry.js → p-694e1c4a.entry.js} +1 -1
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/{p-7a9df88b.entry.js → p-7eef0898.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6e89e14b.entry.js → p-7f918d0b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-031721d6.js → p-9132a0a1.js} +1 -1
- package/dist/sankhyablocks/{p-05af89d0.entry.js → p-a42e7a1e.entry.js} +1 -1
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-b364a0b7.entry.js → p-cc42b21b.entry.js} +1 -1
- package/dist/sankhyablocks/p-e16e87fc.entry.js +1 -0
- package/dist/sankhyablocks/{p-656fbc8b.entry.js → p-eb9f0407.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b2caaaf9.entry.js → p-f98e8c12.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f5f5c94a.entry.js → p-ff1ed3a7.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-219452ed.js +0 -60
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-9fd54396.entry.js +0 -1
@@ -7,7 +7,7 @@ require('./index-1dfc7a6e.js');
|
|
7
7
|
require('./ISave-e91b70a7.js');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
9
9
|
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
10
|
+
const dataunitFetcher = require('./dataunit-fetcher-f89461c1.js');
|
11
11
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
12
12
|
require('./form-config-fetcher-ed497282.js');
|
13
13
|
const InMemoryFilterColumnDataSource = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
@@ -241,6 +241,21 @@ function applyFilter(records, dataUnit, filters) {
|
|
241
241
|
}
|
242
242
|
return records.filter(filterFunction);
|
243
243
|
}
|
244
|
+
function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
245
|
+
let records = recordsIn ? [...recordsIn] : [];
|
246
|
+
records = applyFilter(records, dataUnit, request.filters);
|
247
|
+
records = applySorting(records, dataUnit, request.sort);
|
248
|
+
const { offset, limit } = request;
|
249
|
+
const paginationInfoBuilderParams = {
|
250
|
+
recordsLength: records.length,
|
251
|
+
offset,
|
252
|
+
recordsPerPage: limit,
|
253
|
+
};
|
254
|
+
return Promise.resolve({
|
255
|
+
records: getPagesByRecords(records, offset, limit),
|
256
|
+
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
257
|
+
});
|
258
|
+
}
|
244
259
|
function applySorting(records, dataUnit, sorting) {
|
245
260
|
if (sorting == undefined || sorting.length == 0) {
|
246
261
|
return records;
|
@@ -251,18 +266,28 @@ function applySorting(records, dataUnit, sorting) {
|
|
251
266
|
}
|
252
267
|
return records.sort(sortingFunction);
|
253
268
|
}
|
254
|
-
function
|
255
|
-
|
256
|
-
|
269
|
+
function hasValidLimitAndOffset(offset, limit) {
|
270
|
+
return offset >= 0 && limit >= 0;
|
271
|
+
}
|
272
|
+
function getPagesByRecords(records, offset = 0, limit = 0) {
|
273
|
+
if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
|
274
|
+
return [];
|
275
|
+
if (limit === 0 && offset === 0)
|
276
|
+
return records;
|
277
|
+
return records.slice(offset, offset + limit);
|
278
|
+
}
|
279
|
+
function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
280
|
+
if (!recordsLength) {
|
281
|
+
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
257
282
|
}
|
258
|
-
const
|
259
|
-
const lastRecord = Math.min(
|
283
|
+
const lastRecordIndex = offset + recordsPerPage;
|
284
|
+
const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
|
260
285
|
return {
|
261
|
-
currentPage:
|
262
|
-
firstRecord: offset,
|
286
|
+
currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
|
287
|
+
firstRecord: offset + 1,
|
263
288
|
lastRecord: lastRecord,
|
264
|
-
total:
|
265
|
-
hasMore:
|
289
|
+
total: recordsLength,
|
290
|
+
hasMore: lastRecord < recordsLength,
|
266
291
|
};
|
267
292
|
}
|
268
293
|
|
@@ -348,9 +373,7 @@ class InMemoryLoader {
|
|
348
373
|
return core.StringUtils.generateUUID();
|
349
374
|
}
|
350
375
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
351
|
-
|
352
|
-
records = applySorting(records, dataUnit, request.sort);
|
353
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
376
|
+
return buildLoadDataResponse(recordsIn, dataUnit, request);
|
354
377
|
}
|
355
378
|
metadaLoader() {
|
356
379
|
return Promise.resolve(this._metadata);
|
@@ -1069,7 +1092,5 @@ exports.DataUnitFetcher = DataUnitFetcher;
|
|
1069
1092
|
exports.DatasetStrategy = DatasetStrategy;
|
1070
1093
|
exports.InMemoryLoader = InMemoryLoader;
|
1071
1094
|
exports.PreloadManager = PreloadManager;
|
1072
|
-
exports.
|
1073
|
-
exports.applySorting = applySorting;
|
1074
|
-
exports.buildPaginationInfo = buildPaginationInfo;
|
1095
|
+
exports.buildLoadDataResponse = buildLoadDataResponse;
|
1075
1096
|
exports.getRecordValue = getRecordValue;
|
@@ -11,7 +11,7 @@ require('./index-1dfc7a6e.js');
|
|
11
11
|
require('./ISave-e91b70a7.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-f89461c1.js');
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
16
16
|
require('./form-config-fetcher-ed497282.js');
|
17
17
|
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const ConfigStorage = require('./ConfigStorage-ecc0ed20.js');
|
9
9
|
const DataFetcher = require('./DataFetcher-cadeef8e.js');
|
10
10
|
const authFetcher = require('./auth-fetcher-d68841bc.js');
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-f89461c1.js');
|
12
12
|
const pesquisaFetcher = require('./pesquisa-fetcher-ca89181c.js');
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
|
14
14
|
require('./form-config-fetcher-ed497282.js');
|
@@ -8,7 +8,7 @@ const DataFetcher = require('./DataFetcher-cadeef8e.js');
|
|
8
8
|
require('./pesquisa-fetcher-ca89181c.js');
|
9
9
|
require('./index-1dfc7a6e.js');
|
10
10
|
const ISave = require('./ISave-e91b70a7.js');
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-f89461c1.js');
|
12
12
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
13
13
|
require('./form-config-fetcher-ed497282.js');
|
14
14
|
const constants = require('./constants-35ddd366.js');
|
@@ -464,9 +464,7 @@ class AttachFetcherDataUnitFactory {
|
|
464
464
|
});
|
465
465
|
this._records = records;
|
466
466
|
}
|
467
|
-
|
468
|
-
records = dataunitFetcher.applySorting(records, dataUnit, request.sort);
|
469
|
-
return Promise.resolve({ records, paginationInfo: dataunitFetcher.buildPaginationInfo(records, request.offset, request.limit) });
|
467
|
+
return dataunitFetcher.buildLoadDataResponse(this._records, dataUnit, request);
|
470
468
|
}
|
471
469
|
saveLoader(changes, fetcher) {
|
472
470
|
return new Promise((resolve) => {
|
@@ -11,7 +11,7 @@ const index$1 = require('./index-1dfc7a6e.js');
|
|
11
11
|
require('./ISave-e91b70a7.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-f89461c1.js');
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
16
16
|
require('./form-config-fetcher-ed497282.js');
|
17
17
|
const constants = require('./constants-35ddd366.js');
|
@@ -8,12 +8,12 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const index = require('./index-1dfc7a6e.js');
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
10
10
|
const DataFetcher = require('./DataFetcher-cadeef8e.js');
|
11
|
-
const snkDataUnit = require('./snk-data-unit-
|
11
|
+
const snkDataUnit = require('./snk-data-unit-004f781a.js');
|
12
12
|
require('./pesquisa-fetcher-ca89181c.js');
|
13
13
|
require('./ISave-e91b70a7.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-f89461c1.js');
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
18
|
require('./form-config-fetcher-ed497282.js');
|
19
19
|
require('./PrintUtils-bcaeb82f.js');
|
@@ -4,7 +4,7 @@ const index = require('./index-f9e81701.js');
|
|
4
4
|
const core = require('@sankhyalabs/core');
|
5
5
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
6
6
|
const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
|
7
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
7
|
+
const dataunitFetcher = require('./dataunit-fetcher-f89461c1.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-004f781a.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
9
9
|
require('./SnkMessageBuilder-bae64d0d.js');
|
10
|
-
require('./dataunit-fetcher-
|
10
|
+
require('./dataunit-fetcher-f89461c1.js');
|
11
11
|
require('./DataFetcher-cadeef8e.js');
|
12
12
|
require('./PrintUtils-bcaeb82f.js');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -12,12 +12,12 @@ const index$1 = require('./index-1dfc7a6e.js');
|
|
12
12
|
require('./ISave-e91b70a7.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-f89461c1.js');
|
16
16
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
17
17
|
require('./form-config-fetcher-ed497282.js');
|
18
18
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
19
19
|
const constants = require('./constants-35ddd366.js');
|
20
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
20
|
+
const snkGuidesViewer = require('./snk-guides-viewer-68777d37.js');
|
21
21
|
const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
|
22
22
|
require('./ConfigStorage-ecc0ed20.js');
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
@@ -252,7 +252,7 @@ class SnkFilterModalFactory {
|
|
252
252
|
}
|
253
253
|
}
|
254
254
|
|
255
|
-
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-
|
255
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:8px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
|
256
256
|
|
257
257
|
const SnkFilterBar = class {
|
258
258
|
constructor(hostRef) {
|
@@ -26,7 +26,7 @@ const SnkFilterCheckboxList = class {
|
|
26
26
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
27
27
|
}
|
28
28
|
renderOptions() {
|
29
|
-
return this.optionsList.map(option => (index.h("ez-check", { label: option.label,
|
29
|
+
return this.optionsList.map(option => (index.h("ez-check", { label: option.label, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
30
30
|
}
|
31
31
|
isChecked(itemName) {
|
32
32
|
var _a;
|
@@ -9,14 +9,14 @@ const ConfigStorage = require('./ConfigStorage-ecc0ed20.js');
|
|
9
9
|
const index$1 = require('./index-1dfc7a6e.js');
|
10
10
|
const fieldSearch = require('./field-search-68e34bf4.js');
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
12
|
-
const ContinuousInsertUtils = require('./ContinuousInsertUtils-
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-b32220f0.js');
|
13
13
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
14
14
|
require('./DataFetcher-cadeef8e.js');
|
15
15
|
require('./pesquisa-fetcher-ca89181c.js');
|
16
16
|
require('./ISave-e91b70a7.js');
|
17
17
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
18
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
19
|
-
require('./dataunit-fetcher-
|
19
|
+
require('./dataunit-fetcher-f89461c1.js');
|
20
20
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
21
21
|
require('./form-config-fetcher-ed497282.js');
|
22
22
|
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
@@ -80,7 +80,7 @@ class ServerSideExporterProvider extends ContinuousInsertUtils.CommonsExporter {
|
|
80
80
|
}
|
81
81
|
}
|
82
82
|
|
83
|
-
const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--
|
83
|
+
const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--small)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding)}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
|
84
84
|
|
85
85
|
const SnkGrid = class {
|
86
86
|
constructor(hostRef) {
|
@@ -529,7 +529,7 @@ const SnkGrid = class {
|
|
529
529
|
if (!this._dataUnit) {
|
530
530
|
return undefined;
|
531
531
|
}
|
532
|
-
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, index.h("div", { class: "snk-grid__header ez-margin-bottom--
|
532
|
+
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--extra-small" }, this._showSnkFilterBar &&
|
533
533
|
index.h(index.Fragment, null, index.h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), 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, overflowStrategy: 'none' }, 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, index.h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
534
534
|
}
|
535
535
|
get _element() { return index.getElement(this); }
|
@@ -13,7 +13,7 @@ const index$1 = require('./index-1dfc7a6e.js');
|
|
13
13
|
require('./ISave-e91b70a7.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-f89461c1.js');
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
18
18
|
require('./form-config-fetcher-ed497282.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-68777d37.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('./SnkFormConfigManager-f1c92f79.js');
|
@@ -21,7 +21,7 @@ require('./index-102ba62d.js');
|
|
21
21
|
require('./pesquisa-fetcher-ca89181c.js');
|
22
22
|
require('./ISave-e91b70a7.js');
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
24
|
-
require('./dataunit-fetcher-
|
24
|
+
require('./dataunit-fetcher-f89461c1.js');
|
25
25
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
26
26
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
27
27
|
require('./ResourceIDUtils-5ff86aa7.js');
|
@@ -36,7 +36,7 @@ const SnkSimpleBar = class {
|
|
36
36
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
37
37
|
}
|
38
38
|
render() {
|
39
|
-
return (index.h("div", { class: "simple-bar__container ez-margin-vertical--
|
39
|
+
return (index.h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, index.h("div", { class: "simple-bar__left-slot" }, index.h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), index.h("div", { class: "simple-bar__column" }, index.h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), index.h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), index.h("div", { class: "simple-bar__right-slot" }, index.h("slot", { name: "rightSlot" }))));
|
40
40
|
}
|
41
41
|
get _element() { return index.getElement(this); }
|
42
42
|
};
|
@@ -9,12 +9,12 @@ const constants = require('./constants-35ddd366.js');
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
10
10
|
require('./DataFetcher-cadeef8e.js');
|
11
11
|
require('./pesquisa-fetcher-ca89181c.js');
|
12
|
-
const ContinuousInsertUtils = require('./ContinuousInsertUtils-
|
12
|
+
const ContinuousInsertUtils = require('./ContinuousInsertUtils-b32220f0.js');
|
13
13
|
const index = require('./index-1dfc7a6e.js');
|
14
14
|
require('./ISave-e91b70a7.js');
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
16
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
17
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
17
|
+
const dataunitFetcher = require('./dataunit-fetcher-f89461c1.js');
|
18
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
19
19
|
const formConfigFetcher = require('./form-config-fetcher-ed497282.js');
|
20
20
|
const fieldSearch = require('./field-search-68e34bf4.js');
|
@@ -86,7 +86,7 @@ class ClientSideExporterProvider extends ContinuousInsertUtils.CommonsExporter {
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
89
|
-
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;
|
89
|
+
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
|
90
90
|
|
91
91
|
const SnkSimpleCrud = class {
|
92
92
|
constructor(hostRef) {
|
@@ -806,7 +806,7 @@ const SnkSimpleCrud = class {
|
|
806
806
|
if (this.dataUnit == undefined) {
|
807
807
|
return;
|
808
808
|
}
|
809
|
-
const taskbarContent = (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--
|
809
|
+
const taskbarContent = (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
810
810
|
return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === constants.VIEW_MODE.FORM && taskbarContent, index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
811
811
|
? undefined
|
812
812
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === constants.VIEW_MODE.GRID && taskbarContent, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
@@ -3,7 +3,7 @@ import { SaveErrorsEnum } from '../../../../../lib/http/data-fetcher/fetchers/At
|
|
3
3
|
import { AutorizationType } from '../../../../../lib/http/data-fetcher/fetchers/auth-fetcher';
|
4
4
|
import { attachFetcherMetadataBuilder } from '../../builder/attach-crud-config.builder';
|
5
5
|
import { VIEW_MODE } from '../../../../../lib/utils/constants';
|
6
|
-
import {
|
6
|
+
import { buildLoadDataResponse } from '../../../../../lib/dataUnit/dataUnitInMemoryUtils';
|
7
7
|
const SERVICE_LOAD = "Attach.load";
|
8
8
|
export class AttachFetcherDataUnitFactory {
|
9
9
|
constructor(getMessage) {
|
@@ -49,9 +49,7 @@ export class AttachFetcherDataUnitFactory {
|
|
49
49
|
});
|
50
50
|
this._records = records;
|
51
51
|
}
|
52
|
-
|
53
|
-
records = applySorting(records, dataUnit, request.sort);
|
54
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
52
|
+
return buildLoadDataResponse(this._records, dataUnit, request);
|
55
53
|
}
|
56
54
|
saveLoader(changes, fetcher) {
|
57
55
|
return new Promise((resolve) => {
|
package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js
CHANGED
@@ -19,7 +19,7 @@ export class SnkFilterCheckboxList {
|
|
19
19
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
20
20
|
}
|
21
21
|
renderOptions() {
|
22
|
-
return this.optionsList.map(option => (h("ez-check", { label: option.label,
|
22
|
+
return this.optionsList.map(option => (h("ez-check", { label: option.label, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
23
23
|
}
|
24
24
|
isChecked(itemName) {
|
25
25
|
var _a;
|
@@ -456,7 +456,7 @@ export class SnkGrid {
|
|
456
456
|
if (!this._dataUnit) {
|
457
457
|
return undefined;
|
458
458
|
}
|
459
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto" }, h("div", { class: "snk-grid__header ez-margin-bottom--
|
459
|
+
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--extra-small" }, this._showSnkFilterBar &&
|
460
460
|
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), 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, overflowStrategy: 'none' }, 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: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
461
461
|
}
|
462
462
|
static get is() { return "snk-grid"; }
|
@@ -26,7 +26,7 @@ export class SnkSimpleBar {
|
|
26
26
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
27
27
|
}
|
28
28
|
render() {
|
29
|
-
return (h("div", { class: "simple-bar__container ez-margin-vertical--
|
29
|
+
return (h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
|
30
30
|
}
|
31
31
|
static get is() { return "snk-simple-bar"; }
|
32
32
|
static get encapsulation() { return "scoped"; }
|
@@ -726,7 +726,7 @@ export class SnkSimpleCrud {
|
|
726
726
|
if (this.dataUnit == undefined) {
|
727
727
|
return;
|
728
728
|
}
|
729
|
-
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--
|
729
|
+
const taskbarContent = (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
730
730
|
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, this._currentViewMode === VIEW_MODE.FORM && taskbarContent, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
731
731
|
? undefined
|
732
732
|
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this._currentViewMode === VIEW_MODE.GRID && taskbarContent, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
|
2
|
-
import {
|
2
|
+
import { buildLoadDataResponse } from './dataUnitInMemoryUtils';
|
3
3
|
export default class InMemoryLoader {
|
4
4
|
constructor(metadata, records, config) {
|
5
5
|
this.metadata = metadata;
|
@@ -82,9 +82,7 @@ export default class InMemoryLoader {
|
|
82
82
|
return StringUtils.generateUUID();
|
83
83
|
}
|
84
84
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
85
|
-
|
86
|
-
records = applySorting(records, dataUnit, request.sort);
|
87
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
85
|
+
return buildLoadDataResponse(recordsIn, dataUnit, request);
|
88
86
|
}
|
89
87
|
metadaLoader() {
|
90
88
|
return Promise.resolve(this._metadata);
|
@@ -11,6 +11,21 @@ export function applyFilter(records, dataUnit, filters) {
|
|
11
11
|
}
|
12
12
|
return records.filter(filterFunction);
|
13
13
|
}
|
14
|
+
export function buildLoadDataResponse(recordsIn, dataUnit, request) {
|
15
|
+
let records = recordsIn ? [...recordsIn] : [];
|
16
|
+
records = applyFilter(records, dataUnit, request.filters);
|
17
|
+
records = applySorting(records, dataUnit, request.sort);
|
18
|
+
const { offset, limit } = request;
|
19
|
+
const paginationInfoBuilderParams = {
|
20
|
+
recordsLength: records.length,
|
21
|
+
offset,
|
22
|
+
recordsPerPage: limit,
|
23
|
+
};
|
24
|
+
return Promise.resolve({
|
25
|
+
records: getPagesByRecords(records, offset, limit),
|
26
|
+
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams),
|
27
|
+
});
|
28
|
+
}
|
14
29
|
export function applySorting(records, dataUnit, sorting) {
|
15
30
|
if (sorting == undefined || sorting.length == 0) {
|
16
31
|
return records;
|
@@ -21,17 +36,27 @@ export function applySorting(records, dataUnit, sorting) {
|
|
21
36
|
}
|
22
37
|
return records.sort(sortingFunction);
|
23
38
|
}
|
24
|
-
|
25
|
-
|
26
|
-
|
39
|
+
function hasValidLimitAndOffset(offset, limit) {
|
40
|
+
return offset >= 0 && limit >= 0;
|
41
|
+
}
|
42
|
+
export function getPagesByRecords(records, offset = 0, limit = 0) {
|
43
|
+
if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
|
44
|
+
return [];
|
45
|
+
if (limit === 0 && offset === 0)
|
46
|
+
return records;
|
47
|
+
return records.slice(offset, offset + limit);
|
48
|
+
}
|
49
|
+
export function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
50
|
+
if (!recordsLength) {
|
51
|
+
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
27
52
|
}
|
28
|
-
const
|
29
|
-
const lastRecord = Math.min(
|
53
|
+
const lastRecordIndex = offset + recordsPerPage;
|
54
|
+
const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
|
30
55
|
return {
|
31
|
-
currentPage:
|
32
|
-
firstRecord: offset,
|
56
|
+
currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
|
57
|
+
firstRecord: offset + 1,
|
33
58
|
lastRecord: lastRecord,
|
34
|
-
total:
|
35
|
-
hasMore:
|
59
|
+
total: recordsLength,
|
60
|
+
hasMore: lastRecord < recordsLength,
|
36
61
|
};
|
37
62
|
}
|