@trudb/tru-common-lib 0.0.911 → 0.0.912

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.
@@ -2818,6 +2818,7 @@ class TruMergeData {
2818
2818
  }
2819
2819
 
2820
2820
  class TruDataChangeParser {
2821
+ appEnvionment;
2821
2822
  dataContext;
2822
2823
  entity;
2823
2824
  tableName;
@@ -2837,7 +2838,8 @@ class TruDataChangeParser {
2837
2838
  dataChanged(change) {
2838
2839
  this.dataChanged$.next(change);
2839
2840
  }
2840
- constructor(connection, dataContext, globalDataContext, entity, tableName, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, modelTypeLookup, modelPropertyLookup) {
2841
+ constructor(connection, appEnviroment, dataContext, globalDataContext, entity, tableName, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, modelTypeLookup, modelPropertyLookup) {
2842
+ this.appEnvionment = appEnviroment;
2841
2843
  this.dataContext = dataContext;
2842
2844
  this.globalDataContext = globalDataContext;
2843
2845
  this.entity = entity;
@@ -2946,15 +2948,15 @@ class TruDataChangeParser {
2946
2948
  isSaving = async () => {
2947
2949
  return new Promise((resolve, reject) => {
2948
2950
  var interval = setInterval(() => {
2949
- //if (!$rootScope['isSaving']) {
2950
- // clearInterval(interval);
2951
- // resolve();
2952
- //}
2951
+ if (!this.appEnvionment.isSaving) {
2952
+ clearInterval(interval);
2953
+ resolve();
2954
+ }
2953
2955
  }, 1000);
2954
2956
  });
2955
2957
  };
2956
2958
  update = async (payload) => {
2957
- //await this.isSaving();
2959
+ await this.isSaving();
2958
2960
  var reloadResults = false;
2959
2961
  payload.changes.forEach(async (change) => {
2960
2962
  var foundEntities = [];
@@ -3164,7 +3166,7 @@ class TruConnectionHub {
3164
3166
  }
3165
3167
  };
3166
3168
  subscribe = (dataContext, entity, tableName, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded) => {
3167
- return new TruDataChangeParser(this.connection, dataContext, this.appEnvironment.globalDataContext, entity, tableName, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, this.modelTypeLookup, this.modelPropertyLookup).onDataChanged();
3169
+ return new TruDataChangeParser(this.connection, this.appEnvironment, dataContext, this.appEnvironment.globalDataContext, entity, tableName, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, this.modelTypeLookup, this.modelPropertyLookup).onDataChanged();
3168
3170
  };
3169
3171
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: TruConnectionHub, deps: [{ token: TruDataContext }, { token: TruAppEnvironment }, { token: TruModelTypeLookup }, { token: TruModelPropertyLookup }], target: i0.ɵɵFactoryTarget.Injectable });
3170
3172
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: TruConnectionHub, providedIn: 'root' });
@@ -3542,13 +3544,14 @@ class TruDataGrid {
3542
3544
  this.onSearch(setupQuery);
3543
3545
  }));
3544
3546
  this.subs.push(this.dataContext.onPropertyChanged().subscribe((changeArgs) => {
3545
- const pkeyName = changeArgs.entity?.entityType.shortName + 'Ref';
3546
- if (changeArgs.entityAction === EntityAction.Attach &&
3547
- changeArgs.entity[pkeyName] > -1 &&
3548
- this.config.resultConfig.entityType.name === changeArgs.entity?.constructor.name &&
3549
- this.config.resultConfig.entityType.name !== 'TruDbReport') {
3550
- //this.addEntity(changeArgs.entity)
3551
- }
3547
+ //type ObjectKey = keyof typeof changeArgs.entity;
3548
+ //const pkeyName = changeArgs.entity?.entityType.shortName + 'Ref' as ObjectKey;
3549
+ //if (changeArgs.entityAction === EntityAction.Attach &&
3550
+ // changeArgs.entity![pkeyName] > -1 &&
3551
+ // this.config.resultConfig.entityType.name === changeArgs.entity?.constructor.name &&
3552
+ // this.config.resultConfig.entityType.name !== 'TruDbReport') {
3553
+ // //this.addEntity(changeArgs.entity)
3554
+ //}
3552
3555
  }));
3553
3556
  this.subs.push(this.connectionHub.subscribe(this.dataContext, this.config.resultConfig.entityType, this.config.resultConfig.entityType.name, () => { return this.loadedEntities; }, () => { return this.latestSetupQuery; }, this.config.resultConfig.expands, [], () => { return true; }).subscribe((dataChange) => {
3554
3557
  this.api.refreshCells({ force: true });