@trudb/tru-common-lib 0.1.110 → 0.1.112
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/components/data-grid/tru-data-grid.mjs +64 -61
- package/esm2022/lib/components/layout/tab/services/tru-tab-group-event-notifier.mjs +8 -5
- package/esm2022/lib/components/layout/tab/tab/tru-tab.mjs +2 -2
- package/fesm2022/trudb-tru-common-lib.mjs +70 -64
- package/fesm2022/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/components/data-grid/tru-data-grid.d.ts +5 -4
- package/lib/components/layout/tab/services/tru-tab-group-event-notifier.d.ts +4 -3
- package/package.json +1 -1
|
@@ -3679,13 +3679,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
|
|
|
3679
3679
|
}], ctorParameters: () => [{ type: TruDataContext }, { type: TruAppEnvironment }, { type: TruModelTypeLookup }, { type: TruModelPropertyLookup }] });
|
|
3680
3680
|
|
|
3681
3681
|
class TruTabGroupEventNotifier {
|
|
3682
|
-
active$ = new
|
|
3682
|
+
active$ = new BehaviorSubject(false);
|
|
3683
3683
|
onActiveStateChanged = () => {
|
|
3684
3684
|
return this.active$;
|
|
3685
3685
|
};
|
|
3686
|
-
|
|
3686
|
+
get isActive() {
|
|
3687
|
+
return this.active$.getValue();
|
|
3688
|
+
}
|
|
3689
|
+
set isActive(value) {
|
|
3687
3690
|
this.active$.next(value);
|
|
3688
|
-
}
|
|
3691
|
+
}
|
|
3689
3692
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TruTabGroupEventNotifier, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3690
3693
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TruTabGroupEventNotifier });
|
|
3691
3694
|
}
|
|
@@ -4077,6 +4080,59 @@ class TruDataGrid {
|
|
|
4077
4080
|
this.api.applyTransaction({ add: [enhancedEntity], addIndex: 0 });
|
|
4078
4081
|
}
|
|
4079
4082
|
};
|
|
4083
|
+
getMergeData = (config, entityToValidate) => {
|
|
4084
|
+
if (config.propertyPath?.includes('/')) {
|
|
4085
|
+
let propertyNameParts = config.propertyPath.split('/');
|
|
4086
|
+
propertyNameParts.pop();
|
|
4087
|
+
let targetProperty;
|
|
4088
|
+
propertyNameParts.forEach((name) => {
|
|
4089
|
+
if (!targetProperty) {
|
|
4090
|
+
let targetPropertyName = 'o' + name;
|
|
4091
|
+
targetProperty = entityToValidate[targetPropertyName];
|
|
4092
|
+
}
|
|
4093
|
+
else {
|
|
4094
|
+
let targetPropertyName = 'o' + name;
|
|
4095
|
+
targetProperty = targetProperty[targetPropertyName];
|
|
4096
|
+
}
|
|
4097
|
+
});
|
|
4098
|
+
if (targetProperty && targetProperty.Merge_Data) {
|
|
4099
|
+
return targetProperty.Merge_Data_Set;
|
|
4100
|
+
}
|
|
4101
|
+
return null;
|
|
4102
|
+
}
|
|
4103
|
+
else {
|
|
4104
|
+
return entityToValidate.Merge_Data_Set?.get(config.propertyName) ? entityToValidate.Merge_Data_Set : undefined;
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
validationDialog = null;
|
|
4108
|
+
addValidationDialog = (config, hostElement) => {
|
|
4109
|
+
let target = hostElement.querySelectorAll('.dialog-target')[0];
|
|
4110
|
+
let dialogElement = document.createElement('div');
|
|
4111
|
+
dialogElement.classList.add('invalid');
|
|
4112
|
+
target.appendChild(dialogElement);
|
|
4113
|
+
let componentRef = createComponent(TruValidationDialog, {
|
|
4114
|
+
environmentInjector: this.app.injector,
|
|
4115
|
+
hostElement: dialogElement,
|
|
4116
|
+
});
|
|
4117
|
+
componentRef.instance.config = config;
|
|
4118
|
+
componentRef.instance.close.subscribe(() => {
|
|
4119
|
+
this.api.refreshCells({ force: true });
|
|
4120
|
+
componentRef.destroy();
|
|
4121
|
+
});
|
|
4122
|
+
this.validationDialog = componentRef;
|
|
4123
|
+
this.app.attachView(componentRef.hostView);
|
|
4124
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
4125
|
+
};
|
|
4126
|
+
runSearch = () => {
|
|
4127
|
+
let containerIsActive = true;
|
|
4128
|
+
if (this.tabGroupEventNotifier !== null)
|
|
4129
|
+
containerIsActive = this.tabGroupEventNotifier.isActive;
|
|
4130
|
+
else
|
|
4131
|
+
containerIsActive = true;
|
|
4132
|
+
if ((this.gridType === TruDataGridTypes.Detail || this.gridType === TruDataGridTypes.DetailManyToMany) && containerIsActive) {
|
|
4133
|
+
this.onSearch(this.config.resultConfig.setupQuery(this.entity));
|
|
4134
|
+
}
|
|
4135
|
+
};
|
|
4080
4136
|
defaultColDef = {
|
|
4081
4137
|
suppressKeyboardEvent: this.onSuppressKeyboardEvent
|
|
4082
4138
|
};
|
|
@@ -4127,49 +4183,6 @@ class TruDataGrid {
|
|
|
4127
4183
|
});
|
|
4128
4184
|
}
|
|
4129
4185
|
};
|
|
4130
|
-
getMergeData = (config, entityToValidate) => {
|
|
4131
|
-
if (config.propertyPath?.includes('/')) {
|
|
4132
|
-
let propertyNameParts = config.propertyPath.split('/');
|
|
4133
|
-
propertyNameParts.pop();
|
|
4134
|
-
let targetProperty;
|
|
4135
|
-
propertyNameParts.forEach((name) => {
|
|
4136
|
-
if (!targetProperty) {
|
|
4137
|
-
let targetPropertyName = 'o' + name;
|
|
4138
|
-
targetProperty = entityToValidate[targetPropertyName];
|
|
4139
|
-
}
|
|
4140
|
-
else {
|
|
4141
|
-
let targetPropertyName = 'o' + name;
|
|
4142
|
-
targetProperty = targetProperty[targetPropertyName];
|
|
4143
|
-
}
|
|
4144
|
-
});
|
|
4145
|
-
if (targetProperty && targetProperty.Merge_Data) {
|
|
4146
|
-
return targetProperty.Merge_Data_Set;
|
|
4147
|
-
}
|
|
4148
|
-
return null;
|
|
4149
|
-
}
|
|
4150
|
-
else {
|
|
4151
|
-
return entityToValidate.Merge_Data_Set?.get(config.propertyName) ? entityToValidate.Merge_Data_Set : undefined;
|
|
4152
|
-
}
|
|
4153
|
-
};
|
|
4154
|
-
validationDialog = null;
|
|
4155
|
-
addValidationDialog = (config, hostElement) => {
|
|
4156
|
-
let target = hostElement.querySelectorAll('.dialog-target')[0];
|
|
4157
|
-
let dialogElement = document.createElement('div');
|
|
4158
|
-
dialogElement.classList.add('invalid');
|
|
4159
|
-
target.appendChild(dialogElement);
|
|
4160
|
-
let componentRef = createComponent(TruValidationDialog, {
|
|
4161
|
-
environmentInjector: this.app.injector,
|
|
4162
|
-
hostElement: dialogElement,
|
|
4163
|
-
});
|
|
4164
|
-
componentRef.instance.config = config;
|
|
4165
|
-
componentRef.instance.close.subscribe(() => {
|
|
4166
|
-
this.api.refreshCells({ force: true });
|
|
4167
|
-
componentRef.destroy();
|
|
4168
|
-
});
|
|
4169
|
-
this.validationDialog = componentRef;
|
|
4170
|
-
this.app.attachView(componentRef.hostView);
|
|
4171
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
4172
|
-
};
|
|
4173
4186
|
onCellMouseOver(e) {
|
|
4174
4187
|
let targetElement = e.event.target;
|
|
4175
4188
|
if (!targetElement.classList.contains('ag-cell'))
|
|
@@ -4274,27 +4287,20 @@ class TruDataGrid {
|
|
|
4274
4287
|
this.columnDefs = this.config.resultConfig.columnDefs;
|
|
4275
4288
|
this.gridType = this.config.resultConfig.gridType;
|
|
4276
4289
|
}
|
|
4277
|
-
ngOnChanges(changes) {
|
|
4278
|
-
if (this.gridType === TruDataGridTypes.Detail || this.gridType === TruDataGridTypes.DetailManyToMany)
|
|
4279
|
-
this.onSearch(this.config.resultConfig.setupQuery(this.entity));
|
|
4280
|
-
}
|
|
4281
4290
|
ngAfterViewInit() {
|
|
4282
4291
|
if (this.tabGroupEventNotifier !== null) {
|
|
4283
|
-
this.tabGroupEventNotifier.onActiveStateChanged().subscribe((isActive) => {
|
|
4284
|
-
|
|
4285
|
-
this.onSearch(this.config.resultConfig.setupQuery(this.entity));
|
|
4286
|
-
}
|
|
4292
|
+
this.tabGroupEventNotifier.onActiveStateChanged().pipe(skip(1)).subscribe((isActive) => {
|
|
4293
|
+
this.runSearch();
|
|
4287
4294
|
});
|
|
4288
4295
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
}
|
|
4296
|
+
//setTimeout to prevent: ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError.
|
|
4297
|
+
setTimeout(() => {
|
|
4298
|
+
this.parentToolbarTemplate = this.searchResultViewManager.searchViewToolbarTemplate;
|
|
4299
|
+
this.runSearch();
|
|
4300
|
+
}, 0);
|
|
4301
|
+
}
|
|
4302
|
+
ngOnChanges(changes) {
|
|
4303
|
+
this.runSearch();
|
|
4298
4304
|
}
|
|
4299
4305
|
ngOnDestroy() {
|
|
4300
4306
|
this.subs.forEach(s => s.unsubscribe());
|
|
@@ -6931,7 +6937,7 @@ class TruTab {
|
|
|
6931
6937
|
this.tabGroupEventNotifier = tabGroupEventNotifier;
|
|
6932
6938
|
}
|
|
6933
6939
|
notifyListeners = (isActive) => {
|
|
6934
|
-
this.tabGroupEventNotifier.
|
|
6940
|
+
this.tabGroupEventNotifier.isActive = isActive;
|
|
6935
6941
|
};
|
|
6936
6942
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: TruTab, deps: [{ token: TruTabGroupEventNotifier }], target: i0.ɵɵFactoryTarget.Component });
|
|
6937
6943
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: TruTab, selector: "tru-tab", inputs: { label: "label" }, providers: [TruTabGroupEventNotifier], viewQueries: [{ propertyName: "matTab", first: true, predicate: MatTab, descendants: true }], ngImport: i0, template: "<mat-tab [label]=\"label\">\r\n <ng-content></ng-content>\r\n</mat-tab>\r\n", styles: [""], dependencies: [{ kind: "component", type: i2$2.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }] });
|