@adaptabletools/adaptable 16.2.2 → 16.2.4
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/bundle.cjs.js +88 -88
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/DataImportOptions.d.ts +8 -8
- package/src/AdaptableOptions/PredicateOptions.d.ts +8 -8
- package/src/Api/Implementation/OptionsApiImpl.d.ts +1 -1
- package/src/Api/Implementation/PredicateApiImpl.d.ts +5 -5
- package/src/Api/Implementation/PredicateApiImpl.js +6 -4
- package/src/Api/Internal/DataImportInternalApi.js +0 -3
- package/src/Api/Internal/PredicateInternalApi.d.ts +5 -0
- package/src/Api/Internal/PredicateInternalApi.js +22 -35
- package/src/Api/Internal/StyledColumnInternalApi.d.ts +1 -1
- package/src/Api/PredicateApi.d.ts +5 -0
- package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +5 -5
- package/src/View/Alert/Utilities/getAvailablePredicates.d.ts +1 -1
- package/src/View/DataImport/DataImportWizard/DataImportWizard.js +17 -2
- package/src/View/DataImport/systemFileHandlers.d.ts +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +10 -10
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.4",
|
|
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",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1701436913372;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -3,7 +3,7 @@ import { IRowNode } from '@ag-grid-community/core';
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for managing the Data Import function
|
|
5
5
|
*/
|
|
6
|
-
export interface DataImportOptions<T = Record<string,
|
|
6
|
+
export interface DataImportOptions<T = Record<string, any>> {
|
|
7
7
|
/**
|
|
8
8
|
* File extensions that the Data Import function accepts
|
|
9
9
|
*/
|
|
@@ -25,7 +25,7 @@ export interface DataImportOptions<T = Record<string, unknown>> {
|
|
|
25
25
|
*
|
|
26
26
|
* @experimental It might change in a future version
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
_preprocessRowData?: (context: PreprocessRowDataContext<T>) => Record<string, any>;
|
|
29
29
|
/**
|
|
30
30
|
* Function to get the Primary Key value for a data row (defaults to value of the primaryKey column)
|
|
31
31
|
*
|
|
@@ -36,16 +36,16 @@ export interface DataImportOptions<T = Record<string, unknown>> {
|
|
|
36
36
|
/**
|
|
37
37
|
* Context used when pre-processing Import Data
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
39
|
+
export interface PreprocessRowDataContext<T = Record<string, any>> extends BaseContext {
|
|
40
40
|
/**
|
|
41
41
|
* Data which has been imported
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
rowData: T;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Context used when importing Data
|
|
47
47
|
*/
|
|
48
|
-
export interface HandleImportedDataContext<T = Record<string,
|
|
48
|
+
export interface HandleImportedDataContext<T = Record<string, any>> extends BaseContext {
|
|
49
49
|
/**
|
|
50
50
|
* Data which has been imported
|
|
51
51
|
*/
|
|
@@ -54,7 +54,7 @@ export interface HandleImportedDataContext<T = Record<string, unknown>> extends
|
|
|
54
54
|
/**
|
|
55
55
|
* Files that can be handled by Data Import
|
|
56
56
|
*/
|
|
57
|
-
export interface DataImportFileHandler<T = Record<string,
|
|
57
|
+
export interface DataImportFileHandler<T = Record<string, any>> {
|
|
58
58
|
/**
|
|
59
59
|
* Name of File Extension
|
|
60
60
|
*/
|
|
@@ -80,7 +80,7 @@ export interface DataImportValidationError {
|
|
|
80
80
|
/**
|
|
81
81
|
* Context passed to the `validate` function
|
|
82
82
|
*/
|
|
83
|
-
export interface DataImportValidateContext<T = Record<string,
|
|
83
|
+
export interface DataImportValidateContext<T = Record<string, any>> extends BaseContext {
|
|
84
84
|
/**
|
|
85
85
|
* Imported Row Data
|
|
86
86
|
*/
|
|
@@ -89,7 +89,7 @@ export interface DataImportValidateContext<T = Record<string, unknown>> extends
|
|
|
89
89
|
/**
|
|
90
90
|
* Context passed to the `getPrimaryKeyValue` function
|
|
91
91
|
*/
|
|
92
|
-
export interface GetPrimaryKeyValueContext<T = Record<string,
|
|
92
|
+
export interface GetPrimaryKeyValueContext<T = Record<string, any>> extends BaseContext {
|
|
93
93
|
/**
|
|
94
94
|
* Data being imported
|
|
95
95
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptablePredicateDef, AdaptableScope, BaseContext, PredicateModuleScope, SystemAlertPredicateIds, SystemBadgeStylePredicateIds, SystemFilterPredicateIds, SystemFlashingCellPredicateIds, SystemFormatColumnPredicateIds } from '../types';
|
|
1
|
+
import { AdaptablePredicateDef, AdaptableScope, BaseContext, PredicateModuleScope, SystemAlertPredicateId, SystemAlertPredicateIds, SystemBadgeStylePredicateId, SystemBadgeStylePredicateIds, SystemFilterPredicateId, SystemFilterPredicateIds, SystemFlashingCellPredicateId, SystemFlashingCellPredicateIds, SystemFormatColumnPredicateId, SystemFormatColumnPredicateIds } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Options for managing Adaptable Predicates using AdaptableQL
|
|
4
4
|
*/
|
|
@@ -10,23 +10,23 @@ export interface PredicateOptions {
|
|
|
10
10
|
/**
|
|
11
11
|
* Which System Filter Predicates are available
|
|
12
12
|
*/
|
|
13
|
-
systemFilterPredicates?: SystemFilterPredicateIds | ((context: SystemPredicatesContext) => SystemFilterPredicateIds);
|
|
13
|
+
systemFilterPredicates?: SystemFilterPredicateIds | ((context: SystemPredicatesContext<SystemFilterPredicateId>) => SystemFilterPredicateIds);
|
|
14
14
|
/**
|
|
15
15
|
* Which System Badge Style Predicates are available
|
|
16
16
|
*/
|
|
17
|
-
systemBadgeStylePredicates?: SystemBadgeStylePredicateIds | ((context: SystemPredicatesContext) => SystemBadgeStylePredicateIds);
|
|
17
|
+
systemBadgeStylePredicates?: SystemBadgeStylePredicateIds | ((context: SystemPredicatesContext<SystemBadgeStylePredicateId>) => SystemBadgeStylePredicateIds);
|
|
18
18
|
/**
|
|
19
19
|
* Which System Alert Predicates are available
|
|
20
20
|
*/
|
|
21
|
-
systemAlertPredicates?: SystemAlertPredicateIds | ((context: SystemPredicatesContext) => SystemAlertPredicateIds);
|
|
21
|
+
systemAlertPredicates?: SystemAlertPredicateIds | ((context: SystemPredicatesContext<SystemAlertPredicateId>) => SystemAlertPredicateIds);
|
|
22
22
|
/**
|
|
23
23
|
* Which System Format Column Predicates are available
|
|
24
24
|
*/
|
|
25
|
-
systemFormatColumnPredicates?: SystemFormatColumnPredicateIds | ((context: SystemPredicatesContext) => SystemFormatColumnPredicateIds);
|
|
25
|
+
systemFormatColumnPredicates?: SystemFormatColumnPredicateIds | ((context: SystemPredicatesContext<SystemFormatColumnPredicateId>) => SystemFormatColumnPredicateIds);
|
|
26
26
|
/**
|
|
27
27
|
* Which System Flashing Cell Predicates are available
|
|
28
28
|
*/
|
|
29
|
-
systemFlashingCellPredicates?: SystemFlashingCellPredicateIds | ((context: SystemPredicatesContext) => SystemFlashingCellPredicateIds);
|
|
29
|
+
systemFlashingCellPredicates?: SystemFlashingCellPredicateIds | ((context: SystemPredicatesContext<SystemFlashingCellPredicateId>) => SystemFlashingCellPredicateIds);
|
|
30
30
|
/**
|
|
31
31
|
* Perform case-sensitive text comparisons when evaluating Predicates
|
|
32
32
|
*
|
|
@@ -39,11 +39,11 @@ export interface PredicateOptions {
|
|
|
39
39
|
/**
|
|
40
40
|
* Context used for setting which System Predicates are available
|
|
41
41
|
*/
|
|
42
|
-
export interface SystemPredicatesContext extends BaseContext {
|
|
42
|
+
export interface SystemPredicatesContext<PREDICATE_TYPE = string> extends BaseContext {
|
|
43
43
|
/**
|
|
44
44
|
* AdapTable-provided System Predicate Definitions
|
|
45
45
|
*/
|
|
46
|
-
systemPredicateDefs: AdaptablePredicateDef[];
|
|
46
|
+
systemPredicateDefs: AdaptablePredicateDef<PREDICATE_TYPE>[];
|
|
47
47
|
/**
|
|
48
48
|
* Module for which Predicates are being retrieved
|
|
49
49
|
*/
|
|
@@ -43,5 +43,5 @@ export declare class OptionsApiImpl extends ApiBase implements OptionsApi {
|
|
|
43
43
|
getFlashingCellOptions(): FlashingCellOptions;
|
|
44
44
|
getSettingsPanelOptions(): SettingsPanelOptions;
|
|
45
45
|
getFdc3Options(): Fdc3Options;
|
|
46
|
-
getDataImportOptions(): import("../../types").DataImportOptions<Record<string,
|
|
46
|
+
getDataImportOptions(): import("../../types").DataImportOptions<Record<string, any>>;
|
|
47
47
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ApiBase } from './ApiBase';
|
|
2
2
|
import { PredicateApi } from '../PredicateApi';
|
|
3
|
-
import { PredicateDefHandlerContext, PredicateModuleScope } from '../../
|
|
4
|
-
import { AdaptablePredicate, AdaptablePredicateDef, AdaptableColumnPredicate } from '../../types';
|
|
3
|
+
import { AdaptableColumnPredicate, AdaptablePredicate, AdaptablePredicateDef, PredicateDefHandlerContext, PredicateModuleScope } from '../../types';
|
|
5
4
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
6
5
|
import { PredicateInternalApi } from '../Internal/PredicateInternalApi';
|
|
7
6
|
export declare class PredicateApiImpl extends ApiBase implements PredicateApi {
|
|
8
7
|
internalApi: PredicateInternalApi;
|
|
9
8
|
constructor(adaptable: IAdaptable);
|
|
10
|
-
getPredicateDefs(): AdaptablePredicateDef[];
|
|
11
|
-
getSystemPredicateDefs(): AdaptablePredicateDef[];
|
|
12
|
-
|
|
9
|
+
getPredicateDefs(): AdaptablePredicateDef<string>[];
|
|
10
|
+
getSystemPredicateDefs(): AdaptablePredicateDef<string>[];
|
|
11
|
+
getSystemPredicateDefsByModuleScope<PREDICATE_TYPE extends string = string>(moduleScope: PredicateModuleScope): AdaptablePredicateDef<PREDICATE_TYPE>[];
|
|
12
|
+
getCustomPredicateDefs(): AdaptablePredicateDef<string>[];
|
|
13
13
|
getPredicateDefsByModuleScope(moduleScope: PredicateModuleScope): AdaptablePredicateDef[];
|
|
14
14
|
getPredicateDefById(predicateId: string): AdaptablePredicateDef;
|
|
15
15
|
getSystemPredicateDefById(predicateId: string): AdaptablePredicateDef;
|
|
@@ -3,21 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PredicateApiImpl = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ApiBase_1 = require("./ApiBase");
|
|
6
|
-
const AdaptablePredicate_1 = require("../../PredefinedConfig/Common/AdaptablePredicate");
|
|
7
6
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
|
|
8
7
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
|
|
9
8
|
const PredicateInternalApi_1 = require("../Internal/PredicateInternalApi");
|
|
9
|
+
const AdaptablePredicate_1 = require("../../PredefinedConfig/Common/AdaptablePredicate");
|
|
10
10
|
class PredicateApiImpl extends ApiBase_1.ApiBase {
|
|
11
11
|
constructor(adaptable) {
|
|
12
12
|
super(adaptable);
|
|
13
13
|
this.internalApi = new PredicateInternalApi_1.PredicateInternalApi(adaptable);
|
|
14
14
|
}
|
|
15
15
|
getPredicateDefs() {
|
|
16
|
-
return
|
|
16
|
+
return this.internalApi.mergeSystemAndCustomPredicates(this.getSystemPredicateDefs(), this.getCustomPredicateDefs());
|
|
17
17
|
}
|
|
18
18
|
getSystemPredicateDefs() {
|
|
19
19
|
return AdaptablePredicate_1.SystemPredicateDefs;
|
|
20
20
|
}
|
|
21
|
+
getSystemPredicateDefsByModuleScope(moduleScope) {
|
|
22
|
+
return AdaptablePredicate_1.SystemPredicateDefs.filter((p) => p.moduleScope.includes(moduleScope));
|
|
23
|
+
}
|
|
21
24
|
getCustomPredicateDefs() {
|
|
22
25
|
return this.getPredicateOptions().customPredicateDefs;
|
|
23
26
|
}
|
|
@@ -25,8 +28,7 @@ class PredicateApiImpl extends ApiBase_1.ApiBase {
|
|
|
25
28
|
return this.getPredicateDefs().filter((p) => p.moduleScope.includes(moduleScope));
|
|
26
29
|
}
|
|
27
30
|
getPredicateDefById(predicateId) {
|
|
28
|
-
|
|
29
|
-
return ((_a = this.getSystemPredicateDefById(predicateId)) !== null && _a !== void 0 ? _a : this.getCustomPredicateDefById(predicateId));
|
|
31
|
+
return this.getPredicateDefs().find((predicateDef) => predicateDef.id === predicateId);
|
|
30
32
|
}
|
|
31
33
|
getSystemPredicateDefById(predicateId) {
|
|
32
34
|
return this.getSystemPredicateDefs().find((predicateDef) => predicateDef.id === predicateId);
|
|
@@ -8,9 +8,6 @@ class DataImportInternalApi extends ApiBase_1.ApiBase {
|
|
|
8
8
|
async importData(partialRows) {
|
|
9
9
|
const dataImportOptions = this.getOptions().dataImportOptions;
|
|
10
10
|
let importData = partialRows;
|
|
11
|
-
if (typeof dataImportOptions._preprocessData === 'function') {
|
|
12
|
-
importData = dataImportOptions._preprocessData(Object.assign({ data: partialRows }, (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi())));
|
|
13
|
-
}
|
|
14
11
|
if (typeof dataImportOptions.handleImportedData === 'function') {
|
|
15
12
|
const resolution = await dataImportOptions.handleImportedData(Object.assign({ data: importData }, (0, ObjectFactory_1.createBaseContext)(this.getAdaptableApi())));
|
|
16
13
|
if (resolution && (resolution === null || resolution === void 0 ? void 0 : resolution.emitDataImportedEvent)) {
|
|
@@ -40,4 +40,9 @@ export declare class PredicateInternalApi extends ApiBase {
|
|
|
40
40
|
* Get all Badge Style Predicate Definitions - System and Custom
|
|
41
41
|
*/
|
|
42
42
|
getBadgeStylePredicateDefs(scope: AdaptableScope): AdaptablePredicateDef[];
|
|
43
|
+
/**
|
|
44
|
+
* Merges System and Custom Predicate Definitions but ensures that Custom ones take precedence
|
|
45
|
+
* (i.e. if there is a Custom Predicate with the same Id as a System one, the Custom one is used)
|
|
46
|
+
*/
|
|
47
|
+
mergeSystemAndCustomPredicates(systemDefs: AdaptablePredicateDef[], customDefs: AdaptablePredicateDef[]): AdaptablePredicateDef[];
|
|
43
48
|
}
|
|
@@ -16,10 +16,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
16
16
|
*/
|
|
17
17
|
getFilterPredicateDefs(scope) {
|
|
18
18
|
var _a;
|
|
19
|
-
return
|
|
20
|
-
...(_a = this.getSystemFilterPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)),
|
|
21
|
-
...this.getPredicateApi().getCustomPredicateDefs(),
|
|
22
|
-
].filter((predicateDef) => predicateDef.moduleScope.includes('filter'));
|
|
19
|
+
return this.mergeSystemAndCustomPredicates((_a = this.getSystemFilterPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('filter'));
|
|
23
20
|
}
|
|
24
21
|
getSystemFilterPredicateIds(scope) {
|
|
25
22
|
const systemFilterPredicates = this.getPredicateOptions().systemFilterPredicates;
|
|
@@ -28,9 +25,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
28
25
|
adaptableApi: this.adaptable.api,
|
|
29
26
|
userName: this.getOptions().userName,
|
|
30
27
|
adaptableId: this.getOptions().adaptableId,
|
|
31
|
-
systemPredicateDefs: this.getPredicateApi()
|
|
32
|
-
.getSystemPredicateDefs()
|
|
33
|
-
.filter((p) => p.moduleScope.includes('filter')),
|
|
28
|
+
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('filter'),
|
|
34
29
|
moduleScope: 'filter',
|
|
35
30
|
columnScope: scope,
|
|
36
31
|
};
|
|
@@ -43,10 +38,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
43
38
|
*/
|
|
44
39
|
getAlertPredicateDefs(scope) {
|
|
45
40
|
var _a;
|
|
46
|
-
return
|
|
47
|
-
...(_a = this.getSystemAlertPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)),
|
|
48
|
-
...this.getPredicateApi().getCustomPredicateDefs(),
|
|
49
|
-
].filter((predicateDef) => predicateDef.moduleScope.includes('alert'));
|
|
41
|
+
return this.mergeSystemAndCustomPredicates((_a = this.getSystemAlertPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('alert'));
|
|
50
42
|
}
|
|
51
43
|
getSystemAlertPredicateIds(scope) {
|
|
52
44
|
const systemAlertPredicates = this.getPredicateOptions().systemAlertPredicates;
|
|
@@ -55,9 +47,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
55
47
|
adaptableApi: this.adaptable.api,
|
|
56
48
|
userName: this.getOptions().userName,
|
|
57
49
|
adaptableId: this.getOptions().adaptableId,
|
|
58
|
-
systemPredicateDefs: this.getPredicateApi()
|
|
59
|
-
.getSystemPredicateDefs()
|
|
60
|
-
.filter((p) => p.moduleScope.includes('alert')),
|
|
50
|
+
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('alert'),
|
|
61
51
|
moduleScope: 'alert',
|
|
62
52
|
columnScope: scope,
|
|
63
53
|
};
|
|
@@ -72,9 +62,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
72
62
|
adaptableApi: this.adaptable.api,
|
|
73
63
|
userName: this.getOptions().userName,
|
|
74
64
|
adaptableId: this.getOptions().adaptableId,
|
|
75
|
-
systemPredicateDefs: this.getPredicateApi()
|
|
76
|
-
.getSystemPredicateDefs()
|
|
77
|
-
.filter((p) => p.moduleScope.includes('badgeStyle')),
|
|
65
|
+
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('badgeStyle'),
|
|
78
66
|
moduleScope: 'badgeStyle',
|
|
79
67
|
columnScope: scope,
|
|
80
68
|
};
|
|
@@ -87,10 +75,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
87
75
|
*/
|
|
88
76
|
getFormatColumnPredicateDefs(scope) {
|
|
89
77
|
var _a;
|
|
90
|
-
return
|
|
91
|
-
...(_a = this.getSystemFormatColumnPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)),
|
|
92
|
-
...this.getPredicateApi().getCustomPredicateDefs(),
|
|
93
|
-
].filter((predicateDef) => predicateDef.moduleScope.includes('formatColumn'));
|
|
78
|
+
return this.mergeSystemAndCustomPredicates((_a = this.getSystemFormatColumnPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('formatColumn'));
|
|
94
79
|
}
|
|
95
80
|
getSystemFormatColumnPredicateIds(scope) {
|
|
96
81
|
const systemFormatColumnPredicates = this.getPredicateOptions().systemFormatColumnPredicates;
|
|
@@ -99,9 +84,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
99
84
|
adaptableApi: this.adaptable.api,
|
|
100
85
|
userName: this.getOptions().userName,
|
|
101
86
|
adaptableId: this.getOptions().adaptableId,
|
|
102
|
-
systemPredicateDefs: this.getPredicateApi()
|
|
103
|
-
.getSystemPredicateDefs()
|
|
104
|
-
.filter((p) => p.moduleScope.includes('formatColumn')),
|
|
87
|
+
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('formatColumn'),
|
|
105
88
|
moduleScope: 'formatColumn',
|
|
106
89
|
columnScope: scope,
|
|
107
90
|
};
|
|
@@ -114,10 +97,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
114
97
|
*/
|
|
115
98
|
getFlashingCellPredicateDefs(scope) {
|
|
116
99
|
var _a;
|
|
117
|
-
return
|
|
118
|
-
...(_a = this.getSystemFlashingCellPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)),
|
|
119
|
-
...this.getPredicateApi().getCustomPredicateDefs(),
|
|
120
|
-
].filter((predicateDef) => predicateDef.moduleScope.includes('flashingcell'));
|
|
100
|
+
return this.mergeSystemAndCustomPredicates((_a = this.getSystemFlashingCellPredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('flashingcell'));
|
|
121
101
|
}
|
|
122
102
|
getSystemFlashingCellPredicateIds(scope) {
|
|
123
103
|
const systemFlashingCellPredicates = this.getPredicateOptions().systemFlashingCellPredicates;
|
|
@@ -126,9 +106,7 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
126
106
|
adaptableApi: this.adaptable.api,
|
|
127
107
|
userName: this.getOptions().userName,
|
|
128
108
|
adaptableId: this.getOptions().adaptableId,
|
|
129
|
-
systemPredicateDefs: this.getPredicateApi()
|
|
130
|
-
.getSystemPredicateDefs()
|
|
131
|
-
.filter((p) => p.moduleScope.includes('flashingcell')),
|
|
109
|
+
systemPredicateDefs: this.getPredicateApi().getSystemPredicateDefsByModuleScope('flashingcell'),
|
|
132
110
|
moduleScope: 'flashingcell',
|
|
133
111
|
columnScope: scope,
|
|
134
112
|
};
|
|
@@ -163,10 +141,19 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
|
|
|
163
141
|
*/
|
|
164
142
|
getBadgeStylePredicateDefs(scope) {
|
|
165
143
|
var _a;
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
144
|
+
return this.mergeSystemAndCustomPredicates((_a = this.getSystemBadgeStylePredicateIds(scope)) === null || _a === void 0 ? void 0 : _a.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('badgeStyle'));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Merges System and Custom Predicate Definitions but ensures that Custom ones take precedence
|
|
148
|
+
* (i.e. if there is a Custom Predicate with the same Id as a System one, the Custom one is used)
|
|
149
|
+
*/
|
|
150
|
+
mergeSystemAndCustomPredicates(systemDefs, customDefs) {
|
|
151
|
+
const systemDefsToUse = systemDefs.map((systemDef) => {
|
|
152
|
+
const customDef = customDefs.find((customDef) => customDef.id === systemDef.id);
|
|
153
|
+
return customDef ? customDef : systemDef;
|
|
154
|
+
});
|
|
155
|
+
const customDefsToUse = customDefs.filter((customDef) => !systemDefsToUse.find((systemDef) => systemDef.id === customDef.id));
|
|
156
|
+
return [...systemDefsToUse, ...customDefsToUse];
|
|
170
157
|
}
|
|
171
158
|
}
|
|
172
159
|
exports.PredicateInternalApi = PredicateInternalApi;
|
|
@@ -58,7 +58,7 @@ export declare class StyledColumnInternalApi extends ApiBase {
|
|
|
58
58
|
*/
|
|
59
59
|
hasStyledColumnRelativeCellRange(styledColumn: StyledColumn): boolean;
|
|
60
60
|
getApplicableBadge(styledColumn: StyledColumn, context: PredicateDefHandlerContext): BadgeStyleDefinition | null;
|
|
61
|
-
getBadgePredicateDefsForColumn(columnId: string): import("../../types").AdaptablePredicateDef[];
|
|
61
|
+
getBadgePredicateDefsForColumn(columnId: string): import("../../types").AdaptablePredicateDef<string>[];
|
|
62
62
|
getCheckBoxStyleStyledColumn(column: AdaptableColumn): StyledColumn | undefined;
|
|
63
63
|
isCheckBoxStyleStyledColumn(column: AdaptableColumn): boolean;
|
|
64
64
|
fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
|
|
@@ -12,6 +12,11 @@ export interface PredicateApi {
|
|
|
12
12
|
* Returns Predicate Definitions provided by AdapTable
|
|
13
13
|
*/
|
|
14
14
|
getSystemPredicateDefs(): AdaptablePredicateDef[];
|
|
15
|
+
/**
|
|
16
|
+
* Returns Predicate Definitions provided by AdapTable for given Module Scope
|
|
17
|
+
* @param moduleScope Module Scope to use
|
|
18
|
+
*/
|
|
19
|
+
getSystemPredicateDefsByModuleScope<PREDICATE_TYPE extends string = string>(moduleScope: PredicateModuleScope): AdaptablePredicateDef<PREDICATE_TYPE>[];
|
|
15
20
|
/**
|
|
16
21
|
* Returns Predicate Definitions provided by users
|
|
17
22
|
*/
|
|
@@ -6,11 +6,11 @@ import { BaseContext } from './BaseContext';
|
|
|
6
6
|
/**
|
|
7
7
|
* Predicate object used by AdapTableQL - essentially a boolean function
|
|
8
8
|
*/
|
|
9
|
-
export interface AdaptablePredicate {
|
|
9
|
+
export interface AdaptablePredicate<PREDICATE_TYPE = string> {
|
|
10
10
|
/**
|
|
11
11
|
* Id of Predicate (e.g. `Equals`, `GreaterThan`)
|
|
12
12
|
*/
|
|
13
|
-
PredicateId:
|
|
13
|
+
PredicateId: PREDICATE_TYPE;
|
|
14
14
|
/**
|
|
15
15
|
* Optional Inputs that might be needed for evaluation
|
|
16
16
|
*/
|
|
@@ -28,11 +28,11 @@ export interface AdaptableColumnPredicate extends AdaptablePredicate {
|
|
|
28
28
|
/**
|
|
29
29
|
* Defines a Predicate - include where it can run and what it does
|
|
30
30
|
*/
|
|
31
|
-
export interface AdaptablePredicateDef {
|
|
31
|
+
export interface AdaptablePredicateDef<PREDICATE_TYPE = string> {
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Predicate Id
|
|
34
34
|
*/
|
|
35
|
-
id:
|
|
35
|
+
id: PREDICATE_TYPE;
|
|
36
36
|
/**
|
|
37
37
|
* Name of the Predicate
|
|
38
38
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AdaptableApi, AdaptablePredicateDef, AdaptableScope } from '../../../types';
|
|
2
2
|
import { AlertType } from './getAlertType';
|
|
3
|
-
export declare const getAvailablePredicateDefinitions: (api: AdaptableApi, scope: AdaptableScope, alertType: AlertType) => AdaptablePredicateDef[];
|
|
3
|
+
export declare const getAvailablePredicateDefinitions: (api: AdaptableApi, scope: AdaptableScope, alertType: AlertType) => AdaptablePredicateDef<string>[];
|
|
@@ -32,6 +32,20 @@ const DataImportWizard = (props) => {
|
|
|
32
32
|
}
|
|
33
33
|
return rowData[primaryKey];
|
|
34
34
|
};
|
|
35
|
+
const preprocessRowData = (rowData) => {
|
|
36
|
+
if (typeof (dataImportOptions === null || dataImportOptions === void 0 ? void 0 : dataImportOptions._preprocessRowData) === 'function') {
|
|
37
|
+
return dataImportOptions._preprocessRowData(Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(adaptable.api)), { rowData }));
|
|
38
|
+
}
|
|
39
|
+
// by default just trim the keys
|
|
40
|
+
let processedRowData = {};
|
|
41
|
+
if (rowData) {
|
|
42
|
+
processedRowData = Object.keys(rowData).reduce((acc, key) => {
|
|
43
|
+
acc[key.trim()] = rowData[key];
|
|
44
|
+
return acc;
|
|
45
|
+
}, processedRowData);
|
|
46
|
+
}
|
|
47
|
+
return processedRowData;
|
|
48
|
+
};
|
|
35
49
|
// ---- COLUMNS ----
|
|
36
50
|
const [columnsMap, setColumnsMap] = React.useState(null);
|
|
37
51
|
const mappedRowDataToColumns = React.useMemo(() => {
|
|
@@ -57,9 +71,10 @@ const DataImportWizard = (props) => {
|
|
|
57
71
|
}, [columnsMap]);
|
|
58
72
|
const handleNewRowData = React.useCallback((data) => {
|
|
59
73
|
if (Array.isArray(data)) {
|
|
60
|
-
|
|
74
|
+
const processedData = data.map((rowData) => preprocessRowData(rowData));
|
|
75
|
+
setRowData(processedData);
|
|
61
76
|
const fields = new Set();
|
|
62
|
-
|
|
77
|
+
processedData.forEach((row) => {
|
|
63
78
|
Object.keys(row).forEach((field) => {
|
|
64
79
|
fields.add(field);
|
|
65
80
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DataImportFileHandler } from '../../types';
|
|
2
2
|
export declare const parseCSV: (content: string) => Record<string, unknown>[];
|
|
3
|
-
export declare const systemFileHandlers: DataImportFileHandler<Record<string,
|
|
3
|
+
export declare const systemFileHandlers: DataImportFileHandler<Record<string, any>>[];
|
|
@@ -4108,16 +4108,6 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4108
4108
|
defVal?: undefined;
|
|
4109
4109
|
})[];
|
|
4110
4110
|
};
|
|
4111
|
-
PreprocessDataContext: {
|
|
4112
|
-
name: string;
|
|
4113
|
-
kind: string;
|
|
4114
|
-
desc: string;
|
|
4115
|
-
props: {
|
|
4116
|
-
name: string;
|
|
4117
|
-
kind: string;
|
|
4118
|
-
desc: string;
|
|
4119
|
-
}[];
|
|
4120
|
-
};
|
|
4121
4111
|
PreProcessExportContext: {
|
|
4122
4112
|
name: string;
|
|
4123
4113
|
kind: string;
|
|
@@ -4134,6 +4124,16 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4134
4124
|
ref: string;
|
|
4135
4125
|
})[];
|
|
4136
4126
|
};
|
|
4127
|
+
PreprocessRowDataContext: {
|
|
4128
|
+
name: string;
|
|
4129
|
+
kind: string;
|
|
4130
|
+
desc: string;
|
|
4131
|
+
props: {
|
|
4132
|
+
name: string;
|
|
4133
|
+
kind: string;
|
|
4134
|
+
desc: string;
|
|
4135
|
+
}[];
|
|
4136
|
+
};
|
|
4137
4137
|
QueryableColumnContext: {
|
|
4138
4138
|
name: string;
|
|
4139
4139
|
kind: string;
|