@adaptabletools/adaptable 18.0.12 → 18.1.0-canary.0
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 +4 -3
- package/agGrid.js +4 -3
- package/base.css +7 -2
- package/base.css.map +1 -1
- package/index.css +11 -2
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +27 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
- package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
- package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
- package/src/Api/ColumnApi.d.ts +1 -1
- package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
- package/src/Api/ExpressionApi.d.ts +2 -2
- package/src/Api/Fdc3Api.d.ts +14 -19
- package/src/Api/Implementation/ConfigApiImpl.js +3 -0
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
- package/src/Api/Implementation/Fdc3ApiImpl.js +36 -12
- package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
- package/src/Api/Internal/AlertInternalApi.js +196 -25
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
- package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
- package/src/Api/Internal/ExportInternalApi.js +31 -17
- package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
- package/src/Api/Internal/ExpressionInternalApi.js +79 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +6 -10
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +1 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +18 -1
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
- package/src/PredefinedConfig/Common/Fdc3Context.js +43 -31
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
- package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
- package/src/Strategy/AdaptableModuleBase.js +1 -3
- package/src/Strategy/AlertModule.d.ts +1 -1
- package/src/Strategy/AlertModule.js +8 -8
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/Fdc3Service.js +2 -2
- package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
- package/src/Utilities/Services/QueryLanguageService.js +105 -6
- package/src/Utilities/Services/ReportService.js +8 -5
- package/src/Utilities/Services/RowSummaryService.js +3 -1
- package/src/Utilities/divideBy100.d.ts +1 -0
- package/src/Utilities/divideBy100.js +30 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +23 -0
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
- package/src/View/Components/EntityRulesEditor/index.js +11 -7
- package/src/View/Components/ExpressionWizard.js +1 -1
- package/src/View/Components/FilterForm/QuickFilterValues.js +28 -4
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
- package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
- package/src/View/Components/Selectors/FieldSelector.js +21 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.js +8 -4
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
- package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -2
- package/src/agGrid/AdaptableAgGrid.js +64 -33
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +22 -0
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
- package/src/agGrid/editors/AdaptableDateEditor/index.js +5 -18
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +5 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
- package/src/components/Accordion.js +1 -1
- package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
- package/src/components/Datepicker/index.js +3 -4
- package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
- package/src/components/ExpressionEditor/DataTableEditor.js +63 -0
- package/src/components/ExpressionEditor/EditorInput.js +22 -9
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +71 -13
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +66 -91
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +7 -4
- package/src/components/OverlayTrigger/index.js +10 -6
- package/src/components/icons/column-outline.d.ts +3 -0
- package/src/components/icons/column-outline.js +4 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +4 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +78 -200
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +11 -2
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
- package/src/parser/src/types.d.ts +101 -1
- package/src/types.d.ts +9 -7
- package/tsconfig.esm.tsbuildinfo +1 -1
package/src/Api/ColumnApi.d.ts
CHANGED
|
@@ -292,7 +292,7 @@ export interface ColumnApi {
|
|
|
292
292
|
setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
|
-
* Column
|
|
295
|
+
* Configuration of an AG Grid Column, used for runtime updating of ColDefs
|
|
296
296
|
*/
|
|
297
297
|
export interface ColumnConfig {
|
|
298
298
|
/** Column Id */
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { BaseEventInfo } from './BaseEventInfo';
|
|
2
|
-
import {
|
|
3
|
-
import { Fdc3IntentType } from '../../PredefinedConfig/Common/Fdc3Intent';
|
|
4
|
-
import { AppIdentifier, ContextMetadata } from '@finos/fdc3';
|
|
2
|
+
import { AppIdentifier, Context, ContextMetadata, Intent } from '@finos/fdc3';
|
|
5
3
|
/**
|
|
6
4
|
* EventInfo returned by FDC3 Message events
|
|
7
5
|
*/
|
|
@@ -21,11 +19,11 @@ export interface Fdc3MessageSentInfo extends BaseEventInfo {
|
|
|
21
19
|
/**
|
|
22
20
|
* FDC3 Intent which caused Event to fire (if type is `RaiseIntent`)
|
|
23
21
|
*/
|
|
24
|
-
intent?:
|
|
22
|
+
intent?: Intent;
|
|
25
23
|
/**
|
|
26
24
|
* Full FDC3 Context for object related to the Event
|
|
27
25
|
*/
|
|
28
|
-
context:
|
|
26
|
+
context: Context;
|
|
29
27
|
/**
|
|
30
28
|
* Target application for the message
|
|
31
29
|
*/
|
|
@@ -46,11 +44,11 @@ export interface Fdc3MessageReceivedInfo extends BaseEventInfo {
|
|
|
46
44
|
/**
|
|
47
45
|
* FDC3 Intent which caused Event to fire (if type is `IntentRaised`)
|
|
48
46
|
*/
|
|
49
|
-
intent?:
|
|
47
|
+
intent?: Intent;
|
|
50
48
|
/**
|
|
51
49
|
* Full FDC3 Context for object related to the Event
|
|
52
50
|
*/
|
|
53
|
-
context:
|
|
51
|
+
context: Context;
|
|
54
52
|
/**
|
|
55
53
|
* Metadata associated with the FDC3 Context
|
|
56
54
|
*/
|
|
@@ -48,12 +48,12 @@ export interface ExpressionApi {
|
|
|
48
48
|
*/
|
|
49
49
|
getASTForExpression(expression: string): any;
|
|
50
50
|
/**
|
|
51
|
-
* Returns
|
|
51
|
+
* Returns Expression string of given AdaptableQuery: can be Boolean, AggregatedBoolean, Scalar, AggregatedScalar or Observable
|
|
52
52
|
* @param query - the AdaptableQuery
|
|
53
53
|
*/
|
|
54
54
|
getAdaptableQueryExpression(query: Partial<AdaptableQuery>): string | undefined;
|
|
55
55
|
/**
|
|
56
|
-
* Returns
|
|
56
|
+
* Returns Expression string of given AdaptableQuery with column friendly names (instead of Column IDs)
|
|
57
57
|
* @param query - the AdaptableQuery
|
|
58
58
|
*/
|
|
59
59
|
getAdaptableQueryExpressionWithColumnFriendlyNames(query: Partial<AdaptableQuery>): string | undefined;
|
package/src/Api/Fdc3Api.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Fdc3Context, Fdc3ContextType, Fdc3StandardContextType } from '../PredefinedConfig/Common/Fdc3Context';
|
|
2
1
|
import { IRowNode } from '@ag-grid-community/core';
|
|
3
|
-
import { AppIdentifier, DesktopAgent, IntentResolution } from '@finos/fdc3';
|
|
4
|
-
import { Fdc3IntentType, Fdc3StandardIntentType } from '../PredefinedConfig/Common/Fdc3Intent';
|
|
2
|
+
import { AppIdentifier, Context, ContextType, DesktopAgent, Intent, IntentResolution } from '@finos/fdc3';
|
|
5
3
|
/**
|
|
6
4
|
* Provides run-time access to AdapTable's FDC3 functionality
|
|
7
5
|
*/
|
|
@@ -14,30 +12,27 @@ export interface Fdc3Api {
|
|
|
14
12
|
* Returns the human-friendly label for the given Context Type
|
|
15
13
|
* @param contextType - The FDC3 Context Type
|
|
16
14
|
*/
|
|
17
|
-
getContextLabel(contextType:
|
|
15
|
+
getContextLabel(contextType: ContextType): string;
|
|
18
16
|
/**
|
|
19
17
|
* Builds FDC3 Context Data based on the given Context Type and Row Node
|
|
20
18
|
* @param contextType - The FDC3 Context Type
|
|
21
19
|
* @param rowNode - The Row Node
|
|
22
20
|
*/
|
|
23
|
-
buildContextDataFromRow(contextType:
|
|
21
|
+
buildContextDataFromRow(contextType: ContextType, rowNode: IRowNode): Context;
|
|
24
22
|
/**
|
|
25
23
|
* Builds FDC3 Context Data based on the given Context Type and the Row Node with the given Primary Key Value
|
|
26
24
|
* @param contextType - The FDC3 Context Type
|
|
27
25
|
* @param primaryKeyValue - The Primary Key Value
|
|
28
26
|
*/
|
|
29
|
-
buildContextDataForPrimaryKey(contextType:
|
|
27
|
+
buildContextDataForPrimaryKey(contextType: ContextType, primaryKeyValue: string | number): Context | undefined;
|
|
30
28
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param intent - The FDC3 Intent
|
|
29
|
+
* @deprecated no longer relevant as of FDC3 v2.1
|
|
33
30
|
*/
|
|
34
|
-
getPossibleContextTypes(intent:
|
|
31
|
+
getPossibleContextTypes(intent: Intent): ContextType[];
|
|
35
32
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param contextType - The FDC3 Context Type
|
|
38
|
-
* @param intent - The FDC3 Intent
|
|
33
|
+
* @deprecated no longer relevant as of FDC3 v2.1
|
|
39
34
|
*/
|
|
40
|
-
isContextCompatibleWithIntent(contextType:
|
|
35
|
+
isContextCompatibleWithIntent(contextType: ContextType, intent: Intent): boolean;
|
|
41
36
|
/**
|
|
42
37
|
* Raises an Intent with the given Context from the given Row Node
|
|
43
38
|
* @param rowNode - The Row Node
|
|
@@ -45,7 +40,7 @@ export interface Fdc3Api {
|
|
|
45
40
|
* @param contextType - The FDC3 Context Type
|
|
46
41
|
* @param appIdentifier - The App Identifier
|
|
47
42
|
*/
|
|
48
|
-
raiseIntentFromRow(rowNode: IRowNode, intent:
|
|
43
|
+
raiseIntentFromRow(rowNode: IRowNode, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
49
44
|
/**
|
|
50
45
|
* Raises an Intent with the given Context from the given Row Node with the given Primary Key Value
|
|
51
46
|
* @param primaryKeyValue - The Primary Key Value
|
|
@@ -53,33 +48,33 @@ export interface Fdc3Api {
|
|
|
53
48
|
* @param contextType - The FDC3 Context Type
|
|
54
49
|
* @param appIdentifier - The App Identifier
|
|
55
50
|
*/
|
|
56
|
-
raiseIntentFromPrimaryKey(primaryKeyValue: string | number, intent:
|
|
51
|
+
raiseIntentFromPrimaryKey(primaryKeyValue: string | number, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
|
|
57
52
|
/**
|
|
58
53
|
* Finds and raises an Intent based on the given Context from the given Row Node
|
|
59
54
|
* @param rowNode - The Row Node
|
|
60
55
|
* @param contextType - The FDC3 Context Type
|
|
61
56
|
* @param appIdentifier - The App Identifier
|
|
62
57
|
*/
|
|
63
|
-
raiseIntentForContextFromRow(rowNode: IRowNode, contextType:
|
|
58
|
+
raiseIntentForContextFromRow(rowNode: IRowNode, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
64
59
|
/**
|
|
65
60
|
* Finds and raises an Intent based on the given Context from the given Row Node with the given Primary Key Value
|
|
66
61
|
* @param primaryKeyValue - The Primary Key Value
|
|
67
62
|
* @param contextType - The FDC3 Context Type
|
|
68
63
|
* @param appIdentifier - The App Identifier
|
|
69
64
|
*/
|
|
70
|
-
raiseIntentForContextFromPrimaryKey(primaryKeyValue: string | number, contextType:
|
|
65
|
+
raiseIntentForContextFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
|
|
71
66
|
/**
|
|
72
67
|
* Broadcasts the given Context from the given Row Node
|
|
73
68
|
* @param rowNode - The Row Node
|
|
74
69
|
* @param contextType - The FDC3 Context Type
|
|
75
70
|
*/
|
|
76
|
-
broadcastFromRow(rowNode: IRowNode, contextType:
|
|
71
|
+
broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
|
|
77
72
|
/**
|
|
78
73
|
* Broadcasts the given Context from the given Row Node with the given Primary Key Value
|
|
79
74
|
* @param primaryKeyValue - The Primary Key Value
|
|
80
75
|
* @param contextType - The FDC3 Context Type
|
|
81
76
|
*/
|
|
82
|
-
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType:
|
|
77
|
+
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
|
|
83
78
|
/**
|
|
84
79
|
* Checks if the given Context Type is a FDC3 standard Context Type
|
|
85
80
|
*/
|
|
@@ -45,6 +45,9 @@ export class ConfigApiImpl extends ApiBase {
|
|
|
45
45
|
var _a;
|
|
46
46
|
const adaptableOptions = this.adaptable.adaptableOptions;
|
|
47
47
|
const oldState = this.getPersistedState();
|
|
48
|
+
// clearing filters so that AG Grid doesnt display the filter icon in a column header after grid reloads
|
|
49
|
+
// but this is a hack so would be nicer if there was a better way to do this
|
|
50
|
+
this.getAdaptableApi().gridApi.clearGridFiltering();
|
|
48
51
|
const clearStateFn = ((_a = adaptableOptions.stateOptions) === null || _a === void 0 ? void 0 : _a.clearState) ||
|
|
49
52
|
(() => {
|
|
50
53
|
localStorage.removeItem(adaptableOptions.adaptableStateKey);
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { IRowNode } from '@ag-grid-community/core';
|
|
2
|
-
import { DesktopAgent, IntentResolution } from '@finos/fdc3';
|
|
2
|
+
import { Context, ContextType, DesktopAgent, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
|
|
3
3
|
import { ApiBase } from './ApiBase';
|
|
4
4
|
import { Fdc3Api } from '../Fdc3Api';
|
|
5
5
|
import { Fdc3InternalApi } from '../Internal/Fdc3InternalApi';
|
|
6
6
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
7
|
-
import { Fdc3Context, Fdc3StandardContextType } from '../../PredefinedConfig/Common/Fdc3Context';
|
|
8
|
-
import { Fdc3StandardIntentType } from '../../PredefinedConfig/Common/Fdc3Intent';
|
|
9
7
|
import { AppIdentifier } from '@finos/fdc3/dist/api/AppIdentifier';
|
|
10
8
|
export declare class Fdc3ApiImpl extends ApiBase implements Fdc3Api {
|
|
11
9
|
internalApi: Fdc3InternalApi;
|
|
12
10
|
constructor(adaptable: IAdaptable);
|
|
13
11
|
getDesktopAgent(): DesktopAgent;
|
|
14
|
-
buildContextDataFromRow(contextType:
|
|
15
|
-
buildContextDataForPrimaryKey(contextType:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
isStandardContextType(contextType: string): boolean;
|
|
26
|
-
isStandardIntentType(intentType: string): boolean;
|
|
12
|
+
buildContextDataFromRow(contextType: ContextType, rowNode: IRowNode): Context;
|
|
13
|
+
buildContextDataForPrimaryKey(contextType: ContextType, primaryKeyValue: string | number): Context | undefined;
|
|
14
|
+
raiseIntentFromPrimaryKey(primaryKeyValue: string | number, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
|
|
15
|
+
raiseIntentFromRow(rowNode: IRowNode, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
16
|
+
raiseIntentForContextFromRow(rowNode: IRowNode, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
|
|
17
|
+
raiseIntentForContextFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
|
|
18
|
+
broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
|
|
19
|
+
broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
|
|
20
|
+
getContextLabel(contextType: ContextType): string;
|
|
21
|
+
isStandardContextType(contextType: string): contextType is StandardContextType;
|
|
22
|
+
isStandardIntentType(intentType: string): intentType is StandardIntent;
|
|
27
23
|
private getFdc3Service;
|
|
24
|
+
getPossibleContextTypes(intent: Intent): ContextType[];
|
|
25
|
+
isContextCompatibleWithIntent(contextType: ContextType, intent: Intent): boolean;
|
|
28
26
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ApiBase } from './ApiBase';
|
|
2
2
|
import { Fdc3InternalApi } from '../Internal/Fdc3InternalApi';
|
|
3
|
-
import { ContextConfiguration
|
|
4
|
-
import { Fdc3IntentConfiguration, } from '../../PredefinedConfig/Common/Fdc3Intent';
|
|
3
|
+
import { ContextConfiguration } from '../../PredefinedConfig/Common/Fdc3Context';
|
|
5
4
|
export class Fdc3ApiImpl extends ApiBase {
|
|
6
5
|
constructor(adaptable) {
|
|
7
6
|
super(adaptable);
|
|
@@ -21,14 +20,6 @@ export class Fdc3ApiImpl extends ApiBase {
|
|
|
21
20
|
}
|
|
22
21
|
return this.buildContextDataFromRow(contextType, rowNode);
|
|
23
22
|
}
|
|
24
|
-
getPossibleContextTypes(intent) {
|
|
25
|
-
var _a;
|
|
26
|
-
const compatibleContexts = (_a = Fdc3IntentConfiguration[intent]) === null || _a === void 0 ? void 0 : _a.contexts;
|
|
27
|
-
return compatibleContexts ? [...compatibleContexts] : [];
|
|
28
|
-
}
|
|
29
|
-
isContextCompatibleWithIntent(contextType, intent) {
|
|
30
|
-
return this.getPossibleContextTypes(intent).includes(contextType);
|
|
31
|
-
}
|
|
32
23
|
raiseIntentFromPrimaryKey(primaryKeyValue, intent, contextType, appIdentifier) {
|
|
33
24
|
const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue);
|
|
34
25
|
if (!rowNode) {
|
|
@@ -66,8 +57,10 @@ export class Fdc3ApiImpl extends ApiBase {
|
|
|
66
57
|
return this.broadcastFromRow(rowNode, contextType);
|
|
67
58
|
}
|
|
68
59
|
getContextLabel(contextType) {
|
|
69
|
-
var _a
|
|
70
|
-
return (
|
|
60
|
+
var _a;
|
|
61
|
+
return this.isStandardContextType(contextType)
|
|
62
|
+
? (_a = ContextConfiguration[contextType]) === null || _a === void 0 ? void 0 : _a.label
|
|
63
|
+
: contextType;
|
|
71
64
|
}
|
|
72
65
|
isStandardContextType(contextType) {
|
|
73
66
|
return this.internalApi.isStandardContextType(contextType);
|
|
@@ -78,4 +71,35 @@ export class Fdc3ApiImpl extends ApiBase {
|
|
|
78
71
|
getFdc3Service() {
|
|
79
72
|
return this.getAdaptableApi().internalApi.getFdc3Service();
|
|
80
73
|
}
|
|
74
|
+
getPossibleContextTypes(intent) {
|
|
75
|
+
this.logWarn('Fdc3Api.getPossibleContextTypes is NO longer relevant as of FDC3 v1.2 and will be removed in a future version');
|
|
76
|
+
return [
|
|
77
|
+
'fdc3.action',
|
|
78
|
+
'fdc3.chart',
|
|
79
|
+
'fdc3.chat.initSettings',
|
|
80
|
+
'fdc3.chat.message',
|
|
81
|
+
'fdc3.chat.room',
|
|
82
|
+
'fdc3.chat.searchCriteria',
|
|
83
|
+
'fdc3.contact',
|
|
84
|
+
'fdc3.contactList',
|
|
85
|
+
'fdc3.country',
|
|
86
|
+
'fdc3.currency',
|
|
87
|
+
'fdc3.email',
|
|
88
|
+
'fdc3.instrument',
|
|
89
|
+
'fdc3.instrumentList',
|
|
90
|
+
'fdc3.interaction',
|
|
91
|
+
'fdc3.message',
|
|
92
|
+
'fdc3.organization',
|
|
93
|
+
'fdc3.portfolio',
|
|
94
|
+
'fdc3.position',
|
|
95
|
+
'fdc3.nothing',
|
|
96
|
+
'fdc3.timerange',
|
|
97
|
+
'fdc3.transactionResult',
|
|
98
|
+
'fdc3.valuation',
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
isContextCompatibleWithIntent(contextType, intent) {
|
|
102
|
+
this.logWarn('Fdc3Api.isContextCompatibleWithIntent is NO longer relevant as of FDC3 v1.2 and will be removed in a future version');
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
81
105
|
}
|
|
@@ -77,12 +77,14 @@ export declare class AlertInternalApi extends ApiBase {
|
|
|
77
77
|
* Returns a description of an Alert Definition
|
|
78
78
|
* @param alertDefinition Alert Definition to use
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
getAlertDescriptionForDataChange(alertDefinition: AlertDefinition, cellDataChangedInfo?: CellDataChangedInfo): string;
|
|
81
81
|
/**
|
|
82
82
|
* Returns a description title of an Alert Definition
|
|
83
83
|
* @param alertDefinition Alert Definition to use
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
getAlertMessageHeaderForDataChange(alertDefinition: AlertDefinition, cellDataChangedInfo?: CellDataChangedInfo): string;
|
|
86
|
+
getAlertMessageForGridDataChange(alertDefinition: AlertDefinition, gridDataChangedInfo: GridDataChangedInfo): string;
|
|
87
|
+
getAlertHeaderForGridDataChange(alertDefinition: AlertDefinition, gridDataChangedInfo: GridDataChangedInfo): string;
|
|
86
88
|
/**
|
|
87
89
|
* Returns custom description for alert using the 'alertMessageText' property
|
|
88
90
|
*
|
|
@@ -143,4 +145,17 @@ export declare class AlertInternalApi extends ApiBase {
|
|
|
143
145
|
showAlertsForGridDataChanges(gridDataChangedInfo: GridDataChangedInfo, alertDefinitions: AlertDefinition[]): void;
|
|
144
146
|
shouldFireAlertOnClient(alertDefinition: AlertDefinition): boolean;
|
|
145
147
|
getDefaultAlertNotificationForm(): AlertButtonForm;
|
|
148
|
+
/**
|
|
149
|
+
* Supported tokens:
|
|
150
|
+
* - column-that-changed-name -> [column]
|
|
151
|
+
* - rowData.newValue -> [rowData.newValue]
|
|
152
|
+
* - rowData.oldValue -> [rowData.oldValue]
|
|
153
|
+
* - primaryKey -> [primaryKeyValue]
|
|
154
|
+
* - timestamp -> [timestamp]
|
|
155
|
+
* - trigger -> [trigger]
|
|
156
|
+
*/
|
|
157
|
+
private annotateAlertText;
|
|
158
|
+
private replaceAll;
|
|
159
|
+
private extractColsFromText;
|
|
160
|
+
private extractContextKeysFromText;
|
|
146
161
|
}
|
|
@@ -215,13 +215,36 @@ export class AlertInternalApi extends ApiBase {
|
|
|
215
215
|
* Returns a description of an Alert Definition
|
|
216
216
|
* @param alertDefinition Alert Definition to use
|
|
217
217
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
getAlertDescriptionForDataChange(alertDefinition, cellDataChangedInfo) {
|
|
219
|
+
let customMessage = this.getCustomAlertDescription(alertDefinition, { cellDataChangedInfo });
|
|
220
|
+
const anotationContext = cellDataChangedInfo
|
|
221
|
+
? {
|
|
222
|
+
column: cellDataChangedInfo.column,
|
|
223
|
+
rowNode: cellDataChangedInfo.rowNode,
|
|
224
|
+
oldValue: cellDataChangedInfo.oldValue,
|
|
225
|
+
newValue: cellDataChangedInfo.newValue,
|
|
226
|
+
primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
|
|
227
|
+
timestamp: cellDataChangedInfo.changedAt,
|
|
228
|
+
trigger: cellDataChangedInfo.trigger,
|
|
229
|
+
}
|
|
230
|
+
: {};
|
|
220
231
|
if (customMessage) {
|
|
232
|
+
customMessage = cellDataChangedInfo
|
|
233
|
+
? this.annotateAlertText(customMessage, anotationContext)
|
|
234
|
+
: customMessage;
|
|
221
235
|
return customMessage;
|
|
222
236
|
}
|
|
223
237
|
if (alertDefinition.MessageText != null) {
|
|
224
|
-
|
|
238
|
+
let alertText = alertDefinition.MessageText;
|
|
239
|
+
try {
|
|
240
|
+
alertText = cellDataChangedInfo
|
|
241
|
+
? this.annotateAlertText(alertText, anotationContext)
|
|
242
|
+
: alertText;
|
|
243
|
+
return alertText;
|
|
244
|
+
}
|
|
245
|
+
catch (e) {
|
|
246
|
+
this.logError('Error in getAlertMessageHeader', e);
|
|
247
|
+
}
|
|
225
248
|
}
|
|
226
249
|
let scopeDescription = this.getColumnScopeApi().getScopeDescription(alertDefinition.Scope);
|
|
227
250
|
let ruleDescription = this.getAlertRuleDescription(alertDefinition);
|
|
@@ -231,11 +254,75 @@ export class AlertInternalApi extends ApiBase {
|
|
|
231
254
|
* Returns a description title of an Alert Definition
|
|
232
255
|
* @param alertDefinition Alert Definition to use
|
|
233
256
|
*/
|
|
234
|
-
|
|
257
|
+
getAlertMessageHeaderForDataChange(alertDefinition, cellDataChangedInfo) {
|
|
235
258
|
var _a, _b;
|
|
236
|
-
|
|
259
|
+
const anotationContext = cellDataChangedInfo
|
|
260
|
+
? {
|
|
261
|
+
column: cellDataChangedInfo.column,
|
|
262
|
+
rowNode: cellDataChangedInfo.rowNode,
|
|
263
|
+
oldValue: cellDataChangedInfo.oldValue,
|
|
264
|
+
newValue: cellDataChangedInfo.newValue,
|
|
265
|
+
primaryKeyValue: cellDataChangedInfo.primaryKeyValue,
|
|
266
|
+
timestamp: cellDataChangedInfo.changedAt,
|
|
267
|
+
trigger: cellDataChangedInfo.trigger,
|
|
268
|
+
}
|
|
269
|
+
: {};
|
|
270
|
+
let message = (_a = this.getCustomAlertMessageHeader(alertDefinition, {
|
|
237
271
|
cellDataChangedInfo,
|
|
238
|
-
})) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName
|
|
272
|
+
})) !== null && _a !== void 0 ? _a : (_b = cellDataChangedInfo === null || cellDataChangedInfo === void 0 ? void 0 : cellDataChangedInfo.column) === null || _b === void 0 ? void 0 : _b.friendlyName;
|
|
273
|
+
try {
|
|
274
|
+
message = cellDataChangedInfo ? this.annotateAlertText(message, anotationContext) : message;
|
|
275
|
+
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
this.logError('Error in getAlertMessageHeader', e);
|
|
278
|
+
}
|
|
279
|
+
return message;
|
|
280
|
+
}
|
|
281
|
+
getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo) {
|
|
282
|
+
const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
|
|
283
|
+
const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
|
|
284
|
+
const actionName = rowAdded ? 'Added' : 'Removed';
|
|
285
|
+
const defaultMessage = numberOfChangedRows > 1
|
|
286
|
+
? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
|
|
287
|
+
: `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
|
|
288
|
+
const customMessage = this.getCustomAlertDescription(alertDefinition, {
|
|
289
|
+
gridDataChangedInfo,
|
|
290
|
+
});
|
|
291
|
+
let alertMessage = alertDefinition.MessageText
|
|
292
|
+
? alertDefinition.MessageText
|
|
293
|
+
: customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
|
|
294
|
+
try {
|
|
295
|
+
alertMessage = this.annotateAlertText(alertMessage, {
|
|
296
|
+
numberOfRows: numberOfChangedRows,
|
|
297
|
+
timestamp: gridDataChangedInfo.changedAt,
|
|
298
|
+
trigger: gridDataChangedInfo.rowTrigger,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
catch (e) {
|
|
302
|
+
this.logError('Error in getAlertMessageForGridDataChange', e);
|
|
303
|
+
}
|
|
304
|
+
return alertMessage;
|
|
305
|
+
}
|
|
306
|
+
getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo) {
|
|
307
|
+
const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
|
|
308
|
+
const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
|
|
309
|
+
const actionName = rowAdded ? 'Added' : 'Removed';
|
|
310
|
+
const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
|
|
311
|
+
gridDataChangedInfo,
|
|
312
|
+
});
|
|
313
|
+
const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
|
|
314
|
+
let header = customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader;
|
|
315
|
+
try {
|
|
316
|
+
header = this.annotateAlertText(header, {
|
|
317
|
+
numberOfRows: numberOfChangedRows,
|
|
318
|
+
timestamp: gridDataChangedInfo.changedAt,
|
|
319
|
+
trigger: gridDataChangedInfo.rowTrigger,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
catch (e) {
|
|
323
|
+
this.logError('Error in getAlertHeaderForGridDataChange', e);
|
|
324
|
+
}
|
|
325
|
+
return header;
|
|
239
326
|
}
|
|
240
327
|
/**
|
|
241
328
|
* Returns custom description for alert using the 'alertMessageText' property
|
|
@@ -450,6 +537,7 @@ export class AlertInternalApi extends ApiBase {
|
|
|
450
537
|
}
|
|
451
538
|
}
|
|
452
539
|
});
|
|
540
|
+
``;
|
|
453
541
|
}
|
|
454
542
|
return triggeredAlerts;
|
|
455
543
|
}
|
|
@@ -466,7 +554,6 @@ export class AlertInternalApi extends ApiBase {
|
|
|
466
554
|
}
|
|
467
555
|
isAlertPredicateTriggered(alert, dataChangedEvent, defaultNoPredicateReturn = false) {
|
|
468
556
|
var _a;
|
|
469
|
-
const adapatableApi = this.getAdaptableApi();
|
|
470
557
|
const predicateDefHandlerContext = Object.assign({ value: dataChangedEvent.newValue, oldValue: dataChangedEvent.oldValue,
|
|
471
558
|
// TODO send real display value
|
|
472
559
|
displayValue: null, node: dataChangedEvent.rowNode, column: dataChangedEvent.column }, this.getAdaptableApi().internalApi.buildBaseContext());
|
|
@@ -480,7 +567,7 @@ export class AlertInternalApi extends ApiBase {
|
|
|
480
567
|
if (isCellDataChangedInfo(dataChangedInfo)) {
|
|
481
568
|
alertDefinitions.forEach((alertDefinition) => {
|
|
482
569
|
if (this.shouldFireAlertOnClient(alertDefinition)) {
|
|
483
|
-
const alert = ObjectFactory.CreateCellChangedAlert(this.
|
|
570
|
+
const alert = ObjectFactory.CreateCellChangedAlert(this.getAlertMessageHeaderForDataChange(alertDefinition, dataChangedInfo), this.getAlertDescriptionForDataChange(alertDefinition, dataChangedInfo), alertDefinition, dataChangedInfo);
|
|
484
571
|
this.getAdaptableApi().alertApi.showAdaptableAlert(alert);
|
|
485
572
|
}
|
|
486
573
|
});
|
|
@@ -490,25 +577,9 @@ export class AlertInternalApi extends ApiBase {
|
|
|
490
577
|
}
|
|
491
578
|
}
|
|
492
579
|
showAlertsForGridDataChanges(gridDataChangedInfo, alertDefinitions) {
|
|
493
|
-
const rowAdded = gridDataChangedInfo.rowTrigger === 'Add';
|
|
494
|
-
const numberOfChangedRows = gridDataChangedInfo.rowNodes.length;
|
|
495
|
-
const actionName = rowAdded ? 'Added' : 'Removed';
|
|
496
|
-
const alertHeader = numberOfChangedRows > 1 ? `${actionName} Rows` : `${actionName} Row `;
|
|
497
|
-
const defaultMessage = numberOfChangedRows > 1
|
|
498
|
-
? `${numberOfChangedRows} rows were ${actionName.toLowerCase()}`
|
|
499
|
-
: `${numberOfChangedRows} row was ${actionName.toLowerCase()}`;
|
|
500
580
|
alertDefinitions === null || alertDefinitions === void 0 ? void 0 : alertDefinitions.forEach((alertDefinition) => {
|
|
501
581
|
if (this.shouldFireAlertOnClient(alertDefinition)) {
|
|
502
|
-
const
|
|
503
|
-
gridDataChangedInfo,
|
|
504
|
-
});
|
|
505
|
-
const customHeader = this.getCustomAlertMessageHeader(alertDefinition, {
|
|
506
|
-
gridDataChangedInfo,
|
|
507
|
-
});
|
|
508
|
-
const alertMessage = alertDefinition.MessageText
|
|
509
|
-
? alertDefinition.MessageText
|
|
510
|
-
: customMessage !== null && customMessage !== void 0 ? customMessage : defaultMessage;
|
|
511
|
-
const alert = ObjectFactory.CreateRowChangedAlert(customHeader !== null && customHeader !== void 0 ? customHeader : alertHeader, alertMessage, alertDefinition, gridDataChangedInfo);
|
|
582
|
+
const alert = ObjectFactory.CreateRowChangedAlert(this.getAlertHeaderForGridDataChange(alertDefinition, gridDataChangedInfo), this.getAlertMessageForGridDataChange(alertDefinition, gridDataChangedInfo), alertDefinition, gridDataChangedInfo);
|
|
512
583
|
this.getAlertApi().showAdaptableAlert(alert);
|
|
513
584
|
}
|
|
514
585
|
});
|
|
@@ -541,4 +612,104 @@ export class AlertInternalApi extends ApiBase {
|
|
|
541
612
|
],
|
|
542
613
|
};
|
|
543
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Supported tokens:
|
|
617
|
+
* - column-that-changed-name -> [column]
|
|
618
|
+
* - rowData.newValue -> [rowData.newValue]
|
|
619
|
+
* - rowData.oldValue -> [rowData.oldValue]
|
|
620
|
+
* - primaryKey -> [primaryKeyValue]
|
|
621
|
+
* - timestamp -> [timestamp]
|
|
622
|
+
* - trigger -> [trigger]
|
|
623
|
+
*/
|
|
624
|
+
annotateAlertText(text, context) {
|
|
625
|
+
var _a, _b, _c;
|
|
626
|
+
if (!text) {
|
|
627
|
+
return text;
|
|
628
|
+
}
|
|
629
|
+
if (!context) {
|
|
630
|
+
return text;
|
|
631
|
+
}
|
|
632
|
+
if (context === null || context === void 0 ? void 0 : context.newValue) {
|
|
633
|
+
text = this.replaceAll(text, '[newValue]', context.newValue);
|
|
634
|
+
}
|
|
635
|
+
if (context === null || context === void 0 ? void 0 : context.oldValue) {
|
|
636
|
+
text = this.replaceAll(text, '[oldValue]', context.oldValue);
|
|
637
|
+
}
|
|
638
|
+
if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
|
|
639
|
+
text = this.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
|
|
640
|
+
}
|
|
641
|
+
if (context === null || context === void 0 ? void 0 : context.timestamp) {
|
|
642
|
+
text = this.replaceAll(text, '[timestamp]', context.timestamp + '');
|
|
643
|
+
}
|
|
644
|
+
if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
|
|
645
|
+
text = this.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
|
|
646
|
+
}
|
|
647
|
+
if (context === null || context === void 0 ? void 0 : context.trigger) {
|
|
648
|
+
const dataChangeTriggerMap = {
|
|
649
|
+
edit: 'Edit',
|
|
650
|
+
tick: 'Tick',
|
|
651
|
+
undo: 'Undo',
|
|
652
|
+
aggChange: 'AggChange',
|
|
653
|
+
};
|
|
654
|
+
const rowChangeTriggerMap = {
|
|
655
|
+
Add: 'Added',
|
|
656
|
+
Edit: 'Edited',
|
|
657
|
+
Delete: 'Deleted',
|
|
658
|
+
Load: 'Loaded',
|
|
659
|
+
};
|
|
660
|
+
const mappedTrigger =
|
|
661
|
+
// @ts-ignore
|
|
662
|
+
(_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
|
|
663
|
+
text = this.replaceAll(text, '[trigger]', mappedTrigger);
|
|
664
|
+
}
|
|
665
|
+
if ((context === null || context === void 0 ? void 0 : context.column) && (context === null || context === void 0 ? void 0 : context.rowNode)) {
|
|
666
|
+
text = this.replaceAll(text, '[column]', this.getGridApi().getRawValueFromRowNode(context.rowNode, context.column.columnId));
|
|
667
|
+
}
|
|
668
|
+
if (context === null || context === void 0 ? void 0 : context.rowNode) {
|
|
669
|
+
const columns = this.extractColsFromText(text);
|
|
670
|
+
for (const column of columns) {
|
|
671
|
+
if (this.getColumnApi().getColumnWithColumnId(column)) {
|
|
672
|
+
text = this.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (text.indexOf('[context') !== -1) {
|
|
677
|
+
const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
|
|
678
|
+
const agGridContextKeys = this.extractContextKeysFromText(text);
|
|
679
|
+
for (const key of agGridContextKeys) {
|
|
680
|
+
if (agGridContext[key]) {
|
|
681
|
+
text = this.replaceAll(text, `[context.${key}]`, agGridContext[key]);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return text;
|
|
686
|
+
}
|
|
687
|
+
replaceAll(text, toReplace, replaceWith) {
|
|
688
|
+
if (!text) {
|
|
689
|
+
return text;
|
|
690
|
+
}
|
|
691
|
+
// fails for []
|
|
692
|
+
toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
|
|
693
|
+
return text.replace(new RegExp(toReplace, 'g'), replaceWith);
|
|
694
|
+
}
|
|
695
|
+
extractColsFromText(text) {
|
|
696
|
+
// rowData.columnName => columnName
|
|
697
|
+
const regex = /\[rowData\.(.*?)\]/g;
|
|
698
|
+
let m;
|
|
699
|
+
const cols = [];
|
|
700
|
+
while ((m = regex.exec(text)) !== null) {
|
|
701
|
+
cols.push(m[1]);
|
|
702
|
+
}
|
|
703
|
+
return cols;
|
|
704
|
+
}
|
|
705
|
+
extractContextKeysFromText(text) {
|
|
706
|
+
// context.columnName => columnName
|
|
707
|
+
const regex = /\[context\.(.*?)\]/g;
|
|
708
|
+
let m;
|
|
709
|
+
const contextKeys = [];
|
|
710
|
+
while ((m = regex.exec(text)) !== null) {
|
|
711
|
+
contextKeys.push(m[1]);
|
|
712
|
+
}
|
|
713
|
+
return contextKeys;
|
|
714
|
+
}
|
|
544
715
|
}
|
|
@@ -6,6 +6,7 @@ import { ColumnFilter } from '../../PredefinedConfig/Common/ColumnFilter';
|
|
|
6
6
|
import { IRowNode } from '@ag-grid-community/core';
|
|
7
7
|
import { LayoutColumnFilterAction } from '../../Redux/ActionsReducers/LayoutRedux';
|
|
8
8
|
import * as Redux from 'redux';
|
|
9
|
+
import { ColumnValuesFilterPredicate } from '../../AdaptableOptions/ColumnFilterOptions';
|
|
9
10
|
export declare class ColumnFilterInternalApi extends ApiBase {
|
|
10
11
|
/**
|
|
11
12
|
* Returns Predicate Definition for given Column and Quick Filter shortcut
|
|
@@ -58,4 +59,5 @@ export declare class ColumnFilterInternalApi extends ApiBase {
|
|
|
58
59
|
areColumnFiltersDifferent(oldFilters: ColumnFilter[], newFilters: ColumnFilter[]): boolean;
|
|
59
60
|
getPredicateDefShortcuts(predicateDef: AdaptablePredicateDef): string[];
|
|
60
61
|
getFilterValuesMaxNumberOfItems(column: AdaptableColumn): number | undefined;
|
|
62
|
+
getValuesFitlerPredicateIds(column: AdaptableColumn): ColumnValuesFilterPredicate[];
|
|
61
63
|
}
|
|
@@ -206,4 +206,24 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
206
206
|
return maxFilterValues;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
+
getValuesFitlerPredicateIds(column) {
|
|
210
|
+
var _a;
|
|
211
|
+
const valuesFilterOptions = (_a = this.getOptions().columnFilterOptions) === null || _a === void 0 ? void 0 : _a.valuesFilterOptions;
|
|
212
|
+
const availablePredicates = this.getPredicateApi().getPredicateDefsByModuleScope('columnFilter');
|
|
213
|
+
let predicateIds = [];
|
|
214
|
+
if (typeof (valuesFilterOptions === null || valuesFilterOptions === void 0 ? void 0 : valuesFilterOptions.predicates) === 'function') {
|
|
215
|
+
const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
|
|
216
|
+
predicateIds = valuesFilterOptions.predicates(columnFilterContext);
|
|
217
|
+
}
|
|
218
|
+
else if (Array.isArray(valuesFilterOptions === null || valuesFilterOptions === void 0 ? void 0 : valuesFilterOptions.predicates)) {
|
|
219
|
+
predicateIds = valuesFilterOptions.predicates;
|
|
220
|
+
}
|
|
221
|
+
return predicateIds.filter((predicateId) => {
|
|
222
|
+
const predicate = availablePredicates.find((p) => p.id === predicateId);
|
|
223
|
+
if (!predicate) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return this.getColumnScopeApi().isColumnInScope(column, predicate.columnScope);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
209
229
|
}
|