@easyquery/core 7.2.0-rc03 → 7.2.0-rc07

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.
@@ -1570,6 +1570,7 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
1570
1570
  this.lookupEntity = dto.lent;
1571
1571
  this.dataAttr = dto.dattr;
1572
1572
  this.lookupDataAttr = dto.ldattr;
1573
+ this.defaultValue = dto.defVal;
1573
1574
  this.isNullable = utils_utils.getIfDefined(dto.nul, this.isNullable);
1574
1575
  this.isEditable = utils_utils.getIfDefined(dto.ied, this.isEditable);
1575
1576
  this.showOnView = utils_utils.getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -3164,6 +3165,7 @@ __webpack_require__.d(__webpack_exports__, "Operand", function() { return /* ree
3164
3165
  __webpack_require__.d(__webpack_exports__, "EqValueEditor", function() { return /* reexport */ EqValueEditor; });
3165
3166
  __webpack_require__.d(__webpack_exports__, "EqAction", function() { return /* reexport */ EqAction; });
3166
3167
  __webpack_require__.d(__webpack_exports__, "EqModelLoader", function() { return /* reexport */ EqModelLoader; });
3168
+ __webpack_require__.d(__webpack_exports__, "InMemoryModelStorage", function() { return /* reexport */ model_storage_InMemoryModelStorage; });
3167
3169
  __webpack_require__.d(__webpack_exports__, "BrowserQueryStorage", function() { return /* reexport */ query_storage_BrowserQueryStorage; });
3168
3170
  __webpack_require__.d(__webpack_exports__, "EqContext", function() { return /* reexport */ context_EqContext; });
3169
3171
  __webpack_require__.d(__webpack_exports__, "Widget", function() { return /* reexport */ widget_Widget; });
