@easyquery/core 7.2.5-rc03 → 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-rc03
3
+ * EasyQuery.JS Core v7.2.5
4
4
  * Copyright 2024 Korzh.com
5
5
  * Licensed under MIT
6
6
  *
7
- * Build time: 1/15/2024 11:04:57 AM
7
+ * Build time: 1/18/2024 1:26:55 PM
8
8
  */
9
9
 
10
10
  'use strict';
@@ -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;
@@ -1,10 +1,10 @@
1
1
 
2
2
  /*
3
- * EasyQuery.JS Core v7.2.5-rc03
3
+ * EasyQuery.JS Core v7.2.5
4
4
  * Copyright 2024 Korzh.com
5
5
  * Licensed under MIT
6
6
  *
7
- * Build time: 1/15/2024 11:04:57 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';
@@ -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;
@@ -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-rc03",
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",