@adaptabletools/adaptable 13.0.0-canary.2 → 13.0.0-canary.3
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/agGrid.d.ts +23 -1
- package/agGrid.js +23 -1
- package/base.css +1 -0
- package/bundle.cjs.js +158 -158
- package/index.css +1 -0
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AdaptableQLOptions.d.ts +42 -14
- package/src/Api/ConditionalStyleApi.d.ts +20 -0
- package/src/Api/FormatColumnApi.d.ts +42 -3
- package/src/Api/Implementation/FormatColumnApiImpl.d.ts +17 -1
- package/src/Api/Implementation/FormatColumnApiImpl.js +94 -14
- package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +0 -2
- package/src/Api/Implementation/QueryLanguageApiImpl.js +0 -3
- package/src/Api/QueryLanguageApi.d.ts +0 -5
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +37 -37
- package/src/PredefinedConfig/FormatColumnState.d.ts +19 -0
- package/src/PredefinedConfig/PredefinedConfig.d.ts +1 -0
- package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +14 -0
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +43 -1
- package/src/Redux/Store/AdaptableStore.js +2 -0
- package/src/Strategy/FormatColumnModule.d.ts +2 -9
- package/src/Strategy/FormatColumnModule.js +5 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +5 -5
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -0
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +4 -1
- package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -0
- package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +4 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -0
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +4 -1
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -0
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +4 -1
- package/src/Utilities/Extensions/TypeExtensions.d.ts +1 -0
- package/src/Utilities/Extensions/TypeExtensions.js +5 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +14 -4
- package/src/Utilities/Services/LicenseService.js +1 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +5 -3
- package/src/Utilities/Services/QueryLanguageService.js +92 -39
- package/src/Utilities/license/LicenseDetails.d.ts +1 -1
- package/src/Utilities/license/decode.d.ts +1 -0
- package/src/Utilities/license/decode.js +1 -1
- package/src/View/FormatColumn/MoveFormatColumn.d.ts +7 -0
- package/src/View/FormatColumn/MoveFormatColumn.js +27 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +9 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +66 -0
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +20 -2
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -1
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +14 -0
- package/src/View/FormatColumn/Wizard/constants.d.ts +1 -0
- package/src/View/FormatColumn/Wizard/constants.js +4 -0
- package/src/agGrid/Adaptable.d.ts +5 -0
- package/src/agGrid/Adaptable.js +103 -45
- package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +1 -1
- package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +47 -29
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/types.d.ts +6 -3
- package/src/types.d.ts +2 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.booleanExpressionFunctions = void 0;
|
|
3
|
+
exports.booleanExpressionFunctionsList = exports.booleanExpressionFunctions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const isAfter_1 = tslib_1.__importDefault(require("date-fns/isAfter"));
|
|
6
6
|
const isBefore_1 = tslib_1.__importDefault(require("date-fns/isBefore"));
|
|
@@ -293,3 +293,6 @@ exports.booleanExpressionFunctions = {
|
|
|
293
293
|
examples: ['QUERY("anyNamedQuery")'],
|
|
294
294
|
},
|
|
295
295
|
};
|
|
296
|
+
exports.booleanExpressionFunctionsList = Object.entries(exports.booleanExpressionFunctions).map(([functionName, expressionImplementation]) => ({
|
|
297
|
+
[functionName]: expressionImplementation,
|
|
298
|
+
}));
|
|
@@ -6,4 +6,5 @@ export declare type ObservableFunctionName = 'WHERE' | 'COL' | 'TIMEFRAME' | Obs
|
|
|
6
6
|
declare type ObservableFunction = 'ROW_CHANGE' | 'GRID_CHANGE';
|
|
7
7
|
declare type ChangeFunction = 'MAX' | 'MIN' | 'NONE' | 'COUNT';
|
|
8
8
|
export declare const observableExpressionFunctions: Record<ObservableFunctionName, ExpressionFunction>;
|
|
9
|
+
export declare const observableExpressionFunctionsList: Record<ObservableFunctionName, ExpressionFunction>[];
|
|
9
10
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.observableExpressionFunctions = void 0;
|
|
3
|
+
exports.observableExpressionFunctionsList = exports.observableExpressionFunctions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
@@ -212,6 +212,9 @@ exports.observableExpressionFunctions = {
|
|
|
212
212
|
examples: ["TIMEFRAME('20s')", "TIMEFRAME('5m')", "TIMEFRAME('1h')"],
|
|
213
213
|
},
|
|
214
214
|
};
|
|
215
|
+
exports.observableExpressionFunctionsList = Object.entries(exports.observableExpressionFunctions).map(([functionName, expressionImplementation]) => ({
|
|
216
|
+
[functionName]: expressionImplementation,
|
|
217
|
+
}));
|
|
215
218
|
// return TRUE if the last(tail) element has the greatest value
|
|
216
219
|
const isLastElementMaxValue = (values) => {
|
|
217
220
|
const [tailValue] = values.slice(-1);
|
|
@@ -4,3 +4,4 @@ import { ExpressionFunction } from '../../parser/src/types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare type ScalarFunctionName = 'ADD' | 'SUB' | 'MUL' | 'DIV' | 'MOD' | 'POW' | 'MIN' | 'MAX' | 'AVG' | 'DATE' | 'NOW' | 'TODAY' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | 'ADD_DAYS' | 'ADD_WEEKS' | 'ADD_MONTHS' | 'ADD_YEARS' | 'DIFF_DAYS' | 'DIFF_WEEKS' | 'DIFF_MONTHS' | 'DIFF_YEARS' | 'SUB_STRING' | 'REPLACE' | 'COALESCE' | 'LEN' | 'UPPER' | 'LOWER' | 'CONCAT' | 'IF' | 'COL' | 'VAR';
|
|
6
6
|
export declare const scalarExpressionFunctions: Record<ScalarFunctionName, ExpressionFunction>;
|
|
7
|
+
export declare const scalarExpressionFunctionsList: Record<ScalarFunctionName, ExpressionFunction>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scalarExpressionFunctions = void 0;
|
|
3
|
+
exports.scalarExpressionFunctionsList = exports.scalarExpressionFunctions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ExpressionEvaluationError_1 = require("../../parser/src/ExpressionEvaluationError");
|
|
6
6
|
const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
|
|
@@ -356,3 +356,6 @@ exports.scalarExpressionFunctions = {
|
|
|
356
356
|
examples: ['VAR(CURRENT_USER)', 'VAR(IS_VALID_VALUE, IS_BLANK([col1]), [col2] < [col3])'],
|
|
357
357
|
},
|
|
358
358
|
};
|
|
359
|
+
exports.scalarExpressionFunctionsList = Object.entries(exports.scalarExpressionFunctions).map(([functionName, expressionImplementation]) => ({
|
|
360
|
+
[functionName]: expressionImplementation,
|
|
361
|
+
}));
|
|
@@ -73,4 +73,5 @@ export declare type _DeepRequiredObject<T> = {
|
|
|
73
73
|
[P in keyof T]-?: DeepRequired<NonUndefined<T[P]>>;
|
|
74
74
|
};
|
|
75
75
|
export declare type NonUndefined<A> = A extends undefined ? never : A;
|
|
76
|
+
export declare const getTypedKeys: <T extends string>(input: Record<T, any>) => T[];
|
|
76
77
|
export {};
|
|
@@ -3,9 +3,12 @@ import { IAdaptableService } from './IAdaptableService';
|
|
|
3
3
|
import { RowNode } from '@ag-grid-community/core';
|
|
4
4
|
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
5
5
|
import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
|
|
6
|
-
import { ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { AggregatedScalarFunctionName, ScalarAggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
7
|
+
import { AggregatedBooleanFunctionName, BooleanAggregationParameter } from '../../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
|
|
8
|
+
import { BooleanFunctionName } from '../../ExpressionFunctions/booleanExpressionFunctions';
|
|
9
|
+
import { ScalarFunctionName } from '../../ExpressionFunctions/scalarExpressionFunctions';
|
|
10
|
+
import { ObservableFunctionName } from '../../ExpressionFunctions/observableExpressionFunctions';
|
|
11
|
+
import { ExpressionFunctionMap } from '../../../parser/src/types';
|
|
9
12
|
export interface IQueryLanguageService extends IAdaptableService {
|
|
10
13
|
evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: RowNode): boolean;
|
|
11
14
|
evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
|
|
@@ -31,10 +34,17 @@ export interface IQueryLanguageService extends IAdaptableService {
|
|
|
31
34
|
errorMessage: string;
|
|
32
35
|
};
|
|
33
36
|
computeAggregatedBooleanValue(expression: string, module: AdaptableModule): boolean;
|
|
34
|
-
|
|
37
|
+
getModuleExpressionFunctionsMap(module: AdaptableModule): ModuleExpressionFunctionsMap;
|
|
35
38
|
getColumnsFromExpression(input: string): string[];
|
|
36
39
|
getNamedQueryNamesFromExpression(input: string): string[];
|
|
37
40
|
isCumulativeAggregate(input: string): boolean;
|
|
38
41
|
evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
|
|
39
42
|
getExpressionWithColumnFriendlyNames(expression: string): string;
|
|
40
43
|
}
|
|
44
|
+
export interface ModuleExpressionFunctionsMap {
|
|
45
|
+
booleanFunctions?: ExpressionFunctionMap<BooleanFunctionName>;
|
|
46
|
+
scalarFunctions?: ExpressionFunctionMap<ScalarFunctionName>;
|
|
47
|
+
observableFunctions?: ExpressionFunctionMap<ObservableFunctionName>;
|
|
48
|
+
aggregatedBooleanFunctions?: ExpressionFunctionMap<AggregatedBooleanFunctionName>;
|
|
49
|
+
aggregatedScalarFunctions?: ExpressionFunctionMap<AggregatedScalarFunctionName>;
|
|
50
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LicenseService=exports.LicenseValidityType=void 0;const e=require("tslib"),a=require("../../Redux/ActionsReducers/SystemRedux"),t=require("../../Redux/ActionsReducers/PopupRedux"),s=e.__importDefault(require("../ObjectFactory")),o=require("../Helpers/LoggingHelper"),i=e.__importDefault(require("lodash/clamp")),n=require("../Constants/DocumentationLinkConstants"),r=require("../license/decode"),c="sales@adaptabletools.com",l=10,d=864e5;var p;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(p=exports.LicenseValidityType||(exports.LicenseValidityType={}));const E=/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g,_=/(https):\/\/\S+(\.csb\.app)/g,I=/(https):\/\/\S+(\.adaptabletools\.com)/g,O="undefined"!=typeof window?window.location.origin:"",N=()=>{const[e,a,t]=Array.from(E.exec(O)||[]);return"https"===a&&"sandpack.codesandbox.io"===t},h=()=>{const[e,a,t]=Array.from(_.exec(O)||[]);return"https"===a&&".csb.app"===t},u=()=>{const[e,a,t]=Array.from(I.exec(O)||[]);return"https"===a&&".adaptabletools.com"===t};class A{constructor(e,a,t){this.adaptable=e,this.adaptable=e;let s=null;if(a)try{s=(0,r.decode)(a)}catch(e){s=e}N()||h()||u()||this.handleLicenseValidation(s,this.getValidityType(s,t))}getValidityType(e,a){if(!e)return p.NO_LICENSE;if(e instanceof Error)return p.INVALID_LICENSE;const t=new Date(a.publishedAt),s=new Date(e.end),o=s<new Date,i=e.trial;let n=null;return n=o?s>t?i?p.NON_PRODUCTION_EXPIRED_IN_SCOPE:p.COMMERCIAL_EXPIRED_IN_SCOPE:i?p.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:p.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:i?p.NON_PRODUCTION_VALID:p.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){var t;const s=new Date;s.setHours(0,0,0,0);let l=0;e instanceof Error||!(null==e?void 0:e.end)||(l=Math.floor(((null===(t=null==e?void 0:e.end)||void 0===t?void 0:t.getTime())-s.getTime())/864e5),l=(0,i.default)(l,0,1/0));let d="",p="";!e||e instanceof Error||!e.appName||e.appName==r.GENERIC_APP_NAME||(d=e.appName,p=" for application [APP_NAME]");const E=(e,a=n.LicenseDocsLink,t=c,s=l,o=d)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",o).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(E("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":(0,o.ConsoleLogByMessageType)(E("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":(0,o.ConsoleLogByMessageType)(E("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(E("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":if(l<=10)(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{"development"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV||(0,o.ConsoleLogByMessageType)(E(`Thank you for using a valid AdapTable license${p}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":(0,o.ConsoleLogByMessageType)(E(`This AdapTable license${p} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction((0,t.PopupShowAlert)({alertType:"generic",header:"License Error",message:e,alertDefinition:s.default.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseShowWatermark)(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction((0,a.SystemLicenseDisablePersistence)())}destroy(){}}exports.LicenseService=A;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IQueryLanguageService } from './Interface/IQueryLanguageService';
|
|
1
|
+
import { IQueryLanguageService, ModuleExpressionFunctionsMap } from './Interface/IQueryLanguageService';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
4
4
|
import { RowNode } from '@ag-grid-community/core';
|
|
5
5
|
import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
|
|
6
|
-
import { ModuleExpressionFunctions } from '../../AdaptableOptions/AdaptableQLOptions';
|
|
7
6
|
import { ScalarAggregationParameter } from '../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
8
7
|
import { AdaptableApi } from '../../../types';
|
|
9
8
|
import { BooleanAggregationParameter } from '../ExpressionFunctions/aggregatedBooleanExpressionFunctions';
|
|
@@ -43,7 +42,10 @@ export declare class QueryLanguageService implements IQueryLanguageService {
|
|
|
43
42
|
getNamedQueryNamesFromExpression(input?: string): string[];
|
|
44
43
|
isCumulativeAggregate(input: string): boolean;
|
|
45
44
|
getExpressionWithColumnFriendlyNames(expression?: string): string;
|
|
46
|
-
|
|
45
|
+
getModuleExpressionFunctionsMap(module: AdaptableModule): ModuleExpressionFunctionsMap;
|
|
46
|
+
private getFunctionNames;
|
|
47
|
+
private extractDefaultExpressionFunctions;
|
|
48
|
+
private mapFunctionsDefinitionToMap;
|
|
47
49
|
evaluateCustomQueryVariable(functionName: string, args?: any[]): any;
|
|
48
50
|
private getBooleanAndScalarFunctions;
|
|
49
51
|
private getExpressionCacheKey;
|
|
@@ -5,7 +5,13 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const parser = tslib_1.__importStar(require("../../parser/src"));
|
|
6
6
|
const rxjs_1 = require("rxjs");
|
|
7
7
|
const LoggingHelper_1 = require("../Helpers/LoggingHelper");
|
|
8
|
+
const aggregatedScalarExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedScalarExpressionFunctions");
|
|
9
|
+
const aggregatedBooleanExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedBooleanExpressionFunctions");
|
|
8
10
|
const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
|
|
11
|
+
const booleanExpressionFunctions_1 = require("../ExpressionFunctions/booleanExpressionFunctions");
|
|
12
|
+
const scalarExpressionFunctions_1 = require("../ExpressionFunctions/scalarExpressionFunctions");
|
|
13
|
+
const observableExpressionFunctions_1 = require("../ExpressionFunctions/observableExpressionFunctions");
|
|
14
|
+
const TypeExtensions_1 = require("../Extensions/TypeExtensions");
|
|
9
15
|
class QueryLanguageService {
|
|
10
16
|
constructor(adaptableApi) {
|
|
11
17
|
this.adaptableApi = adaptableApi;
|
|
@@ -16,7 +22,7 @@ class QueryLanguageService {
|
|
|
16
22
|
this.cacheModuleSpecificExpressionFunctions = new Map();
|
|
17
23
|
}
|
|
18
24
|
evaluateBooleanExpression(expression, module, rowNode) {
|
|
19
|
-
const moduleExpressionFunctions = this.
|
|
25
|
+
const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
|
|
20
26
|
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
|
|
21
27
|
return parser.evaluate(expression, {
|
|
22
28
|
node: rowNode,
|
|
@@ -30,7 +36,7 @@ class QueryLanguageService {
|
|
|
30
36
|
return this.evaluateBooleanExpression(expression, module, rowNode);
|
|
31
37
|
}
|
|
32
38
|
evaluateAggregatedScalarExpression(expression, module) {
|
|
33
|
-
const aggregatedScalarFunctions = this.
|
|
39
|
+
const aggregatedScalarFunctions = this.getModuleExpressionFunctionsMap(module).aggregatedScalarFunctions;
|
|
34
40
|
return parser.evaluate(expression, {
|
|
35
41
|
node: null,
|
|
36
42
|
adaptableApi: this.adaptableApi,
|
|
@@ -39,7 +45,7 @@ class QueryLanguageService {
|
|
|
39
45
|
});
|
|
40
46
|
}
|
|
41
47
|
evaluateObservableExpression(reactiveExpression, module) {
|
|
42
|
-
const moduleExpressionFunctions = this.
|
|
48
|
+
const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
|
|
43
49
|
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
|
|
44
50
|
const reactiveExpression$ = parser.evaluate(reactiveExpression, {
|
|
45
51
|
node: reactiveExpression,
|
|
@@ -51,12 +57,12 @@ class QueryLanguageService {
|
|
|
51
57
|
return reactiveExpression$;
|
|
52
58
|
}
|
|
53
59
|
evaluateAggregatedBooleanExpression(aggregationExpression, module) {
|
|
54
|
-
const
|
|
55
|
-
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(
|
|
60
|
+
const moduleExpressionFunctionsMap = this.getModuleExpressionFunctionsMap(module);
|
|
61
|
+
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctionsMap);
|
|
56
62
|
const aggregationEvaluation = parser.evaluate(aggregationExpression, {
|
|
57
63
|
node: aggregationExpression,
|
|
58
64
|
adaptableApi: this.adaptableApi,
|
|
59
|
-
functions:
|
|
65
|
+
functions: moduleExpressionFunctionsMap.aggregatedBooleanFunctions,
|
|
60
66
|
whereClauseFunctions: booleanAndScalarFunctions,
|
|
61
67
|
evaluateCustomQueryVariable: this.evaluateCustomQueryVariable,
|
|
62
68
|
});
|
|
@@ -89,7 +95,7 @@ class QueryLanguageService {
|
|
|
89
95
|
}
|
|
90
96
|
const { ast } = parser.parse(expression.trim());
|
|
91
97
|
const rootFn = ast[ast.length - 1];
|
|
92
|
-
const moduleExpressionFunctions = this.
|
|
98
|
+
const moduleExpressionFunctions = this.getModuleExpressionFunctionsMap(module);
|
|
93
99
|
const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
|
|
94
100
|
if (rootFn.type === undefined || booleanAndScalarFunctions[rootFn.type] === undefined) {
|
|
95
101
|
const result = {
|
|
@@ -268,43 +274,90 @@ class QueryLanguageService {
|
|
|
268
274
|
}
|
|
269
275
|
// Returns the ExpressionFunctions available for the given Module as specified in the `QueryLanguageOptions.moduleExpressionFunctions`
|
|
270
276
|
// if there are no specific functions defined, it falls back to the default values
|
|
271
|
-
|
|
272
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
277
|
+
getModuleExpressionFunctionsMap(module) {
|
|
278
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
279
|
+
const expressionOptions = this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions;
|
|
280
|
+
if (module) {
|
|
281
|
+
let cachedResult = this.cacheModuleSpecificExpressionFunctions.get(module);
|
|
282
|
+
if (cachedResult) {
|
|
283
|
+
return cachedResult;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const defaultBooleanExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultBooleanFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions);
|
|
287
|
+
const defaultScalarExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultScalarFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions);
|
|
288
|
+
const defaultObservableExpressionFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultObservableFunctions, observableExpressionFunctions_1.observableExpressionFunctions);
|
|
289
|
+
const defaultAggregatedBooleanFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions);
|
|
290
|
+
const defaultAggregatedScalarFunctions = this.extractDefaultExpressionFunctions(expressionOptions.defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions);
|
|
273
291
|
if (!module) {
|
|
274
292
|
(0, LoggingHelper_1.LogAdaptableInfo)(`QueryLanguageService.getModuleExpressionFunctions() was called with an undefined 'module' param, this should never happen`);
|
|
275
293
|
return {
|
|
276
|
-
booleanFunctions: this.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
booleanFunctions: this.mapFunctionsDefinitionToMap(defaultBooleanExpressionFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions),
|
|
295
|
+
scalarFunctions: this.mapFunctionsDefinitionToMap(defaultScalarExpressionFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions),
|
|
296
|
+
observableFunctions: this.mapFunctionsDefinitionToMap(defaultObservableExpressionFunctions, observableExpressionFunctions_1.observableExpressionFunctions),
|
|
297
|
+
aggregatedBooleanFunctions: this.mapFunctionsDefinitionToMap(defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions),
|
|
298
|
+
aggregatedScalarFunctions: this.mapFunctionsDefinitionToMap(defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
let moduleExpressionFunctions;
|
|
302
|
+
if (typeof expressionOptions.moduleExpressionFunctions === 'function') {
|
|
303
|
+
const context = {
|
|
304
|
+
adaptableApi: this.adaptableApi,
|
|
305
|
+
module,
|
|
306
|
+
defaultBooleanFunctionNames: this.getFunctionNames(defaultBooleanExpressionFunctions),
|
|
307
|
+
defaultScalarFunctionNames: this.getFunctionNames(defaultScalarExpressionFunctions),
|
|
308
|
+
defaultObservableFunctionNames: this.getFunctionNames(defaultObservableExpressionFunctions),
|
|
309
|
+
defaultAggregatedBooleanFunctionNames: this.getFunctionNames(defaultAggregatedBooleanFunctions),
|
|
310
|
+
defaultAggregatedScalarFunctionNames: this.getFunctionNames(defaultAggregatedScalarFunctions),
|
|
286
311
|
};
|
|
312
|
+
moduleExpressionFunctions = (_a = expressionOptions.moduleExpressionFunctions(context)) !== null && _a !== void 0 ? _a : {};
|
|
287
313
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return cachedResult;
|
|
314
|
+
else {
|
|
315
|
+
moduleExpressionFunctions = (_c = (_b = expressionOptions.moduleExpressionFunctions) === null || _b === void 0 ? void 0 : _b[module]) !== null && _c !== void 0 ? _c : {};
|
|
291
316
|
}
|
|
292
|
-
const
|
|
293
|
-
.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
.defaultScalarFunctions,
|
|
299
|
-
observableFunctions: (_e = moduleSpecificOptions.observableFunctions) !== null && _e !== void 0 ? _e : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
|
|
300
|
-
.defaultObservableFunctions,
|
|
301
|
-
aggregatedBooleanFunctions: (_f = moduleSpecificOptions.aggregatedBooleanFunctions) !== null && _f !== void 0 ? _f : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
|
|
302
|
-
.defaultAggregatedBooleanFunctions,
|
|
303
|
-
aggregatedScalarFunctions: (_g = moduleSpecificOptions.aggregatedScalarFunctions) !== null && _g !== void 0 ? _g : this.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
|
|
304
|
-
.defaultAggregatedScalarFunctions,
|
|
317
|
+
const moduleExpressionFunctionsMap = {
|
|
318
|
+
booleanFunctions: this.mapFunctionsDefinitionToMap((_d = moduleExpressionFunctions.booleanFunctions) !== null && _d !== void 0 ? _d : defaultBooleanExpressionFunctions, booleanExpressionFunctions_1.booleanExpressionFunctions),
|
|
319
|
+
scalarFunctions: this.mapFunctionsDefinitionToMap((_e = moduleExpressionFunctions.scalarFunctions) !== null && _e !== void 0 ? _e : defaultScalarExpressionFunctions, scalarExpressionFunctions_1.scalarExpressionFunctions),
|
|
320
|
+
observableFunctions: this.mapFunctionsDefinitionToMap((_f = moduleExpressionFunctions.observableFunctions) !== null && _f !== void 0 ? _f : defaultObservableExpressionFunctions, observableExpressionFunctions_1.observableExpressionFunctions),
|
|
321
|
+
aggregatedBooleanFunctions: this.mapFunctionsDefinitionToMap((_g = moduleExpressionFunctions.aggregatedBooleanFunctions) !== null && _g !== void 0 ? _g : defaultAggregatedBooleanFunctions, aggregatedBooleanExpressionFunctions_1.aggregatedBooleanExpressionFunctions),
|
|
322
|
+
aggregatedScalarFunctions: this.mapFunctionsDefinitionToMap((_h = moduleExpressionFunctions.aggregatedScalarFunctions) !== null && _h !== void 0 ? _h : defaultAggregatedScalarFunctions, aggregatedScalarExpressionFunctions_1.aggregatedScalarExpressionFunctions),
|
|
305
323
|
};
|
|
306
|
-
this.cacheModuleSpecificExpressionFunctions.set(module,
|
|
307
|
-
return
|
|
324
|
+
this.cacheModuleSpecificExpressionFunctions.set(module, moduleExpressionFunctionsMap);
|
|
325
|
+
return moduleExpressionFunctionsMap;
|
|
326
|
+
}
|
|
327
|
+
getFunctionNames(definitions) {
|
|
328
|
+
return definitions.flatMap((definition) => {
|
|
329
|
+
if (typeof definition === 'string') {
|
|
330
|
+
return definition;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
return (0, TypeExtensions_1.getTypedKeys)(definition);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
extractDefaultExpressionFunctions(defaultOptions, availableExpressionFunctions) {
|
|
338
|
+
if (typeof defaultOptions === 'function') {
|
|
339
|
+
const context = {
|
|
340
|
+
adaptableApi: this.adaptableApi,
|
|
341
|
+
availableExpressionFunctionNames: (0, TypeExtensions_1.getTypedKeys)(availableExpressionFunctions),
|
|
342
|
+
};
|
|
343
|
+
return defaultOptions(context);
|
|
344
|
+
}
|
|
345
|
+
return defaultOptions;
|
|
346
|
+
}
|
|
347
|
+
mapFunctionsDefinitionToMap(functionsDefinition, internalExpressionFunctions) {
|
|
348
|
+
let resultMap = {};
|
|
349
|
+
functionsDefinition.forEach((definition) => {
|
|
350
|
+
if (typeof definition === 'string') {
|
|
351
|
+
const internalFunction = internalExpressionFunctions[definition];
|
|
352
|
+
if (internalFunction) {
|
|
353
|
+
resultMap[definition] = internalFunction;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
resultMap = Object.assign(Object.assign({}, resultMap), definition);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
return resultMap;
|
|
308
361
|
}
|
|
309
362
|
evaluateCustomQueryVariable(functionName, args) {
|
|
310
363
|
var _a, _b, _c;
|
|
@@ -317,8 +370,8 @@ class QueryLanguageService {
|
|
|
317
370
|
? customQueryVariableDefinition(context)
|
|
318
371
|
: customQueryVariableDefinition;
|
|
319
372
|
}
|
|
320
|
-
getBooleanAndScalarFunctions(
|
|
321
|
-
return Object.assign(Object.assign({},
|
|
373
|
+
getBooleanAndScalarFunctions(moduleExpressionFunctionsMap) {
|
|
374
|
+
return Object.assign(Object.assign({}, moduleExpressionFunctionsMap.booleanFunctions), moduleExpressionFunctionsMap.scalarFunctions);
|
|
322
375
|
}
|
|
323
376
|
getExpressionCacheKey(expression, module) {
|
|
324
377
|
return `${module}::${expression}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode=exports.fieldsToLicenseDetails=exports.GENERIC_APP_NAME=void 0;const e=require("./hashing"),t=()=>new Error("Invalid License");exports.GENERIC_APP_NAME="GenericAdaptableApp";const r=e=>{var r;const s=e.reduce(((e,t)=>(e.set(t.name,t.value),e)),new Map),o={start:new Date(s.get("StartDate")),end:new Date(s.get("EndDate")),owner:s.get("Owner"),appName:s.get("AppName")||exports.GENERIC_APP_NAME,timestamp:s.get("TS")?Number(s.get("TS")):0,trial:"true"===s.get("Trial"),ref:null!==(r=s.get("Ref"))&&void 0!==r?r:""};if(!(o.start&&o.end&&o.owner&&"boolean"==typeof o.trial&&o.ref))throw t();return o};exports.fieldsToLicenseDetails=r;const s=r=>{let s="",o=r.split("|").map((e=>{let[t,r]=e.split("=");return"C"===t&&(s=r),{name:t,value:r}}));if(!s)throw t();const a=s.split(",").reverse(),n=a.pop();a.forEach(((r,s)=>{const a=o[s];if((0,e.compute_string)(a.value)!==r)throw t()}));const i=[...o];i.pop();const p=i.map((e=>`${e.name}=${e.value}`)).join("|");if((0,e.compute_string)(p)!==n)throw t();return o=o.map((e=>Object.assign(Object.assign({},e),{value:decodeURI(e.value)}))),(0,exports.fieldsToLicenseDetails)(o)};exports.decode=s;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoveFormatColumn = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
7
|
+
const FormatColumnRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/FormatColumnRedux"));
|
|
8
|
+
const react_redux_1 = require("react-redux");
|
|
9
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
10
|
+
const MoveFormatColumn = (props) => {
|
|
11
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
12
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
13
|
+
const formatColumn = adaptable.api.formatColumnApi.getAllFormatColumn();
|
|
14
|
+
const handleMoveUp = React.useCallback(() => {
|
|
15
|
+
dispatch(FormatColumnRedux.FormatColumnMoveUp(props.data));
|
|
16
|
+
}, []);
|
|
17
|
+
const handleMoveDown = React.useCallback(() => {
|
|
18
|
+
dispatch(FormatColumnRedux.FormatColumnMoveDown(props.data));
|
|
19
|
+
}, []);
|
|
20
|
+
if ((formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.length) <= 1) {
|
|
21
|
+
return React.createElement(React.Fragment, null);
|
|
22
|
+
}
|
|
23
|
+
return (React.createElement(React.Fragment, null,
|
|
24
|
+
React.createElement(SimpleButton_1.default, { "data-id": "move-up", title: "move up", onClick: handleMoveUp, variant: "text", icon: "arrow-up" }),
|
|
25
|
+
React.createElement(SimpleButton_1.default, { "data-name": "move-down", title: "move down", onClick: handleMoveDown, variant: "text", icon: "arrow-down" })));
|
|
26
|
+
};
|
|
27
|
+
exports.MoveFormatColumn = MoveFormatColumn;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormatColumn } from '../../../../types';
|
|
3
|
+
declare type FormatColumnRuleWizardSectionProps = {
|
|
4
|
+
onChange: (data: FormatColumn) => void;
|
|
5
|
+
defaultPredicateId: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function renderFormatColumnRuleSummary(data: FormatColumn): JSX.Element;
|
|
8
|
+
export declare function FormatColumnRuleWizardSection(props: FormatColumnRuleWizardSectionProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatColumnRuleWizardSection = exports.renderFormatColumnRuleSummary = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
8
|
+
const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
|
|
9
|
+
const CodeBlock_1 = require("../../../components/CodeBlock");
|
|
10
|
+
const CheckBox_1 = require("../../../components/CheckBox");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
function renderFormatColumnRuleSummary(data) {
|
|
13
|
+
return (React.createElement(EntityRulesEditor_1.EntityRulesSummary, { data: data, renderPredicate: (contents) => {
|
|
14
|
+
return (React.createElement(React.Fragment, null,
|
|
15
|
+
"Apply Format Column on ",
|
|
16
|
+
React.createElement(CodeBlock_1.CodeBlock, null, contents)));
|
|
17
|
+
}, renderQueryExpression: (contents) => {
|
|
18
|
+
return (React.createElement(React.Fragment, null,
|
|
19
|
+
"Apply Format Column when",
|
|
20
|
+
' ',
|
|
21
|
+
React.createElement("b", null,
|
|
22
|
+
React.createElement(CodeBlock_1.CodeBlock, null, contents))));
|
|
23
|
+
} }));
|
|
24
|
+
}
|
|
25
|
+
exports.renderFormatColumnRuleSummary = renderFormatColumnRuleSummary;
|
|
26
|
+
function FormatColumnRuleWizardSection(props) {
|
|
27
|
+
const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
28
|
+
const hasRule = Boolean(data.Rule);
|
|
29
|
+
const handleRuleToggle = React.useCallback(() => {
|
|
30
|
+
const newFormatColumn = Object.assign({}, data);
|
|
31
|
+
if (hasRule) {
|
|
32
|
+
delete newFormatColumn.Rule;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
newFormatColumn.Rule = {
|
|
36
|
+
Predicate: {
|
|
37
|
+
PredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
props.onChange(newFormatColumn);
|
|
42
|
+
}, [data.Rule]);
|
|
43
|
+
const hasIncompatibleStyle = Boolean(data.ColumnStyle);
|
|
44
|
+
return (React.createElement(rebass_1.Box, null,
|
|
45
|
+
React.createElement(rebass_1.Box, { p: 2, mb: 1 },
|
|
46
|
+
React.createElement(CheckBox_1.CheckBox, { disabled: hasIncompatibleStyle, checked: hasRule, onClick: handleRuleToggle }, "Enable Condition"),
|
|
47
|
+
hasIncompatibleStyle && (React.createElement(rebass_1.Text, { ml: 1 }, "Condition is only available for Standard Style."))),
|
|
48
|
+
hasRule && (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId,
|
|
49
|
+
// TODO see what is this
|
|
50
|
+
predicateDefs: api.formatColumnApi.getFormatColumnDefsForScope(data.Scope), showAggregation: false, showObservable: false, showPredicate: !api.scopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {
|
|
51
|
+
selectPredicate: 'Select a Format Column Rule - to be applied when data changes',
|
|
52
|
+
useBooleanQuery: (React.createElement(React.Fragment, null,
|
|
53
|
+
"Use an BooleanQuery if ",
|
|
54
|
+
React.createElement("i", null, "Scope"),
|
|
55
|
+
" is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
|
|
56
|
+
useObservableQuery: (React.createElement(React.Fragment, null,
|
|
57
|
+
"Use an ObservableQuery if ",
|
|
58
|
+
React.createElement("i", null, "Scope"),
|
|
59
|
+
" is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
|
|
60
|
+
useAggregationQuery: (React.createElement(React.Fragment, null,
|
|
61
|
+
"Use an AggregatedBooleanQuery if ",
|
|
62
|
+
React.createElement("i", null, "Scope"),
|
|
63
|
+
" is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
|
|
64
|
+
} }))));
|
|
65
|
+
}
|
|
66
|
+
exports.FormatColumnRuleWizardSection = FormatColumnRuleWizardSection;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
|
|
7
7
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
8
9
|
const renderFormatColumnScopeSummary = (data) => {
|
|
9
10
|
return (0, NewScopeComponent_1.renderScopeSummary)(data.Scope, {
|
|
10
11
|
scopeWholeRow: 'Matching rows will be formatted',
|
|
@@ -14,12 +15,29 @@ const renderFormatColumnScopeSummary = (data) => {
|
|
|
14
15
|
};
|
|
15
16
|
exports.renderFormatColumnScopeSummary = renderFormatColumnScopeSummary;
|
|
16
17
|
const FormatColumnScopeWizardSection = (props) => {
|
|
17
|
-
const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
18
|
+
const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
|
|
18
19
|
return (React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
|
|
19
20
|
rowScope: 'Apply a style to an entire row',
|
|
20
21
|
columnScope: 'Select columns to format',
|
|
21
22
|
}, scope: data.Scope, updateScope: (Scope) => {
|
|
22
|
-
|
|
23
|
+
var _a;
|
|
24
|
+
const newData = Object.assign(Object.assign({}, data), { Scope });
|
|
25
|
+
const wholeRow = api.scopeApi.scopeIsAll(Scope);
|
|
26
|
+
if ((_a = newData.Rule) === null || _a === void 0 ? void 0 : _a.Predicate) {
|
|
27
|
+
if (wholeRow) {
|
|
28
|
+
// if scope is whole row, a predicate cannot be present, so we set the rule
|
|
29
|
+
// to be a boolean expression
|
|
30
|
+
delete newData.Rule.Predicate;
|
|
31
|
+
newData.Rule.BooleanExpression = '';
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// if scope is not whole row, if you have a predicate, reset it
|
|
35
|
+
newData.Rule.Predicate = {
|
|
36
|
+
PredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
props.onChange(newData);
|
|
23
41
|
} }));
|
|
24
42
|
};
|
|
25
43
|
exports.FormatColumnScopeWizardSection = FormatColumnScopeWizardSection;
|
|
@@ -278,6 +278,7 @@ function FormatColumnStyleWizardSection(props) {
|
|
|
278
278
|
props.onChange(newData);
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
+
const onlyStandardStyleAvailable = Boolean(data.Rule);
|
|
281
282
|
return (React.createElement(React.Fragment, null,
|
|
282
283
|
onlyBooleanColumnsInScope && (React.createElement(Tabs_1.Tabs, null,
|
|
283
284
|
React.createElement(Tabs_1.Tabs.Tab, null, "CheckBox Column"),
|
|
@@ -293,7 +294,7 @@ function FormatColumnStyleWizardSection(props) {
|
|
|
293
294
|
}
|
|
294
295
|
props.onChange(formatColumn);
|
|
295
296
|
} }, "Display Column As CheckBox")))),
|
|
296
|
-
singleNumericColumn ? (React.createElement(React.Fragment, null,
|
|
297
|
+
singleNumericColumn && !onlyStandardStyleAvailable ? (React.createElement(React.Fragment, null,
|
|
297
298
|
React.createElement(Tabs_1.Tabs, null,
|
|
298
299
|
React.createElement(Tabs_1.Tabs.Tab, null, "Create a Format Column Style"),
|
|
299
300
|
React.createElement(Tabs_1.Tabs.Content, null,
|
|
@@ -17,6 +17,9 @@ const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/Obje
|
|
|
17
17
|
const react_redux_1 = require("react-redux");
|
|
18
18
|
const FormatColumnRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/FormatColumnRedux"));
|
|
19
19
|
const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
|
|
20
|
+
const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
|
|
21
|
+
const FormatColumnRuleWizardSection_1 = require("./FormatColumnRuleWizardSection");
|
|
22
|
+
const constants_1 = require("./constants");
|
|
20
23
|
const adjustDisplayFormat = (formatColumn, api) => {
|
|
21
24
|
formatColumn = Object.assign({}, formatColumn);
|
|
22
25
|
const formatDataType = (0, FormatColumnFormatWizardSection_1.getFormatDisplayTypeForScope)(formatColumn.Scope, api);
|
|
@@ -113,6 +116,17 @@ function FormatColumnWizard(props) {
|
|
|
113
116
|
React.createElement(FormatColumnScopeWizardSection_1.FormatColumnScopeWizardSection, { onChange: setFormatColumn })));
|
|
114
117
|
},
|
|
115
118
|
},
|
|
119
|
+
{
|
|
120
|
+
isValid: (abObject, api, context) => {
|
|
121
|
+
return abObject.Rule ? (0, EntityRulesEditor_1.isRuleValid)(abObject, api, context) : true;
|
|
122
|
+
},
|
|
123
|
+
title: 'Condition',
|
|
124
|
+
details: 'Build the rules when Format column should be applied',
|
|
125
|
+
render: () => {
|
|
126
|
+
return (React.createElement(rebass_1.Box, { p: 2 },
|
|
127
|
+
React.createElement(FormatColumnRuleWizardSection_1.FormatColumnRuleWizardSection, { onChange: setFormatColumn, defaultPredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN })));
|
|
128
|
+
},
|
|
129
|
+
},
|
|
116
130
|
{
|
|
117
131
|
title: 'Style',
|
|
118
132
|
details: 'Format Column Style',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN = "NonBlanks";
|