@adaptabletools/adaptable-cjs 18.1.7 → 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 +1 -1
- package/src/Api/Internal/AlertInternalApi.d.ts +0 -3
- package/src/Api/Internal/AlertInternalApi.js +12 -39
- 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/Utilities/Helpers/FormatHelper.d.ts +23 -4
- package/src/Utilities/Helpers/FormatHelper.js +75 -16
- package/src/Utilities/Helpers/Helper.d.ts +6 -0
- package/src/Utilities/Helpers/Helper.js +35 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +5 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -1
- package/src/agGrid/AdaptableAgGrid.js +9 -9
- package/src/env.js +2 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
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;
|
|
@@ -9,6 +9,7 @@ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Exten
|
|
|
9
9
|
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
10
10
|
const IAlertService_1 = require("../../Utilities/Services/Interface/IAlertService");
|
|
11
11
|
const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
|
|
12
|
+
const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
|
|
12
13
|
class AlertInternalApi extends ApiBase_1.ApiBase {
|
|
13
14
|
getExpressionForAlertRule(alertRule) {
|
|
14
15
|
var expression;
|
|
@@ -635,19 +636,19 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
|
|
|
635
636
|
return text;
|
|
636
637
|
}
|
|
637
638
|
if (context === null || context === void 0 ? void 0 : context.newValue) {
|
|
638
|
-
text =
|
|
639
|
+
text = Helper_1.default.replaceAll(text, '[newValue]', context.newValue);
|
|
639
640
|
}
|
|
640
641
|
if (context === null || context === void 0 ? void 0 : context.oldValue) {
|
|
641
|
-
text =
|
|
642
|
+
text = Helper_1.default.replaceAll(text, '[oldValue]', context.oldValue);
|
|
642
643
|
}
|
|
643
644
|
if (context === null || context === void 0 ? void 0 : context.primaryKeyValue) {
|
|
644
|
-
text =
|
|
645
|
+
text = Helper_1.default.replaceAll(text, '[primaryKeyValue]', context.primaryKeyValue);
|
|
645
646
|
}
|
|
646
647
|
if (context === null || context === void 0 ? void 0 : context.timestamp) {
|
|
647
|
-
text =
|
|
648
|
+
text = Helper_1.default.replaceAll(text, '[timestamp]', context.timestamp + '');
|
|
648
649
|
}
|
|
649
650
|
if (context === null || context === void 0 ? void 0 : context.numberOfRows) {
|
|
650
|
-
text =
|
|
651
|
+
text = Helper_1.default.replaceAll(text, '[numberOfRows]', context.numberOfRows + '');
|
|
651
652
|
}
|
|
652
653
|
if (context === null || context === void 0 ? void 0 : context.trigger) {
|
|
653
654
|
const dataChangeTriggerMap = {
|
|
@@ -665,57 +666,29 @@ class AlertInternalApi extends ApiBase_1.ApiBase {
|
|
|
665
666
|
const mappedTrigger =
|
|
666
667
|
// @ts-ignore
|
|
667
668
|
(_a = (dataChangeTriggerMap[context.trigger] || rowChangeTriggerMap[context.trigger])) !== null && _a !== void 0 ? _a : context.trigger;
|
|
668
|
-
text =
|
|
669
|
+
text = Helper_1.default.replaceAll(text, '[trigger]', mappedTrigger);
|
|
669
670
|
}
|
|
670
671
|
if (context === null || context === void 0 ? void 0 : context.column) {
|
|
671
|
-
text =
|
|
672
|
+
text = Helper_1.default.replaceAll(text, '[column]', this.getColumnApi().getFriendlyNameForColumnId(context.column.columnId));
|
|
672
673
|
}
|
|
673
674
|
if (context === null || context === void 0 ? void 0 : context.rowNode) {
|
|
674
|
-
const columns =
|
|
675
|
+
const columns = Helper_1.default.extractColsFromText(text);
|
|
675
676
|
for (const column of columns) {
|
|
676
677
|
if (this.getColumnApi().getColumnWithColumnId(column)) {
|
|
677
|
-
text =
|
|
678
|
+
text = Helper_1.default.replaceAll(text, `[rowData.${column}]`, this.getGridApi().getRawValueFromRowNode(context.rowNode, column));
|
|
678
679
|
}
|
|
679
680
|
}
|
|
680
681
|
}
|
|
681
682
|
if (text.indexOf('[context') !== -1) {
|
|
682
683
|
const agGridContext = (_c = (_b = this.adaptable.agGridAdapter).getGridOption) === null || _c === void 0 ? void 0 : _c.call(_b, 'context');
|
|
683
|
-
const agGridContextKeys =
|
|
684
|
+
const agGridContextKeys = Helper_1.default.extractContextKeysFromText(text);
|
|
684
685
|
for (const key of agGridContextKeys) {
|
|
685
686
|
if (agGridContext[key]) {
|
|
686
|
-
text =
|
|
687
|
+
text = Helper_1.default.replaceAll(text, `[context.${key}]`, agGridContext[key]);
|
|
687
688
|
}
|
|
688
689
|
}
|
|
689
690
|
}
|
|
690
691
|
return text;
|
|
691
692
|
}
|
|
692
|
-
replaceAll(text, toReplace, replaceWith) {
|
|
693
|
-
if (!text) {
|
|
694
|
-
return text;
|
|
695
|
-
}
|
|
696
|
-
// fails for []
|
|
697
|
-
toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
|
|
698
|
-
return text.replace(new RegExp(toReplace, 'g'), replaceWith);
|
|
699
|
-
}
|
|
700
|
-
extractColsFromText(text) {
|
|
701
|
-
// rowData.columnName => columnName
|
|
702
|
-
const regex = /\[rowData\.(.*?)\]/g;
|
|
703
|
-
let m;
|
|
704
|
-
const cols = [];
|
|
705
|
-
while ((m = regex.exec(text)) !== null) {
|
|
706
|
-
cols.push(m[1]);
|
|
707
|
-
}
|
|
708
|
-
return cols;
|
|
709
|
-
}
|
|
710
|
-
extractContextKeysFromText(text) {
|
|
711
|
-
// context.columnName => columnName
|
|
712
|
-
const regex = /\[context\.(.*?)\]/g;
|
|
713
|
-
let m;
|
|
714
|
-
const contextKeys = [];
|
|
715
|
-
while ((m = regex.exec(text)) !== null) {
|
|
716
|
-
contextKeys.push(m[1]);
|
|
717
|
-
}
|
|
718
|
-
return contextKeys;
|
|
719
|
-
}
|
|
720
693
|
}
|
|
721
694
|
exports.AlertInternalApi = AlertInternalApi;
|
|
@@ -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
|
*
|
|
@@ -95,9 +95,9 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
95
95
|
* @param customDisplayFormatterContext context that includes value to format
|
|
96
96
|
* @param options formatter options
|
|
97
97
|
*/
|
|
98
|
-
getNumberFormattedValue(value, node,
|
|
99
|
-
const preparedValue = this.applyCustomFormatters(value, node,
|
|
100
|
-
return FormatHelper_1.default.NumberFormatter(preparedValue, options);
|
|
98
|
+
getNumberFormattedValue(value, node, column, options) {
|
|
99
|
+
const preparedValue = this.applyCustomFormatters(value, node, column, options);
|
|
100
|
+
return FormatHelper_1.default.NumberFormatter(preparedValue, options, node, column, this.getAdaptableApi());
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Format value according to format options.
|
|
@@ -105,9 +105,9 @@ class FormatColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
105
105
|
* @param value context that includes value to format
|
|
106
106
|
* @param options formatter options
|
|
107
107
|
*/
|
|
108
|
-
getStringFormattedValue(value, node,
|
|
109
|
-
const preparedValue = this.applyCustomFormatters(value, node,
|
|
110
|
-
return FormatHelper_1.default.StringFormatter(preparedValue, options);
|
|
108
|
+
getStringFormattedValue(value, node, column, options) {
|
|
109
|
+
const preparedValue = this.applyCustomFormatters(value, node, column, options);
|
|
110
|
+
return FormatHelper_1.default.StringFormatter(preparedValue, options, node, column, this.getAdaptableApi());
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* Format value according to format options.
|
|
@@ -88,7 +88,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
|
|
|
88
88
|
const shouldShowValuesCount = this.shouldShowValuesCount(abColumn);
|
|
89
89
|
let valueOptions = [];
|
|
90
90
|
if (shouldShowValuesCount) {
|
|
91
|
-
const allGridCells = this.adaptable.getGridCellsForColumn(columnId,
|
|
91
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(columnId, this.getColumnFilterOptions().valuesFilterOptions.showCurrentlyFilteredValuesCount);
|
|
92
92
|
const allGridValues = allGridCells.map((gc) => gc.displayValue);
|
|
93
93
|
const newsortedDistinctValues = sortedDistinctValues.filter((gc) => gc.displayValue != undefined && gc.displayValue != '' && gc.displayValue != null);
|
|
94
94
|
valueOptions = newsortedDistinctValues.map((cv) => {
|
|
@@ -148,7 +148,7 @@ class GridInternalApi extends ApiBase_1.ApiBase {
|
|
|
148
148
|
addPredicateValues(params) {
|
|
149
149
|
var _a, _b, _c, _d;
|
|
150
150
|
const { valueOptions, column, shouldShowValuesCount, visibleRowsOnly } = params;
|
|
151
|
-
const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId,
|
|
151
|
+
const allGridCells = this.adaptable.getGridCellsForColumn(column.columnId, visibleRowsOnly);
|
|
152
152
|
const adaptableApi = this.getAdaptableApi();
|
|
153
153
|
const predicateIds = adaptableApi.columnFilterApi.internalApi.getValuesFitlerPredicateIds(column);
|
|
154
154
|
if (ArrayExtensions_1.default.IsNullOrEmpty(predicateIds)) {
|
|
@@ -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;
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormatContentHelper = exports.resolvePlaceholders = exports.StringFormatter = exports.DateFormatter = exports.NumberFormatter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
// TODO inspect why the following is erroring on angular build
|
|
6
6
|
// import dateFnsFormat from 'date-fns/format';
|
|
7
7
|
const format_1 = tslib_1.__importDefault(require("date-fns/format"));
|
|
8
8
|
const sentence_case_1 = require("sentence-case");
|
|
9
9
|
const GeneralConstants_1 = require("../Constants/GeneralConstants");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
|
|
11
|
+
/*
|
|
12
|
+
export function Format(input: any, format: AdaptableFormat) {
|
|
13
|
+
if (format.Formatter === 'NumberFormatter') {
|
|
14
|
+
return NumberFormatter(input, format.Options);
|
|
15
|
+
}
|
|
16
|
+
if (format.Formatter === 'DateFormatter') {
|
|
17
|
+
return DateFormatter(input, format.Options);
|
|
18
|
+
}
|
|
19
|
+
throw new Error('Unknown formatter');
|
|
20
|
+
}
|
|
21
|
+
*/
|
|
22
|
+
function NumberFormatter(input, options = {}, rowNode, column, api) {
|
|
23
|
+
var _a;
|
|
24
|
+
let preparedInput;
|
|
25
|
+
if (options.Content) {
|
|
26
|
+
const context = {
|
|
27
|
+
column,
|
|
28
|
+
rowNode,
|
|
29
|
+
input,
|
|
30
|
+
api,
|
|
31
|
+
};
|
|
32
|
+
preparedInput = exports.FormatContentHelper.resolvePlaceholders(options.Content.toString(), context);
|
|
13
33
|
}
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
else {
|
|
35
|
+
preparedInput = input;
|
|
16
36
|
}
|
|
17
|
-
throw new Error('Unknown formatter');
|
|
18
|
-
}
|
|
19
|
-
exports.Format = Format;
|
|
20
|
-
function NumberFormatter(input, options = {}) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
let preparedInput = (_a = options.Content) !== null && _a !== void 0 ? _a : input;
|
|
23
37
|
if (preparedInput == null || preparedInput == undefined) {
|
|
24
38
|
return undefined;
|
|
25
39
|
}
|
|
@@ -71,7 +85,7 @@ function NumberFormatter(input, options = {}) {
|
|
|
71
85
|
digitsToUse = options.FractionDigits;
|
|
72
86
|
}
|
|
73
87
|
else {
|
|
74
|
-
let decimalCount = Math.floor(n) === n ? 0 : ((
|
|
88
|
+
let decimalCount = Math.floor(n) === n ? 0 : ((_a = n.toString().split(fractionsSepatator)[1]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
75
89
|
digitsToUse = decimalCount;
|
|
76
90
|
}
|
|
77
91
|
s = n.toLocaleString('en-US', {
|
|
@@ -114,8 +128,20 @@ function DateFormatter(input, options, strictFormatting = false) {
|
|
|
114
128
|
}
|
|
115
129
|
}
|
|
116
130
|
exports.DateFormatter = DateFormatter;
|
|
117
|
-
function StringFormatter(input, options = {}) {
|
|
118
|
-
let preparedInput
|
|
131
|
+
function StringFormatter(input, options = {}, rowNode, column, api) {
|
|
132
|
+
let preparedInput;
|
|
133
|
+
if (options.Content) {
|
|
134
|
+
const context = {
|
|
135
|
+
column,
|
|
136
|
+
rowNode,
|
|
137
|
+
input,
|
|
138
|
+
api,
|
|
139
|
+
};
|
|
140
|
+
preparedInput = exports.FormatContentHelper.resolvePlaceholders(options.Content, context);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
preparedInput = input;
|
|
144
|
+
}
|
|
119
145
|
if (preparedInput == null || preparedInput == undefined) {
|
|
120
146
|
return undefined;
|
|
121
147
|
}
|
|
@@ -146,4 +172,37 @@ function StringFormatter(input, options = {}) {
|
|
|
146
172
|
return s;
|
|
147
173
|
}
|
|
148
174
|
exports.StringFormatter = StringFormatter;
|
|
149
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Supported tokens:
|
|
177
|
+
* - column -> [column]
|
|
178
|
+
* - input -> [value]
|
|
179
|
+
* - rowData.colId -> [rowData.colId]
|
|
180
|
+
*/
|
|
181
|
+
function resolvePlaceholders(text, context) {
|
|
182
|
+
if (!text) {
|
|
183
|
+
return text;
|
|
184
|
+
}
|
|
185
|
+
if (!context) {
|
|
186
|
+
return text;
|
|
187
|
+
}
|
|
188
|
+
if (context === null || context === void 0 ? void 0 : context.input) {
|
|
189
|
+
text = Helper_1.default.replaceAll(text, '[value]', context.input);
|
|
190
|
+
}
|
|
191
|
+
if (context === null || context === void 0 ? void 0 : context.column) {
|
|
192
|
+
text = Helper_1.default.replaceAll(text, '[column]', context.api.columnApi.getFriendlyNameForColumnId(context.column.columnId));
|
|
193
|
+
}
|
|
194
|
+
if (context === null || context === void 0 ? void 0 : context.rowNode) {
|
|
195
|
+
const columns = Helper_1.default.extractColsFromText(text);
|
|
196
|
+
for (const column of columns) {
|
|
197
|
+
if (context.api.columnApi.getColumnWithColumnId(column)) {
|
|
198
|
+
text = Helper_1.default.replaceAll(text, `[rowData.${column}]`, context.api.gridApi.getRawValueFromRowNode(context.rowNode, column));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return text;
|
|
203
|
+
}
|
|
204
|
+
exports.resolvePlaceholders = resolvePlaceholders;
|
|
205
|
+
exports.FormatContentHelper = {
|
|
206
|
+
resolvePlaceholders,
|
|
207
|
+
};
|
|
208
|
+
exports.default = { NumberFormatter, DateFormatter, StringFormatter, FormatContentHelper: exports.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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Helper = exports.clamp = exports.modeNumberArray = exports.medianNumberArray = exports.meanNumberArray = exports.standardDeviationNumberArray = exports.sumNumberArray = exports.roundNumberTo4dp = exports.roundNumber = exports.isInputNotNullOrEmpty = exports.isInputNullOrEmpty = exports.returnItemCount = exports.copyToClipboard = exports.createDownloadedFile = exports.convertArrayToCsv = exports.arrayToKeyMap = exports.cloneObject = exports.getStringRepresentionFromKey = exports.objectHasKeys = exports.objectNotExists = exports.objectExists = void 0;
|
|
3
|
+
exports.Helper = exports.extractContextKeysFromText = exports.replaceAll = exports.extractColsFromText = exports.clamp = exports.modeNumberArray = exports.medianNumberArray = exports.meanNumberArray = exports.standardDeviationNumberArray = exports.sumNumberArray = exports.roundNumberTo4dp = exports.roundNumber = exports.isInputNotNullOrEmpty = exports.isInputNullOrEmpty = exports.returnItemCount = exports.copyToClipboard = exports.createDownloadedFile = exports.convertArrayToCsv = exports.arrayToKeyMap = exports.cloneObject = exports.getStringRepresentionFromKey = exports.objectHasKeys = exports.objectNotExists = exports.objectExists = void 0;
|
|
4
4
|
const StringExtensions_1 = require("../Extensions/StringExtensions");
|
|
5
5
|
const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
|
|
6
6
|
function objectExists(item) {
|
|
@@ -250,6 +250,37 @@ function clamp(value, boundOne, boundTwo) {
|
|
|
250
250
|
return value;
|
|
251
251
|
}
|
|
252
252
|
exports.clamp = clamp;
|
|
253
|
+
function extractColsFromText(text) {
|
|
254
|
+
// rowData.columnName => columnName
|
|
255
|
+
const regex = /\[rowData\.(.*?)\]/g;
|
|
256
|
+
let m;
|
|
257
|
+
const cols = [];
|
|
258
|
+
while ((m = regex.exec(text)) !== null) {
|
|
259
|
+
cols.push(m[1]);
|
|
260
|
+
}
|
|
261
|
+
return cols;
|
|
262
|
+
}
|
|
263
|
+
exports.extractColsFromText = extractColsFromText;
|
|
264
|
+
function replaceAll(text, toReplace, replaceWith) {
|
|
265
|
+
if (!text) {
|
|
266
|
+
return text;
|
|
267
|
+
}
|
|
268
|
+
// fails for []
|
|
269
|
+
toReplace = toReplace.replace('[', '\\[').replace(']', '\\]');
|
|
270
|
+
return text.replace(new RegExp(toReplace, 'g'), replaceWith);
|
|
271
|
+
}
|
|
272
|
+
exports.replaceAll = replaceAll;
|
|
273
|
+
function extractContextKeysFromText(text) {
|
|
274
|
+
// context.columnName => columnName
|
|
275
|
+
const regex = /\[context\.(.*?)\]/g;
|
|
276
|
+
let m;
|
|
277
|
+
const contextKeys = [];
|
|
278
|
+
while ((m = regex.exec(text)) !== null) {
|
|
279
|
+
contextKeys.push(m[1]);
|
|
280
|
+
}
|
|
281
|
+
return contextKeys;
|
|
282
|
+
}
|
|
283
|
+
exports.extractContextKeysFromText = extractContextKeysFromText;
|
|
253
284
|
exports.Helper = {
|
|
254
285
|
objectExists,
|
|
255
286
|
objectNotExists,
|
|
@@ -270,5 +301,8 @@ exports.Helper = {
|
|
|
270
301
|
medianNumberArray,
|
|
271
302
|
modeNumberArray,
|
|
272
303
|
clamp,
|
|
304
|
+
extractColsFromText,
|
|
305
|
+
replaceAll,
|
|
306
|
+
extractContextKeysFromText,
|
|
273
307
|
};
|
|
274
308
|
exports.default = exports.Helper;
|
|
@@ -21,6 +21,7 @@ const AdaptableContext_1 = require("../../AdaptableContext");
|
|
|
21
21
|
const FormatHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/FormatHelper"));
|
|
22
22
|
const Toggle_1 = require("../../../components/Toggle");
|
|
23
23
|
const GeneralConstants_1 = require("../../../Utilities/Constants/GeneralConstants");
|
|
24
|
+
const Textarea_1 = tslib_1.__importDefault(require("../../../components/Textarea"));
|
|
24
25
|
const DOLLAR_OPTIONS = {
|
|
25
26
|
FractionDigits: 2,
|
|
26
27
|
FractionSeparator: '.',
|
|
@@ -376,7 +377,10 @@ const renderStringFormat = (data, _onChange, setFormatOption, scopedCustomFormat
|
|
|
376
377
|
React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
|
|
377
378
|
React.createElement(Input_1.default, { "data-name": "suffix", value: (_b = data.DisplayFormat.Options.Suffix) !== null && _b !== void 0 ? _b : '', onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
|
|
378
379
|
React.createElement(FormLayout_1.FormRow, { label: "Content" },
|
|
379
|
-
React.createElement(
|
|
380
|
+
React.createElement(Textarea_1.default, { minWidth: 300, rows: 3, placeholder: "use defaults", marginTop: 2, type: 'text', autoFocus: false, value: (_c = data.DisplayFormat.Options.Content) !== null && _c !== void 0 ? _c : '',
|
|
381
|
+
// placeholder="defaults to column name"
|
|
382
|
+
// onChange={(e: any) => onMessageHeaderChange(e)}
|
|
383
|
+
onChange: (e) => setFormatOption('Content', e.currentTarget.value) })),
|
|
380
384
|
React.createElement(FormLayout_1.FormRow, { label: "Empty" },
|
|
381
385
|
React.createElement(CheckBox_1.CheckBox, { "data-name": "empty-checkbox", checked: data.DisplayFormat.Options.Empty, onChange: (checked) => setFormatOption('Empty', checked) })))))),
|
|
382
386
|
scopedCustomFormatters.length > 0 && (React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
|
|
@@ -243,7 +243,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
243
243
|
private getDistinctGridCellsForColumn;
|
|
244
244
|
private addDistinctColumnValue;
|
|
245
245
|
private getUniqueGridCells;
|
|
246
|
-
getGridCellsForColumn(columnId: string,
|
|
246
|
+
getGridCellsForColumn(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
|
|
247
247
|
getRowNodesForPrimaryKeys(primaryKeyValues: any[]): any[];
|
|
248
248
|
getRowNodeByIndex(index: number): IRowNode;
|
|
249
249
|
getAgGridStatusPanels(): import("@ag-grid-community/core").StatusPanelDef[];
|
|
@@ -280,6 +280,7 @@ class AdaptableAgGrid {
|
|
|
280
280
|
this.adaptableOptions = this.normalizeAdaptableOptions(this.adaptableOptions);
|
|
281
281
|
const { showLoadingScreen, loadingScreenDelay, loadingScreenText, loadingScreenTitle } = this.adaptableOptions.userInterfaceOptions;
|
|
282
282
|
if (showLoadingScreen) {
|
|
283
|
+
this.logger.info(`Show Loading Screen`);
|
|
283
284
|
const portalElement = (0, Modal_1.ensurePortalElement)();
|
|
284
285
|
if (portalElement) {
|
|
285
286
|
this.unmountLoadingScreen = this.renderReactRoot((0, react_1.createElement)(AdaptableLoadingScreen_1.AdaptableLoadingScreen, {
|
|
@@ -289,6 +290,9 @@ class AdaptableAgGrid {
|
|
|
289
290
|
loadingScreenTitle,
|
|
290
291
|
}), portalElement);
|
|
291
292
|
}
|
|
293
|
+
else {
|
|
294
|
+
this.logger.consoleError(`Adaptable failed to show the loading screen!`);
|
|
295
|
+
}
|
|
292
296
|
}
|
|
293
297
|
this.forPlugins((plugin) => plugin.afterInitOptions(this, this.adaptableOptions));
|
|
294
298
|
this.api = new AdaptableApiImpl_1.AdaptableApiImpl(this);
|
|
@@ -354,6 +358,7 @@ class AdaptableAgGrid {
|
|
|
354
358
|
this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
|
|
355
359
|
return Promise.reject('Adaptable failed to initialize AG Grid!');
|
|
356
360
|
}
|
|
361
|
+
this.logger.info(`Hide Loading Screen`);
|
|
357
362
|
(_b = this.unmountLoadingScreen) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
358
363
|
perfInitAgGrid.end();
|
|
359
364
|
// we need to intercept several AG Grid Api methods and trigger Adaptale state changes
|
|
@@ -2360,17 +2365,12 @@ class AdaptableAgGrid {
|
|
|
2360
2365
|
}
|
|
2361
2366
|
return uniqueVals.slice(0, this.api.columnFilterApi.internalApi.getFilterValuesMaxNumberOfItems(column));
|
|
2362
2367
|
}
|
|
2363
|
-
getGridCellsForColumn(columnId,
|
|
2368
|
+
getGridCellsForColumn(columnId, onlyVisibleRows = false) {
|
|
2364
2369
|
let returnValues = [];
|
|
2365
2370
|
const handler = (rowNode) => {
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
if (gridCell.rawValue
|
|
2369
|
-
if (includeBlanks) {
|
|
2370
|
-
returnValues.push(gridCell);
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
else {
|
|
2371
|
+
if (!this.isGroupRowNode(rowNode)) {
|
|
2372
|
+
const gridCell = this.getGridCellFromRowNode(rowNode, columnId);
|
|
2373
|
+
if (gridCell && gridCell.rawValue !== undefined && gridCell.rawValue !== null) {
|
|
2374
2374
|
returnValues.push(gridCell);
|
|
2375
2375
|
}
|
|
2376
2376
|
}
|
package/src/env.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
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" || '',
|
|
5
|
-
PUBLISH_TIMESTAMP:
|
|
6
|
-
VERSION: "18.1.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1720529578367 || Date.now(),
|
|
6
|
+
VERSION: "18.1.8" || '--current-version--',
|
|
7
7
|
};
|