@sankhyalabs/core 5.20.0-dev.8 → 5.20.0-dev.81
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/.docs/classes/Base64Utils.md +39 -0
- package/.docs/classes/Change.md +11 -11
- package/.docs/classes/ColumnFilterManager.md +145 -0
- package/.docs/classes/DataUnit.md +429 -139
- package/.docs/classes/DataUnitInMemoryLoader.md +303 -0
- package/.docs/classes/DataUnitLoaderUtils.md +151 -0
- package/.docs/classes/DateUtils.md +8 -8
- package/.docs/classes/FieldComparator.md +2 -2
- package/.docs/classes/IDBRepository.md +22 -0
- package/.docs/classes/KeyboardManager.md +99 -9
- package/.docs/classes/LockManager.md +249 -0
- package/.docs/classes/MaskFormatter.md +66 -14
- package/.docs/classes/ObjectUtils.md +189 -0
- package/.docs/classes/OverflowWatcher.md +533 -0
- package/.docs/classes/SelectionInfo.md +25 -11
- package/.docs/classes/ServiceCanceledException.md +193 -0
- package/.docs/classes/ServiceUtils.md +67 -0
- package/.docs/classes/SilentException.md +193 -0
- package/.docs/classes/StringUtils.md +33 -9
- package/.docs/classes/UserAgentUtils.md +15 -1
- package/.docs/enumerations/Action.md +41 -21
- package/.docs/enumerations/ChangeOperation.md +4 -4
- package/.docs/enumerations/LockManagerOperation.md +33 -0
- package/.docs/enumerations/OverflowDirection.md +29 -0
- package/.docs/enumerations/RECORD_DATE_FORMAT.md +27 -0
- package/.docs/enumerations/SelectionMode.md +2 -2
- package/.docs/enumerations/StorageType.md +37 -0
- package/.docs/enumerations/UserInterface.md +15 -5
- package/.docs/globals.md +25 -0
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/DataUnitInMemoryLoaderConfig.md +37 -0
- package/.docs/interfaces/IRepository.md +18 -0
- package/.docs/interfaces/LoadDataRequest.md +1 -1
- package/.docs/interfaces/OverFlowWatcherParams.md +67 -0
- package/.docs/interfaces/PageRequest.md +3 -3
- package/.docs/interfaces/PaginationInfo.md +25 -0
- package/.docs/interfaces/PaginationInfoBuilderParams.md +37 -0
- package/.docs/interfaces/QuickFilter.md +3 -3
- package/.docs/interfaces/Record.md +4 -4
- package/.docs/interfaces/SavedRecord.md +5 -5
- package/.docs/interfaces/WaitingChange.md +3 -3
- package/.docs/namespaces/MaskFormatter/type-aliases/MaskCharacter.md +1 -1
- package/.docs/namespaces/MaskFormatter/variables/MaskCharacter.md +1 -1
- package/.docs/type-aliases/DataUnitEventOptions.md +17 -0
- package/.docs/type-aliases/OnOverflowCallBack.md +25 -0
- package/.docs/variables/OVERFLOWED_CLASS_NAME.md +13 -0
- package/.releaserc +1 -0
- package/bun.lockb +0 -0
- package/dist/dataunit/DataUnit.d.ts +92 -13
- package/dist/dataunit/DataUnit.js +227 -71
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/DataUnitHelper.js +6 -5
- package/dist/dataunit/DataUnitHelper.js.map +1 -1
- package/dist/dataunit/formatting/PrettyFormatter.js +17 -6
- package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
- package/dist/dataunit/loader/DataUnitInMemoryLoaderConfig.d.ts +9 -0
- package/dist/dataunit/loader/DataUnitInMemoryLoaderConfig.js +6 -0
- package/dist/dataunit/loader/DataUnitInMemoryLoaderConfig.js.map +1 -0
- package/dist/dataunit/loader/dataUnitInMemoryLoader.d.ts +25 -0
- package/dist/dataunit/loader/dataUnitInMemoryLoader.js +131 -0
- package/dist/dataunit/loader/dataUnitInMemoryLoader.js.map +1 -0
- package/dist/dataunit/loader/utils/dataUnitLoaderUtils.d.ts +20 -0
- package/dist/dataunit/loader/utils/dataUnitLoaderUtils.js +62 -0
- package/dist/dataunit/loader/utils/dataUnitLoaderUtils.js.map +1 -0
- package/dist/dataunit/loading/LoadDataRequest.d.ts +1 -1
- package/dist/dataunit/loading/PaginationInfo.d.ts +8 -0
- package/dist/dataunit/metadata/DataType.js +7 -1
- package/dist/dataunit/metadata/DataType.js.map +1 -1
- package/dist/dataunit/metadata/UnitMetadata.d.ts +1 -0
- package/dist/dataunit/metadata/UnitMetadata.js +1 -0
- package/dist/dataunit/metadata/UnitMetadata.js.map +1 -1
- package/dist/dataunit/sorting/FieldComparator.d.ts +2 -2
- package/dist/dataunit/sorting/FieldComparator.js +4 -9
- package/dist/dataunit/sorting/FieldComparator.js.map +1 -1
- package/dist/dataunit/state/action/DataUnitAction.d.ts +2 -0
- package/dist/dataunit/state/action/DataUnitAction.js +2 -0
- package/dist/dataunit/state/action/DataUnitAction.js.map +1 -1
- package/dist/dataunit/state/slice/LoadingControlSlice.js +16 -0
- package/dist/dataunit/state/slice/LoadingControlSlice.js.map +1 -1
- package/dist/dataunit/state/slice/RecordsSlice.js +1 -1
- package/dist/dataunit/state/slice/RecordsSlice.js.map +1 -1
- package/dist/dataunit/state/slice/SelectionSlice.js +4 -4
- package/dist/dataunit/state/slice/SelectionSlice.js.map +1 -1
- package/dist/exceptions/ServiceCanceledException.d.ts +14 -0
- package/dist/exceptions/ServiceCanceledException.js +13 -0
- package/dist/exceptions/ServiceCanceledException.js.map +1 -0
- package/dist/exceptions/SilentException.d.ts +14 -0
- package/dist/exceptions/SilentException.js +13 -0
- package/dist/exceptions/SilentException.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/repository/IRepository.d.ts +6 -0
- package/dist/repository/indexeddb/IDBRepository.d.ts +1 -0
- package/dist/repository/indexeddb/IDBRepository.js +3 -0
- package/dist/repository/indexeddb/IDBRepository.js.map +1 -1
- package/dist/utils/Base64Utils.d.ts +7 -0
- package/dist/utils/Base64Utils.js +13 -0
- package/dist/utils/Base64Utils.js.map +1 -0
- package/dist/utils/CacheManager/index.d.ts +52 -0
- package/dist/utils/CacheManager/index.js +101 -0
- package/dist/utils/CacheManager/index.js.map +1 -0
- package/dist/utils/CacheManager/interfaces/index.d.ts +5 -0
- package/dist/utils/CacheManager/interfaces/index.js +7 -0
- package/dist/utils/CacheManager/interfaces/index.js.map +1 -0
- package/dist/utils/ColumnFilterManager.d.ts +19 -0
- package/dist/utils/ColumnFilterManager.js +73 -0
- package/dist/utils/ColumnFilterManager.js.map +1 -0
- package/dist/utils/DateUtils.js +3 -0
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/ElementUtils.d.ts +2 -0
- package/dist/utils/ElementUtils.js +9 -0
- package/dist/utils/ElementUtils.js.map +1 -0
- package/dist/utils/KeyboardManager/index.d.ts +9 -0
- package/dist/utils/KeyboardManager/index.js +45 -1
- package/dist/utils/KeyboardManager/index.js.map +1 -1
- package/dist/utils/KeyboardManager/interface.d.ts +1 -0
- package/dist/utils/LockManager.d.ts +58 -0
- package/dist/utils/LockManager.js +188 -0
- package/dist/utils/LockManager.js.map +1 -0
- package/dist/utils/MaskFormatter.d.ts +16 -1
- package/dist/utils/MaskFormatter.js +82 -2
- package/dist/utils/MaskFormatter.js.map +1 -1
- package/dist/utils/ObjectUtils.d.ts +52 -0
- package/dist/utils/ObjectUtils.js +71 -0
- package/dist/utils/ObjectUtils.js.map +1 -1
- package/dist/utils/OnboardingUtils.js +1 -1
- package/dist/utils/OnboardingUtils.js.map +1 -1
- package/dist/utils/OverflowWatcher/index.d.ts +59 -0
- package/dist/utils/OverflowWatcher/index.js +188 -0
- package/dist/utils/OverflowWatcher/index.js.map +1 -0
- package/dist/utils/OverflowWatcher/types/overflow-callback.d.ts +6 -0
- package/dist/utils/OverflowWatcher/types/overflow-callback.js +2 -0
- package/dist/utils/OverflowWatcher/types/overflow-callback.js.map +1 -0
- package/dist/utils/OverflowWatcher/types/overflow-direction.d.ts +7 -0
- package/dist/utils/OverflowWatcher/types/overflow-direction.js +9 -0
- package/dist/utils/OverflowWatcher/types/overflow-direction.js.map +1 -0
- package/dist/utils/ServiceUtils.d.ts +24 -0
- package/dist/utils/ServiceUtils.js +40 -0
- package/dist/utils/ServiceUtils.js.map +1 -0
- package/dist/utils/SortingUtils.d.ts +9 -0
- package/dist/utils/SortingUtils.js +24 -0
- package/dist/utils/SortingUtils.js.map +1 -0
- package/dist/utils/StringUtils.d.ts +6 -0
- package/dist/utils/StringUtils.js +23 -6
- package/dist/utils/StringUtils.js.map +1 -1
- package/dist/utils/UserAgentUtils/index.d.ts +1 -0
- package/dist/utils/UserAgentUtils/index.js +5 -0
- package/dist/utils/UserAgentUtils/index.js.map +1 -1
- package/jest.config.ts +2 -0
- package/package.json +2 -1
- package/reports/test-report.xml +760 -0
- package/setupTests.js +7 -0
- package/sonar-project.properties +6 -3
- package/src/dataunit/DataUnit.ts +278 -86
- package/src/dataunit/DataUnitHelper.ts +6 -5
- package/src/dataunit/formatting/PrettyFormatter.ts +19 -6
- package/src/dataunit/loader/DataUnitInMemoryLoaderConfig.ts +10 -0
- package/src/dataunit/loader/dataUnitInMemoryLoader.ts +176 -0
- package/src/dataunit/loader/utils/dataUnitLoaderUtils.ts +86 -0
- package/src/dataunit/loading/LoadDataRequest.ts +1 -1
- package/src/dataunit/loading/PaginationInfo.ts +10 -0
- package/src/dataunit/metadata/DataType.ts +8 -1
- package/src/dataunit/metadata/UnitMetadata.ts +1 -0
- package/src/dataunit/sorting/FieldComparator.ts +18 -32
- package/src/dataunit/state/action/DataUnitAction.ts +2 -0
- package/src/dataunit/state/slice/LoadingControlSlice.ts +42 -0
- package/src/dataunit/state/slice/RecordsSlice.ts +1 -1
- package/src/dataunit/state/slice/SelectionSlice.ts +4 -4
- package/src/dataunit/state/slice/test/RecordsSlice.spec.ts +45 -0
- package/src/dataunit/test/DataUnit.spec.ts +44 -0
- package/src/exceptions/ServiceCanceledException.ts +25 -0
- package/src/exceptions/SilentException.ts +25 -0
- package/src/index.ts +32 -1
- package/src/repository/IRepository.ts +7 -0
- package/src/repository/indexeddb/IDBRepository.ts +4 -0
- package/src/utils/Base64Utils.ts +13 -0
- package/src/utils/CacheManager/index.ts +103 -0
- package/src/utils/CacheManager/interfaces/index.ts +5 -0
- package/src/utils/ColumnFilterManager.ts +104 -0
- package/src/utils/DateUtils.ts +3 -0
- package/src/utils/ElementUtils.ts +10 -0
- package/src/utils/KeyboardManager/index.ts +57 -0
- package/src/utils/KeyboardManager/interface.ts +1 -0
- package/src/utils/LockManager.ts +207 -0
- package/src/utils/MaskFormatter.ts +93 -2
- package/src/utils/ObjectUtils.ts +77 -0
- package/src/utils/OnboardingUtils.ts +1 -1
- package/src/utils/OverflowWatcher/index.ts +243 -0
- package/src/utils/OverflowWatcher/types/overflow-callback.ts +6 -0
- package/src/utils/OverflowWatcher/types/overflow-direction.ts +7 -0
- package/src/utils/ServiceUtils.ts +36 -0
- package/src/utils/SortingUtils.ts +30 -0
- package/src/utils/StringUtils.ts +23 -6
- package/src/utils/UserAgentUtils/index.ts +6 -1
- package/test/dataunit/formatting/PrettyFormatter.spec.ts +177 -0
- package/test/dataunit/loader/dataUnitInMemoryLoader.spec.ts +221 -0
- package/test/dataunit/loader/utils/dataUnitLoaderUtils.spec.ts +158 -0
- package/test/testCases/NumberUtilsTestCases.ts +190 -0
- package/test/testCases/StringUtilsTestCases.ts +435 -0
- package/test/testCases/TimeFormatterTestUtils.ts +43 -0
- package/test/util/ColumnFilterManager.spec.ts +133 -0
- package/test/util/ElementUtils.spec.ts +34 -0
- package/test/util/NumberUtils.spec.ts +72 -150
- package/test/util/ObjectUtils.spec.ts +572 -0
- package/test/util/OverflowWatcher.spec.ts +152 -0
- package/test/util/StringUtils.spec.ts +260 -36
- package/test/util/TimeFormatter.spec.ts +65 -18
|
@@ -29,6 +29,9 @@ import { v4 as uuid } from "uuid";
|
|
|
29
29
|
import { DataUnitStorage } from "./DataUnitStorage.js";
|
|
30
30
|
import { getInvalidFieldMessage, InvalidFieldsReducer } from "./state/slice/InvalidFieldsSlice.js";
|
|
31
31
|
import { getLoadingProperties, LoadingPropertiesReducer } from "./state/slice/LoadingProperties.js";
|
|
32
|
+
import SortingUtils from "../utils/SortingUtils.js";
|
|
33
|
+
import ServiceCanceledException from "../exceptions/ServiceCanceledException.js";
|
|
34
|
+
import SilentException from "../exceptions/SilentException.js";
|
|
32
35
|
/***
|
|
33
36
|
* `DataUnit`: Atua como uma camada de abstração entre o back-end e a interface do usuário.
|
|
34
37
|
*/
|
|
@@ -37,6 +40,8 @@ export default class DataUnit {
|
|
|
37
40
|
var _a;
|
|
38
41
|
this._childByName = new Map();
|
|
39
42
|
this._savingLockers = [];
|
|
43
|
+
this._waitingToReload = false;
|
|
44
|
+
this._cancelPagination = false;
|
|
40
45
|
/**
|
|
41
46
|
*
|
|
42
47
|
* Trata as Actions do DataUnit Parent
|
|
@@ -50,6 +55,8 @@ export default class DataUnit {
|
|
|
50
55
|
case Action.NEXT_SELECTED:
|
|
51
56
|
case Action.PREVIOUS_SELECTED:
|
|
52
57
|
case Action.DATA_LOADED:
|
|
58
|
+
case Action.RECORDS_ADDED:
|
|
59
|
+
case Action.EDITION_CANCELED:
|
|
53
60
|
this.clearDataUnit();
|
|
54
61
|
const selectedRecord = (_a = this._parentDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecord();
|
|
55
62
|
if (selectedRecord != undefined && !this.isNewRecord(selectedRecord.__record__id__)) {
|
|
@@ -75,11 +82,12 @@ export default class DataUnit {
|
|
|
75
82
|
InvalidFieldsReducer,
|
|
76
83
|
SnapshotReducer
|
|
77
84
|
]);
|
|
78
|
-
this._observers =
|
|
85
|
+
this._observers = new Map();
|
|
79
86
|
this._filterProviders = new Map();
|
|
80
87
|
this._sortingProvider = undefined;
|
|
81
88
|
this._defaultSorting = [];
|
|
82
|
-
this.
|
|
89
|
+
this._allowReleaseCallbacks = true;
|
|
90
|
+
this._interceptors = new Map();
|
|
83
91
|
this._parentDataUnit = parentDataUnit;
|
|
84
92
|
(_a = this._parentDataUnit) === null || _a === void 0 ? void 0 : _a.subscribe(this.onDataUnitParentEvent);
|
|
85
93
|
this._loadingLockers = [];
|
|
@@ -107,10 +115,12 @@ export default class DataUnit {
|
|
|
107
115
|
* - Sorting Providers
|
|
108
116
|
*/
|
|
109
117
|
releaseCallbacks() {
|
|
110
|
-
this.
|
|
118
|
+
if (!this._allowReleaseCallbacks)
|
|
119
|
+
return;
|
|
120
|
+
this._observers = new Map();
|
|
111
121
|
this._filterProviders = new Map();
|
|
112
122
|
this._sortingProvider = undefined;
|
|
113
|
-
this._interceptors =
|
|
123
|
+
this._interceptors = new Map();
|
|
114
124
|
}
|
|
115
125
|
/**
|
|
116
126
|
* Adiciona uma propriedade transacional que será envida aos
|
|
@@ -135,6 +145,31 @@ export default class DataUnit {
|
|
|
135
145
|
get dataUnitId() {
|
|
136
146
|
return this._uuid;
|
|
137
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Retorna se o dataUnit está com recarregamento pendente.
|
|
150
|
+
*/
|
|
151
|
+
isWaitingToReload() {
|
|
152
|
+
return this._waitingToReload;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Define se o dataUnit tem um recarregamento pendente.
|
|
156
|
+
* @param isWaiting
|
|
157
|
+
*/
|
|
158
|
+
setWaitingToReload(isWaiting) {
|
|
159
|
+
this._waitingToReload = isWaiting;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Informa se a paginação deve ser cancelada.
|
|
163
|
+
*/
|
|
164
|
+
get cancelPagination() {
|
|
165
|
+
return this._cancelPagination;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Informa se a paginação deve ser cancelada.
|
|
169
|
+
*/
|
|
170
|
+
set cancelPagination(cancelPagination) {
|
|
171
|
+
this._cancelPagination = cancelPagination;
|
|
172
|
+
}
|
|
138
173
|
/**
|
|
139
174
|
*
|
|
140
175
|
* Obtém o nome de identificação do DataUnit (geralmente em formato de URI - Uniform Resource Identifier).
|
|
@@ -203,7 +238,7 @@ export default class DataUnit {
|
|
|
203
238
|
if (yield this.dispatchAction(Action.LOADING_DATA, request, executionCtx)) {
|
|
204
239
|
if (this.dataLoader) {
|
|
205
240
|
this.dataLoader(this, request).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
yield this.dispatchAction(Action.DATA_LOADED, Object.assign(Object.assign({}, response), { keepSelection: request.keepSelection, filters: request.filters }), executionCtx);
|
|
241
|
+
yield this.dispatchAction(Action.DATA_LOADED, Object.assign(Object.assign({}, response), { keepSelection: request.keepSelection, filters: request.filters, selectFirstRecord }), executionCtx);
|
|
207
242
|
yield this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
208
243
|
if (selectFirstRecord) {
|
|
209
244
|
this.requestSelectFirst(executionCtx);
|
|
@@ -255,6 +290,11 @@ export default class DataUnit {
|
|
|
255
290
|
}
|
|
256
291
|
});
|
|
257
292
|
}
|
|
293
|
+
loadDataWithParams({ source, keepSelection, selectFirstRecord, executionCtx, checkLastFilter, quickFilter }) {
|
|
294
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
295
|
+
return yield this.loadData(quickFilter, executionCtx, checkLastFilter, source, selectFirstRecord, keepSelection);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
258
298
|
/**
|
|
259
299
|
*
|
|
260
300
|
* Carrega os registros do DataUnit.
|
|
@@ -266,18 +306,21 @@ export default class DataUnit {
|
|
|
266
306
|
* @returns - Registros requisitados.
|
|
267
307
|
*
|
|
268
308
|
*/
|
|
269
|
-
loadData(quickFilter, executionCtx, checkLastFilter, source, selectFirstRecord) {
|
|
309
|
+
loadData(quickFilter, executionCtx, checkLastFilter, source, selectFirstRecord, keepSelection) {
|
|
270
310
|
return __awaiter(this, void 0, void 0, function* () {
|
|
271
311
|
yield this.processLoadingLockers();
|
|
272
|
-
if (this._parentDataUnit
|
|
273
|
-
|
|
274
|
-
|
|
312
|
+
if (this._parentDataUnit) {
|
|
313
|
+
const parentRecord = this._parentDataUnit.getSelectedRecord();
|
|
314
|
+
if (parentRecord == undefined || this._parentDataUnit.isNewRecord(parentRecord.__record__id__)) {
|
|
315
|
+
if (this.records) {
|
|
316
|
+
this.clearDataUnit();
|
|
317
|
+
}
|
|
318
|
+
return Promise.resolve({
|
|
319
|
+
records: []
|
|
320
|
+
});
|
|
275
321
|
}
|
|
276
|
-
return Promise.resolve({
|
|
277
|
-
records: []
|
|
278
|
-
});
|
|
279
322
|
}
|
|
280
|
-
const loadDataRequest = this.getLoadDataRequest(quickFilter, source);
|
|
323
|
+
const loadDataRequest = this.getLoadDataRequest(quickFilter, source, keepSelection);
|
|
281
324
|
return this.executeLoadData(loadDataRequest, executionCtx, checkLastFilter, selectFirstRecord);
|
|
282
325
|
});
|
|
283
326
|
}
|
|
@@ -293,6 +336,9 @@ export default class DataUnit {
|
|
|
293
336
|
*/
|
|
294
337
|
gotoPage(page, executionCtx) {
|
|
295
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
if (this._pageSize === 0) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
296
342
|
let request = getCurrentRequest(this._stateManager);
|
|
297
343
|
if (!request) {
|
|
298
344
|
request = {
|
|
@@ -333,12 +379,13 @@ export default class DataUnit {
|
|
|
333
379
|
return this.gotoPage(getCurrentPage(this._stateManager) - 1, executionCtx);
|
|
334
380
|
});
|
|
335
381
|
}
|
|
336
|
-
getLoadDataRequest(quickFilter, source) {
|
|
382
|
+
getLoadDataRequest(quickFilter, source, keepSelection) {
|
|
337
383
|
const request = {
|
|
338
384
|
filters: (quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.filter) ? [quickFilter.filter] : this.getFilters(),
|
|
339
385
|
sort: this.getSort(),
|
|
340
386
|
parentRecordId: this.getParentRecordId(),
|
|
341
|
-
source
|
|
387
|
+
source,
|
|
388
|
+
keepSelection
|
|
342
389
|
};
|
|
343
390
|
if (quickFilter) {
|
|
344
391
|
request.quickFilter = quickFilter;
|
|
@@ -405,7 +452,16 @@ export default class DataUnit {
|
|
|
405
452
|
Promise.all(dispatchPromisses).then(() => resolve());
|
|
406
453
|
}).catch(cause => {
|
|
407
454
|
const { errorCode } = cause;
|
|
455
|
+
this.dispatchAction(Action.SAVING_ERROR);
|
|
408
456
|
this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
457
|
+
if (cause instanceof ServiceCanceledException) {
|
|
458
|
+
console.debug("Service canceled: " + cause.message);
|
|
459
|
+
resolve();
|
|
460
|
+
}
|
|
461
|
+
if (cause instanceof SilentException) {
|
|
462
|
+
fail(cause);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
409
465
|
fail(new ErrorException("Erro ao salvar alterações", cause, errorCode));
|
|
410
466
|
});
|
|
411
467
|
}
|
|
@@ -509,9 +565,10 @@ export default class DataUnit {
|
|
|
509
565
|
const currentRecordsKeys = Array.from(getCurrentRecords(this._stateManager).keys());
|
|
510
566
|
const removedIndex = recordIds
|
|
511
567
|
.map(id => currentRecordsKeys.indexOf(id))
|
|
512
|
-
.filter(index => index > -1)
|
|
568
|
+
.filter(index => index > -1)
|
|
569
|
+
.sort((a, b) => a - b);
|
|
513
570
|
const nextIndex = Math.min(removedIndex.slice(-1)[0] + 1, currentRecordsKeys.length);
|
|
514
|
-
const selectionAfterRemove = [currentRecordsKeys[nextIndex]];
|
|
571
|
+
const selectionAfterRemove = currentRecordsKeys[nextIndex] ? [currentRecordsKeys[nextIndex]] : [];
|
|
515
572
|
this.dispatchAction(Action.RECORDS_REMOVED, { records: removedIds, cachedRecords, removedIndex, buffered: false, selectionAfterRemove }, executionCtx);
|
|
516
573
|
this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
517
574
|
resolve(removedIds);
|
|
@@ -591,7 +648,7 @@ export default class DataUnit {
|
|
|
591
648
|
*
|
|
592
649
|
*/
|
|
593
650
|
addInterceptor(interceptor) {
|
|
594
|
-
this._interceptors.
|
|
651
|
+
this._interceptors.set(interceptor.interceptAction.toString(), interceptor);
|
|
595
652
|
}
|
|
596
653
|
/**
|
|
597
654
|
*
|
|
@@ -601,7 +658,7 @@ export default class DataUnit {
|
|
|
601
658
|
*
|
|
602
659
|
*/
|
|
603
660
|
removeInterceptor(interceptor) {
|
|
604
|
-
this._interceptors
|
|
661
|
+
this._interceptors.delete(interceptor.interceptAction.toString());
|
|
605
662
|
}
|
|
606
663
|
/**
|
|
607
664
|
*
|
|
@@ -700,7 +757,8 @@ export default class DataUnit {
|
|
|
700
757
|
*
|
|
701
758
|
*/
|
|
702
759
|
set records(records) {
|
|
703
|
-
this.
|
|
760
|
+
const paginationInfo = this.getPaginationInfo();
|
|
761
|
+
this.dispatchAction(Action.DATA_LOADED, { records, paginationInfo }, undefined);
|
|
704
762
|
}
|
|
705
763
|
/**
|
|
706
764
|
*
|
|
@@ -787,6 +845,9 @@ export default class DataUnit {
|
|
|
787
845
|
copySelected(executionCtx) {
|
|
788
846
|
const selectionInfo = this.getSelectionInfo();
|
|
789
847
|
if (selectionInfo) {
|
|
848
|
+
if (selectionInfo.isAllRecords()) {
|
|
849
|
+
throw new Error("Erro interno: Impossível copiar os registros selecionados pois a seleção atual é virtual.");
|
|
850
|
+
}
|
|
790
851
|
const selectedRecords = selectionInfo.records;
|
|
791
852
|
if (selectedRecords) {
|
|
792
853
|
this.dispatchAction(Action.RECORDS_COPIED, prepareCopiedRecord(this._stateManager, selectedRecords, this.getParentRecordId()), executionCtx);
|
|
@@ -845,27 +906,35 @@ export default class DataUnit {
|
|
|
845
906
|
* @param fieldName -Identificador do campo a ser modificado.
|
|
846
907
|
* @param newValue - Valor a ser inserido no campo.
|
|
847
908
|
* @param records - Indica quais registros foram afetados pela alteração no valor do campo.
|
|
909
|
+
* @param options - Configurações do evento
|
|
848
910
|
* @returns - Promise que será resolvida quando o novo valor for persistido no state.
|
|
849
911
|
*
|
|
850
|
-
|
|
851
|
-
setFieldValue(fieldName, newValue, records) {
|
|
912
|
+
*/
|
|
913
|
+
setFieldValue(fieldName, newValue, records, options) {
|
|
852
914
|
return __awaiter(this, void 0, void 0, function* () {
|
|
853
|
-
|
|
915
|
+
const noRecordSelected = !this.hasNewRecord() && !this.getSelectedRecord();
|
|
916
|
+
const suppressCreateNewRecord = options === null || options === void 0 ? void 0 : options.suppressCreateNewRecord;
|
|
917
|
+
if (noRecordSelected && suppressCreateNewRecord)
|
|
918
|
+
return Promise.resolve(false);
|
|
919
|
+
if (noRecordSelected)
|
|
854
920
|
yield this.addRecord();
|
|
855
921
|
const typedValue = this.validateAndTypeValue(fieldName, newValue);
|
|
856
922
|
const currentValue = this.getFieldValue(fieldName);
|
|
923
|
+
if (!(newValue instanceof Promise) && ObjectUtils.hasEquivalentProps(currentValue, typedValue)) {
|
|
924
|
+
return Promise.resolve(false);
|
|
925
|
+
}
|
|
857
926
|
if (newValue instanceof Promise) {
|
|
858
927
|
const promise = new Promise(accept => {
|
|
859
928
|
newValue.then(resolvedValue => {
|
|
860
929
|
this.dispatchAction(Action.DATA_RESOLVED, { [fieldName]: resolvedValue, records }, undefined);
|
|
861
|
-
accept(this.setFieldValue(fieldName, resolvedValue, records));
|
|
930
|
+
accept(this.setFieldValue(fieldName, resolvedValue, records, options));
|
|
862
931
|
});
|
|
863
932
|
});
|
|
864
933
|
this._savingLockers.push(promise);
|
|
865
934
|
return promise;
|
|
866
935
|
}
|
|
867
936
|
if (currentValue !== typedValue) {
|
|
868
|
-
const promise = this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records }, undefined);
|
|
937
|
+
const promise = this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records }, undefined, options);
|
|
869
938
|
this._savingLockers.push(promise);
|
|
870
939
|
return promise;
|
|
871
940
|
}
|
|
@@ -884,6 +953,17 @@ export default class DataUnit {
|
|
|
884
953
|
setInvalidField(fieldName, message, recordId) {
|
|
885
954
|
this.dispatchAction(Action.FIELD_INVALIDATED, { fieldName, message, recordId }, undefined);
|
|
886
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
*
|
|
958
|
+
* Cancela o saving exibindo os campos invalidos.
|
|
959
|
+
*
|
|
960
|
+
* @param filds - Lista dos campos
|
|
961
|
+
* @param recordId - Indica qual registro está com os campos inválido.
|
|
962
|
+
*
|
|
963
|
+
*/
|
|
964
|
+
savingCanceled(fields, recordId) {
|
|
965
|
+
this.dispatchAction(Action.SAVING_CANCELED, { fields, recordId }, undefined);
|
|
966
|
+
}
|
|
887
967
|
/**
|
|
888
968
|
*
|
|
889
969
|
* Limpa campos inválidos.
|
|
@@ -982,7 +1062,7 @@ export default class DataUnit {
|
|
|
982
1062
|
setSelection(selection, executionCtx) {
|
|
983
1063
|
return new Promise(resolve => {
|
|
984
1064
|
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection }, executionCtx)
|
|
985
|
-
.then(() => resolve(getSelectionInfo(
|
|
1065
|
+
.then(() => resolve(this.getSelectionInfo()));
|
|
986
1066
|
});
|
|
987
1067
|
}
|
|
988
1068
|
/**
|
|
@@ -1001,30 +1081,44 @@ export default class DataUnit {
|
|
|
1001
1081
|
*
|
|
1002
1082
|
* @param selection - IDs dos registros selecionados no snapshot atual
|
|
1003
1083
|
* @param executionCtx - Contexto de execução da seleção dos registros do DataUnit.
|
|
1004
|
-
*
|
|
1005
1084
|
* @returns - Informações sobre a seleção.
|
|
1006
1085
|
*/
|
|
1007
1086
|
updatePageSelection(selection, executionCtx) {
|
|
1008
|
-
if (!selection)
|
|
1087
|
+
if (!selection)
|
|
1009
1088
|
return Promise.resolve(this.getSelectionInfo());
|
|
1010
|
-
}
|
|
1011
1089
|
return new Promise(resolve => {
|
|
1012
|
-
const newSelection = new Set(
|
|
1013
|
-
const currentRecords = getCurrentRecords(this._stateManager) || new Map();
|
|
1014
|
-
Array.from(currentRecords.keys()).forEach(recordId => {
|
|
1015
|
-
if (selection.includes(recordId)) {
|
|
1016
|
-
newSelection.add(recordId);
|
|
1017
|
-
}
|
|
1018
|
-
else {
|
|
1019
|
-
newSelection.delete(recordId);
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1090
|
+
const newSelection = new Set(selection);
|
|
1022
1091
|
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection: Array.from(newSelection) }, executionCtx)
|
|
1023
|
-
.then(() =>
|
|
1024
|
-
|
|
1025
|
-
|
|
1092
|
+
.then(() => resolve(this.getSelectionInfo()));
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
updatePageSelectionAll(addRecords) {
|
|
1096
|
+
return new Promise(resolve => {
|
|
1097
|
+
const newSelection = new Set();
|
|
1098
|
+
const cachedSelection = getSelection(this._stateManager);
|
|
1099
|
+
cachedSelection.forEach(item => newSelection.add(item));
|
|
1100
|
+
const recordsIds = this.records.map(r => r.__record__id__);
|
|
1101
|
+
recordsIds.forEach(id => addRecords ? newSelection.add(id) : newSelection.delete(id));
|
|
1102
|
+
this.dispatchAction(Action.SELECTION_CHANGED, { type: "id", selection: Array.from(newSelection) })
|
|
1103
|
+
.then(() => resolve(this.getSelectionInfo()));
|
|
1026
1104
|
});
|
|
1027
1105
|
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Seleciona todos os registros da página.
|
|
1108
|
+
*
|
|
1109
|
+
* @returns - Informações sobre a seleção.
|
|
1110
|
+
*/
|
|
1111
|
+
selectAllRecords() {
|
|
1112
|
+
return this.updatePageSelectionAll(true);
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Desseleciona todos os registros da página.
|
|
1116
|
+
*
|
|
1117
|
+
* @returns - Informações sobre a seleção.
|
|
1118
|
+
*/
|
|
1119
|
+
unSelectAllRecords() {
|
|
1120
|
+
return this.updatePageSelectionAll(false);
|
|
1121
|
+
}
|
|
1028
1122
|
/**
|
|
1029
1123
|
*
|
|
1030
1124
|
* Obtém informações sobre a seleção atual.
|
|
@@ -1033,7 +1127,22 @@ export default class DataUnit {
|
|
|
1033
1127
|
*
|
|
1034
1128
|
**/
|
|
1035
1129
|
getSelectionInfo() {
|
|
1036
|
-
|
|
1130
|
+
var _a;
|
|
1131
|
+
const selectionInfo = getSelectionInfo(this._stateManager);
|
|
1132
|
+
selectionInfo.getAllRecords = () => {
|
|
1133
|
+
var _a, _b;
|
|
1134
|
+
let records = (_b = (_a = this.allRecordsLoader) === null || _a === void 0 ? void 0 : _a.call(this, this)) !== null && _b !== void 0 ? _b : [];
|
|
1135
|
+
if (selectionInfo.sort != undefined && selectionInfo.sort.length > 0) {
|
|
1136
|
+
const sortingFunction = SortingUtils.getSortingFunction(this, selectionInfo.sort);
|
|
1137
|
+
records = [...records].sort(sortingFunction);
|
|
1138
|
+
}
|
|
1139
|
+
return records;
|
|
1140
|
+
};
|
|
1141
|
+
if (selectionInfo.sort != undefined && selectionInfo.sort.length > 0) {
|
|
1142
|
+
const sortingFunction = SortingUtils.getSortingFunction(this, selectionInfo.sort);
|
|
1143
|
+
(_a = selectionInfo.records) === null || _a === void 0 ? void 0 : _a.sort(sortingFunction);
|
|
1144
|
+
}
|
|
1145
|
+
return selectionInfo;
|
|
1037
1146
|
}
|
|
1038
1147
|
/**
|
|
1039
1148
|
*
|
|
@@ -1045,6 +1154,14 @@ export default class DataUnit {
|
|
|
1045
1154
|
getSelectedRecord() {
|
|
1046
1155
|
return getSelectedRecord(this._stateManager);
|
|
1047
1156
|
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Retorna o DataUnit pai
|
|
1159
|
+
*
|
|
1160
|
+
* @returns DataUnit pai ou undefined
|
|
1161
|
+
*/
|
|
1162
|
+
getParentDataUnit() {
|
|
1163
|
+
return this._parentDataUnit;
|
|
1164
|
+
}
|
|
1048
1165
|
/**
|
|
1049
1166
|
*
|
|
1050
1167
|
* Limpa todos os registros do DataUnit
|
|
@@ -1132,12 +1249,25 @@ export default class DataUnit {
|
|
|
1132
1249
|
*
|
|
1133
1250
|
* Retorna se existe algum tipo de alteração pendente.
|
|
1134
1251
|
*
|
|
1252
|
+
* @param ignoreChildren: Define se deverá ignorar alterações pendentes no DataUnit filho.
|
|
1135
1253
|
* @returns Verdadeiro se existir alterações pendentes.
|
|
1136
1254
|
*
|
|
1137
1255
|
*/
|
|
1138
|
-
isDirty() {
|
|
1256
|
+
isDirty(ignoreChildren) {
|
|
1257
|
+
if (ignoreChildren)
|
|
1258
|
+
return isDirty(this._stateManager);
|
|
1139
1259
|
return isDirty(this._stateManager) || this.childrenIsDirty();
|
|
1140
1260
|
}
|
|
1261
|
+
/**
|
|
1262
|
+
*
|
|
1263
|
+
* Retorna se existe alterações pendentes no DataUnit pai.
|
|
1264
|
+
*
|
|
1265
|
+
* @returns Verdadeiro se existir alterações pendentes e Falso caso não exista alterações ou não exista DataUnit pai.
|
|
1266
|
+
*
|
|
1267
|
+
*/
|
|
1268
|
+
isParentDirty() {
|
|
1269
|
+
return this._parentDataUnit ? this._parentDataUnit.isDirty(true) : false;
|
|
1270
|
+
}
|
|
1141
1271
|
/**
|
|
1142
1272
|
*
|
|
1143
1273
|
* Retorna se existe algum DataUnit detail com alterações pendentes.
|
|
@@ -1299,18 +1429,18 @@ export default class DataUnit {
|
|
|
1299
1429
|
* @returns - Verdadeiro se ação iniciada.
|
|
1300
1430
|
*
|
|
1301
1431
|
*/
|
|
1302
|
-
dispatchAction(actionType, payload, executionCtx) {
|
|
1432
|
+
dispatchAction(actionType, payload, executionCtx, options) {
|
|
1303
1433
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1304
1434
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
1305
1435
|
let action = new DataUnitAction(actionType, payload);
|
|
1306
1436
|
if (executionCtx && executionCtx.before) {
|
|
1307
1437
|
action = executionCtx.before(action);
|
|
1308
1438
|
}
|
|
1309
|
-
if (action && this._interceptors && this._interceptors.
|
|
1439
|
+
if (action && this._interceptors && this._interceptors.size > 0) {
|
|
1310
1440
|
action = yield this.intercept(action, this._interceptors.values());
|
|
1311
1441
|
}
|
|
1312
1442
|
if (action) {
|
|
1313
|
-
this.doDispatchAction(action);
|
|
1443
|
+
this.doDispatchAction(action, options);
|
|
1314
1444
|
if (executionCtx && executionCtx.after) {
|
|
1315
1445
|
executionCtx.after(action);
|
|
1316
1446
|
}
|
|
@@ -1350,17 +1480,14 @@ export default class DataUnit {
|
|
|
1350
1480
|
* @param action - Ações em execução no DataUnit.
|
|
1351
1481
|
*
|
|
1352
1482
|
*/
|
|
1353
|
-
doDispatchAction(action) {
|
|
1483
|
+
doDispatchAction(action, options = {}) {
|
|
1354
1484
|
var _a;
|
|
1355
1485
|
this._stateManager.process(action);
|
|
1356
1486
|
(_a = this === null || this === void 0 ? void 0 : this._parentDataUnit) === null || _a === void 0 ? void 0 : _a.dispatchAction(Action.CHILD_CHANGED, { srcAction: action, srcDataUnit: this });
|
|
1357
1487
|
this._observers.forEach(f => {
|
|
1358
|
-
|
|
1359
|
-
if some observer throws exceptions,
|
|
1360
|
-
should be continued
|
|
1361
|
-
*/
|
|
1488
|
+
//if some observer throws exceptions, should be continued
|
|
1362
1489
|
try {
|
|
1363
|
-
f(action);
|
|
1490
|
+
f(action, options);
|
|
1364
1491
|
}
|
|
1365
1492
|
catch (e) {
|
|
1366
1493
|
console.warn("[DataUnit] error while call observer", e);
|
|
@@ -1395,20 +1522,36 @@ export default class DataUnit {
|
|
|
1395
1522
|
* Ela vai ser chamada sempre que uma ação for despachada (dispatchAction()).
|
|
1396
1523
|
*
|
|
1397
1524
|
* @param observer - Função que recebe como parâmetro as ações que serão monitoradas.
|
|
1398
|
-
*
|
|
1525
|
+
* @param uuid - Identificador do observer. Quando não informado, será gerado um identificador aleatório.
|
|
1399
1526
|
*/
|
|
1400
|
-
subscribe(observer) {
|
|
1401
|
-
|
|
1527
|
+
subscribe(observer, uuid) {
|
|
1528
|
+
if (uuid) {
|
|
1529
|
+
this._observers.set(uuid, observer);
|
|
1530
|
+
}
|
|
1531
|
+
else {
|
|
1532
|
+
uuid = StringUtils.generateUUID();
|
|
1533
|
+
this._observers.set(uuid, observer);
|
|
1534
|
+
}
|
|
1535
|
+
return uuid;
|
|
1402
1536
|
}
|
|
1403
1537
|
/**
|
|
1404
1538
|
*
|
|
1405
1539
|
* Remove um observer existente.
|
|
1406
1540
|
*
|
|
1407
1541
|
* @param observer - Observer que se deseja remover.
|
|
1408
|
-
*
|
|
1542
|
+
* @param uuid - Identificador do observer. Quando não informado o delete removera com base no equals do observer.
|
|
1409
1543
|
*/
|
|
1410
|
-
unsubscribe(observer) {
|
|
1411
|
-
|
|
1544
|
+
unsubscribe(observer, uuid) {
|
|
1545
|
+
if (uuid) {
|
|
1546
|
+
this._observers.delete(uuid);
|
|
1547
|
+
}
|
|
1548
|
+
else {
|
|
1549
|
+
this._observers.forEach((valor, chave) => {
|
|
1550
|
+
if (valor == observer) {
|
|
1551
|
+
this._observers.delete(chave);
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1412
1555
|
}
|
|
1413
1556
|
/**
|
|
1414
1557
|
*
|
|
@@ -1420,19 +1563,21 @@ export default class DataUnit {
|
|
|
1420
1563
|
reloadCurrentRecord() {
|
|
1421
1564
|
return new Promise((resolve, fail) => __awaiter(this, void 0, void 0, function* () {
|
|
1422
1565
|
const selection = getSelection(this._stateManager);
|
|
1423
|
-
this.dispatchAction(Action.LOADING_RECORD, selection);
|
|
1566
|
+
yield this.dispatchAction(Action.LOADING_RECORD, selection);
|
|
1424
1567
|
if (!this.recordLoader || !this.dataLoader) {
|
|
1425
|
-
this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
1568
|
+
yield this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
1569
|
+
resolve([]);
|
|
1426
1570
|
return;
|
|
1427
1571
|
}
|
|
1428
|
-
this.recordLoader(this, selection).then(response => {
|
|
1429
|
-
this.dispatchAction(Action.RECORD_LOADED, response);
|
|
1430
|
-
this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
1431
|
-
|
|
1432
|
-
|
|
1572
|
+
this.recordLoader(this, selection).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
1573
|
+
yield this.dispatchAction(Action.RECORD_LOADED, response);
|
|
1574
|
+
yield this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
1575
|
+
resolve(response);
|
|
1576
|
+
})).catch((cause) => __awaiter(this, void 0, void 0, function* () {
|
|
1577
|
+
yield this.dispatchAction(Action.LOADING_PROPERTIES_CLEANED);
|
|
1433
1578
|
const { errorCode } = cause;
|
|
1434
1579
|
fail(new ErrorException("Erro ao recarregar registro", cause, errorCode));
|
|
1435
|
-
});
|
|
1580
|
+
}));
|
|
1436
1581
|
}));
|
|
1437
1582
|
}
|
|
1438
1583
|
/**
|
|
@@ -1515,10 +1660,11 @@ export default class DataUnit {
|
|
|
1515
1660
|
* @param fieldName - nome do campo para ficar invisível.
|
|
1516
1661
|
*
|
|
1517
1662
|
*/
|
|
1518
|
-
hideField(fieldName) {
|
|
1663
|
+
hideField(fieldName, options) {
|
|
1519
1664
|
const fieldDescriptor = this.getField(fieldName);
|
|
1520
1665
|
if ((fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.visible) === true) {
|
|
1521
1666
|
fieldDescriptor.visible = false;
|
|
1667
|
+
fieldDescriptor.properties = Object.assign(Object.assign({}, fieldDescriptor.properties), { visibleOnConfig: options.visibleOnConfig });
|
|
1522
1668
|
this.metadata = Object.assign({}, this.metadata);
|
|
1523
1669
|
}
|
|
1524
1670
|
}
|
|
@@ -1570,10 +1716,13 @@ export default class DataUnit {
|
|
|
1570
1716
|
getSelection() {
|
|
1571
1717
|
console.warn("DataUnit: O método `getSelection` foi descontinuado. Use o método `getSelectionInfo`.");
|
|
1572
1718
|
const selection = this.getSelectionInfo();
|
|
1573
|
-
if (selection
|
|
1719
|
+
if (selection == undefined) {
|
|
1720
|
+
return [];
|
|
1721
|
+
}
|
|
1722
|
+
if (selection.isAllRecords()) {
|
|
1574
1723
|
throw new Error("Erro interno: Impossível retornar os registros selecionados. A seleção atual é virtual. Use o método `getSelectionInfo`.");
|
|
1575
1724
|
}
|
|
1576
|
-
return
|
|
1725
|
+
return selection === null || selection === void 0 ? void 0 : selection.recordIds;
|
|
1577
1726
|
}
|
|
1578
1727
|
/**
|
|
1579
1728
|
* Adiciona um campo stand-alone ao dataUnit.
|
|
@@ -1603,6 +1752,9 @@ export default class DataUnit {
|
|
|
1603
1752
|
}));
|
|
1604
1753
|
return loadingLockerResolver || Promise.resolve;
|
|
1605
1754
|
}
|
|
1755
|
+
set allowReleaseCallbacks(allow) {
|
|
1756
|
+
this._allowReleaseCallbacks = allow;
|
|
1757
|
+
}
|
|
1606
1758
|
processLoadingLockers() {
|
|
1607
1759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1608
1760
|
if (this._loadingLockers.length) {
|
|
@@ -1613,6 +1765,7 @@ export default class DataUnit {
|
|
|
1613
1765
|
}
|
|
1614
1766
|
}
|
|
1615
1767
|
DataUnit.CHANGING_PAGE_LOADING_SOURCE = "CHANGING_PAGE_LOADING_SOURCE";
|
|
1768
|
+
DataUnit.ALL_RECORDS_SELECTION_SOURCE = "ALL_RECORDS_SELECTION_SOURCE";
|
|
1616
1769
|
DataUnit.DEFAULT_DATAUNIT_NAME = "dataunit";
|
|
1617
1770
|
export var ChangeOperation;
|
|
1618
1771
|
(function (ChangeOperation) {
|
|
@@ -1698,7 +1851,10 @@ export class SelectionInfo {
|
|
|
1698
1851
|
}
|
|
1699
1852
|
get records() {
|
|
1700
1853
|
if (this.isAllRecords()) {
|
|
1701
|
-
|
|
1854
|
+
if (this.getAllRecords != undefined) {
|
|
1855
|
+
return this.getAllRecords();
|
|
1856
|
+
}
|
|
1857
|
+
throw new Error("Erro interno: Impossível retornar os registros selecionados numa seleção virtual.");
|
|
1702
1858
|
}
|
|
1703
1859
|
return this._records;
|
|
1704
1860
|
}
|