@easyquery/core 7.2.5 → 7.3.0-rc01
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.
- package/dist/easyquery.core.cjs.js +32 -17
- package/dist/easyquery.core.esm.js +32 -17
- package/dist/types/main/context.d.ts +4 -0
- package/package.json +2 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* EasyQuery.JS Core v7.
|
|
3
|
+
* EasyQuery.JS Core v7.3.0-rc01
|
|
4
4
|
* Copyright 2024 Korzh.com
|
|
5
5
|
* Licensed under MIT
|
|
6
6
|
*
|
|
7
|
-
* Build time:
|
|
7
|
+
* Build time: 2/10/2024 10:51:56 AM
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -3378,15 +3378,15 @@ class Query {
|
|
|
3378
3378
|
if (!model)
|
|
3379
3379
|
return '';
|
|
3380
3380
|
const getConditionGroupText = (group) => {
|
|
3381
|
-
let result = '', conjKey =
|
|
3381
|
+
let result = '', conjKey = 'Conj' + exports.equtils.linkTypeToStr(group.linkType), conjText = core.i18n.getText(conjKey), condText, i;
|
|
3382
3382
|
for (i = 0; i < group.getConditions().length; i++) {
|
|
3383
|
-
condText =
|
|
3383
|
+
condText = '';
|
|
3384
3384
|
let cond = group.getConditions()[i];
|
|
3385
|
-
if (cond.enabled || typeof (cond.enabled) ===
|
|
3385
|
+
if (cond.enabled || typeof (cond.enabled) === 'undefined') {
|
|
3386
3386
|
if (cond.isGroup()) {
|
|
3387
3387
|
condText = getConditionGroupText(cond);
|
|
3388
3388
|
if (condText) {
|
|
3389
|
-
condText =
|
|
3389
|
+
condText = '(' + condText + ')';
|
|
3390
3390
|
}
|
|
3391
3391
|
}
|
|
3392
3392
|
else {
|
|
@@ -3397,14 +3397,17 @@ class Query {
|
|
|
3397
3397
|
for (let pi = 0; pi < plen; pi++) {
|
|
3398
3398
|
let part = parts[pi];
|
|
3399
3399
|
let txt = part.text;
|
|
3400
|
-
if (part.type ==
|
|
3400
|
+
if (part.type == 'expression') {
|
|
3401
3401
|
let expr = cond.expressions[part.index];
|
|
3402
3402
|
if (expr.kind == exports.DataKind.Attribute || expr.tag == exports.ExprTag.EntityAttribute) {
|
|
3403
3403
|
let attr = model.getAttributeById(expr.value);
|
|
3404
3404
|
if (attr != null) {
|
|
3405
|
-
txt = model.getAttributeText(attr,
|
|
3405
|
+
txt = model.getAttributeText(attr, '{entity} {attr}');
|
|
3406
3406
|
}
|
|
3407
3407
|
}
|
|
3408
|
+
if (expr.kind == exports.DataKind.Query) {
|
|
3409
|
+
txt = ': (' + expr.subQuery.getConditionsText() + ')';
|
|
3410
|
+
}
|
|
3408
3411
|
else {
|
|
3409
3412
|
txt = expr.getText();
|
|
3410
3413
|
if (this.model.isDateMacro(txt) || this.model.isTimeMacro(txt)) {
|
|
@@ -3415,20 +3418,20 @@ class Query {
|
|
|
3415
3418
|
}
|
|
3416
3419
|
}
|
|
3417
3420
|
if (pi > 0)
|
|
3418
|
-
condText +=
|
|
3421
|
+
condText += ' ';
|
|
3419
3422
|
condText += txt;
|
|
3420
3423
|
}
|
|
3421
3424
|
}
|
|
3422
3425
|
}
|
|
3423
3426
|
if (condText) {
|
|
3424
3427
|
if (i > 0 && result) {
|
|
3425
|
-
result +=
|
|
3428
|
+
result += ' ' + conjText + ' ';
|
|
3426
3429
|
}
|
|
3427
3430
|
result += condText;
|
|
3428
3431
|
}
|
|
3429
3432
|
}
|
|
3430
3433
|
if (group.linkType == exports.LinkType.None || group.linkType == exports.LinkType.NotAll) {
|
|
3431
|
-
result =
|
|
3434
|
+
result = 'not ( " + result + " )';
|
|
3432
3435
|
}
|
|
3433
3436
|
return result;
|
|
3434
3437
|
};
|
|
@@ -4645,7 +4648,7 @@ class EqContext {
|
|
|
4645
4648
|
}
|
|
4646
4649
|
}
|
|
4647
4650
|
setOptions(options) {
|
|
4648
|
-
core.utils.
|
|
4651
|
+
core.utils.assign(this.options, options);
|
|
4649
4652
|
}
|
|
4650
4653
|
get backendInfo() {
|
|
4651
4654
|
return this._backendInfo;
|
|
@@ -4847,19 +4850,28 @@ class EqContext {
|
|
|
4847
4850
|
queryId: this.defaultQueryId,
|
|
4848
4851
|
modelId: this.defaultModelId,
|
|
4849
4852
|
success: () => {
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
+
//if we load query on start - then we should throw the 'ready' event only after its successful loading
|
|
4854
|
+
this.throwReady();
|
|
4855
|
+
},
|
|
4856
|
+
error: () => {
|
|
4857
|
+
//if the default query can't be loaded - we still throw the 'ready' event
|
|
4858
|
+
this.throwReady();
|
|
4853
4859
|
}
|
|
4854
4860
|
});
|
|
4855
4861
|
}
|
|
4856
4862
|
else {
|
|
4857
|
-
this.
|
|
4858
|
-
this.fireEvent('ready');
|
|
4863
|
+
this.throwReady();
|
|
4859
4864
|
}
|
|
4860
4865
|
}
|
|
4861
4866
|
});
|
|
4862
4867
|
}
|
|
4868
|
+
/**
|
|
4869
|
+
* Refreshes all widgets and raises 'ready' event
|
|
4870
|
+
*/
|
|
4871
|
+
throwReady() {
|
|
4872
|
+
this.refreshWidgets(exports.WidgetGroup.Query);
|
|
4873
|
+
this.fireEvent('ready');
|
|
4874
|
+
}
|
|
4863
4875
|
/**
|
|
4864
4876
|
* Clears the content of the current query
|
|
4865
4877
|
*/
|
|
@@ -5711,6 +5723,9 @@ class EqContext {
|
|
|
5711
5723
|
}
|
|
5712
5724
|
});
|
|
5713
5725
|
}
|
|
5726
|
+
else {
|
|
5727
|
+
console.error('No exporter for this format: ' + format);
|
|
5728
|
+
}
|
|
5714
5729
|
}
|
|
5715
5730
|
}
|
|
5716
5731
|
limitCustomSqlColumns() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* EasyQuery.JS Core v7.
|
|
3
|
+
* EasyQuery.JS Core v7.3.0-rc01
|
|
4
4
|
* Copyright 2024 Korzh.com
|
|
5
5
|
* Licensed under MIT
|
|
6
6
|
*
|
|
7
|
-
* Build time:
|
|
7
|
+
* Build time: 2/10/2024 10:51:56 AM
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { i18n, DataType, utils, ValueEditor, MetaEntity, MetaEntityAttr, EditorTag, MetaData, EventEmitter, AggregationSettings, HttpClient, EasyDataTable } from '@easydata/core';
|
|
@@ -3377,15 +3377,15 @@ class Query {
|
|
|
3377
3377
|
if (!model)
|
|
3378
3378
|
return '';
|
|
3379
3379
|
const getConditionGroupText = (group) => {
|
|
3380
|
-
let result = '', conjKey =
|
|
3380
|
+
let result = '', conjKey = 'Conj' + equtils.linkTypeToStr(group.linkType), conjText = i18n.getText(conjKey), condText, i;
|
|
3381
3381
|
for (i = 0; i < group.getConditions().length; i++) {
|
|
3382
|
-
condText =
|
|
3382
|
+
condText = '';
|
|
3383
3383
|
let cond = group.getConditions()[i];
|
|
3384
|
-
if (cond.enabled || typeof (cond.enabled) ===
|
|
3384
|
+
if (cond.enabled || typeof (cond.enabled) === 'undefined') {
|
|
3385
3385
|
if (cond.isGroup()) {
|
|
3386
3386
|
condText = getConditionGroupText(cond);
|
|
3387
3387
|
if (condText) {
|
|
3388
|
-
condText =
|
|
3388
|
+
condText = '(' + condText + ')';
|
|
3389
3389
|
}
|
|
3390
3390
|
}
|
|
3391
3391
|
else {
|
|
@@ -3396,14 +3396,17 @@ class Query {
|
|
|
3396
3396
|
for (let pi = 0; pi < plen; pi++) {
|
|
3397
3397
|
let part = parts[pi];
|
|
3398
3398
|
let txt = part.text;
|
|
3399
|
-
if (part.type ==
|
|
3399
|
+
if (part.type == 'expression') {
|
|
3400
3400
|
let expr = cond.expressions[part.index];
|
|
3401
3401
|
if (expr.kind == DataKind.Attribute || expr.tag == ExprTag.EntityAttribute) {
|
|
3402
3402
|
let attr = model.getAttributeById(expr.value);
|
|
3403
3403
|
if (attr != null) {
|
|
3404
|
-
txt = model.getAttributeText(attr,
|
|
3404
|
+
txt = model.getAttributeText(attr, '{entity} {attr}');
|
|
3405
3405
|
}
|
|
3406
3406
|
}
|
|
3407
|
+
if (expr.kind == DataKind.Query) {
|
|
3408
|
+
txt = ': (' + expr.subQuery.getConditionsText() + ')';
|
|
3409
|
+
}
|
|
3407
3410
|
else {
|
|
3408
3411
|
txt = expr.getText();
|
|
3409
3412
|
if (this.model.isDateMacro(txt) || this.model.isTimeMacro(txt)) {
|
|
@@ -3414,20 +3417,20 @@ class Query {
|
|
|
3414
3417
|
}
|
|
3415
3418
|
}
|
|
3416
3419
|
if (pi > 0)
|
|
3417
|
-
condText +=
|
|
3420
|
+
condText += ' ';
|
|
3418
3421
|
condText += txt;
|
|
3419
3422
|
}
|
|
3420
3423
|
}
|
|
3421
3424
|
}
|
|
3422
3425
|
if (condText) {
|
|
3423
3426
|
if (i > 0 && result) {
|
|
3424
|
-
result +=
|
|
3427
|
+
result += ' ' + conjText + ' ';
|
|
3425
3428
|
}
|
|
3426
3429
|
result += condText;
|
|
3427
3430
|
}
|
|
3428
3431
|
}
|
|
3429
3432
|
if (group.linkType == LinkType.None || group.linkType == LinkType.NotAll) {
|
|
3430
|
-
result =
|
|
3433
|
+
result = 'not ( " + result + " )';
|
|
3431
3434
|
}
|
|
3432
3435
|
return result;
|
|
3433
3436
|
};
|
|
@@ -4644,7 +4647,7 @@ class EqContext {
|
|
|
4644
4647
|
}
|
|
4645
4648
|
}
|
|
4646
4649
|
setOptions(options) {
|
|
4647
|
-
utils.
|
|
4650
|
+
utils.assign(this.options, options);
|
|
4648
4651
|
}
|
|
4649
4652
|
get backendInfo() {
|
|
4650
4653
|
return this._backendInfo;
|
|
@@ -4846,19 +4849,28 @@ class EqContext {
|
|
|
4846
4849
|
queryId: this.defaultQueryId,
|
|
4847
4850
|
modelId: this.defaultModelId,
|
|
4848
4851
|
success: () => {
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
+
//if we load query on start - then we should throw the 'ready' event only after its successful loading
|
|
4853
|
+
this.throwReady();
|
|
4854
|
+
},
|
|
4855
|
+
error: () => {
|
|
4856
|
+
//if the default query can't be loaded - we still throw the 'ready' event
|
|
4857
|
+
this.throwReady();
|
|
4852
4858
|
}
|
|
4853
4859
|
});
|
|
4854
4860
|
}
|
|
4855
4861
|
else {
|
|
4856
|
-
this.
|
|
4857
|
-
this.fireEvent('ready');
|
|
4862
|
+
this.throwReady();
|
|
4858
4863
|
}
|
|
4859
4864
|
}
|
|
4860
4865
|
});
|
|
4861
4866
|
}
|
|
4867
|
+
/**
|
|
4868
|
+
* Refreshes all widgets and raises 'ready' event
|
|
4869
|
+
*/
|
|
4870
|
+
throwReady() {
|
|
4871
|
+
this.refreshWidgets(WidgetGroup.Query);
|
|
4872
|
+
this.fireEvent('ready');
|
|
4873
|
+
}
|
|
4862
4874
|
/**
|
|
4863
4875
|
* Clears the content of the current query
|
|
4864
4876
|
*/
|
|
@@ -5710,6 +5722,9 @@ class EqContext {
|
|
|
5710
5722
|
}
|
|
5711
5723
|
});
|
|
5712
5724
|
}
|
|
5725
|
+
else {
|
|
5726
|
+
console.error('No exporter for this format: ' + format);
|
|
5727
|
+
}
|
|
5713
5728
|
}
|
|
5714
5729
|
}
|
|
5715
5730
|
limitCustomSqlColumns() {
|
|
@@ -194,6 +194,10 @@ export declare class EqContext {
|
|
|
194
194
|
* to load the model with such ID.
|
|
195
195
|
*/
|
|
196
196
|
loadDefaultModel(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Refreshes all widgets and raises 'ready' event
|
|
199
|
+
*/
|
|
200
|
+
protected throwReady(): void;
|
|
197
201
|
/**
|
|
198
202
|
* Clears the content of the current query
|
|
199
203
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyquery/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0-rc01",
|
|
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",
|
|
@@ -30,8 +30,5 @@
|
|
|
30
30
|
"license": "LGPL-3.0",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|
|
33
|
-
]
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"@easydata/core": "^1.4.21"
|
|
36
|
-
}
|
|
33
|
+
]
|
|
37
34
|
}
|