@adaptabletools/adaptable 18.1.6 → 18.1.8
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/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -2
- package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +3 -4
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +3 -0
- package/src/AdaptableOptions/ExpressionOptions.d.ts +3 -0
- package/src/AdaptableOptions/GridFilterOptions.d.ts +4 -1
- package/src/AdaptableOptions/StateOptions.d.ts +1 -1
- package/src/Api/AdaptableApi.d.ts +1 -4
- package/src/Api/ColumnScopeApi.d.ts +1 -1
- package/src/Api/Events/SystemStatusMessageDisplayed.d.ts +1 -1
- package/src/Api/Implementation/GridApiImpl.js +1 -1
- package/src/Api/Internal/AlertInternalApi.d.ts +0 -3
- package/src/Api/Internal/AlertInternalApi.js +12 -39
- package/src/Api/Internal/CommentsInternalApi.js +0 -4
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +2 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +6 -6
- package/src/Api/Internal/GridInternalApi.js +2 -2
- package/src/Api/Internal/NoteInternalApi.js +0 -4
- package/src/Api/StatusBarApi.d.ts +5 -5
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/Menu.d.ts +6 -0
- package/src/Strategy/CalculatedColumnModule.js +1 -1
- package/src/Strategy/ColumnFilterModule.js +13 -11
- package/src/Strategy/CommentModule.js +3 -0
- package/src/Strategy/NoteModule.js +3 -0
- package/src/Utilities/Helpers/FormatHelper.d.ts +23 -4
- package/src/Utilities/Helpers/FormatHelper.js +73 -14
- package/src/Utilities/Helpers/Helper.d.ts +6 -0
- package/src/Utilities/Helpers/Helper.js +31 -0
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +5 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +2 -2
- package/src/agGrid/AdaptableAgGrid.js +17 -24
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +3 -0
- package/src/components/Select/Select.d.ts +1 -0
- package/src/components/Select/Select.js +8 -2
- package/src/components/icons/index.js +1 -1
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +149 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/types.d.ts +25 -4
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "18.1.
|
|
3
|
+
"version": "18.1.8",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -177,7 +177,7 @@ export interface IAdaptable {
|
|
|
177
177
|
getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
|
|
178
178
|
getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
|
|
179
179
|
getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
|
|
180
|
-
getGridCellsForColumn(columnId: string,
|
|
180
|
+
getGridCellsForColumn(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
|
|
181
181
|
getRowNodesForPrimaryKeys(primaryKeyValues: any[]): IRowNode[];
|
|
182
182
|
getRowNodeForPrimaryKey(primaryKeyValue: any): IRowNode;
|
|
183
183
|
getRowNodeByIndex(index: number): IRowNode;
|
|
@@ -247,7 +247,7 @@ export interface IAdaptable {
|
|
|
247
247
|
getAllGridColumns(): Column<any>[];
|
|
248
248
|
clearRowGroupColumns(): void;
|
|
249
249
|
expandAllRowGroups(): void;
|
|
250
|
-
|
|
250
|
+
collapseAllRowGroups(): void;
|
|
251
251
|
expandRowGroupsForValues(columnValues: any[]): void;
|
|
252
252
|
getExpandRowGroupsKeys(): any[];
|
|
253
253
|
getAdaptableContainerElement(): HTMLElement | null;
|
|
@@ -23,14 +23,13 @@ export type AngularFrameworkComponent<T = unknown> = {
|
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
25
|
* A function that returns a ReactNode
|
|
26
|
-
* @example
|
|
27
|
-
* ```
|
|
28
|
-
* () => <MyCustomToolbar />
|
|
29
|
-
* ```
|
|
30
26
|
*/
|
|
31
27
|
export type ReactFrameworkComponent = ({ adaptableApi, }: {
|
|
32
28
|
adaptableApi: AdaptableApi;
|
|
33
29
|
}) => ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a Vue Component to be used in AdapTable UI controls
|
|
32
|
+
*/
|
|
34
33
|
export type VueFrameworkComponent<Component extends unknown = unknown> = ({ adaptableApi, }: {
|
|
35
34
|
adaptableApi: AdaptableApi;
|
|
36
35
|
}) => Component;
|
|
@@ -301,4 +301,7 @@ export interface ValuesFilterPredicateContext<TData = any> extends BaseContext {
|
|
|
301
301
|
*/
|
|
302
302
|
predicate: ColumnValuesFilterPredicate;
|
|
303
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Predicate used in Column Values Filter
|
|
306
|
+
*/
|
|
304
307
|
export type ColumnValuesFilterPredicate = TypeHint<string, SystemFilterPredicateIds>;
|
|
@@ -197,6 +197,9 @@ export interface ModuleExpressionFunctions {
|
|
|
197
197
|
*/
|
|
198
198
|
systemAggregatedScalarFunctions?: AggregatedScalarFunctionName[] | ((context: GlobalExpressionFunctionsContext<AggregatedScalarFunctionName>) => AggregatedScalarFunctionName[]);
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Context used when providing Fields programatically
|
|
202
|
+
*/
|
|
200
203
|
export interface AdaptableFieldContext extends BaseContext {
|
|
201
204
|
}
|
|
202
205
|
/**
|
|
@@ -16,8 +16,11 @@ export interface GridFilterOptions<TData = any> {
|
|
|
16
16
|
*/
|
|
17
17
|
clearGridFilterOnStartUp?: boolean;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* List of Editors that can create a Grid Filter
|
|
21
|
+
*/
|
|
19
22
|
export type GridFilterEditors = GridFilterEditor[];
|
|
20
23
|
/**
|
|
21
|
-
*
|
|
24
|
+
* Editor to use for Grid Filter: 'ExpressionEditor' or 'QueryBuilder'
|
|
22
25
|
*/
|
|
23
26
|
export type GridFilterEditor = 'ExpressionEditor' | 'QueryBuilder';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AdaptableState } from '../PredefinedConfig/AdaptableState';
|
|
2
2
|
/**
|
|
3
|
-
* Options related to Adaptable State hydration/dehydration
|
|
3
|
+
* Options related to Adaptable State hydration / dehydration; allows users to intercept state persistence and loading with custom functionality
|
|
4
4
|
*/
|
|
5
5
|
export interface StateOptions {
|
|
6
6
|
/**
|
|
@@ -50,10 +50,7 @@ import { CommentApi } from './CommentApi';
|
|
|
50
50
|
import { ColumnMenuApi } from './ColumnMenuApi';
|
|
51
51
|
import { ContextMenuApi } from './ContextMenuApi';
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
* The `AdaptableApi` provides developers with run-time access to AdapTable.
|
|
55
|
-
*
|
|
56
|
-
* Has a huge number of classes each dedicated to a specific AdapTable Module or functionality
|
|
53
|
+
* Provides developers with run-time access to AdapTable. Contains many classes each dedicated to a specific AdapTable Module or functionality
|
|
57
54
|
*/
|
|
58
55
|
export interface AdaptableApi {
|
|
59
56
|
/**
|
|
@@ -37,7 +37,7 @@ export interface ColumnScopeApi {
|
|
|
37
37
|
*/
|
|
38
38
|
scopeHasColumnType(scope: ColumnScope): boolean;
|
|
39
39
|
/**
|
|
40
|
-
* True if
|
|
40
|
+
* True if Scope is DataTypes and contains just 'Boolean'
|
|
41
41
|
* @param scope Scope to check
|
|
42
42
|
*/
|
|
43
43
|
scopeHasOnlyBooleanDataType(scope: ColumnScope): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SystemStatusMessageInfo } from '../../PredefinedConfig/Common/SystemStatusMessageInfo';
|
|
2
2
|
import { BaseEventInfo } from './BaseEventInfo';
|
|
3
3
|
/**
|
|
4
|
-
* Object returned by
|
|
4
|
+
* Object returned by SystemStatusMessageDisplayed Event
|
|
5
5
|
*/
|
|
6
6
|
export interface SystemStatusMessageDisplayedInfo extends BaseEventInfo {
|
|
7
7
|
/**
|
|
@@ -342,7 +342,7 @@ export class GridApiImpl extends ApiBase {
|
|
|
342
342
|
this.adaptable.expandAllRowGroups();
|
|
343
343
|
}
|
|
344
344
|
collapseAllRowGroups() {
|
|
345
|
-
this.adaptable.
|
|
345
|
+
this.adaptable.collapseAllRowGroups();
|
|
346
346
|
}
|
|
347
347
|
getExpandRowGroupsKeys() {
|
|
348
348
|
return this.adaptable.getExpandRowGroupsKeys();
|
|
@@ -5,6 +5,7 @@ import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
|
5
5
|
import { AlertModuleId } from '../../Utilities/Constants/ModuleConstants';
|
|
6
6
|
import { isCellDataChangedInfo } from '../../Utilities/Services/Interface/IAlertService';
|
|
7
7
|
import ObjectFactory from '../../Utilities/ObjectFactory';
|
|
8
|
+
import Helper from '../../Utilities/Helpers/Helper';
|
|
8
9
|
export class AlertInternalApi extends ApiBase {
|
|
9
10
|
getExpressionForAlertRule(alertRule) {
|
|
10
11
|
var expression;
|
|
@@ -631,19 +632,19 @@ export class AlertInternalApi extends ApiBase {
|
|
|
631
632
|
return text;
|
|
632
633
|
}
|
|
633
634
|
if (context === null || context === void 0 ? void 0 : context.newValue) {
|
|
634
|
-
text =
|
|
635
|
+
text = Helper.replaceAll(text, '[newValue]', context.newValue);
|
|
635
636
|
}
|
|
636
637
|
if (context === null || context === void 0 ? void 0 : context.oldValue) {
|
|
637
|
-
text =
|
|
638
|
+
text = Helper.replaceAll(text, '[oldValue]', context.oldValue);
|
|
638
639
|
}
|
|
639
640
|
if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
|
|
640
|
-
text =
|
|
641
|
+
text = Helper.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
|
|
641
642
|
}
|
|
642
643
|
if (context === null || context === void 0 ? void 0 : context.timestamp) {
|
|
643
|
-
text =
|
|
644
|
+
text = Helper.replaceAll(text, '[timestamp]', context.timestamp + '');
|
|
644
645
|
}
|
|
645
646
|
if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
|
|
646
|
-
text =
|
|
647
|
+
text = Helper.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
|
|
647
648
|
}
|
|
648
649
|
if (context === null || context === void 0 ? void 0 : context.trigger) {
|
|
649
650
|
const dataChangeTriggerMap = {
|
|
@@ -661,56 +662,28 @@ export class AlertInternalApi extends ApiBase {
|
|
|
661
662
|
const mappedTrigger =
|
|
662
663
|
// @ts-ignore
|
|
663
664
|
(_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
|
|
664
|
-
text =
|
|
665
|
+
text = Helper.replaceAll(text, '[trigger]', mappedTrigger);
|
|
665
666
|
}
|
|
666
667
|
if (context === null || context === void 0 ? void 0 : context.column) {
|
|
667
|
-
text =
|
|
668
|
+
text = Helper.replaceAll(text, '[column]', this.getColumnApi().getFriendlyNameForColumnId(context.column.columnId));
|
|
668
669
|
}
|
|
669
670
|
if (context === null || context === void 0 ? void 0 : context.rowNode) {
|
|
670
|
-
const columns =
|
|
671
|
+
const columns = Helper.extractColsFromText(text);
|
|
671
672
|
for (const column of columns) {
|
|
672
673
|
if (this.getColumnApi().getColumnWithColumnId(column)) {
|
|
673
|
-
text =
|
|
674
|
+
text = Helper.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
|
|
674
675
|
}
|
|
675
676
|
}
|
|
676
677
|
}
|
|
677
678
|
if (text.indexOf('[context') !== -1) {
|
|
678
679
|
const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
|
|
679
|
-
const agGridContextKeys =
|
|
680
|
+
const agGridContextKeys = Helper.extractContextKeysFromText(text);
|
|
680
681
|
for (const key of agGridContextKeys) {
|
|
681
682
|
if (agGridContext[key]) {
|
|
682
|
-
text =
|
|
683
|
+
text = Helper.replaceAll(text, `[context.${key}]`, agGridContext[key]);
|
|
683
684
|
}
|
|
684
685
|
}
|
|
685
686
|
}
|
|
686
687
|
return text;
|
|
687
688
|
}
|
|
688
|
-
replaceAll(text, toReplace, replaceWith) {
|
|
689
|
-
if (!text) {
|
|
690
|
-
return text;
|
|
691
|
-
}
|
|
692
|
-
// fails for []
|
|
693
|
-
toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
|
|
694
|
-
return text.replace(new RegExp(toReplace, 'g'), replaceWith);
|
|
695
|
-
}
|
|
696
|
-
extractColsFromText(text) {
|
|
697
|
-
// rowData.columnName => columnName
|
|
698
|
-
const regex = /\[rowData\.(.*?)\]/g;
|
|
699
|
-
let m;
|
|
700
|
-
const cols = [];
|
|
701
|
-
while ((m = regex.exec(text)) !== null) {
|
|
702
|
-
cols.push(m[1]);
|
|
703
|
-
}
|
|
704
|
-
return cols;
|
|
705
|
-
}
|
|
706
|
-
extractContextKeysFromText(text) {
|
|
707
|
-
// context.columnName => columnName
|
|
708
|
-
const regex = /\[context\.(.*?)\]/g;
|
|
709
|
-
let m;
|
|
710
|
-
const contextKeys = [];
|
|
711
|
-
while ((m = regex.exec(text)) !== null) {
|
|
712
|
-
contextKeys.push(m[1]);
|
|
713
|
-
}
|
|
714
|
-
return contextKeys;
|
|
715
|
-
}
|
|
716
689
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
2
|
export class CommentsInternalApi extends ApiBase {
|
|
3
3
|
areCommentsSupported() {
|
|
4
|
-
var _a;
|
|
5
4
|
const currentLayout = this.getLayoutApi().getCurrentLayout();
|
|
6
5
|
if (currentLayout.EnablePivot) {
|
|
7
6
|
return false;
|
|
8
7
|
}
|
|
9
|
-
if ((_a = currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.RowGroupedColumns) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
8
|
return true;
|
|
13
9
|
}
|
|
14
10
|
}
|
|
@@ -56,14 +56,14 @@ export declare class FormatColumnInternalApi extends ApiBase {
|
|
|
56
56
|
* @param customDisplayFormatterContext context that includes value to format
|
|
57
57
|
* @param options formatter options
|
|
58
58
|
*/
|
|
59
|
-
getNumberFormattedValue(value: any, node: IRowNode,
|
|
59
|
+
getNumberFormattedValue(value: any, node: IRowNode, column: AdaptableColumn, options: AdaptableFormat['Options']): any;
|
|
60
60
|
/**
|
|
61
61
|
* Format value according to format options.
|
|
62
62
|
*
|
|
63
63
|
* @param value context that includes value to format
|
|
64
64
|
* @param options formatter options
|
|
65
65
|
*/
|
|
66
|
-
getStringFormattedValue(value: any, node: IRowNode,
|
|
66
|
+
getStringFormattedValue(value: any, node: IRowNode, column: AdaptableColumn, options: StringFormatterOptions): string;
|
|
67
67
|
/**
|
|
68
68
|
* Format value according to format options.
|
|
69
69
|
*
|
|
@@ -91,9 +91,9 @@ export class FormatColumnInternalApi extends ApiBase {
|
|
|
91
91
|
* @param customDisplayFormatterContext context that includes value to format
|
|
92
92
|
* @param options formatter options
|
|
93
93
|
*/
|
|
94
|
-
getNumberFormattedValue(value, node,
|
|
95
|
-
const preparedValue = this.applyCustomFormatters(value, node,
|
|
96
|
-
return FormatHelper.NumberFormatter(preparedValue, options);
|
|
94
|
+
getNumberFormattedValue(value, node, column, options) {
|
|
95
|
+
const preparedValue = this.applyCustomFormatters(value, node, column, options);
|
|
96
|
+
return FormatHelper.NumberFormatter(preparedValue, options, node, column, this.getAdaptableApi());
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Format value according to format options.
|
|
@@ -101,9 +101,9 @@ export class FormatColumnInternalApi extends ApiBase {
|
|
|
101
101
|
* @param value context that includes value to format
|
|
102
102
|
* @param options formatter options
|
|
103
103
|
*/
|
|
104
|
-
getStringFormattedValue(value, node,
|
|
105
|
-
const preparedValue = this.applyCustomFormatters(value, node,
|
|
106
|
-
return FormatHelper.StringFormatter(preparedValue, options);
|
|
104
|
+
getStringFormattedValue(value, node, column, options) {
|
|
105
|
+
const preparedValue = this.applyCustomFormatters(value, node, column, options);
|
|
106
|
+
return FormatHelper.StringFormatter(preparedValue, options, node, column, this.getAdaptableApi());
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Format value according to format options.
|
|
@@ -84,7 +84,7 @@ export class GridInternalApi extends ApiBase {
|
|
|
84
84
|
const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
|
|
85
85
|
let valueOptions = [];
|
|
86
86
|
if (shouldShowValuesCount) {
|
|
87
|
-
const allGridCells = this.adaptable.getGridCellsForColumn(columnId,
|
|
87
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(columnId, this.getColumnFilterOptions().valuesFilterOptions.showCurrentlyFilteredValuesCount);
|
|
88
88
|
const allGridValues = allGridCells.map((gc) => gc.displayValue);
|
|
89
89
|
const newsortedDistinctValues = sortedDistinctValues.filter((gc) => gc.displayValue != undefined && gc.displayValue != '' && gc.displayValue != null);
|
|
90
90
|
valueOptions = newsortedDistinctValues.map((cv) => {
|
|
@@ -144,7 +144,7 @@ export class GridInternalApi extends ApiBase {
|
|
|
144
144
|
addPredicateValues(params) {
|
|
145
145
|
var _a, _b, _c, _d;
|
|
146
146
|
const { valueOptions, column, shouldShowValuesCount, visibleRowsOnly } = params;
|
|
147
|
-
const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId,
|
|
147
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId, visibleRowsOnly);
|
|
148
148
|
const adaptableApi = this.getAdaptableApi();
|
|
149
149
|
const predicateIds = adaptableApi.columnFilterApi.internalApi.getValuesFitlerPredicateIds(column);
|
|
150
150
|
if (ArrayExtensions.IsNullOrEmpty(predicateIds)) {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
2
|
export class NoteInternalApi extends ApiBase {
|
|
3
3
|
areNotesSupported() {
|
|
4
|
-
var _a;
|
|
5
4
|
const currentLayout = this.getLayoutApi().getCurrentLayout();
|
|
6
5
|
if (currentLayout.EnablePivot) {
|
|
7
6
|
return false;
|
|
8
7
|
}
|
|
9
|
-
if ((_a = currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.RowGroupedColumns) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
8
|
return true;
|
|
13
9
|
}
|
|
14
10
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { StatusPanelDef } from '@ag-grid-community/core';
|
|
2
2
|
import { AdaptableStatusBar } from '../PredefinedConfig/StatusBarState';
|
|
3
3
|
/**
|
|
4
|
-
* Methods for
|
|
4
|
+
* Methods for managing the AdapTable Status Bar
|
|
5
5
|
*/
|
|
6
6
|
export interface StatusBarApi {
|
|
7
7
|
/**
|
|
8
|
-
* Retrieves
|
|
8
|
+
* Retrieves current AG Grid Status Bar Panels
|
|
9
9
|
*/
|
|
10
10
|
getAgGridStatusPanels(): StatusPanelDef[];
|
|
11
11
|
/**
|
|
12
|
-
* Retrieves
|
|
12
|
+
* Retrieves current AdapTable Status Bar Panels
|
|
13
13
|
*/
|
|
14
14
|
getAdaptableStatusBars: () => AdaptableStatusBar[];
|
|
15
15
|
/**
|
|
16
|
-
* Sets
|
|
17
|
-
* @param statusPanels
|
|
16
|
+
* Sets Adaptable Status Bar Panels
|
|
17
|
+
* @param statusPanels Adaptable Status Bar Panels
|
|
18
18
|
*/
|
|
19
19
|
setStatusBarPanels: (statusPanels: AdaptableStatusBar[]) => void;
|
|
20
20
|
}
|
|
@@ -54,4 +54,4 @@ export interface AdaptableBaseIcon {
|
|
|
54
54
|
/**
|
|
55
55
|
* All AdapTable System Icon names
|
|
56
56
|
*/
|
|
57
|
-
export type AdaptableSystemIconName = 'add' | 'alert' | 'building' | 'laptop' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-up-long' | 'arrow-down-long' | 'arrow-expand' | 'paperclip' | 'unfilled-circle' | 'boolean-list' | 'broadcast' | 'brush' | 'spanner' | 'edit-table' | '
|
|
57
|
+
export type AdaptableSystemIconName = 'add' | 'alert' | 'building' | 'laptop' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-up-long' | 'arrow-down-long' | 'arrow-expand' | 'paperclip' | 'unfilled-circle' | 'boolean-list' | 'broadcast' | 'brush' | 'spanner' | 'edit-table' | 'calculated-column' | 'calendar' | 'call' | 'cells' | 'fdc3' | 'flag' | 'chart' | 'chat' | 'check' | 'check-circle' | 'checked' | 'clone' | 'close' | 'cloud-upload' | 'collapse' | 'column-add' | 'columns' | 'filter-list' | 'copy' | 'comment' | 'comments' | 'contains' | 'dashboard' | 'json' | 'data-set' | 'date-range' | 'delete' | 'division' | 'dock' | 'dollar' | 'drag' | 'edit' | 'ends-with' | 'equals' | 'equation' | 'error' | 'excel' | 'expand' | 'exponent' | 'export' | 'export-data' | 'fast-backward' | 'fast-forward' | 'filter' | 'filter-off' | 'lightning' | 'folder' | 'folder-open' | 'folder-shared' | 'color-palette' | 'horizontal-lines' | 'function' | 'greater-than' | 'greater-than-or-equal' | 'history' | 'home' | 'import-export' | 'info' | 'brain' | 'download' | 'grid' | 'interactions' | 'less-than' | 'less-than-or-equal' | 'list' | 'logout' | 'mail' | 'menu' | 'minus' | 'multiplication' | 'money' | 'newpage' | 'news' | 'filled-circle' | 'not-contains' | 'not-equal' | 'open-in-new' | 'order' | 'organisation' | 'pause' | 'percent' | 'percent-tag' | 'person' | 'contact' | 'pie-chart' | 'play' | 'plus' | 'add-circle' | 'search' | 'search-table' | 'select-all' | 'select-off' | 'select-fwd' | 'sync' | 'quote' | 'refresh' | 'regex' | 'reminder' | 'save' | 'schedule' | 'science' | 'settings' | 'link' | 'sort-asc' | 'sort-desc' | 'spark-line' | 'resume' | 'starts-with' | 'assignment' | 'statusbar' | 'stop' | 'traffic-lights' | 'tab-unselected' | 'theme' | 'clipboard' | 'target' | 'triangle-down' | 'triangle-up' | 'unchecked' | 'undo' | 'downloaded' | 'upload' | 'warning' | 'gradient' | 'badge' | 'italic' | 'bold' | 'align-left' | 'align-right' | 'align-center' | 'align-justify' | 'underline' | 'strikethrough' | 'overline' | 'case-upper' | 'case-lower' | 'case-sentence' | 'visibility-on' | 'visibility-off' | 'visibility-off-bold' | 'visibility-on-bold' | 'note' | 'import' | 'grid-filter' | 'grid-info' | 'csv' | 'rows' | 'expand-all' | 'collapse-all' | 'column-outline';
|
|
@@ -5,7 +5,13 @@ import { SelectedCellInfo } from '../Selection/SelectedCellInfo';
|
|
|
5
5
|
import { SelectedRowInfo } from '../Selection/SelectedRowInfo';
|
|
6
6
|
import { Column, IRowNode } from '@ag-grid-community/core';
|
|
7
7
|
import { AdaptableIcon, BaseContext } from '../../types';
|
|
8
|
+
/**
|
|
9
|
+
* Name of Column Menu Item provided by AdapTable
|
|
10
|
+
*/
|
|
8
11
|
export type AdaptableColumnMenuItemName = (typeof ADAPTABLE_COLUMN_MENU_ITEMS)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Name of Context Menu Item provided by AdapTable
|
|
14
|
+
*/
|
|
9
15
|
export type AdaptableContextMenuItemName = (typeof ADAPTABLE_CONTEXT_MENU_ITEMS)[number];
|
|
10
16
|
/**
|
|
11
17
|
* List of Shipped Adaptable Column Menu Items
|
|
@@ -9,7 +9,7 @@ import { getCalculatedColumnSettingsTags } from '../View/CalculatedColumn/Utilit
|
|
|
9
9
|
import Helper from '../Utilities/Helpers/Helper';
|
|
10
10
|
export class CalculatedColumnModule extends AdaptableModuleBase {
|
|
11
11
|
constructor(api) {
|
|
12
|
-
super(ModuleConstants.CalculatedColumnModuleId, ModuleConstants.CalculatedColumnFriendlyName, '
|
|
12
|
+
super(ModuleConstants.CalculatedColumnModuleId, ModuleConstants.CalculatedColumnFriendlyName, 'calculated-column', 'CalculatedColumnPopup', 'Create bespoke columns whose cell value is derived dynamically from an Expression', api);
|
|
13
13
|
}
|
|
14
14
|
onAdaptableReady() {
|
|
15
15
|
this.api.calculatedColumnApi.refreshAggregatedCalculatedColumns();
|
|
@@ -71,17 +71,19 @@ export class ColumnFilterModule extends AdaptableModuleBase {
|
|
|
71
71
|
this.api.optionsApi.getColumnFilterOptions().useAdaptableColumnFiltering) {
|
|
72
72
|
const existingColumnFilter = this.getExistingColumnFilter(menuContext.adaptableColumn);
|
|
73
73
|
if (!existingColumnFilter) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
if (!menuContext.isRowGroupColumn && !menuContext.isGroupedNode) {
|
|
75
|
+
let isMultiple = menuContext.selectedCellInfo.gridCells.length > 1;
|
|
76
|
+
let clickFunction = isMultiple
|
|
77
|
+
? () => {
|
|
78
|
+
this.api.columnFilterApi.internalApi.createValuesColumnFilterForCells(menuContext.selectedCellInfo.gridCells);
|
|
79
|
+
}
|
|
80
|
+
: () => {
|
|
81
|
+
this.api.columnFilterApi.internalApi.createEqualityColumnFilterForCell(menuContext.selectedCellInfo.gridCells[0]);
|
|
82
|
+
};
|
|
83
|
+
return [
|
|
84
|
+
this.createMenuItemClickFunction('column-filter-on-cell-value', isMultiple ? 'Filter on Cell Values' : 'Filter on Cell Value', this.moduleInfo.Glyph, clickFunction),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
89
|
return [
|
|
@@ -32,6 +32,9 @@ export class CommentModule extends AdaptableModuleBase {
|
|
|
32
32
|
if (!this.api.commentApi.internalApi.areCommentsSupported()) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
+
if (menuContext.isRowGroupColumn || menuContext.isGroupedNode) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
35
38
|
const items = [];
|
|
36
39
|
const isCellCommentable = typeof ((_b = (_a = this.api.optionsApi) === null || _a === void 0 ? void 0 : _a.getCommentOptions()) === null || _b === void 0 ? void 0 : _b.isCellCommentable) === 'function'
|
|
37
40
|
? (_d = (_c = this.api.optionsApi) === null || _c === void 0 ? void 0 : _c.getCommentOptions()) === null || _d === void 0 ? void 0 : _d.isCellCommentable(Object.assign({ gridCell: menuContext.gridCell }, createBaseContext(this.api)))
|
|
@@ -18,6 +18,9 @@ export class NoteModule extends AdaptableModuleBase {
|
|
|
18
18
|
if (!this.api.noteApi.internalApi.areNotesSupported()) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
+
if (menuContext.isRowGroupColumn || menuContext.isGroupedNode) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
21
24
|
const isReadOnly = this.adaptable.api.entitlementApi.getEntitlementAccessLevelForModule(this.moduleInfo.ModuleName) === 'ReadOnly';
|
|
22
25
|
if (isReadOnly) {
|
|
23
26
|
return undefined;
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import { NumberFormatterOptions, DateFormatterOptions,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { NumberFormatterOptions, DateFormatterOptions, StringFormatterOptions } from '../../PredefinedConfig/Common/AdaptableFormat';
|
|
2
|
+
import { IRowNode } from '@ag-grid-community/core';
|
|
3
|
+
import { AdaptableApi, AdaptableColumn } from '../../types';
|
|
4
|
+
export declare function NumberFormatter(input: number, options?: NumberFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
|
|
4
5
|
export declare function DateFormatter(input: number | Date | string, options: DateFormatterOptions, strictFormatting?: boolean): string | undefined;
|
|
5
|
-
export declare function StringFormatter(input: string, options?: StringFormatterOptions): string;
|
|
6
|
+
export declare function StringFormatter(input: string, options?: StringFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
|
|
7
|
+
/**
|
|
8
|
+
* Supported tokens:
|
|
9
|
+
* - column -> [column]
|
|
10
|
+
* - input -> [value]
|
|
11
|
+
* - rowData.colId -> [rowData.colId]
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePlaceholders(text: string, context: {
|
|
14
|
+
rowNode: IRowNode;
|
|
15
|
+
input: any;
|
|
16
|
+
column: AdaptableColumn<any>;
|
|
17
|
+
api: AdaptableApi;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare const FormatContentHelper: {
|
|
20
|
+
resolvePlaceholders: typeof resolvePlaceholders;
|
|
21
|
+
};
|
|
6
22
|
declare const _default: {
|
|
7
23
|
NumberFormatter: typeof NumberFormatter;
|
|
8
24
|
DateFormatter: typeof DateFormatter;
|
|
9
25
|
StringFormatter: typeof StringFormatter;
|
|
26
|
+
FormatContentHelper: {
|
|
27
|
+
resolvePlaceholders: typeof resolvePlaceholders;
|
|
28
|
+
};
|
|
10
29
|
};
|
|
11
30
|
export default _default;
|
|
@@ -3,18 +3,33 @@
|
|
|
3
3
|
import dateFnsFormat from 'date-fns/format';
|
|
4
4
|
import { sentenceCase } from 'sentence-case';
|
|
5
5
|
import { DEFAULT_DATE_FORMAT_PATTERN } from '../Constants/GeneralConstants';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import Helper from '../../Utilities/Helpers/Helper';
|
|
7
|
+
/*
|
|
8
|
+
export function Format(input: any, format: AdaptableFormat) {
|
|
9
|
+
if (format.Formatter === 'NumberFormatter') {
|
|
10
|
+
return NumberFormatter(input, format.Options);
|
|
11
|
+
}
|
|
12
|
+
if (format.Formatter === 'DateFormatter') {
|
|
13
|
+
return DateFormatter(input, format.Options);
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Unknown formatter');
|
|
16
|
+
}
|
|
17
|
+
*/
|
|
18
|
+
export function NumberFormatter(input, options = {}, rowNode, column, api) {
|
|
19
|
+
var _a;
|
|
20
|
+
let preparedInput;
|
|
21
|
+
if (options.Content) {
|
|
22
|
+
const context = {
|
|
23
|
+
column,
|
|
24
|
+
rowNode,
|
|
25
|
+
input,
|
|
26
|
+
api,
|
|
27
|
+
};
|
|
28
|
+
preparedInput = FormatContentHelper.resolvePlaceholders(options.Content.toString(), context);
|
|
9
29
|
}
|
|
10
|
-
|
|
11
|
-
|
|
30
|
+
else {
|
|
31
|
+
preparedInput = input;
|
|
12
32
|
}
|
|
13
|
-
throw new Error('Unknown formatter');
|
|
14
|
-
}
|
|
15
|
-
export function NumberFormatter(input, options = {}) {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
let preparedInput = (_a = options.Content) !== null && _a !== void 0 ? _a : input;
|
|
18
33
|
if (preparedInput == null || preparedInput == undefined) {
|
|
19
34
|
return undefined;
|
|
20
35
|
}
|
|
@@ -66,7 +81,7 @@ export function NumberFormatter(input, options = {}) {
|
|
|
66
81
|
digitsToUse = options.FractionDigits;
|
|
67
82
|
}
|
|
68
83
|
else {
|
|
69
|
-
let decimalCount = Math.floor(n) === n ? 0 : ((
|
|
84
|
+
let decimalCount = Math.floor(n) === n ? 0 : ((_a = n.toString().split(fractionsSepatator)[1]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
70
85
|
digitsToUse = decimalCount;
|
|
71
86
|
}
|
|
72
87
|
s = n.toLocaleString('en-US', {
|
|
@@ -107,8 +122,20 @@ export function DateFormatter(input, options, strictFormatting = false) {
|
|
|
107
122
|
return input;
|
|
108
123
|
}
|
|
109
124
|
}
|
|
110
|
-
export function StringFormatter(input, options = {}) {
|
|
111
|
-
let preparedInput
|
|
125
|
+
export function StringFormatter(input, options = {}, rowNode, column, api) {
|
|
126
|
+
let preparedInput;
|
|
127
|
+
if (options.Content) {
|
|
128
|
+
const context = {
|
|
129
|
+
column,
|
|
130
|
+
rowNode,
|
|
131
|
+
input,
|
|
132
|
+
api,
|
|
133
|
+
};
|
|
134
|
+
preparedInput = FormatContentHelper.resolvePlaceholders(options.Content, context);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
preparedInput = input;
|
|
138
|
+
}
|
|
112
139
|
if (preparedInput == null || preparedInput == undefined) {
|
|
113
140
|
return undefined;
|
|
114
141
|
}
|
|
@@ -138,4 +165,36 @@ export function StringFormatter(input, options = {}) {
|
|
|
138
165
|
}
|
|
139
166
|
return s;
|
|
140
167
|
}
|
|
141
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Supported tokens:
|
|
170
|
+
* - column -> [column]
|
|
171
|
+
* - input -> [value]
|
|
172
|
+
* - rowData.colId -> [rowData.colId]
|
|
173
|
+
*/
|
|
174
|
+
export function resolvePlaceholders(text, context) {
|
|
175
|
+
if (!text) {
|
|
176
|
+
return text;
|
|
177
|
+
}
|
|
178
|
+
if (!context) {
|
|
179
|
+
return text;
|
|
180
|
+
}
|
|
181
|
+
if (context === null || context === void 0 ? void 0 : context.input) {
|
|
182
|
+
text = Helper.replaceAll(text, '[value]', context.input);
|
|
183
|
+
}
|
|
184
|
+
if (context === null || context === void 0 ? void 0 : context.column) {
|
|
185
|
+
text = Helper.replaceAll(text, '[column]', context.api.columnApi.getFriendlyNameForColumnId(context.column.columnId));
|
|
186
|
+
}
|
|
187
|
+
if (context === null || context === void 0 ? void 0 : context.rowNode) {
|
|
188
|
+
const columns = Helper.extractColsFromText(text);
|
|
189
|
+
for (const column of columns) {
|
|
190
|
+
if (context.api.columnApi.getColumnWithColumnId(column)) {
|
|
191
|
+
text = Helper.replaceAll(text, `[rowData.${column}]`, context.api.gridApi.getRawValueFromRowNode(context.rowNode, column));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return text;
|
|
196
|
+
}
|
|
197
|
+
export const FormatContentHelper = {
|
|
198
|
+
resolvePlaceholders,
|
|
199
|
+
};
|
|
200
|
+
export default { NumberFormatter, DateFormatter, StringFormatter, FormatContentHelper };
|
|
@@ -18,6 +18,9 @@ export declare function meanNumberArray(numericValues: number[]): number;
|
|
|
18
18
|
export declare function medianNumberArray(numericValues: number[]): number;
|
|
19
19
|
export declare function modeNumberArray(numbers: number[]): number;
|
|
20
20
|
export declare function clamp(value: any, boundOne: number, boundTwo: number): number;
|
|
21
|
+
export declare function extractColsFromText(text: string): string[];
|
|
22
|
+
export declare function replaceAll(text: string, toReplace: string, replaceWith: string): string;
|
|
23
|
+
export declare function extractContextKeysFromText(text: string): string[];
|
|
21
24
|
export declare const Helper: {
|
|
22
25
|
objectExists: typeof objectExists;
|
|
23
26
|
objectNotExists: typeof objectNotExists;
|
|
@@ -38,5 +41,8 @@ export declare const Helper: {
|
|
|
38
41
|
medianNumberArray: typeof medianNumberArray;
|
|
39
42
|
modeNumberArray: typeof modeNumberArray;
|
|
40
43
|
clamp: typeof clamp;
|
|
44
|
+
extractColsFromText: typeof extractColsFromText;
|
|
45
|
+
replaceAll: typeof replaceAll;
|
|
46
|
+
extractContextKeysFromText: typeof extractContextKeysFromText;
|
|
41
47
|
};
|
|
42
48
|
export default Helper;
|