@easyquery/core 7.2.0-rc02 → 7.2.0-rc06

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);
@@ -2662,6 +2663,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
2662
2663
  this.cachedRows = [];
2663
2664
  this.total = 0;
2664
2665
  this.needTotal = !this._elasticChunks;
2666
+ this.fireUpdated();
2665
2667
  };
2666
2668
  EasyDataTable.prototype.createRow = function (dataOrRow) {
2667
2669
  var _this = this;
@@ -3163,6 +3165,7 @@ __webpack_require__.d(__webpack_exports__, "Operand", function() { return /* ree
3163
3165
  __webpack_require__.d(__webpack_exports__, "EqValueEditor", function() { return /* reexport */ EqValueEditor; });
3164
3166
  __webpack_require__.d(__webpack_exports__, "EqAction", function() { return /* reexport */ EqAction; });
3165
3167
  __webpack_require__.d(__webpack_exports__, "EqModelLoader", function() { return /* reexport */ EqModelLoader; });
3168
+ __webpack_require__.d(__webpack_exports__, "InMemoryModelStorage", function() { return /* reexport */ model_storage_InMemoryModelStorage; });
3166
3169
  __webpack_require__.d(__webpack_exports__, "BrowserQueryStorage", function() { return /* reexport */ query_storage_BrowserQueryStorage; });
3167
3170
  __webpack_require__.d(__webpack_exports__, "EqContext", function() { return /* reexport */ context_EqContext; });
3168
3171
  __webpack_require__.d(__webpack_exports__, "Widget", function() { return /* reexport */ widget_Widget; });
@@ -5592,8 +5595,6 @@ var query_Query = /** @class */ (function () {
5592
5595
  }
5593
5596
  this.setDefaultName();
5594
5597
  this.description = "";
5595
- this.modelId = "";
5596
- this.modelName = "";
5597
5598
  this.model = (model) ? model : new data_model_DataModel();
5598
5599
  if (data) {
5599
5600
  this.loadFromData(data);
@@ -5607,10 +5608,14 @@ var query_Query = /** @class */ (function () {
5607
5608
  this.parentQuery = options.parent;
5608
5609
  }
5609
5610
  this.addChangedCallback(function (ev) {
5610
- if (ev.data && ev.data.part === QueryChangePart.Columns
5611
- && ev.data.action !== QueryChangeAction.Modify
5611
+ if (ev.data
5612
+ && ((ev.data.part & QueryChangePart.Columns) > 0)
5612
5613
  && !ev.data.aggregation) {
5613
- _this.aggrSettings.clear();
5614
+ if (_this._enableAggregation && _this.updateAggregationSettings()) {
5615
+ _this.fireChangedEvent({
5616
+ part: QueryChangePart.Aggregation
5617
+ });
5618
+ }
5614
5619
  }
5615
5620
  });
5616
5621
  }
@@ -5631,19 +5636,6 @@ var query_Query = /** @class */ (function () {
5631
5636
  this.processQueryForAggregation();
5632
5637
  var aggrCols = this.columns.filter(function (c) { return c.enabled
5633
5638
  && c.expr.tag == ExprTag.AggregateFunction; });
5634
- // // query contains aggregate columns
5635
- // if (aggrCols.length) {
5636
- // for (const col of aggrCols) {
5637
- // const attr = this.model.getAttributeById(col.expr.args[0].value);
5638
- // this.changeColumnType(col, ExprTag.EntityAttribute, {
5639
- // caption: this.model.getAttributeText(attr, `{attr}`)
5640
- // });
5641
- // }
5642
- // this.fireChangedEvent({
5643
- // part: QueryChangePart.Columns,
5644
- // wasModified: true
5645
- // });
5646
- // }
5647
5639
  }
5648
5640
  if (!this._enableAggregation) {
5649
5641
  this.aggrSettings.clear();
@@ -5652,6 +5644,40 @@ var query_Query = /** @class */ (function () {
5652
5644
  enumerable: true,
5653
5645
  configurable: true
5654
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
+ };
5655
5681
  Query.prototype.createSubQuery = function () {
5656
5682
  return new Query(this.model);
5657
5683
  };
@@ -7358,6 +7384,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7358
7384
  this.httpClient = new public_api["f" /* HttpClient */]();
7359
7385
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
7360
7386
  this.modelResolver = function (_) { return new data_model_DataModel(); };
7387
+ this.modelStorageResolver = null;
7361
7388
  this.queryResolver = function (context) { return new query_Query(context.getModel()); };
7362
7389
  this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
7363
7390
  this.queryStorageResolver = function (context) { return new query_storage_BrowserQueryStorage(context); };
@@ -7368,6 +7395,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7368
7395
  this.aggrCalculatoResolver = function (context) { return new DefaultAggregatesCalculator(context); };
7369
7396
  }
7370
7397
  EqServiceProvider.prototype.reset = function () {
7398
+ this.modelStorage = null;
7371
7399
  this.modelLoader = null;
7372
7400
  this.queryStorage = null;
7373
7401
  this.querySynchronizer = null;
@@ -7396,6 +7424,15 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7396
7424
  }
7397
7425
  return this.modelLoader;
7398
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
+ };
7399
7436
  EqServiceProvider.prototype.getQueryStorage = function () {
7400
7437
  if (!this.queryStorage) {
7401
7438
  if (!this.queryStorageResolver) {
@@ -7459,6 +7496,9 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
7459
7496
  EqServiceProvider.prototype.registerModelLoaderResolver = function (resolver) {
7460
7497
  this.modelLoaderResolver = resolver;
7461
7498
  };
7499
+ EqServiceProvider.prototype.registerModelStorageResolver = function (resolver) {
7500
+ this.modelStorageResolver = resolver;
7501
+ };
7462
7502
  EqServiceProvider.prototype.registerQueryStorageResolver = function (resolver) {
7463
7503
  this.queryStorageResolver = resolver;
7464
7504
  };
@@ -7572,6 +7612,25 @@ var EqAction;
7572
7612
  EqAction["UploadQueryFile"] = "UploadQueryFile";
7573
7613
  })(EqAction || (EqAction = {}));
7574
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
+
7575
7634
  // CONCATENATED MODULE: ./src/main/action.ts
7576
7635
  var EqActionResult;
7577
7636
  (function (EqActionResult) {
@@ -7873,10 +7932,14 @@ var context_EqContext = /** @class */ (function () {
7873
7932
  }
7874
7933
  if (options.endpoint) {
7875
7934
  this.baseEndpoint = options.endpoint;
7876
- console.warn('The `endpoint` option is deprecated and will be ignored.\n'
7935
+ console.warn('The `endpoint` option is deprecated.\n'
7877
7936
  + 'Please use `context.useEndpoint(endpointURL)` function instead.');
7878
7937
  }
7879
7938
  this.setDefaultEndpoints(this.baseEndpoint);
7939
+ if (options.modelStorageResolver) {
7940
+ var eqServices = this.getServices();
7941
+ eqServices.registerModelStorageResolver(options.modelStorageResolver);
7942
+ }
7880
7943
  this.loadQueryOnStart = false;
7881
7944
  if (options.loadQueryOnStart) {
7882
7945
  this.loadQueryOnStart = options.loadQueryOnStart;
@@ -8745,6 +8808,7 @@ var context_EqContext = /** @class */ (function () {
8745
8808
  _this.resultContent = result;
8746
8809
  if (result.resultSet) {
8747
8810
  _this.resultTable.clear();
8811
+ _this.resultTable.id = _this.query.getId();
8748
8812
  var resultSet = result.resultSet;
8749
8813
  for (var _i = 0, _a = resultSet.cols; _i < _a.length; _i++) {
8750
8814
  var col = _a[_i];
@@ -9209,6 +9273,7 @@ addEasyQueryCoreTexts();
9209
9273
 
9210
9274
 
9211
9275
 
9276
+
9212
9277
 
9213
9278
 
9214
9279
  //for backward compatibility