@easyquery/core 7.2.5-rc02 → 7.2.5

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.
@@ -1,10 +1,10 @@
1
1
 
2
2
  /*
3
- * EasyQuery.JS Core v7.2.5-rc02
3
+ * EasyQuery.JS Core v7.2.5
4
4
  * Copyright 2024 Korzh.com
5
5
  * Licensed under MIT
6
6
  *
7
- * Build time: 1/9/2024 11:22:26 AM
7
+ * Build time: 1/18/2024 1:26:55 PM
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2211,7 +2211,7 @@ class Query {
2211
2211
  return hasChanged;
2212
2212
  }
2213
2213
  createSubQuery() {
2214
- return new Query(this.model, null, { context: this.context });
2214
+ return new Query(this.model, null, { parent: this, context: this.context });
2215
2215
  }
2216
2216
  useAggregation(settingsTuner, silent = false) {
2217
2217
  this.aggrSettings.clear();
@@ -2937,6 +2937,7 @@ class Query {
2937
2937
  */
2938
2938
  addColumn(descriptor, silent = false) {
2939
2939
  let newColumn;
2940
+ const justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
2940
2941
  if (descriptor.column) {
2941
2942
  newColumn = descriptor.column;
2942
2943
  }
@@ -2955,12 +2956,16 @@ class Query {
2955
2956
  else if (typeof descriptor.constValue === 'undefined' && !descriptor.customSql) {
2956
2957
  throw new Error('Not enought data for addColumn operation. One of the following options must be defined: attribute, attributeId, constValue or customSlq');
2957
2958
  }
2958
- if (attr && !attr.useInResult) {
2959
- if (attr.lookupAttr) {
2960
- attr = this.model.getAttributeById(attr.lookupAttr);
2961
- }
2962
- if (!attr || !attr.useInResult) {
2963
- throw new Error(`Can't use this attribute for a column`);
2959
+ if (attr) {
2960
+ let checkedOption = justsorted ? attr.useInSorting : attr.useInResult;
2961
+ if (!checkedOption) {
2962
+ if (attr.lookupAttr) {
2963
+ attr = this.model.getAttributeById(attr.lookupAttr);
2964
+ checkedOption = justsorted ? attr.useInSorting : attr.useInResult;
2965
+ }
2966
+ if (!checkedOption) {
2967
+ throw new Error(`Can't use this attribute for a column`);
2968
+ }
2964
2969
  }
2965
2970
  }
2966
2971
  if (descriptor.aggrFuncId && descriptor.customSql) {
@@ -3011,7 +3016,6 @@ class Query {
3011
3016
  newColumn.enabled = core.utils.getIfDefined(descriptor.enabled, true);
3012
3017
  newColumn.setReadOnly(core.utils.getIfDefined(descriptor.readonly, false));
3013
3018
  }
3014
- const justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
3015
3019
  if (!justsorted) {
3016
3020
  if (descriptor.index && descriptor.index >= 0 && descriptor.index < this.columns.length) {
3017
3021
  this.columns.splice(descriptor.index, 0, newColumn);
@@ -3035,7 +3039,7 @@ class Query {
3035
3039
  * const column = new Column();
3036
3040
  * column.caption = "Company name";
3037
3041
  *
3038
- * query.addColumn(column, 1)
3042
+ * query.addColumnObj(column, 1)
3039
3043
  */
3040
3044
  addColumnObj(column, index, author) {
3041
3045
  let columns = this.columns;
@@ -4004,7 +4008,7 @@ class EqServiceProvider {
4004
4008
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
4005
4009
  this.modelResolver = (_) => new DataModel();
4006
4010
  this.modelStorageResolver = null;
4007
- this.queryResolver = (context) => new Query(context.getModel(), null, { context });
4011
+ this.queryResolver = (context) => new Query(context.getModel(), null, { context: context });
4008
4012
  this.modelLoaderResolver = (context) => new EqServerModelLoader(context);
4009
4013
  this.queryStorageResolver = (context) => new BrowserQueryStorage(context);
4010
4014
  this.querySynchronizerResolver = (context) => new EqServerQuerySynchronizer(context);
@@ -4769,7 +4773,7 @@ class EqContext {
4769
4773
  }
4770
4774
  /**
4771
4775
  * Sets the content of the current data model
4772
- */
4776
+ */
4773
4777
  loadModelFromData(modelPlainData) {
4774
4778
  this.getQuery().loadModelData(modelPlainData);
4775
4779
  this.dataModel = this.getQuery().getModel();
@@ -1,10 +1,10 @@
1
1
 
2
2
  /*
3
- * EasyQuery.JS Core v7.2.5-rc02
3
+ * EasyQuery.JS Core v7.2.5
4
4
  * Copyright 2024 Korzh.com
5
5
  * Licensed under MIT
6
6
  *
7
- * Build time: 1/9/2024 11:22:26 AM
7
+ * Build time: 1/18/2024 1:26:55 PM
8
8
  */
9
9
 
10
10
  import { i18n, DataType, utils, ValueEditor, MetaEntity, MetaEntityAttr, EditorTag, MetaData, EventEmitter, AggregationSettings, HttpClient, EasyDataTable } from '@easydata/core';
@@ -2210,7 +2210,7 @@ class Query {
2210
2210
  return hasChanged;
2211
2211
  }
2212
2212
  createSubQuery() {
2213
- return new Query(this.model, null, { context: this.context });
2213
+ return new Query(this.model, null, { parent: this, context: this.context });
2214
2214
  }
2215
2215
  useAggregation(settingsTuner, silent = false) {
2216
2216
  this.aggrSettings.clear();
@@ -2936,6 +2936,7 @@ class Query {
2936
2936
  */
2937
2937
  addColumn(descriptor, silent = false) {
2938
2938
  let newColumn;
2939
+ const justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
2939
2940
  if (descriptor.column) {
2940
2941
  newColumn = descriptor.column;
2941
2942
  }
@@ -2954,12 +2955,16 @@ class Query {
2954
2955
  else if (typeof descriptor.constValue === 'undefined' && !descriptor.customSql) {
2955
2956
  throw new Error('Not enought data for addColumn operation. One of the following options must be defined: attribute, attributeId, constValue or customSlq');
2956
2957
  }
2957
- if (attr && !attr.useInResult) {
2958
- if (attr.lookupAttr) {
2959
- attr = this.model.getAttributeById(attr.lookupAttr);
2960
- }
2961
- if (!attr || !attr.useInResult) {
2962
- throw new Error(`Can't use this attribute for a column`);
2958
+ if (attr) {
2959
+ let checkedOption = justsorted ? attr.useInSorting : attr.useInResult;
2960
+ if (!checkedOption) {
2961
+ if (attr.lookupAttr) {
2962
+ attr = this.model.getAttributeById(attr.lookupAttr);
2963
+ checkedOption = justsorted ? attr.useInSorting : attr.useInResult;
2964
+ }
2965
+ if (!checkedOption) {
2966
+ throw new Error(`Can't use this attribute for a column`);
2967
+ }
2963
2968
  }
2964
2969
  }
2965
2970
  if (descriptor.aggrFuncId && descriptor.customSql) {
@@ -3010,7 +3015,6 @@ class Query {
3010
3015
  newColumn.enabled = utils.getIfDefined(descriptor.enabled, true);
3011
3016
  newColumn.setReadOnly(utils.getIfDefined(descriptor.readonly, false));
3012
3017
  }
3013
- const justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
3014
3018
  if (!justsorted) {
3015
3019
  if (descriptor.index && descriptor.index >= 0 && descriptor.index < this.columns.length) {
3016
3020
  this.columns.splice(descriptor.index, 0, newColumn);
@@ -3034,7 +3038,7 @@ class Query {
3034
3038
  * const column = new Column();
3035
3039
  * column.caption = "Company name";
3036
3040
  *
3037
- * query.addColumn(column, 1)
3041
+ * query.addColumnObj(column, 1)
3038
3042
  */
3039
3043
  addColumnObj(column, index, author) {
3040
3044
  let columns = this.columns;
@@ -4003,7 +4007,7 @@ class EqServiceProvider {
4003
4007
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
4004
4008
  this.modelResolver = (_) => new DataModel();
4005
4009
  this.modelStorageResolver = null;
4006
- this.queryResolver = (context) => new Query(context.getModel(), null, { context });
4010
+ this.queryResolver = (context) => new Query(context.getModel(), null, { context: context });
4007
4011
  this.modelLoaderResolver = (context) => new EqServerModelLoader(context);
4008
4012
  this.queryStorageResolver = (context) => new BrowserQueryStorage(context);
4009
4013
  this.querySynchronizerResolver = (context) => new EqServerQuerySynchronizer(context);
@@ -4768,7 +4772,7 @@ class EqContext {
4768
4772
  }
4769
4773
  /**
4770
4774
  * Sets the content of the current data model
4771
- */
4775
+ */
4772
4776
  loadModelFromData(modelPlainData) {
4773
4777
  this.getQuery().loadModelData(modelPlainData);
4774
4778
  this.dataModel = this.getQuery().getModel();
@@ -162,7 +162,7 @@ export declare class EqContext {
162
162
  getModel(): DataModel;
163
163
  /**
164
164
  * Sets the content of the current data model
165
- */
165
+ */
166
166
  loadModelFromData(modelPlainData: ModelPlainData): void;
167
167
  /**
168
168
  * Sets the ID of the default model
@@ -307,7 +307,7 @@ export declare class Query implements AggregationColumnStore {
307
307
  * const column = new Column();
308
308
  * column.caption = "Company name";
309
309
  *
310
- * query.addColumn(column, 1)
310
+ * query.addColumnObj(column, 1)
311
311
  */
312
312
  addColumnObj(column: QueryColumn | QueryColumn[], index: any, author: any): void;
313
313
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyquery/core",
3
- "version": "7.2.5-rc02",
3
+ "version": "7.2.5",
4
4
  "description": "EasyQuery.JS Community core modules",
5
5
  "types": "./dist/types/public_api.d.ts",
6
6
  "main": "./dist/easyquery.core.cjs.js",
@@ -10,7 +10,7 @@
10
10
  "build": "npm run clear && rollup -c",
11
11
  "watch": "npm run clear && rollup -c -w",
12
12
  "docs": "typedoc src/public_api.ts --out ./docs",
13
- "test": "jest"
13
+ "test": "vitest run"
14
14
  },
15
15
  "author": "Korzh.com",
16
16
  "homepage": "https://korzh.com/easyquery/javascript",