@@ -5593,8 +5595,6 @@ var query_Query = /** @class */ (function () {
5593
5595
  }
5594
5596
  this.setDefaultName();
5595
5597
  this.description = "";
5596
- this.modelId = "";
5597
- this.modelName = "";
5598
5598
  this.model = (model) ? model : new data_model_DataModel();
5599
5599
  if (data) {
5600
5600
  this.loadFromData(data);
@@ -5608,10 +5608,14 @@ var query_Query = /** @class */ (function () {
5608
5608
  this.parentQuery = options.parent;
5609
5609
  }
5610
5610
  this.addChangedCallback(function (ev) {
5611
- if (ev.data && ev.data.part === QueryChangePart.Columns
5612
- && ev.data.action !== QueryChangeAction.Modify
5611
+ if (ev.data
5612
+ && ((ev.data.part & QueryChangePart.Columns) > 0)
5613
5613
  && !ev.data.aggregation) {
5614
- _this.aggrSettings.clear();
5614
+ if (_this._enableAggregation && _this.updateAggregationSettings()) {
5615
+ _this.fireChangedEvent({
5616
+ part: QueryChangePart.Aggregation
5617
+ });
5618
+ }
5615
5619
  }
5616
5620
  });
5617
5621
  }
@@ -5632,19 +5636,6 @@ var query_Query = /** @class */ (function () {
5632
5636
  this.processQueryForAggregation();
5633
5637
  var aggrCols = this.columns.filter(function (c) { return c.enabled
5634
5638
  && c.expr.tag == ExprTag.AggregateFunction; });
5635
- // // query contains aggregate columns
5636
- // if (aggrCols.length) {
5637
- // for (const col of aggrCols) {
5638
- // const attr = this.model.getAttributeById(col.expr.args[0].value);
5639
- // this.changeColumnType(col, ExprTag.EntityAttribute, {
5640
- // caption: this.model.getAttributeText(attr, `{attr}`)
5641
- // });
5642
- // }
5643
- // this.fireChangedEvent({
5644
- // part: QueryChangePart.Columns,
5645
- // wasModified: true
5646
- // });
5647
- // }
5648
5639
  }
5649
5640
  if (!this._enableAggregation) {
5650
5641
  this.aggrSettings.clear();
@@ -5653,6 +5644,40 @@ var query_Query = /** @class */ (function () {
5653
5644
  enumerable: true,
5654
5645
  configurable: true
5655
5646
  });
5647
+ Query.prototype.updateAggregationSettings = function () {
5648
+ var hasChanged = false;
5649
+ var aggrSettings = this.getAggregationSettings();
5650
+ for (var i = aggrSettings.groups.length - 1; i >= 0; i--) {
5651
+ var group = aggrSettings.groups[i];
5652
+ var _loop_1 = function (j) {
5653
+ var colId = group.columns[j];
5654
+ if (!this_1.columns.find(function (col) { return col.id === colId; })) {
5655
+ group.columns.splice(j, 1);
5656
+ hasChanged = true;
5657
+ }
5658
+ };
5659
+ var this_1 = this;
5660
+ for (var j = group.columns.length - 1; j >= 0; j--) {
5661
+ _loop_1(j);
5662
+ }
5663
+ if (group.columns.length == 0) {
5664
+ aggrSettings.groups.slice(i, 1);
5665
+ }
5666
+ }
5667
+ var aggregates = aggrSettings.getAggregates();
5668
+ var _loop_2 = function (i) {
5669
+ var aggr = aggregates[i];
5670
+ if (!this_2.columns.find(function (col) { return col.id === aggr.colId; })) {
5671
+ aggregates.splice(i, 1);
5672
+ hasChanged = true;
5673
+ }
5674
+ };
5675
+ var this_2 = this;
5676
+ for (var i = aggregates.length - 1; i >= 0; i--) {
5677
+ _loop_2(i);
5678
+ }
5679
+ return hasChanged;
5680
+ };
5656
5681
  Query.prototype.createSubQuery = function () {
5657
5682
  return new Query(this.model);
5658
5683
  };
@@ -7359,6 +7384,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7359
7384
  this.httpClient = new public_api["f" /* HttpClient */]();
7360
7385
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
7361
7386
  this.modelResolver = function (_) { return new data_model_DataModel(); };
7387
+ this.modelStorageResolver = null;
7362
7388
  this.queryResolver = function (context) { return new query_Query(context.getModel()); };
7363
7389
  this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
7364
7390
  this.queryStorageResolver = function (context) { return new query_storage_BrowserQueryStorage(context); };
@@ -7369,6 +7395,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7369
7395
  this.aggrCalculatoResolver = function (context) { return new DefaultAggregatesCalculator(context); };
7370
7396
  }
7371
7397
  EqServiceProvider.prototype.reset = function () {
7398
+ this.modelStorage = null;
7372
7399
  this.modelLoader = null;
7373
7400
  this.queryStorage = null;
7374
7401
  this.querySynchronizer = null;
@@ -7397,6 +7424,15 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7397
7424
  }
7398
7425
  return this.modelLoader;
7399
7426
  };
7427
+ EqServiceProvider.prototype.getModelStorage = function () {
7428
+ if (!this.modelStorage) {
7429
+ if (!this.modelStorageResolver) {
7430
+ throw 'ModelStorageResolver is not defined';
7431
+ }
7432
+ this.modelStorage = this.modelStorageResolver(this.context);
7433
+ }
7434
+ return this.modelStorage;
7435
+ };
7400
7436
  EqServiceProvider.prototype.getQueryStorage = function () {
7401
7437
  if (!this.queryStorage) {
7402
7438
  if (!this.queryStorageResolver) {
@@ -7460,6 +7496,9 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7460
7496
  EqServiceProvider.prototype.registerModelLoaderResolver = function (resolver) {
7461
7497
  this.modelLoaderResolver = resolver;
7462
7498
  };
7499
+ EqServiceProvider.prototype.registerModelStorageResolver = function (resolver) {
7500
+ this.modelStorageResolver = resolver;
7501
+ };
7463
7502
  EqServiceProvider.prototype.registerQueryStorageResolver = function (resolver) {
7464
7503
  this.queryStorageResolver = resolver;
7465
7504
  };
@@ -7573,6 +7612,25 @@ var EqAction;
7573
7612
  EqAction["UploadQueryFile"] = "UploadQueryFile";
7574
7613
  })(EqAction || (EqAction = {}));
7575
7614
 
7615
+ // CONCATENATED MODULE: ./src/main/model_storage.ts
7616
+
7617
+ var model_storage_InMemoryModelStorage = /** @class */ (function () {
7618
+ function InMemoryModelStorage(models) {
7619
+ this.models = [];
7620
+ if (models) {
7621
+ public_api["l" /* utils */].assign(this.models, [], models);
7622
+ }
7623
+ }
7624
+ InMemoryModelStorage.prototype.getModels = function () {
7625
+ var _this = this;
7626
+ return new Promise(function (resolve, reject) {
7627
+ resolve(_this.models);
7628
+ });
7629
+ };
7630
+ return InMemoryModelStorage;
7631
+ }());
7632
+
7633
+
7576
7634
  // CONCATENATED MODULE: ./src/main/action.ts
7577
7635
  var EqActionResult;
7578
7636
  (function (EqActionResult) {
@@ -7874,10 +7932,14 @@ var context_EqContext = /** @class */ (function () {
7874
7932
  }
7875
7933
  if (options.endpoint) {
7876
7934
  this.baseEndpoint = options.endpoint;
7877
- console.warn('The `endpoint` option is deprecated and will be ignored.\n'
7935
+ console.warn('The `endpoint` option is deprecated.\n'
7878
7936
  + 'Please use `context.useEndpoint(endpointURL)` function instead.');
7879
7937
  }
7880
7938
  this.setDefaultEndpoints(this.baseEndpoint);
7939
+ if (options.modelStorageResolver) {
7940
+ var eqServices = this.getServices();
7941
+ eqServices.registerModelStorageResolver(options.modelStorageResolver);
7942
+ }
7881
7943
  this.loadQueryOnStart = false;
7882
7944
  if (options.loadQueryOnStart) {
7883
7945
  this.loadQueryOnStart = options.loadQueryOnStart;
@@ -9211,6 +9273,7 @@ addEasyQueryCoreTexts();
9211
9273
 
9212
9274
 
9213
9275
 
9276
+
9214
9277
 
9215
9278
 
9216
9279
  //for backward compatibility