@adaptabletools/adaptable 21.1.3 → 21.2.1
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/base.css +1 -0
- package/base.css.map +1 -1
- package/index.css +1 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/PredicateOptions.d.ts +5 -5
- package/src/AdaptableState/Common/AdaptablePredicate.d.ts +8 -1
- package/src/AdaptableState/Common/AdaptablePredicate.js +8 -1
- package/src/Api/ColumnApi.d.ts +6 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +11 -0
- package/src/Api/Implementation/CommentsApiImpl.d.ts +1 -1
- package/src/Api/Implementation/CommentsApiImpl.js +6 -6
- package/src/Api/Implementation/NoteApiImpl.d.ts +1 -1
- package/src/Api/Implementation/NoteApiImpl.js +2 -2
- package/src/Api/Internal/AlertInternalApi.js +2 -2
- package/src/Api/Internal/ColumnFilterInternalApi.js +3 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +1 -0
- package/src/Api/NoteApi.d.ts +2 -2
- package/src/Redux/ActionsReducers/CommentsRedux.d.ts +34 -31
- package/src/Redux/ActionsReducers/CommentsRedux.js +33 -30
- package/src/Redux/Store/AdaptableStore.js +6 -6
- package/src/Strategy/FlashingCellModule.js +3 -3
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +32 -4
- package/src/Utilities/Services/ValidationService.js +1 -0
- package/src/Utilities/weightedAverage.d.ts +3 -3
- package/src/Utilities/weightedAverage.js +27 -14
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +32 -15
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +5 -5
- package/src/View/StateManagement/components/ExportDropdown.js +2 -2
- package/src/View/StateManagement/handleExportState.d.ts +2 -1
- package/src/View/StateManagement/handleExportState.js +2 -2
- package/src/agGrid/AdaptableAgGrid.js +2 -1
- package/src/agGrid/AgGridAdapter.js +4 -2
- package/src/agGrid/cellRenderers/BadgeRenderer.js +2 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -2,74 +2,77 @@ import * as Redux from 'redux';
|
|
|
2
2
|
import { CommentThread, AdaptableComment, CommentState } from '../../AdaptableState/CommentState';
|
|
3
3
|
import { CellAddress } from '../../types';
|
|
4
4
|
/**
|
|
5
|
-
* @ReduxAction A
|
|
5
|
+
* @ReduxAction A Comment has been added
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const COMMENT_ADD = "COMMENT_ADD";
|
|
8
8
|
/**
|
|
9
|
-
* @ReduxAction
|
|
9
|
+
* @ReduxAction A Comment Thread has been added
|
|
10
10
|
*/
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const COMMENT_THREAD_ADD = "COMMENT_THREAD_ADD";
|
|
12
12
|
/**
|
|
13
|
-
* @ReduxAction
|
|
13
|
+
* @ReduxAction A Comment Thread has been removed
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const COMMENT_THREAD_DELETE = "COMMENT_THREAD_DELETE";
|
|
16
16
|
/**
|
|
17
|
-
* @ReduxAction A
|
|
17
|
+
* @ReduxAction A Comment has been edited
|
|
18
18
|
*/
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const COMMENT_EDIT = "COMMENT_EDIT";
|
|
20
20
|
/**
|
|
21
|
-
* @ReduxAction A
|
|
21
|
+
* @ReduxAction A Comment has been deleted
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const COMMENT_DELETE = "COMMENT_DELETE";
|
|
24
24
|
/**
|
|
25
25
|
* @ReduxAction Comments Module is ready
|
|
26
26
|
*/
|
|
27
27
|
export declare const COMMENTS_READY = "COMMENTS_READY";
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @ReduxAction Comments have been loaded
|
|
30
|
+
*/
|
|
31
|
+
export declare const COMMENTS_THREADS_LOAD = "COMMENTS_THREADS_LOAD";
|
|
29
32
|
export interface AdaptableCommentAction extends Redux.Action {
|
|
30
33
|
comment: AdaptableComment;
|
|
31
34
|
cellAddress: CellAddress;
|
|
32
35
|
}
|
|
33
|
-
export interface
|
|
36
|
+
export interface AdaptableCommentAddAction extends AdaptableCommentAction {
|
|
34
37
|
}
|
|
35
|
-
export interface
|
|
38
|
+
export interface AdaptableCommentThreadAddAction extends Redux.Action {
|
|
36
39
|
commentThread: CommentThread;
|
|
37
40
|
}
|
|
38
|
-
export interface
|
|
39
|
-
|
|
41
|
+
export interface AdaptableCommentThreadsLoadAction extends Redux.Action {
|
|
42
|
+
commentThreads: CommentThread[];
|
|
40
43
|
}
|
|
41
|
-
export interface
|
|
44
|
+
export interface AdaptableCommentThreadDeleteAction extends Redux.Action {
|
|
42
45
|
cellAddress: CellAddress;
|
|
43
46
|
}
|
|
44
|
-
export interface
|
|
47
|
+
export interface AdaptableCommentEditAction extends AdaptableCommentAction {
|
|
45
48
|
}
|
|
46
|
-
export interface
|
|
49
|
+
export interface AdaptableCommentDeleteAction extends Redux.Action {
|
|
47
50
|
commentUuid: AdaptableComment['Uuid'];
|
|
48
51
|
cellAddress: CellAddress;
|
|
49
52
|
}
|
|
50
|
-
export interface
|
|
53
|
+
export interface CommentReadyAction extends Redux.Action {
|
|
51
54
|
commentState: CommentState;
|
|
52
55
|
}
|
|
53
|
-
export declare const
|
|
54
|
-
|
|
55
|
-
}) =>
|
|
56
|
-
export declare const
|
|
56
|
+
export declare const CommentThreadsLoad: ({ commentThreads, }: {
|
|
57
|
+
commentThreads: CommentThread[];
|
|
58
|
+
}) => AdaptableCommentThreadsLoadAction;
|
|
59
|
+
export declare const CommentAdd: ({ comment, cellAddress, }: {
|
|
57
60
|
comment: AdaptableComment;
|
|
58
61
|
cellAddress: CellAddress;
|
|
59
|
-
}) =>
|
|
60
|
-
export declare const
|
|
62
|
+
}) => AdaptableCommentAddAction;
|
|
63
|
+
export declare const CommentThreadAdd: ({ commentThread, }: {
|
|
61
64
|
commentThread: CommentThread;
|
|
62
|
-
}) =>
|
|
63
|
-
export declare const
|
|
65
|
+
}) => AdaptableCommentThreadAddAction;
|
|
66
|
+
export declare const CommentThreadDelete: ({ cellAddress: cellAddress, }: {
|
|
64
67
|
cellAddress: CellAddress;
|
|
65
|
-
}) =>
|
|
66
|
-
export declare const
|
|
68
|
+
}) => AdaptableCommentThreadDeleteAction;
|
|
69
|
+
export declare const CommentEdit: ({ comment, cellAddress, }: {
|
|
67
70
|
comment: AdaptableComment;
|
|
68
71
|
cellAddress: CellAddress;
|
|
69
|
-
}) =>
|
|
72
|
+
}) => AdaptableCommentEditAction;
|
|
70
73
|
export declare const CommentsDelete: ({ commentUuid, cellAddress, }: {
|
|
71
74
|
commentUuid: AdaptableComment['Uuid'];
|
|
72
75
|
cellAddress: CellAddress;
|
|
73
|
-
}) =>
|
|
76
|
+
}) => AdaptableCommentDeleteAction;
|
|
74
77
|
export declare const GetCellCommentSelector: (state: CommentState, address: CellAddress) => CommentThread | undefined;
|
|
75
78
|
export declare const CommentsReducer: Redux.Reducer<CommentState>;
|
|
@@ -2,54 +2,57 @@ import { EMPTY_ARRAY } from '../../Utilities/Constants/GeneralConstants';
|
|
|
2
2
|
import ObjectFactory from '../../Utilities/ObjectFactory';
|
|
3
3
|
import { AnnotationsService } from '../../Utilities/Services/AnnotationsService';
|
|
4
4
|
/**
|
|
5
|
-
* @ReduxAction A
|
|
5
|
+
* @ReduxAction A Comment has been added
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const COMMENT_ADD = 'COMMENT_ADD';
|
|
8
8
|
/**
|
|
9
|
-
* @ReduxAction
|
|
9
|
+
* @ReduxAction A Comment Thread has been added
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
11
|
+
export const COMMENT_THREAD_ADD = 'COMMENT_THREAD_ADD';
|
|
12
12
|
/**
|
|
13
|
-
* @ReduxAction
|
|
13
|
+
* @ReduxAction A Comment Thread has been removed
|
|
14
14
|
*/
|
|
15
|
-
export const
|
|
15
|
+
export const COMMENT_THREAD_DELETE = 'COMMENT_THREAD_DELETE';
|
|
16
16
|
/**
|
|
17
|
-
* @ReduxAction A
|
|
17
|
+
* @ReduxAction A Comment has been edited
|
|
18
18
|
*/
|
|
19
|
-
export const
|
|
19
|
+
export const COMMENT_EDIT = 'COMMENT_EDIT';
|
|
20
20
|
/**
|
|
21
|
-
* @ReduxAction A
|
|
21
|
+
* @ReduxAction A Comment has been deleted
|
|
22
22
|
*/
|
|
23
|
-
export const
|
|
23
|
+
export const COMMENT_DELETE = 'COMMENT_DELETE';
|
|
24
24
|
/**
|
|
25
25
|
* @ReduxAction Comments Module is ready
|
|
26
26
|
*/
|
|
27
27
|
export const COMMENTS_READY = 'COMMENTS_READY';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @ReduxAction Comments have been loaded
|
|
30
|
+
*/
|
|
31
|
+
export const COMMENTS_THREADS_LOAD = 'COMMENTS_THREADS_LOAD';
|
|
32
|
+
export const CommentThreadsLoad = ({ commentThreads, }) => ({
|
|
33
|
+
type: COMMENTS_THREADS_LOAD,
|
|
34
|
+
commentThreads,
|
|
32
35
|
});
|
|
33
|
-
export const
|
|
34
|
-
type:
|
|
36
|
+
export const CommentAdd = ({ comment, cellAddress, }) => ({
|
|
37
|
+
type: COMMENT_ADD,
|
|
35
38
|
comment,
|
|
36
39
|
cellAddress,
|
|
37
40
|
});
|
|
38
|
-
export const
|
|
39
|
-
type:
|
|
41
|
+
export const CommentThreadAdd = ({ commentThread, }) => ({
|
|
42
|
+
type: COMMENT_THREAD_ADD,
|
|
40
43
|
commentThread,
|
|
41
44
|
});
|
|
42
|
-
export const
|
|
43
|
-
type:
|
|
45
|
+
export const CommentThreadDelete = ({ cellAddress: cellAddress, }) => ({
|
|
46
|
+
type: COMMENT_THREAD_DELETE,
|
|
44
47
|
cellAddress: cellAddress,
|
|
45
48
|
});
|
|
46
|
-
export const
|
|
47
|
-
type:
|
|
49
|
+
export const CommentEdit = ({ comment, cellAddress, }) => ({
|
|
50
|
+
type: COMMENT_EDIT,
|
|
48
51
|
comment,
|
|
49
52
|
cellAddress,
|
|
50
53
|
});
|
|
51
54
|
export const CommentsDelete = ({ commentUuid, cellAddress, }) => ({
|
|
52
|
-
type:
|
|
55
|
+
type: COMMENT_DELETE,
|
|
53
56
|
cellAddress,
|
|
54
57
|
commentUuid,
|
|
55
58
|
});
|
|
@@ -66,7 +69,7 @@ const initialState = {
|
|
|
66
69
|
};
|
|
67
70
|
export const CommentsReducer = (state = initialState, action) => {
|
|
68
71
|
switch (action.type) {
|
|
69
|
-
case
|
|
72
|
+
case COMMENT_ADD: {
|
|
70
73
|
const addAction = action;
|
|
71
74
|
const commentThread = state.CommentThreads ?? [];
|
|
72
75
|
const cellCommentIndex = commentThread.findIndex((cellComments) => {
|
|
@@ -89,7 +92,7 @@ export const CommentsReducer = (state = initialState, action) => {
|
|
|
89
92
|
}
|
|
90
93
|
return { ...state, CommentThreads: comments };
|
|
91
94
|
}
|
|
92
|
-
case
|
|
95
|
+
case COMMENT_THREAD_ADD: {
|
|
93
96
|
return {
|
|
94
97
|
...state,
|
|
95
98
|
CommentThreads: [
|
|
@@ -98,14 +101,14 @@ export const CommentsReducer = (state = initialState, action) => {
|
|
|
98
101
|
],
|
|
99
102
|
};
|
|
100
103
|
}
|
|
101
|
-
case
|
|
104
|
+
case COMMENT_THREAD_DELETE: {
|
|
102
105
|
const deleteAction = action;
|
|
103
106
|
return {
|
|
104
107
|
...state,
|
|
105
108
|
CommentThreads: (state.CommentThreads ?? []).filter((cellComments) => !AnnotationsService.isSameAddress(cellComments, deleteAction.cellAddress)),
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
|
-
case
|
|
111
|
+
case COMMENT_EDIT: {
|
|
109
112
|
const editAction = action;
|
|
110
113
|
let edited = false;
|
|
111
114
|
const adaptableCellComments = (state.CommentThreads ?? []).map((cellComments) => {
|
|
@@ -128,7 +131,7 @@ export const CommentsReducer = (state = initialState, action) => {
|
|
|
128
131
|
CommentThreads: adaptableCellComments,
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
|
-
case
|
|
134
|
+
case COMMENT_DELETE: {
|
|
132
135
|
const deleteAction = action;
|
|
133
136
|
const adaptableCellComments = (state.CommentThreads ?? [])
|
|
134
137
|
.map((cellComments) => {
|
|
@@ -152,10 +155,10 @@ export const CommentsReducer = (state = initialState, action) => {
|
|
|
152
155
|
CommentThreads: adaptableCellComments,
|
|
153
156
|
};
|
|
154
157
|
}
|
|
155
|
-
case
|
|
158
|
+
case COMMENTS_THREADS_LOAD: {
|
|
156
159
|
return {
|
|
157
160
|
...state,
|
|
158
|
-
CommentThreads: action.
|
|
161
|
+
CommentThreads: action.commentThreads,
|
|
159
162
|
};
|
|
160
163
|
}
|
|
161
164
|
default:
|
|
@@ -864,11 +864,11 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
864
864
|
* Use Case: Comments has been edited/deleted/added
|
|
865
865
|
* Action: Triangle can be removed/added
|
|
866
866
|
*/
|
|
867
|
-
case CommentsRedux.
|
|
868
|
-
case CommentsRedux.
|
|
869
|
-
case CommentsRedux.
|
|
870
|
-
case CommentsRedux.
|
|
871
|
-
case CommentsRedux.
|
|
867
|
+
case CommentsRedux.COMMENT_ADD:
|
|
868
|
+
case CommentsRedux.COMMENT_EDIT:
|
|
869
|
+
case CommentsRedux.COMMENT_DELETE:
|
|
870
|
+
case CommentsRedux.COMMENT_THREAD_DELETE:
|
|
871
|
+
case CommentsRedux.COMMENT_THREAD_ADD: {
|
|
872
872
|
let returnAction = next(action);
|
|
873
873
|
adaptable.AnnotationsService.checkListenToEvents();
|
|
874
874
|
let rowNode = null;
|
|
@@ -893,7 +893,7 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
|
|
|
893
893
|
}
|
|
894
894
|
return returnAction;
|
|
895
895
|
}
|
|
896
|
-
case CommentsRedux.
|
|
896
|
+
case CommentsRedux.COMMENTS_THREADS_LOAD: {
|
|
897
897
|
const previousCommentThreads = adaptable.api.commentApi.getAllComments();
|
|
898
898
|
let returnAction = next(action);
|
|
899
899
|
const newCommentThreads = adaptable.api.commentApi.getAllComments() ?? [];
|
|
@@ -185,7 +185,7 @@ export class FlashingCellModule extends AdaptableModuleBase {
|
|
|
185
185
|
ColumnIds: [column.columnId],
|
|
186
186
|
},
|
|
187
187
|
Rule: {
|
|
188
|
-
|
|
188
|
+
BooleanExpression: 'ANY_CHANGE([' + column.columnId + '])',
|
|
189
189
|
},
|
|
190
190
|
})),
|
|
191
191
|
];
|
|
@@ -228,8 +228,8 @@ export class FlashingCellModule extends AdaptableModuleBase {
|
|
|
228
228
|
const predicateDefHandlerContext = {
|
|
229
229
|
value: dataChangedEvent.newValue,
|
|
230
230
|
oldValue: dataChangedEvent.oldValue,
|
|
231
|
-
|
|
232
|
-
displayValue:
|
|
231
|
+
rawValue: dataChangedEvent.newValue,
|
|
232
|
+
displayValue: dataChangedEvent.newValue,
|
|
233
233
|
node: dataChangedEvent.rowNode,
|
|
234
234
|
column: dataChangedEvent.column,
|
|
235
235
|
...this.api.internalApi.buildBaseContext(),
|
|
@@ -642,7 +642,7 @@ export const scalarExpressionFunctions = {
|
|
|
642
642
|
description: "Returns the percentage difference between a cell's current value and its previous value.",
|
|
643
643
|
signatures: [
|
|
644
644
|
'PERCENT_CHANGE( [colName], <INCREASE|DECREASE> )',
|
|
645
|
-
'PERCENT_CHANGE( COL(name: string), <INCREASE|DECREASE>)',
|
|
645
|
+
'PERCENT_CHANGE( COL(name: string), <INCREASE|DECREASE> )',
|
|
646
646
|
],
|
|
647
647
|
examples: [
|
|
648
648
|
'PERCENT_CHANGE([col1])',
|
|
@@ -662,11 +662,39 @@ export const scalarExpressionFunctions = {
|
|
|
662
662
|
throw new ExpressionEvaluationError('ABSOLUTE_CHANGE', 'First argument should be numeric');
|
|
663
663
|
}
|
|
664
664
|
const previousValue = context.dataChangedEvent.oldValue;
|
|
665
|
-
|
|
665
|
+
const increaseDecrease = args[1];
|
|
666
|
+
let result;
|
|
667
|
+
if (!increaseDecrease) {
|
|
668
|
+
result = sanitizeNumericResult(Math.abs(previousValue - currentValue));
|
|
669
|
+
}
|
|
670
|
+
else if (increaseDecrease === 'INCREASE') {
|
|
671
|
+
result =
|
|
672
|
+
currentValue - previousValue > 0
|
|
673
|
+
? sanitizeNumericResult(currentValue - previousValue)
|
|
674
|
+
: undefined;
|
|
675
|
+
}
|
|
676
|
+
else if (increaseDecrease === 'DECREASE') {
|
|
677
|
+
result =
|
|
678
|
+
currentValue - previousValue < 0
|
|
679
|
+
? sanitizeNumericResult(previousValue - currentValue)
|
|
680
|
+
: undefined;
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
throw new ExpressionEvaluationError('ABSOLUTE_CHANGE', 'Optional second argument must be "INCREASE" or "DECREASE"');
|
|
684
|
+
}
|
|
685
|
+
return result;
|
|
666
686
|
},
|
|
667
687
|
description: "Returns the absolute difference between a cell's current value and its previous value.",
|
|
668
|
-
signatures: [
|
|
669
|
-
|
|
688
|
+
signatures: [
|
|
689
|
+
'ABSOLUTE_CHANGE( [colName] )',
|
|
690
|
+
'ABSOLUTE_CHANGE( COL(name: string) )',
|
|
691
|
+
'ABSOLUTE_CHANGE( COL(name: string), <INCREASE|DECREASE> )',
|
|
692
|
+
],
|
|
693
|
+
examples: [
|
|
694
|
+
'ABSOLUTE_CHANGE([col1])',
|
|
695
|
+
'ABSOLUTE_CHANGE([col1], "INCREASE")',
|
|
696
|
+
'ABSOLUTE_CHANGE([col1], "DECREASE")',
|
|
697
|
+
],
|
|
670
698
|
category: 'changes',
|
|
671
699
|
returnType: 'number',
|
|
672
700
|
},
|
|
@@ -81,6 +81,7 @@ export class ValidationService {
|
|
|
81
81
|
const predicateDefHandlerContext = {
|
|
82
82
|
value: dataChangedEvent.newValue,
|
|
83
83
|
oldValue: dataChangedEvent.oldValue,
|
|
84
|
+
rawValue: dataChangedEvent.newValue,
|
|
84
85
|
displayValue,
|
|
85
86
|
node: dataChangedEvent.rowNode,
|
|
86
87
|
column: dataChangedEvent.column,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAggFuncParams } from 'ag-grid-enterprise';
|
|
2
2
|
export declare const getNumericValue: (input: unknown) => number | null;
|
|
3
3
|
export declare const weightedAverage: (params: IAggFuncParams, columnId: string, weightColumnId: string) => {
|
|
4
|
-
[x: string]: number | (() =>
|
|
5
|
-
toString: () =>
|
|
6
|
-
|
|
4
|
+
[x: string]: number | (() => string) | (() => number);
|
|
5
|
+
toString: () => string;
|
|
6
|
+
toNumber: () => number;
|
|
7
7
|
};
|
|
@@ -6,12 +6,27 @@ export const getNumericValue = (input) => {
|
|
|
6
6
|
const numericValue = toNumber(input);
|
|
7
7
|
return isNaN(numericValue) ? null : numericValue;
|
|
8
8
|
};
|
|
9
|
+
function getWeightedAverageLeafNodes(gridApi, groupRowNode, filteredOnly) {
|
|
10
|
+
const nodeList = (filteredOnly ? groupRowNode.childrenAfterFilter : groupRowNode.childrenAfterGroup) ?? [];
|
|
11
|
+
let leafNodes = [];
|
|
12
|
+
nodeList.forEach((rowNode) => {
|
|
13
|
+
if (rowNode.group === true) {
|
|
14
|
+
// Recursively extract leaf nodes from group
|
|
15
|
+
leafNodes = leafNodes.concat(getWeightedAverageLeafNodes(gridApi, rowNode, filteredOnly));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
leafNodes.push(rowNode);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return leafNodes;
|
|
22
|
+
}
|
|
9
23
|
export const weightedAverage = (params, columnId, weightColumnId) => {
|
|
10
24
|
const { api: gridApi, rowNode: groupRowNode } = params;
|
|
11
25
|
let weightedColumnValueSum = 0;
|
|
12
26
|
let columnValueSum = 0;
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
const filteredOnly = !gridApi.getGridOption('suppressAggFilteredOnly');
|
|
28
|
+
const leafNodes = getWeightedAverageLeafNodes(gridApi, groupRowNode, filteredOnly);
|
|
29
|
+
leafNodes.forEach((rowNode) => {
|
|
15
30
|
// when editing values might be converted to strings
|
|
16
31
|
const rawColumnValue = gridApi.getCellValue({ colKey: columnId, rowNode });
|
|
17
32
|
const columnValue = getNumericValue(rawColumnValue);
|
|
@@ -24,21 +39,19 @@ export const weightedAverage = (params, columnId, weightColumnId) => {
|
|
|
24
39
|
columnValueSum += columnValue * weightedColumnValue;
|
|
25
40
|
}
|
|
26
41
|
});
|
|
42
|
+
let result = columnValueSum / weightedColumnValueSum;
|
|
43
|
+
// 0 / 0 = NaN
|
|
44
|
+
if (isNaN(result)) {
|
|
45
|
+
result = 0;
|
|
46
|
+
}
|
|
27
47
|
return {
|
|
48
|
+
// the grid by default uses toString to render values for an object, so this
|
|
49
|
+
// is a trick to get the default cellRenderer to display the avg value
|
|
28
50
|
toString: () => {
|
|
29
|
-
|
|
30
|
-
// 0 / 0 = NaN
|
|
31
|
-
if (isNaN(result)) {
|
|
32
|
-
return '';
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
51
|
+
return String(result);
|
|
35
52
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// 0 / 0 = NaN
|
|
39
|
-
if (isNaN(result)) {
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
53
|
+
// used for sorting
|
|
54
|
+
toNumber: function () {
|
|
42
55
|
return result;
|
|
43
56
|
},
|
|
44
57
|
[columnId]: columnValueSum,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Flex, Box, Text } from 'rebass';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { sentenceCase } from 'sentence-case';
|
|
4
3
|
import SimpleButton from '../../../components/SimpleButton';
|
|
5
4
|
import Input from '../../../components/Input';
|
|
6
5
|
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
@@ -9,6 +8,26 @@ import { cloneObject } from '../../../Utilities/Helpers/Helper';
|
|
|
9
8
|
import StringExtensions from '../../../Utilities/Extensions/StringExtensions';
|
|
10
9
|
import { AdaptableIconSelector } from '../../Components/AdaptableIconSelector';
|
|
11
10
|
import { Select } from '../../../components/Select';
|
|
11
|
+
function renderCommand(command) {
|
|
12
|
+
switch (command) {
|
|
13
|
+
case 'highlight-cell':
|
|
14
|
+
return 'Highlight Cell';
|
|
15
|
+
case 'highlight-row':
|
|
16
|
+
return 'Highlight Row';
|
|
17
|
+
case 'jump-to-cell':
|
|
18
|
+
return 'Jump to Cell';
|
|
19
|
+
case 'jump-to-column':
|
|
20
|
+
return 'Jump to Column';
|
|
21
|
+
case 'jump-to-row':
|
|
22
|
+
return 'Jump to Row';
|
|
23
|
+
case 'suspend':
|
|
24
|
+
return 'Suspend';
|
|
25
|
+
case 'undo':
|
|
26
|
+
return 'Undo';
|
|
27
|
+
default:
|
|
28
|
+
return command;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
12
31
|
const TONE_OPTIONS = [
|
|
13
32
|
{
|
|
14
33
|
label: 'Tone: Use Alert Tone',
|
|
@@ -73,6 +92,12 @@ export const AlertButtonsEditor = (props) => {
|
|
|
73
92
|
if (hasSuspend) {
|
|
74
93
|
buttonCommands.push('suspend');
|
|
75
94
|
}
|
|
95
|
+
const commandHandlers = api.optionsApi.getAlertOptions().commandHandlers;
|
|
96
|
+
if (commandHandlers) {
|
|
97
|
+
commandHandlers.forEach((ch) => {
|
|
98
|
+
buttonCommands.push(ch.name);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
76
101
|
return (React.createElement(React.Fragment, null,
|
|
77
102
|
React.createElement(Flex, { flexDirection: "row", alignItems: "center", justifyContent: "space-between" },
|
|
78
103
|
React.createElement(Text, { fontSize: 2, mt: 3, mb: 2 }, "Add Buttons to the Alert Notification, and set Actions to perform when the Button is clicked"),
|
|
@@ -98,7 +123,7 @@ export const AlertButtonsEditor = (props) => {
|
|
|
98
123
|
btnCommands = button.Command;
|
|
99
124
|
}
|
|
100
125
|
// filter out the adaptable standard commands
|
|
101
|
-
const btnUserFunctions = btnCommands.filter((command) => !buttonCommands.includes(command));
|
|
126
|
+
// const btnUserFunctions = btnCommands.filter((command) => !buttonCommands.includes(command));
|
|
102
127
|
const setVariant = (variant) => {
|
|
103
128
|
onChange(AlertButtons.map((btn, i) => {
|
|
104
129
|
if (i === index) {
|
|
@@ -197,19 +222,11 @@ export const AlertButtonsEditor = (props) => {
|
|
|
197
222
|
React.createElement(SimpleButton, { icon: "close", tone: "error", disabled: AlertButtons.length <= 1, marginLeft: 1, variant: "text", tooltip: AlertButtons.length <= 1 ? 'Cannot remove last button' : 'Remove button', onClick: () => {
|
|
198
223
|
onChange(AlertButtons.filter((btn) => btn !== button));
|
|
199
224
|
} }))),
|
|
200
|
-
React.createElement(FormRow, { label: React.createElement(Text, { fontSize: 2 }, "Actions") },
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
btnUserFunctions.length ? (React.createElement(CheckBox, { checked: true, disabled: true },
|
|
207
|
-
React.createElement(Text, { fontSize: 2 },
|
|
208
|
-
"User function",
|
|
209
|
-
btnUserFunctions.length > 1 ? 's' : '',
|
|
210
|
-
":",
|
|
211
|
-
' ',
|
|
212
|
-
btnUserFunctions.join(', ')))) : null),
|
|
225
|
+
React.createElement(FormRow, { label: React.createElement(Text, { fontSize: 2 }, "Actions") }, buttonCommands.map((commandName) => {
|
|
226
|
+
return (React.createElement(CheckBox, { key: commandName, marginRight: 3, onChange: (checked) => handleCommandChange(checked, commandName), checked: button.Command === commandName ||
|
|
227
|
+
(Array.isArray(button.Command) && button.Command.includes(commandName)) },
|
|
228
|
+
React.createElement(Text, { fontSize: 2 }, renderCommand(commandName))));
|
|
229
|
+
})),
|
|
213
230
|
iconSelector && (React.createElement(FormRow, { label: React.createElement(Text, { fontSize: 2 }, "Icon") },
|
|
214
231
|
React.createElement(Box, null, iconSelector))))));
|
|
215
232
|
})));
|
|
@@ -12,20 +12,20 @@ export const renderFormatColumnSettingsSummary = (data) => {
|
|
|
12
12
|
return (React.createElement(Box, { padding: 2 },
|
|
13
13
|
React.createElement(Text, null,
|
|
14
14
|
"Cell alignment ",
|
|
15
|
-
React.createElement(Tag, null, data.CellAlignment ?? '
|
|
15
|
+
React.createElement(Tag, null, data.CellAlignment ?? 'Default')),
|
|
16
16
|
React.createElement(Text, { mt: 3 },
|
|
17
17
|
"Data Rows ",
|
|
18
|
-
React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? '
|
|
18
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? 'No' : 'Yes')),
|
|
19
19
|
' ',
|
|
20
20
|
React.createElement(Text, { mt: 3 },
|
|
21
21
|
"Group Rows ",
|
|
22
|
-
React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? '
|
|
22
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? 'No' : 'Yes')),
|
|
23
23
|
React.createElement(Text, { mt: 3 },
|
|
24
24
|
"Summary Rows ",
|
|
25
|
-
React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? '
|
|
25
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'No' : 'Yes')),
|
|
26
26
|
React.createElement(Text, { mt: 3 },
|
|
27
27
|
"Total Rows ",
|
|
28
|
-
React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? '
|
|
28
|
+
React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? 'No' : 'Yes')),
|
|
29
29
|
React.createElement(Text, { mt: 3 },
|
|
30
30
|
"Apply on Column Groups:",
|
|
31
31
|
' ',
|
|
@@ -6,11 +6,11 @@ export const ExportDropdown = (props) => {
|
|
|
6
6
|
switch (props.type) {
|
|
7
7
|
case 'adaptableState':
|
|
8
8
|
const adaptableState = props.api.stateApi.getPersistentState();
|
|
9
|
-
handleExportState(destination, 'adaptableState', adaptableState);
|
|
9
|
+
handleExportState(destination, 'adaptableState', adaptableState, props.api);
|
|
10
10
|
break;
|
|
11
11
|
case 'initialState':
|
|
12
12
|
const initialState = props.api.stateApi.getInitialState();
|
|
13
|
-
handleExportState(destination, 'initialState', initialState);
|
|
13
|
+
handleExportState(destination, 'initialState', initialState, props.api);
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { AdaptableApi } from '../../types';
|
|
2
|
+
export declare const handleExportState: (type: 'Clipboard' | 'Console' | 'JSON', name: 'adaptableState' | 'initialState', state: any, api: AdaptableApi) => void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Helper from '../../Utilities/Helpers/Helper';
|
|
2
|
-
export const handleExportState = (type, name, state) => {
|
|
2
|
+
export const handleExportState = (type, name, state, api) => {
|
|
3
3
|
switch (type) {
|
|
4
4
|
case 'Clipboard':
|
|
5
5
|
let stringifiedState = JSON.stringify(state);
|
|
6
6
|
Helper.copyToClipboard(stringifiedState);
|
|
7
7
|
break;
|
|
8
8
|
case 'Console':
|
|
9
|
-
|
|
9
|
+
api.consoleLog('Adaptable State: ', state);
|
|
10
10
|
break;
|
|
11
11
|
case 'JSON':
|
|
12
12
|
const jsonFileName = name + '.json';
|
|
@@ -1764,7 +1764,8 @@ You need to define at least one Layout!`);
|
|
|
1764
1764
|
let _displayValue = defaults ? defaults.displayValue : undefined;
|
|
1765
1765
|
let _normalisedValue = defaults ? defaults.normalisedValue : undefined;
|
|
1766
1766
|
let _isRowGroupCell;
|
|
1767
|
-
const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId)
|
|
1767
|
+
const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId) ||
|
|
1768
|
+
this.api.columnApi.isPivotAggColumnWithNoPivotColumns(columnId);
|
|
1768
1769
|
const self = this;
|
|
1769
1770
|
const api = this.api;
|
|
1770
1771
|
const getRawValue = () => {
|
|
@@ -154,7 +154,8 @@ export class AgGridAdapter {
|
|
|
154
154
|
const pivotColumnFilters = self.adaptableApi.filterApi.columnFilterApi
|
|
155
155
|
.getActiveColumnFilters()
|
|
156
156
|
.filter((columnFilter) => self.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId) ||
|
|
157
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId)
|
|
157
|
+
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId) ||
|
|
158
|
+
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(columnFilter.ColumnId));
|
|
158
159
|
try {
|
|
159
160
|
if (pivotColumnFilters.length > 0) {
|
|
160
161
|
for (const columnFilter of pivotColumnFilters) {
|
|
@@ -178,7 +179,8 @@ export class AgGridAdapter {
|
|
|
178
179
|
this.DANGER_isAggFilterPresentMonkeyPatcher = function () {
|
|
179
180
|
const columnFilters = self.adaptableApi.filterApi.columnFilterApi.getActiveColumnFilters();
|
|
180
181
|
return columnFilters.some((colFilter) => self.adaptableApi.columnApi.isPivotResultColumn(colFilter.ColumnId) ||
|
|
181
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(colFilter.ColumnId)
|
|
182
|
+
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(colFilter.ColumnId) ||
|
|
183
|
+
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(colFilter.ColumnId));
|
|
182
184
|
};
|
|
183
185
|
agGridColumnFilterService.isAggFilterPresent = this.DANGER_isAggFilterPresentMonkeyPatcher;
|
|
184
186
|
}
|
|
@@ -59,6 +59,7 @@ export const getBadgeRendererForColumn = (badgeStyle, abColumn, api) => {
|
|
|
59
59
|
for (const value of params.value) {
|
|
60
60
|
const predicateDefHandlerContext = {
|
|
61
61
|
value: value,
|
|
62
|
+
rawValue: value,
|
|
62
63
|
oldValue: null,
|
|
63
64
|
displayValue: params.formatValue,
|
|
64
65
|
node: params.node,
|
|
@@ -82,6 +83,7 @@ export const getBadgeRendererForColumn = (badgeStyle, abColumn, api) => {
|
|
|
82
83
|
let formattedValue = params.formatValue?.(params.value) ?? params.value ?? '';
|
|
83
84
|
const predicateDefHandlerContext = {
|
|
84
85
|
value: params.value,
|
|
86
|
+
rawValue: params.value,
|
|
85
87
|
oldValue: null,
|
|
86
88
|
displayValue: params.formatValue,
|
|
87
89
|
node: params.node,
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "21.1
|
|
3
|
+
PUBLISH_TIMESTAMP: 1768226502639 || Date.now(),
|
|
4
|
+
VERSION: "21.2.1" || '--current-version--',
|
|
5
5
|
};
|