@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-kb-67792.3 → 0.0.0-bugfix-dev-KB-71601.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{IExporterProvider-10b7fed5.js → IExporterProvider-a6e2acaa.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-d4873076.js → dataunit-fetcher-4c0d1485.js} +25 -11
- 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 +39 -22
- 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-f0221097.js → snk-data-unit-054841d2.js} +3 -2
- 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 +14 -15
- package/dist/cjs/snk-grid.cjs.entry.js +2 -2
- package/dist/cjs/{snk-guides-viewer-aafc3073.js → snk-guides-viewer-58907f8d.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-attach/snk-attach.js +24 -15
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +8 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +2 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +14 -15
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +17 -3
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +9 -9
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/components/dataunit-fetcher.js +25 -11
- package/dist/components/snk-attach2.js +38 -21
- package/dist/components/snk-data-unit2.js +2 -1
- package/dist/components/snk-filter-bar2.js +14 -15
- package/dist/esm/{IExporterProvider-d597f27d.js → IExporterProvider-66c83d70.js} +1 -1
- package/dist/esm/{dataunit-fetcher-3d2ec959.js → dataunit-fetcher-1c1cdd90.js} +25 -11
- 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 +39 -22
- 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-1ef94aef.js → snk-data-unit-a0a8b82a.js} +3 -2
- 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 +14 -15
- package/dist/esm/snk-grid.entry.js +2 -2
- package/dist/esm/{snk-guides-viewer-62124f3d.js → snk-guides-viewer-5fe10c89.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-70001ac1.js → p-1b64a684.js} +1 -1
- package/dist/sankhyablocks/{p-0c68f40f.entry.js → p-42bd6a34.entry.js} +1 -1
- package/dist/sankhyablocks/p-449df4bf.entry.js +1 -0
- package/dist/sankhyablocks/p-5b26cc7c.entry.js +1 -0
- package/dist/sankhyablocks/{p-d65d98ed.entry.js → p-67525bf6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-74c665d5.entry.js → p-7a0d7901.entry.js} +1 -1
- package/dist/sankhyablocks/{p-421bec84.entry.js → p-812e5d2e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-51999ab5.entry.js → p-8c8ad7b9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8c1ff936.entry.js → p-959fdc87.entry.js} +1 -1
- package/dist/sankhyablocks/{p-162b9a59.entry.js → p-9c5e0d8a.entry.js} +1 -1
- package/dist/sankhyablocks/p-a4c04730.js +60 -0
- package/dist/sankhyablocks/{p-094eebf6.entry.js → p-b6f1135c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-76a65660.js → p-c0b3a683.js} +1 -1
- package/dist/sankhyablocks/{p-c273d6ee.js → p-e6ab759c.js} +1 -1
- package/dist/sankhyablocks/{p-08c28ddd.entry.js → p-fb5798b4.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -1
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +6 -1
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/package.json +1 -1
- package/dist/sankhyablocks/p-091ce761.js +0 -60
- package/dist/sankhyablocks/p-42f7b05d.entry.js +0 -1
- package/dist/sankhyablocks/p-6c364d25.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-4c0d1485.js');
|
|
11
11
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
12
12
|
require('./form-config-fetcher-feb08214.js');
|
|
13
13
|
const InMemoryFilterColumnDataSource = require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
@@ -251,18 +251,18 @@ function applySorting(records, dataUnit, sorting) {
|
|
|
251
251
|
}
|
|
252
252
|
return records.sort(sortingFunction);
|
|
253
253
|
}
|
|
254
|
-
function buildPaginationInfo(
|
|
255
|
-
if (
|
|
256
|
-
return
|
|
254
|
+
function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
|
|
255
|
+
if (!recordsLength) {
|
|
256
|
+
return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
|
|
257
257
|
}
|
|
258
|
-
const
|
|
259
|
-
const lastRecord = Math.min(
|
|
258
|
+
const lastRecordIndex = offset + recordsPerPage;
|
|
259
|
+
const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
|
|
260
260
|
return {
|
|
261
|
-
currentPage:
|
|
262
|
-
firstRecord: offset,
|
|
261
|
+
currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
|
|
262
|
+
firstRecord: offset + 1,
|
|
263
263
|
lastRecord: lastRecord,
|
|
264
|
-
total:
|
|
265
|
-
hasMore:
|
|
264
|
+
total: recordsLength,
|
|
265
|
+
hasMore: lastRecord < recordsLength,
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -348,9 +348,23 @@ class InMemoryLoader {
|
|
|
348
348
|
return core.StringUtils.generateUUID();
|
|
349
349
|
}
|
|
350
350
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
|
351
|
-
let records =
|
|
351
|
+
let records = recordsIn ? [...recordsIn] : [];
|
|
352
|
+
records = applyFilter(records, dataUnit, request.filters);
|
|
352
353
|
records = applySorting(records, dataUnit, request.sort);
|
|
353
|
-
|
|
354
|
+
const { offset, limit } = request;
|
|
355
|
+
let pageRecords = records ? [...records] : [];
|
|
356
|
+
if (records && offset >= 0 && limit >= 0) {
|
|
357
|
+
pageRecords = records.slice(offset, offset + limit);
|
|
358
|
+
}
|
|
359
|
+
const paginationInfoBuilderParams = {
|
|
360
|
+
recordsLength: records.length,
|
|
361
|
+
offset,
|
|
362
|
+
recordsPerPage: limit
|
|
363
|
+
};
|
|
364
|
+
return Promise.resolve({
|
|
365
|
+
records: pageRecords,
|
|
366
|
+
paginationInfo: buildPaginationInfo(paginationInfoBuilderParams)
|
|
367
|
+
});
|
|
354
368
|
}
|
|
355
369
|
metadaLoader() {
|
|
356
370
|
return Promise.resolve(this._metadata);
|
|
@@ -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-4c0d1485.js');
|
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
16
16
|
require('./form-config-fetcher-feb08214.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-e49214c6.js');
|
|
9
9
|
const DataFetcher = require('./DataFetcher-77729a93.js');
|
|
10
10
|
const authFetcher = require('./auth-fetcher-29bb791c.js');
|
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-4c0d1485.js');
|
|
12
12
|
const pesquisaFetcher = require('./pesquisa-fetcher-a1d0353f.js');
|
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-cceebbae.js');
|
|
14
14
|
require('./form-config-fetcher-feb08214.js');
|
|
@@ -8,7 +8,7 @@ const DataFetcher = require('./DataFetcher-77729a93.js');
|
|
|
8
8
|
require('./pesquisa-fetcher-a1d0353f.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-4c0d1485.js');
|
|
12
12
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
13
13
|
require('./form-config-fetcher-feb08214.js');
|
|
14
14
|
const constants = require('./constants-35ddd366.js');
|
|
@@ -117,21 +117,23 @@ const SERVICE = {
|
|
|
117
117
|
download: "AnexoSistemaSP.baixar",
|
|
118
118
|
};
|
|
119
119
|
class AnexoSistemaFetcher {
|
|
120
|
-
constructor(entityName,
|
|
120
|
+
constructor(entityName, dataUnitName) {
|
|
121
121
|
var _a;
|
|
122
122
|
this.entityName = entityName;
|
|
123
|
-
this.registerKey = registerKey;
|
|
124
123
|
this.dataUnitName = dataUnitName;
|
|
125
124
|
this.validateFields = (fields) => {
|
|
126
125
|
if (!!fields.LINK && !!fields.NOMEARQUIVO)
|
|
127
126
|
throw new Error(ISave.SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
|
|
128
127
|
if (!fields.LINK && !fields.NOMEARQUIVO)
|
|
129
128
|
throw new Error(ISave.SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
|
|
130
|
-
if (!this.
|
|
129
|
+
if (!this._registerKey)
|
|
131
130
|
throw new Error('Register key can not be null');
|
|
132
131
|
};
|
|
133
132
|
this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
|
|
134
133
|
}
|
|
134
|
+
set registerKey(registerKey) {
|
|
135
|
+
this._registerKey = registerKey;
|
|
136
|
+
}
|
|
135
137
|
async save(change) {
|
|
136
138
|
var _a, _b;
|
|
137
139
|
let { updatingFields: fields } = change;
|
|
@@ -150,7 +152,7 @@ class AnexoSistemaFetcher {
|
|
|
150
152
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
|
151
153
|
link: fields.LINK,
|
|
152
154
|
nameEntity: this.entityName,
|
|
153
|
-
pkEntity: this.
|
|
155
|
+
pkEntity: this._registerKey,
|
|
154
156
|
typeAcess: fields.TIPOACESSO,
|
|
155
157
|
typeApres: fields.TIPOAPRES,
|
|
156
158
|
}
|
|
@@ -190,7 +192,7 @@ class AnexoSistemaFetcher {
|
|
|
190
192
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
|
191
193
|
link: fields.LINK,
|
|
192
194
|
nameEntity: this.entityName,
|
|
193
|
-
pkEntity: this.
|
|
195
|
+
pkEntity: this._registerKey,
|
|
194
196
|
typeAcess: fields.TIPOACESSO,
|
|
195
197
|
typeApres: fields.TIPOAPRES,
|
|
196
198
|
}
|
|
@@ -464,7 +466,13 @@ class AttachFetcherDataUnitFactory {
|
|
|
464
466
|
}
|
|
465
467
|
let records = dataunitFetcher.applyFilter(this._records, dataUnit, request.filters);
|
|
466
468
|
records = dataunitFetcher.applySorting(records, dataUnit, request.sort);
|
|
467
|
-
|
|
469
|
+
//TODO: não está sendo tratada a paginação nesse caso, é preciso replicar a lógica como no inMemoryLoader
|
|
470
|
+
const paginationInfoBuilderParams = {
|
|
471
|
+
recordsLength: records.length,
|
|
472
|
+
offset: request.offset,
|
|
473
|
+
recordsPerPage: request.limit
|
|
474
|
+
};
|
|
475
|
+
return Promise.resolve({ records, paginationInfo: dataunitFetcher.buildPaginationInfo(paginationInfoBuilderParams) });
|
|
468
476
|
}
|
|
469
477
|
saveLoader(changes, fetcher) {
|
|
470
478
|
return new Promise((resolve) => {
|
|
@@ -660,11 +668,20 @@ const SnkAttach = class {
|
|
|
660
668
|
this.loadAttachmentDataUnit();
|
|
661
669
|
}
|
|
662
670
|
if (oldRegisterKey !== newRegisterKey) {
|
|
671
|
+
if (this._currentFetcher instanceof AnexoSistemaFetcher) {
|
|
672
|
+
this._currentFetcher.registerKey = newRegisterKey;
|
|
673
|
+
}
|
|
663
674
|
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
|
664
675
|
}
|
|
665
676
|
}
|
|
677
|
+
getAnexoSistemaFetcherInstance() {
|
|
678
|
+
var _a;
|
|
679
|
+
const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
680
|
+
anexoSistemaFetcher.registerKey = this.registerKey;
|
|
681
|
+
return anexoSistemaFetcher;
|
|
682
|
+
}
|
|
666
683
|
async initAttach() {
|
|
667
|
-
var _a, _b, _c, _d, _e
|
|
684
|
+
var _a, _b, _c, _d, _e;
|
|
668
685
|
if (!this.fetcherType && !this.registerKey)
|
|
669
686
|
return;
|
|
670
687
|
if (!this.fetcherType) {
|
|
@@ -672,18 +689,18 @@ const SnkAttach = class {
|
|
|
672
689
|
}
|
|
673
690
|
this.returnToGridMode();
|
|
674
691
|
if (this.fetcherType === "AnexoSistema") {
|
|
675
|
-
this._currentFetcher =
|
|
676
|
-
(
|
|
677
|
-
await ((
|
|
692
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
693
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
694
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
678
695
|
return;
|
|
679
696
|
}
|
|
680
697
|
if (this.fetcherType === "Attach") {
|
|
681
|
-
const hasMoreOneItem = ((
|
|
698
|
+
const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
|
|
682
699
|
if (hasMoreOneItem)
|
|
683
700
|
return;
|
|
684
701
|
}
|
|
685
|
-
await ((
|
|
686
|
-
await ((
|
|
702
|
+
await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
|
|
703
|
+
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
|
|
687
704
|
}
|
|
688
705
|
/**
|
|
689
706
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -742,11 +759,11 @@ const SnkAttach = class {
|
|
|
742
759
|
}
|
|
743
760
|
}
|
|
744
761
|
async loadAnexoSistema() {
|
|
745
|
-
var _a, _b
|
|
762
|
+
var _a, _b;
|
|
746
763
|
this._currentDataUnit = new dataunitFetcher.DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
747
|
-
this._currentFetcher =
|
|
764
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
748
765
|
if (!this._currentDataUnit.metadata) {
|
|
749
|
-
await ((
|
|
766
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
750
767
|
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
|
751
768
|
}
|
|
752
769
|
this.initDataUnitLoaders();
|
|
@@ -756,7 +773,7 @@ const SnkAttach = class {
|
|
|
756
773
|
this._currentDataUnit.addInterceptor({
|
|
757
774
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
|
758
775
|
});
|
|
759
|
-
await ((
|
|
776
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
760
777
|
this.disableEditFieldsNotInForm();
|
|
761
778
|
}
|
|
762
779
|
async loadAttach() {
|
|
@@ -782,16 +799,16 @@ const SnkAttach = class {
|
|
|
782
799
|
}
|
|
783
800
|
}
|
|
784
801
|
initDataUnitLoaders() {
|
|
785
|
-
var _a, _b
|
|
802
|
+
var _a, _b;
|
|
786
803
|
if (this.fetcherType === "AnexoSistema") {
|
|
787
|
-
this._currentFetcher =
|
|
804
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
788
805
|
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
789
|
-
(
|
|
806
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
790
807
|
}
|
|
791
808
|
if (this.fetcherType === "Attach") {
|
|
792
809
|
this._currentFetcher = new AttachFetcher();
|
|
793
810
|
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
794
|
-
(
|
|
811
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
795
812
|
this.returnToGridMode();
|
|
796
813
|
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
797
814
|
});
|
|
@@ -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-4c0d1485.js');
|
|
15
15
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
16
16
|
require('./form-config-fetcher-feb08214.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-77729a93.js');
|
|
11
|
-
const snkDataUnit = require('./snk-data-unit-
|
|
11
|
+
const snkDataUnit = require('./snk-data-unit-054841d2.js');
|
|
12
12
|
require('./pesquisa-fetcher-a1d0353f.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-4c0d1485.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
require('./form-config-fetcher-feb08214.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-cceebbae.js');
|
|
7
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
7
|
+
const dataunitFetcher = require('./dataunit-fetcher-4c0d1485.js');
|
|
8
8
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
9
9
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
10
10
|
|
|
@@ -560,7 +560,8 @@ const SnkDataUnit = class {
|
|
|
560
560
|
if (forceMetadataLoad || !this.dataUnit.metadata)
|
|
561
561
|
await this.dataUnit.loadMetadata();
|
|
562
562
|
if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
|
|
563
|
-
this.getMetadataByRow(this.dataUnit);
|
|
563
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
|
564
|
+
this.dataUnit.records = records;
|
|
564
565
|
}
|
|
565
566
|
this.dataState = this.buildDataState();
|
|
566
567
|
let resolver;
|
|
@@ -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-054841d2.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
9
|
require('./SnkMessageBuilder-cceebbae.js');
|
|
10
|
-
require('./dataunit-fetcher-
|
|
10
|
+
require('./dataunit-fetcher-4c0d1485.js');
|
|
11
11
|
require('./DataFetcher-77729a93.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-4c0d1485.js');
|
|
16
16
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
17
|
require('./form-config-fetcher-feb08214.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-58907f8d.js');
|
|
21
21
|
const SnkMessageBuilder = require('./SnkMessageBuilder-cceebbae.js');
|
|
22
22
|
require('./ConfigStorage-e49214c6.js');
|
|
23
23
|
require('./PrintUtils-bcaeb82f.js');
|
|
@@ -265,13 +265,13 @@ const SnkFilterBar = class {
|
|
|
265
265
|
this._pendingVariables = false;
|
|
266
266
|
this._customfiltersToBeUpdated = [];
|
|
267
267
|
this._calculateSortIndex = (item) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
if (!item.visible)
|
|
269
|
+
return 0;
|
|
270
|
+
if (item.hardFixed)
|
|
271
|
+
return 1000000; //campos Hard Fixed não variam a ordem
|
|
272
|
+
let index = item.fixed ? 100000 : 0;
|
|
273
|
+
index += this.hasValidValue(item) ? 10000 : 0;
|
|
274
|
+
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
|
275
275
|
return index;
|
|
276
276
|
};
|
|
277
277
|
this._filtersComparator = (a, b) => {
|
|
@@ -292,13 +292,12 @@ const SnkFilterBar = class {
|
|
|
292
292
|
this.showPersonalizedFilter = false;
|
|
293
293
|
this.personalizedFilterId = undefined;
|
|
294
294
|
}
|
|
295
|
-
|
|
296
|
-
if (item.value
|
|
297
|
-
return
|
|
298
|
-
if (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return index;
|
|
295
|
+
hasValidValue(item) {
|
|
296
|
+
if (item.value === undefined || item.value === null)
|
|
297
|
+
return false;
|
|
298
|
+
if (!Array.isArray(item.value))
|
|
299
|
+
return true;
|
|
300
|
+
return item.value.some(filterItem => filterItem.check === true);
|
|
302
301
|
}
|
|
303
302
|
observeFilterConfig(newValue, oldValue) {
|
|
304
303
|
if (core.ObjectUtils.equals(newValue, oldValue))
|
|
@@ -525,7 +524,7 @@ const SnkFilterBar = class {
|
|
|
525
524
|
getFilterItems() {
|
|
526
525
|
const pinnedItems = [];
|
|
527
526
|
const unpinnedItems = [];
|
|
528
|
-
this.filterConfig
|
|
527
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
|
529
528
|
.filter(this.filterActiveFilter)
|
|
530
529
|
.forEach((item, index) => {
|
|
531
530
|
item = core.ObjectUtils.copy(item);
|
|
@@ -9,14 +9,14 @@ const ConfigStorage = require('./ConfigStorage-e49214c6.js');
|
|
|
9
9
|
const index$1 = require('./index-1dfc7a6e.js');
|
|
10
10
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
11
11
|
const index$2 = require('./index-102ba62d.js');
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-a6e2acaa.js');
|
|
13
13
|
const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
|
|
14
14
|
require('./DataFetcher-77729a93.js');
|
|
15
15
|
require('./pesquisa-fetcher-a1d0353f.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-4c0d1485.js');
|
|
20
20
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
21
21
|
require('./form-config-fetcher-feb08214.js');
|
|
22
22
|
const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
|
|
@@ -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-4c0d1485.js');
|
|
17
17
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
18
18
|
require('./form-config-fetcher-feb08214.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-58907f8d.js');
|
|
6
6
|
require('./index-f9e81701.js');
|
|
7
7
|
require('@sankhyalabs/core');
|
|
8
8
|
require('./SnkFormConfigManager-beebf47a.js');
|
|
@@ -21,7 +21,7 @@ require('./constants-35ddd366.js');
|
|
|
21
21
|
require('./pesquisa-fetcher-a1d0353f.js');
|
|
22
22
|
require('./ISave-e91b70a7.js');
|
|
23
23
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
24
|
-
require('./dataunit-fetcher-
|
|
24
|
+
require('./dataunit-fetcher-4c0d1485.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');
|
|
@@ -9,12 +9,12 @@ const constants = require('./constants-35ddd366.js');
|
|
|
9
9
|
const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
|
|
10
10
|
require('./DataFetcher-77729a93.js');
|
|
11
11
|
require('./pesquisa-fetcher-a1d0353f.js');
|
|
12
|
-
const IExporterProvider = require('./IExporterProvider-
|
|
12
|
+
const IExporterProvider = require('./IExporterProvider-a6e2acaa.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-4c0d1485.js');
|
|
18
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
19
19
|
const formConfigFetcher = require('./form-config-fetcher-feb08214.js');
|
|
20
20
|
const fieldSearch = require('./field-search-f56aa7d6.js');
|
|
@@ -46,11 +46,20 @@ export class SnkAttach {
|
|
|
46
46
|
this.loadAttachmentDataUnit();
|
|
47
47
|
}
|
|
48
48
|
if (oldRegisterKey !== newRegisterKey) {
|
|
49
|
+
if (this._currentFetcher instanceof AnexoSistemaFetcher) {
|
|
50
|
+
this._currentFetcher.registerKey = newRegisterKey;
|
|
51
|
+
}
|
|
49
52
|
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
|
50
53
|
}
|
|
51
54
|
}
|
|
55
|
+
getAnexoSistemaFetcherInstance() {
|
|
56
|
+
var _a;
|
|
57
|
+
const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
|
58
|
+
anexoSistemaFetcher.registerKey = this.registerKey;
|
|
59
|
+
return anexoSistemaFetcher;
|
|
60
|
+
}
|
|
52
61
|
async initAttach() {
|
|
53
|
-
var _a, _b, _c, _d, _e
|
|
62
|
+
var _a, _b, _c, _d, _e;
|
|
54
63
|
if (!this.fetcherType && !this.registerKey)
|
|
55
64
|
return;
|
|
56
65
|
if (!this.fetcherType) {
|
|
@@ -58,18 +67,18 @@ export class SnkAttach {
|
|
|
58
67
|
}
|
|
59
68
|
this.returnToGridMode();
|
|
60
69
|
if (this.fetcherType === "AnexoSistema") {
|
|
61
|
-
this._currentFetcher =
|
|
62
|
-
(
|
|
63
|
-
await ((
|
|
70
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
71
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
72
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
64
73
|
return;
|
|
65
74
|
}
|
|
66
75
|
if (this.fetcherType === "Attach") {
|
|
67
|
-
const hasMoreOneItem = ((
|
|
76
|
+
const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
|
|
68
77
|
if (hasMoreOneItem)
|
|
69
78
|
return;
|
|
70
79
|
}
|
|
71
|
-
await ((
|
|
72
|
-
await ((
|
|
80
|
+
await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
|
|
81
|
+
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
|
|
73
82
|
}
|
|
74
83
|
/**
|
|
75
84
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
@@ -128,11 +137,11 @@ export class SnkAttach {
|
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
139
|
async loadAnexoSistema() {
|
|
131
|
-
var _a, _b
|
|
140
|
+
var _a, _b;
|
|
132
141
|
this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
|
133
|
-
this._currentFetcher =
|
|
142
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
134
143
|
if (!this._currentDataUnit.metadata) {
|
|
135
|
-
await ((
|
|
144
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
|
136
145
|
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
|
137
146
|
}
|
|
138
147
|
this.initDataUnitLoaders();
|
|
@@ -142,7 +151,7 @@ export class SnkAttach {
|
|
|
142
151
|
this._currentDataUnit.addInterceptor({
|
|
143
152
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
|
144
153
|
});
|
|
145
|
-
await ((
|
|
154
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
|
146
155
|
this.disableEditFieldsNotInForm();
|
|
147
156
|
}
|
|
148
157
|
async loadAttach() {
|
|
@@ -168,16 +177,16 @@ export class SnkAttach {
|
|
|
168
177
|
}
|
|
169
178
|
}
|
|
170
179
|
initDataUnitLoaders() {
|
|
171
|
-
var _a, _b
|
|
180
|
+
var _a, _b;
|
|
172
181
|
if (this.fetcherType === "AnexoSistema") {
|
|
173
|
-
this._currentFetcher =
|
|
182
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
|
174
183
|
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
|
175
|
-
(
|
|
184
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
|
176
185
|
}
|
|
177
186
|
if (this.fetcherType === "Attach") {
|
|
178
187
|
this._currentFetcher = new AttachFetcher();
|
|
179
188
|
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
|
180
|
-
(
|
|
189
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
|
181
190
|
this.returnToGridMode();
|
|
182
191
|
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
|
183
192
|
});
|
|
@@ -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 { applyFilter, applySorting, buildPaginationInfo } from '../../../../../lib/dataUnit/dataUnitInMemoryUtils';
|
|
6
|
+
import { applyFilter, applySorting, buildPaginationInfo, } from '../../../../../lib/dataUnit/dataUnitInMemoryUtils';
|
|
7
7
|
const SERVICE_LOAD = "Attach.load";
|
|
8
8
|
export class AttachFetcherDataUnitFactory {
|
|
9
9
|
constructor(getMessage) {
|
|
@@ -51,7 +51,13 @@ export class AttachFetcherDataUnitFactory {
|
|
|
51
51
|
}
|
|
52
52
|
let records = applyFilter(this._records, dataUnit, request.filters);
|
|
53
53
|
records = applySorting(records, dataUnit, request.sort);
|
|
54
|
-
|
|
54
|
+
//TODO: não está sendo tratada a paginação nesse caso, é preciso replicar a lógica como no inMemoryLoader
|
|
55
|
+
const paginationInfoBuilderParams = {
|
|
56
|
+
recordsLength: records.length,
|
|
57
|
+
offset: request.offset,
|
|
58
|
+
recordsPerPage: request.limit
|
|
59
|
+
};
|
|
60
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(paginationInfoBuilderParams) });
|
|
55
61
|
}
|
|
56
62
|
saveLoader(changes, fetcher) {
|
|
57
63
|
return new Promise((resolve) => {
|
|
@@ -553,7 +553,8 @@ export class SnkDataUnit {
|
|
|
553
553
|
if (forceMetadataLoad || !this.dataUnit.metadata)
|
|
554
554
|
await this.dataUnit.loadMetadata();
|
|
555
555
|
if ((_a = this.dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) {
|
|
556
|
-
this.getMetadataByRow(this.dataUnit);
|
|
556
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
|
557
|
+
this.dataUnit.records = records;
|
|
557
558
|
}
|
|
558
559
|
this.dataState = this.buildDataState();
|
|
559
560
|
let resolver;
|
|
@@ -15,13 +15,13 @@ export class SnkFilterBar {
|
|
|
15
15
|
this._pendingVariables = false;
|
|
16
16
|
this._customfiltersToBeUpdated = [];
|
|
17
17
|
this._calculateSortIndex = (item) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
if (!item.visible)
|
|
19
|
+
return 0;
|
|
20
|
+
if (item.hardFixed)
|
|
21
|
+
return 1000000; //campos Hard Fixed não variam a ordem
|
|
22
|
+
let index = item.fixed ? 100000 : 0;
|
|
23
|
+
index += this.hasValidValue(item) ? 10000 : 0;
|
|
24
|
+
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
|
25
25
|
return index;
|
|
26
26
|
};
|
|
27
27
|
this._filtersComparator = (a, b) => {
|
|
@@ -42,13 +42,12 @@ export class SnkFilterBar {
|
|
|
42
42
|
this.showPersonalizedFilter = false;
|
|
43
43
|
this.personalizedFilterId = undefined;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
if (item.value
|
|
47
|
-
return
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return index;
|
|
45
|
+
hasValidValue(item) {
|
|
46
|
+
if (item.value === undefined || item.value === null)
|
|
47
|
+
return false;
|
|
48
|
+
if (!Array.isArray(item.value))
|
|
49
|
+
return true;
|
|
50
|
+
return item.value.some(filterItem => filterItem.check === true);
|
|
52
51
|
}
|
|
53
52
|
observeFilterConfig(newValue, oldValue) {
|
|
54
53
|
if (ObjectUtils.equals(newValue, oldValue))
|
|
@@ -276,7 +275,7 @@ export class SnkFilterBar {
|
|
|
276
275
|
getFilterItems() {
|
|
277
276
|
const pinnedItems = [];
|
|
278
277
|
const unpinnedItems = [];
|
|
279
|
-
this.filterConfig
|
|
278
|
+
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
|
280
279
|
.filter(this.filterActiveFilter)
|
|
281
280
|
.forEach((item, index) => {
|
|
282
281
|
item = ObjectUtils.copy(item);
|