@sankhyalabs/core 5.20.0-dev.81 → 5.20.0-dev.82
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/Change.md +11 -11
- package/.docs/classes/DataUnit.md +178 -122
- package/.docs/classes/SelectionInfo.md +12 -12
- package/.docs/enumerations/Action.md +41 -31
- package/.docs/enumerations/ChangeOperation.md +4 -4
- package/.docs/enumerations/SelectionMode.md +2 -2
- package/.docs/interfaces/DUActionInterceptor.md +1 -1
- package/.docs/interfaces/PageRequest.md +3 -3
- 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/type-aliases/DataUnitEventOptions.md +1 -1
- package/dist/dataunit/DataUnit.d.ts +10 -0
- package/dist/dataunit/DataUnit.js +21 -2
- package/dist/dataunit/DataUnit.js.map +1 -1
- package/dist/dataunit/state/action/DataUnitAction.d.ts +1 -0
- package/dist/dataunit/state/action/DataUnitAction.js +1 -0
- package/dist/dataunit/state/action/DataUnitAction.js.map +1 -1
- package/package.json +1 -1
- package/reports/test-report.xml +495 -495
- package/src/dataunit/DataUnit.ts +24 -2
- package/src/dataunit/state/action/DataUnitAction.ts +2 -0
package/src/dataunit/DataUnit.ts
CHANGED
|
@@ -55,6 +55,7 @@ export default class DataUnit {
|
|
|
55
55
|
private _allowReleaseCallbacks: boolean;
|
|
56
56
|
private _waitingToReload: boolean = false;
|
|
57
57
|
private _cancelPagination: boolean = false;
|
|
58
|
+
private _isMultipleEdition: boolean = false;
|
|
58
59
|
|
|
59
60
|
public metadataLoader?: (dataUnit: DataUnit) => Promise<UnitMetadata>;
|
|
60
61
|
public dataLoader?: (dataUnit: DataUnit, request: LoadDataRequest) => Promise<LoadDataResponse>;
|
|
@@ -183,6 +184,21 @@ export default class DataUnit {
|
|
|
183
184
|
this._cancelPagination = cancelPagination;
|
|
184
185
|
}
|
|
185
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Informa se o DataUnit está no modo de edição de múltiplos registros.
|
|
189
|
+
*/
|
|
190
|
+
public get isMultipleEdition(): boolean {
|
|
191
|
+
return this._isMultipleEdition;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Define se o DataUnit está no modo de edição de múltiplos registros.
|
|
196
|
+
*/
|
|
197
|
+
public set isMultipleEdition(isMultipleEdition) {
|
|
198
|
+
this._isMultipleEdition = isMultipleEdition;
|
|
199
|
+
this.dispatchAction(Action.MULTIPLE_EDITION_CHANGED, {isMultipleEdition});
|
|
200
|
+
}
|
|
201
|
+
|
|
186
202
|
/**
|
|
187
203
|
*
|
|
188
204
|
* Obtém o nome de identificação do DataUnit (geralmente em formato de URI - Uniform Resource Identifier).
|
|
@@ -1031,7 +1047,7 @@ export default class DataUnit {
|
|
|
1031
1047
|
const typedValue = this.validateAndTypeValue(fieldName, newValue);
|
|
1032
1048
|
const currentValue = this.getFieldValue(fieldName);
|
|
1033
1049
|
|
|
1034
|
-
if(
|
|
1050
|
+
if(this.areEquivalentValues(newValue, currentValue, typedValue)) {
|
|
1035
1051
|
return Promise.resolve(false);
|
|
1036
1052
|
}
|
|
1037
1053
|
|
|
@@ -1046,7 +1062,7 @@ export default class DataUnit {
|
|
|
1046
1062
|
return promise;
|
|
1047
1063
|
}
|
|
1048
1064
|
|
|
1049
|
-
if (currentValue !== typedValue) {
|
|
1065
|
+
if (this.isMultipleEdition || currentValue !== typedValue) {
|
|
1050
1066
|
const promise = this.dispatchAction(Action.DATA_CHANGED, { [fieldName]: typedValue, records }, undefined, options);
|
|
1051
1067
|
this._savingLockers.push(promise);
|
|
1052
1068
|
return promise;
|
|
@@ -1055,6 +1071,12 @@ export default class DataUnit {
|
|
|
1055
1071
|
return Promise.resolve(false);
|
|
1056
1072
|
}
|
|
1057
1073
|
|
|
1074
|
+
private areEquivalentValues(newValue: any, currentValue: any, typedValue: any) {
|
|
1075
|
+
return !(newValue instanceof Promise)
|
|
1076
|
+
&& ObjectUtils.hasEquivalentProps(currentValue, typedValue)
|
|
1077
|
+
&& !this.isMultipleEdition;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1058
1080
|
/**
|
|
1059
1081
|
*
|
|
1060
1082
|
* Marca campos como inválidos.
|