@trudb/tru-common-lib 0.1.83 → 0.1.85
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/esm2022/lib/base-classes/tru-edit-control-config-base.mjs +1 -1
- package/esm2022/lib/base-classes/tru-list-control-config-base.mjs +1 -1
- package/esm2022/lib/components/data-grid/tru-data-grid.mjs +4 -3
- package/esm2022/lib/directives/breeze-validator/tru-breeze-validator.mjs +27 -21
- package/fesm2022/trudb-tru-common-lib.mjs +28 -22
- package/fesm2022/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/base-classes/tru-edit-control-config-base.d.ts +1 -0
- package/lib/base-classes/tru-list-control-config-base.d.ts +1 -0
- package/lib/directives/breeze-validator/tru-breeze-validator.d.ts +6 -3
- package/package.json +1 -1
|
@@ -3946,10 +3946,11 @@ class TruDataGrid {
|
|
|
3946
3946
|
this.rowData = associatedEntities.map(this.enhanceRowDataForEntity, associatedEntities);
|
|
3947
3947
|
else
|
|
3948
3948
|
associatedEntities = this.rowData.map((e) => { return e.$entity; });
|
|
3949
|
-
let
|
|
3949
|
+
let associatableType = this.config.resultConfig.entityManyToManyType.name;
|
|
3950
|
+
let associatableTypeName = this.config.resultConfig.entityManyToManyTypeName;
|
|
3950
3951
|
let associatedMapOfAssociatable = _.map(associatedEntities, function (e) { return e['o' + associatableTypeName]; });
|
|
3951
3952
|
this.unassociatedChoices = associatableEntities.filter(object1 => {
|
|
3952
|
-
return !associatedMapOfAssociatable.some(object2 => { return object1.value.$ === object2[
|
|
3953
|
+
return !associatedMapOfAssociatable.some(object2 => { return object1.value.$ === object2[associatableType + 'Ref']; });
|
|
3953
3954
|
});
|
|
3954
3955
|
};
|
|
3955
3956
|
exportData = () => {
|
|
@@ -7118,6 +7119,7 @@ class TruBreezeValidator {
|
|
|
7118
7119
|
dataContext;
|
|
7119
7120
|
viewContainerRef;
|
|
7120
7121
|
componentFactoryResolver;
|
|
7122
|
+
entity;
|
|
7121
7123
|
config;
|
|
7122
7124
|
constructor(el, dataContext, viewContainerRef, componentFactoryResolver) {
|
|
7123
7125
|
this.el = el;
|
|
@@ -7130,15 +7132,16 @@ class TruBreezeValidator {
|
|
|
7130
7132
|
dialogRef = null;
|
|
7131
7133
|
subs = [];
|
|
7132
7134
|
currentDialog = null;
|
|
7135
|
+
context = TruValidationDialogContext.Control;
|
|
7133
7136
|
getMergeData = () => {
|
|
7134
|
-
if (this.config.
|
|
7135
|
-
let propertyNameParts = this.config.
|
|
7137
|
+
if (this.config.propertyPath?.includes('/')) {
|
|
7138
|
+
let propertyNameParts = this.config.propertyPath.split('/');
|
|
7136
7139
|
propertyNameParts.pop();
|
|
7137
7140
|
let targetProperty;
|
|
7138
7141
|
propertyNameParts.forEach((name) => {
|
|
7139
7142
|
if (!targetProperty) {
|
|
7140
7143
|
let targetPropertyName = 'o' + name;
|
|
7141
|
-
targetProperty = this.
|
|
7144
|
+
targetProperty = this.entity[targetPropertyName];
|
|
7142
7145
|
}
|
|
7143
7146
|
else {
|
|
7144
7147
|
let targetPropertyName = 'o' + name;
|
|
@@ -7151,7 +7154,7 @@ class TruBreezeValidator {
|
|
|
7151
7154
|
return undefined;
|
|
7152
7155
|
}
|
|
7153
7156
|
else {
|
|
7154
|
-
return this.
|
|
7157
|
+
return this.entity.Merge_Data_Set?.get(this.config.propertyName) ? this.entity.Merge_Data_Set : undefined;
|
|
7155
7158
|
}
|
|
7156
7159
|
};
|
|
7157
7160
|
parseErrorMessages = (validationErrors) => {
|
|
@@ -7180,55 +7183,58 @@ class TruBreezeValidator {
|
|
|
7180
7183
|
const entityPkeyName = validationTableName + 'Ref';
|
|
7181
7184
|
const validationObjectEntitypkeyName = validationTableName + 'Ref';
|
|
7182
7185
|
let addedPropertyValdations = validationObject.added.filter((v) => {
|
|
7183
|
-
return v.propertyName === this.config.
|
|
7186
|
+
return v.propertyName === this.config.propertyName;
|
|
7184
7187
|
});
|
|
7185
7188
|
let removedPropertyValdations = validationObject.removed.filter((v) => {
|
|
7186
|
-
return v.propertyName === this.config.
|
|
7189
|
+
return v.propertyName === this.config.propertyName;
|
|
7187
7190
|
});
|
|
7188
7191
|
this.mergeData = this.getMergeData();
|
|
7189
|
-
if (this.config.
|
|
7190
|
-
this.
|
|
7192
|
+
if (this.config.rootTable === validationTableName &&
|
|
7193
|
+
this.entity[entityPkeyName] === validationObjectEntity[validationObjectEntitypkeyName] &&
|
|
7191
7194
|
(addedPropertyValdations.length || this.mergeData)) {
|
|
7192
7195
|
this.removeValidationDialog();
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
this.
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7196
|
+
let config = new TruValidationDialogConfig(this.entity, this.config);
|
|
7197
|
+
config.propertyName = this.config.propertyName;
|
|
7198
|
+
config.mergeData = this.mergeData;
|
|
7199
|
+
config.errorMsg = this.parseErrorMessages(addedPropertyValdations);
|
|
7200
|
+
this.addValidationDialog(config);
|
|
7201
|
+
}
|
|
7202
|
+
if (this.config.rootTable === validationTableName &&
|
|
7203
|
+
this.entity[entityPkeyName] === validationObjectEntity[validationObjectEntitypkeyName] &&
|
|
7200
7204
|
(removedPropertyValdations.length)) {
|
|
7201
7205
|
this.removeValidationDialog();
|
|
7202
7206
|
}
|
|
7203
7207
|
};
|
|
7204
7208
|
ngOnInit() { }
|
|
7205
7209
|
ngAfterViewInit() {
|
|
7206
|
-
if (this.
|
|
7210
|
+
if (this.context !== TruValidationDialogContext.Grid && !this.config.isSubProperty) {
|
|
7207
7211
|
this.subs.push(this.dataContext.validationChangeDetection.subscribe(entities => {
|
|
7208
7212
|
this.valErrsChanged(entities);
|
|
7209
7213
|
}));
|
|
7210
7214
|
}
|
|
7211
7215
|
}
|
|
7212
7216
|
ngOnChanges(changes) {
|
|
7213
|
-
if (!changes.
|
|
7217
|
+
if (!changes.entity.firstChange) {
|
|
7214
7218
|
this.removeValidationDialog();
|
|
7215
|
-
this.
|
|
7219
|
+
this.entity.entityAspect.validateEntity();
|
|
7216
7220
|
}
|
|
7217
7221
|
}
|
|
7218
7222
|
ngOnDestroy() {
|
|
7219
7223
|
this.subs.forEach(s => s.unsubscribe());
|
|
7220
7224
|
}
|
|
7221
7225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TruBreezeValidator, deps: [{ token: i0.ElementRef }, { token: TruDataContext }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
7222
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: TruBreezeValidator, selector: "[truBreezeValidator]", inputs: {
|
|
7226
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: TruBreezeValidator, selector: "[truBreezeValidator]", inputs: { entity: ["truBreezeValidator", "entity"], config: "config" }, usesOnChanges: true, ngImport: i0 });
|
|
7223
7227
|
}
|
|
7224
7228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TruBreezeValidator, decorators: [{
|
|
7225
7229
|
type: Directive,
|
|
7226
7230
|
args: [{
|
|
7227
7231
|
selector: '[truBreezeValidator]'
|
|
7228
7232
|
}]
|
|
7229
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: TruDataContext }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }], propDecorators: {
|
|
7233
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: TruDataContext }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }], propDecorators: { entity: [{
|
|
7230
7234
|
type: Input,
|
|
7231
7235
|
args: ['truBreezeValidator']
|
|
7236
|
+
}], config: [{
|
|
7237
|
+
type: Input
|
|
7232
7238
|
}] } });
|
|
7233
7239
|
|
|
7234
7240
|
class TruBreezeValidatorModule {
|