@adaptabletools/adaptable 12.0.0-canary.4 → 12.0.0-canary.5
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 +129 -126
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/ColumnOptions.d.ts +4 -0
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +2 -0
- package/src/AdaptableOptions/EditOptions.d.ts +6 -0
- package/src/AdaptableOptions/LayoutOptions.d.ts +6 -1
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +2 -0
- package/src/AdaptableOptions/StateOptions.d.ts +10 -0
- package/src/Api/Implementation/SmartEditApiImpl.d.ts +1 -1
- package/src/Api/Implementation/SmartEditApiImpl.js +2 -1
- package/src/Api/SmartEditApi.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +5 -5
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +8 -0
- package/src/Utilities/Extensions/TypeExtensions.d.ts +30 -0
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +1 -3
- package/src/Utilities/Helpers/AdaptableHelper.js +2 -13
- package/src/Utilities/Helpers/DateHelper.d.ts +27 -0
- package/src/Utilities/Helpers/DateHelper.js +33 -1
- package/src/Utilities/Services/Interface/IMetamodelService.d.ts +1 -0
- package/src/Utilities/Services/MetamodelService.d.ts +7 -1
- package/src/Utilities/Services/MetamodelService.js +82 -6
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +10 -8
- package/src/View/Components/AdaptableDateInput/index.js +1 -1
- package/src/agGrid/Adaptable.js +3 -2
- package/src/metamodel/adaptable-metamodel-model.d.ts +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +5 -13
- package/src/metamodel/adaptable.metamodel.js +1 -12981
- 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": "12.0.0-canary.
|
|
3
|
+
"version": "12.0.0-canary.5",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1655288118527;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -5,10 +5,14 @@ import { Column } from '@ag-grid-community/all-modules';
|
|
|
5
5
|
export interface ColumnOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Provide an alternative Friendly Name for a Column
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue undefined
|
|
8
10
|
*/
|
|
9
11
|
columnFriendlyName?: (columnFriendlyNameContext: ColumnFriendlyNameContext) => string | undefined;
|
|
10
12
|
/**
|
|
11
13
|
* Optional list of Column Types - used primarily for Special Columns
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue []
|
|
12
16
|
*/
|
|
13
17
|
columnTypes?: string[];
|
|
14
18
|
/**
|
|
@@ -47,6 +47,8 @@ export interface DataChangeHistoryOptions {
|
|
|
47
47
|
showDataChange?: (cellDataChangedInfo: CellDataChangedInfo) => boolean;
|
|
48
48
|
/**
|
|
49
49
|
* Action button definition. Can be used to implement undo functionality.
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue undefined
|
|
50
52
|
*/
|
|
51
53
|
changeHistoryButton?: DataChangeHistoryButton | DataChangeHistoryButton[];
|
|
52
54
|
}
|
|
@@ -8,6 +8,8 @@ import { GridCell } from '../PredefinedConfig/Selection/GridCell';
|
|
|
8
8
|
export interface EditOptions {
|
|
9
9
|
/**
|
|
10
10
|
* Function to validate on Server Adaptable data edits
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue undefined
|
|
11
13
|
*/
|
|
12
14
|
validateOnServer?: (cellDataChangedInfo: CellDataChangedInfo) => Promise<ValidationResult>;
|
|
13
15
|
/**
|
|
@@ -19,10 +21,14 @@ export interface EditOptions {
|
|
|
19
21
|
displayServerValidationMessages?: boolean;
|
|
20
22
|
/**
|
|
21
23
|
* Function which checks if given Grid Cell is editable
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue undefined
|
|
22
26
|
*/
|
|
23
27
|
isCellEditable?: (gridCell: GridCell) => boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Custom Operations to use in Smart Edit
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue undefined
|
|
26
32
|
*/
|
|
27
33
|
smartEditCustomOperations?: SmartEditCustomOperation[];
|
|
28
34
|
}
|
|
@@ -68,15 +68,20 @@ export interface LayoutOptions {
|
|
|
68
68
|
export interface LayoutTagOptions {
|
|
69
69
|
/**
|
|
70
70
|
* Automatically generate an Object Tag for each Layout
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue false
|
|
71
73
|
*/
|
|
72
74
|
autoGenerateTagsForLayouts?: boolean | ((context: AutoGenerateTagsForLayoutsContext) => AdaptableObjectTag[]);
|
|
73
75
|
/**
|
|
74
76
|
* Checks if the provided Adaptable Object is available in the given Layout
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue undefined
|
|
75
79
|
*/
|
|
76
80
|
isObjectAvailableInLayout?: (context: LayoutAvailableContext) => boolean;
|
|
77
81
|
/**
|
|
78
82
|
* Automatically checks if Adaptable Objects Tags are available in current Layout
|
|
79
|
-
*
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue false
|
|
80
85
|
*/
|
|
81
86
|
autoCheckTagsForLayouts?: boolean;
|
|
82
87
|
}
|
|
@@ -29,6 +29,8 @@ export interface SettingsPanelOptions {
|
|
|
29
29
|
alwaysShowInToolPanel?: boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Ordered items to display at side of Settings Panel
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue all available AdapTable modules
|
|
32
34
|
*/
|
|
33
35
|
navigation?: {
|
|
34
36
|
items?: (AdaptableSettingsPanel | string | '-')[];
|
|
@@ -5,22 +5,32 @@ import { AdaptableState } from '../PredefinedConfig/AdaptableState';
|
|
|
5
5
|
export interface StateOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Allows the customization of state persistence
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue persists state to local storage
|
|
8
10
|
*/
|
|
9
11
|
persistState?: AdaptablePersistStateFunction;
|
|
10
12
|
/**
|
|
11
13
|
* Allows the customization of Adaptable State loading
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue loads state from local storage
|
|
12
16
|
*/
|
|
13
17
|
loadState?: AdaptableLoadStateFunction;
|
|
14
18
|
/**
|
|
15
19
|
* Allows the customization of the Adaptable State that is going to be persisted
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue undefined
|
|
16
22
|
*/
|
|
17
23
|
saveState?: AdaptableSaveStateFunction;
|
|
18
24
|
/**
|
|
19
25
|
* Allows hooking into Adaptable State hydration
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue undefined
|
|
20
28
|
*/
|
|
21
29
|
applyState?: (state: any) => any;
|
|
22
30
|
/**
|
|
23
31
|
* Allows clearing of remote Adaptable State
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue undefined
|
|
24
34
|
*/
|
|
25
35
|
clearState?: AdaptableClearStateFunction;
|
|
26
36
|
/**
|
|
@@ -10,6 +10,6 @@ export declare class SmartEditApiImpl extends ApiBase implements SmartEditApi {
|
|
|
10
10
|
getSmartEditValue(): number;
|
|
11
11
|
showSmartEditPopup(): void;
|
|
12
12
|
applySmartEdit(gridCells: GridCell[]): void;
|
|
13
|
-
getSmartEditCustomOperations(): SmartEditCustomOperation[]
|
|
13
|
+
getSmartEditCustomOperations(): SmartEditCustomOperation[];
|
|
14
14
|
setCustomSmartEditOperation(customOperationName: string): void;
|
|
15
15
|
}
|
|
@@ -26,7 +26,8 @@ class SmartEditApiImpl extends ApiBase_1.ApiBase {
|
|
|
26
26
|
this.dispatchAction(SmartEditRedux.SmartEditApply(gridCells));
|
|
27
27
|
}
|
|
28
28
|
getSmartEditCustomOperations() {
|
|
29
|
-
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = this.getEditOptions().smartEditCustomOperations) !== null && _a !== void 0 ? _a : [];
|
|
30
31
|
}
|
|
31
32
|
setCustomSmartEditOperation(customOperationName) {
|
|
32
33
|
const customOperation = this.getSmartEditCustomOperations().find((so) => so.name == customOperationName);
|
|
@@ -389,7 +389,7 @@ exports.SystemPredicateDefs = [
|
|
|
389
389
|
columnScope: { DataTypes: ['Date'] },
|
|
390
390
|
moduleScope: ['filter', 'alert', 'flashingcell', 'conditionalstyle'],
|
|
391
391
|
inputs: [{ type: 'date' }],
|
|
392
|
-
handler: ({ value, inputs }) => isAfter_1.default(DateHelper_1.
|
|
392
|
+
handler: ({ value, inputs }) => isAfter_1.default(DateHelper_1.parseFilterValueDate(value), DateHelper_1.parseFilterInputDate(inputs[0])),
|
|
393
393
|
toString: ({ inputs }) => `> ${inputs[0]}`,
|
|
394
394
|
},
|
|
395
395
|
{
|
|
@@ -399,7 +399,7 @@ exports.SystemPredicateDefs = [
|
|
|
399
399
|
columnScope: { DataTypes: ['Date'] },
|
|
400
400
|
moduleScope: ['filter', 'alert', 'flashingcell', 'conditionalstyle'],
|
|
401
401
|
inputs: [{ type: 'date' }],
|
|
402
|
-
handler: ({ value, inputs }) => isBefore_1.default(DateHelper_1.
|
|
402
|
+
handler: ({ value, inputs }) => isBefore_1.default(DateHelper_1.parseFilterValueDate(value), DateHelper_1.parseFilterInputDate(inputs[0])),
|
|
403
403
|
toString: ({ inputs }) => `< ${inputs[0]}`,
|
|
404
404
|
},
|
|
405
405
|
{
|
|
@@ -409,7 +409,7 @@ exports.SystemPredicateDefs = [
|
|
|
409
409
|
columnScope: { DataTypes: ['Date'] },
|
|
410
410
|
moduleScope: ['filter', 'alert', 'flashingcell', 'conditionalstyle'],
|
|
411
411
|
inputs: [{ type: 'date' }],
|
|
412
|
-
handler: ({ value, inputs }) => isSameDay_1.default(DateHelper_1.
|
|
412
|
+
handler: ({ value, inputs }) => isSameDay_1.default(DateHelper_1.parseFilterValueDate(value), DateHelper_1.parseFilterInputDate(inputs[0])),
|
|
413
413
|
toString: ({ inputs }) => `= ${inputs[0]}`,
|
|
414
414
|
},
|
|
415
415
|
{
|
|
@@ -419,7 +419,7 @@ exports.SystemPredicateDefs = [
|
|
|
419
419
|
columnScope: { DataTypes: ['Date'] },
|
|
420
420
|
moduleScope: ['filter', 'alert', 'flashingcell', 'conditionalstyle'],
|
|
421
421
|
inputs: [{ type: 'date' }],
|
|
422
|
-
handler: ({ value, inputs }) => !isSameDay_1.default(DateHelper_1.
|
|
422
|
+
handler: ({ value, inputs }) => !isSameDay_1.default(DateHelper_1.parseFilterValueDate(value), DateHelper_1.parseFilterInputDate(inputs[0])),
|
|
423
423
|
toString: ({ inputs }) => `!= ${inputs[0]}`,
|
|
424
424
|
},
|
|
425
425
|
{
|
|
@@ -428,7 +428,7 @@ exports.SystemPredicateDefs = [
|
|
|
428
428
|
icon: { name: 'calendar' },
|
|
429
429
|
columnScope: { DataTypes: ['Date'] },
|
|
430
430
|
moduleScope: ['filter', 'alert', 'flashingcell', 'conditionalstyle'],
|
|
431
|
-
handler: ({ value, api }) => isSameDay_1.default(DateHelper_1.
|
|
431
|
+
handler: ({ value, api }) => isSameDay_1.default(DateHelper_1.parseFilterValueDate(value), CalendarHelper_1.default.getNextWorkingDay()),
|
|
432
432
|
},
|
|
433
433
|
{
|
|
434
434
|
id: 'LastWorkDay',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
|
|
3
|
+
exports.AdaptableOptionsDocsLink = exports.LicenseDocsLink = exports.PrimaryKeyDocsLink = exports.PredicateDocsLink = exports.AggregatedScalarQueryDocsLink = exports.AggregatedBooleanQueryDocsLink = exports.ObservableQueryDocsLink = exports.ScalarQueryDocsLink = exports.BooleanQueryDocsLink = exports.ExpressionEditorDocsLink = exports.HOST_URL_DOCS = void 0;
|
|
4
4
|
exports.HOST_URL_DOCS = 'https://docs.adaptabletools.com';
|
|
5
5
|
//export const HOST_URL_DOCS = 'http://localhost:3000';
|
|
6
6
|
exports.ExpressionEditorDocsLink = `${exports.HOST_URL_DOCS}/guide/ui-expression-editor`;
|
|
@@ -12,3 +12,4 @@ exports.AggregatedScalarQueryDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptabl
|
|
|
12
12
|
exports.PredicateDocsLink = `${exports.HOST_URL_DOCS}/guide/adaptable-ql-predicate`;
|
|
13
13
|
exports.PrimaryKeyDocsLink = `${exports.HOST_URL_DOCS}/guide/dev-guide-tutorial-primary-key`;
|
|
14
14
|
exports.LicenseDocsLink = `${exports.HOST_URL_DOCS}/guide/licensing`;
|
|
15
|
+
exports.AdaptableOptionsDocsLink = `${exports.HOST_URL_DOCS}/guide/reference-options-overview`;
|
|
@@ -12,6 +12,7 @@ const aggregatedBooleanExpressionFunctions_1 = require("../ExpressionFunctions/a
|
|
|
12
12
|
const AdaptablePredicate_1 = require("../../PredefinedConfig/Common/AdaptablePredicate");
|
|
13
13
|
const Enums_1 = require("../../PredefinedConfig/Common/Enums");
|
|
14
14
|
const aggregatedScalarExpressionFunctions_1 = require("../ExpressionFunctions/aggregatedScalarExpressionFunctions");
|
|
15
|
+
// change type to DeepRequired<AdaptableOptions> to check which properties have no default values defined
|
|
15
16
|
exports.DefaultAdaptableOptions = {
|
|
16
17
|
adaptableId: GeneralConstants.ADAPTABLE_ID,
|
|
17
18
|
adaptableStateKey: undefined,
|
|
@@ -28,6 +29,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
28
29
|
statusbarHighlightDuration: 2000,
|
|
29
30
|
dataChangeDetectionPolicy: 'rawValue',
|
|
30
31
|
actionHandlers: undefined,
|
|
32
|
+
alertMessageText: undefined,
|
|
31
33
|
},
|
|
32
34
|
notificationsOptions: {
|
|
33
35
|
maxNotifications: 3,
|
|
@@ -80,6 +82,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
80
82
|
alertContainer: undefined,
|
|
81
83
|
},
|
|
82
84
|
columnOptions: {
|
|
85
|
+
columnFriendlyName: undefined,
|
|
83
86
|
columnTypes: GeneralConstants_1.EMPTY_ARRAY,
|
|
84
87
|
showMissingColumnsWarning: true,
|
|
85
88
|
autoOrderGroupedColumns: true,
|
|
@@ -110,6 +113,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
110
113
|
validateOnServer: undefined,
|
|
111
114
|
displayServerValidationMessages: true,
|
|
112
115
|
isCellEditable: undefined,
|
|
116
|
+
smartEditCustomOperations: undefined,
|
|
113
117
|
},
|
|
114
118
|
entitlementOptions: {
|
|
115
119
|
defaultAccessLevel: 'Full',
|
|
@@ -157,6 +161,8 @@ exports.DefaultAdaptableOptions = {
|
|
|
157
161
|
maxColumnsToDisplay: 10,
|
|
158
162
|
},
|
|
159
163
|
layoutTagOptions: {
|
|
164
|
+
autoGenerateTagsForLayouts: false,
|
|
165
|
+
isObjectAvailableInLayout: undefined,
|
|
160
166
|
autoCheckTagsForLayouts: false,
|
|
161
167
|
},
|
|
162
168
|
},
|
|
@@ -211,6 +217,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
211
217
|
saveState: (state) => state,
|
|
212
218
|
loadState: undefined,
|
|
213
219
|
persistState: undefined,
|
|
220
|
+
clearState: undefined,
|
|
214
221
|
},
|
|
215
222
|
teamSharingOptions: {
|
|
216
223
|
enableTeamSharing: false,
|
|
@@ -249,6 +256,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
249
256
|
dataChangeHistoryOptions: {
|
|
250
257
|
activeByDefault: false,
|
|
251
258
|
showDataChange: undefined,
|
|
259
|
+
changeHistoryButton: undefined,
|
|
252
260
|
},
|
|
253
261
|
settingsPanelOptions: {
|
|
254
262
|
popupType: 'window',
|
|
@@ -43,4 +43,34 @@ export declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
|
|
|
43
43
|
}[Keys];
|
|
44
44
|
/** Similar to the builtin Extract, but checks the filter strictly */
|
|
45
45
|
export declare type StrictExtract<T, U extends Partial<T>> = Extract<T, U>;
|
|
46
|
+
/**
|
|
47
|
+
* DeepRequired
|
|
48
|
+
*
|
|
49
|
+
* from https://github.com/piotrwitek/utility-types
|
|
50
|
+
*
|
|
51
|
+
* @desc Required that works for deeply nested structure
|
|
52
|
+
* @example
|
|
53
|
+
* // Expect: {
|
|
54
|
+
* // first: {
|
|
55
|
+
* // second: {
|
|
56
|
+
* // name: string;
|
|
57
|
+
* // };
|
|
58
|
+
* // };
|
|
59
|
+
* // }
|
|
60
|
+
* type NestedProps = {
|
|
61
|
+
* first?: {
|
|
62
|
+
* second?: {
|
|
63
|
+
* name?: string;
|
|
64
|
+
* };
|
|
65
|
+
* };
|
|
66
|
+
* };
|
|
67
|
+
* type RequiredNestedProps = DeepRequired<NestedProps>;
|
|
68
|
+
*/
|
|
69
|
+
export declare type DeepRequired<T> = T extends (...args: any[]) => any ? T : T extends any[] ? _DeepRequiredArray<T[number]> : T extends object ? _DeepRequiredObject<T> : T;
|
|
70
|
+
export interface _DeepRequiredArray<T> extends Array<DeepRequired<NonUndefined<T>>> {
|
|
71
|
+
}
|
|
72
|
+
export declare type _DeepRequiredObject<T> = {
|
|
73
|
+
[P in keyof T]-?: DeepRequired<NonUndefined<T[P]>>;
|
|
74
|
+
};
|
|
75
|
+
export declare type NonUndefined<A> = A extends undefined ? never : A;
|
|
46
76
|
export {};
|
|
@@ -9,15 +9,13 @@ export declare function initPredefinedConfigWithUuids(predefinedConfig: Predefin
|
|
|
9
9
|
export declare function checkValidPrimaryKey(adaptable: IAdaptable): boolean;
|
|
10
10
|
export declare function AdaptableObjectExistsInState(array: AdaptableObject[], itemToCheck: AdaptableObject): boolean;
|
|
11
11
|
export declare function getAppropriateAccessLevel(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
|
|
12
|
-
export declare function checkAdaptableOptions(adaptableOptions: AdaptableOptions): void;
|
|
13
12
|
export declare function runAdaptableComparerFunction(columnId: string, columnValues: any[], adaptable: IAdaptable): AdaptableComparerFunction;
|
|
14
13
|
export declare function addAdaptableObjectUuidAndSource(adaptableObject: AdaptableObject): AdaptableObject;
|
|
15
14
|
export declare const AdaptableHelper: {
|
|
16
|
-
|
|
15
|
+
assignAdaptableOptions: typeof assignAdaptableOptions;
|
|
17
16
|
initPredefinedConfigWithUuids: typeof initPredefinedConfigWithUuids;
|
|
18
17
|
checkValidPrimaryKey: typeof checkValidPrimaryKey;
|
|
19
18
|
AdaptableObjectExistsInState: typeof AdaptableObjectExistsInState;
|
|
20
|
-
checkAdaptableOptions: typeof checkAdaptableOptions;
|
|
21
19
|
runAdaptableComparerFunction: typeof runAdaptableComparerFunction;
|
|
22
20
|
getAppropriateAccessLevel: typeof getAppropriateAccessLevel;
|
|
23
21
|
addUuidAndSource: typeof addAdaptableObjectUuidAndSource;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableHelper = exports.addAdaptableObjectUuidAndSource = exports.runAdaptableComparerFunction = exports.
|
|
3
|
+
exports.AdaptableHelper = exports.addAdaptableObjectUuidAndSource = exports.runAdaptableComparerFunction = exports.getAppropriateAccessLevel = exports.AdaptableObjectExistsInState = exports.checkValidPrimaryKey = exports.initPredefinedConfigWithUuids = exports.assignAdaptableOptions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cloneDeepWith_1 = tslib_1.__importDefault(require("lodash/cloneDeepWith"));
|
|
6
6
|
const isPlainObject_1 = tslib_1.__importDefault(require("lodash/isPlainObject"));
|
|
@@ -98,16 +98,6 @@ function getAppropriateAccessLevel(adaptableObject, moduleAccessLevel) {
|
|
|
98
98
|
return moduleAccessLevel;
|
|
99
99
|
}
|
|
100
100
|
exports.getAppropriateAccessLevel = getAppropriateAccessLevel;
|
|
101
|
-
// perform any checks that are necessary here
|
|
102
|
-
// for now just adaptableId
|
|
103
|
-
function checkAdaptableOptions(adaptableOptions) {
|
|
104
|
-
if (adaptableOptions.adaptableId) {
|
|
105
|
-
if (adaptableOptions.adaptableId.includes('.')) {
|
|
106
|
-
LoggingHelper_1.ConsoleLogWarning("The 'adaptableId' property in adaptableOptions should not include a '.'. We strongly recommend that you remove this.");
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.checkAdaptableOptions = checkAdaptableOptions;
|
|
111
101
|
function runAdaptableComparerFunction(columnId, columnValues, adaptable) {
|
|
112
102
|
return function compareItemsOfCustomSort(valueA, valueB, nodeA, nodeB) {
|
|
113
103
|
let firstElementValueString = nodeA
|
|
@@ -149,11 +139,10 @@ function addAdaptableObjectUuidAndSource(adaptableObject) {
|
|
|
149
139
|
}
|
|
150
140
|
exports.addAdaptableObjectUuidAndSource = addAdaptableObjectUuidAndSource;
|
|
151
141
|
exports.AdaptableHelper = {
|
|
152
|
-
|
|
142
|
+
assignAdaptableOptions,
|
|
153
143
|
initPredefinedConfigWithUuids,
|
|
154
144
|
checkValidPrimaryKey,
|
|
155
145
|
AdaptableObjectExistsInState,
|
|
156
|
-
checkAdaptableOptions,
|
|
157
146
|
runAdaptableComparerFunction,
|
|
158
147
|
getAppropriateAccessLevel,
|
|
159
148
|
addUuidAndSource: addAdaptableObjectUuidAndSource,
|
|
@@ -8,3 +8,30 @@ export declare const isValueValidDate: (data: any) => boolean;
|
|
|
8
8
|
export declare const dateToISO: (date: Date | number | string) => string;
|
|
9
9
|
export declare const parseToISO: (date: string | Date | number, dateFormat?: string) => string;
|
|
10
10
|
export declare const parseDateValue: (dateValue: string | Date | number, dateFormat?: string) => Date | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a date with the same day/month/year/hour with the current timezone.
|
|
13
|
+
* '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
|
|
14
|
+
*
|
|
15
|
+
* new Date() always creates the date using the current timezone.
|
|
16
|
+
* To compare two dates, they need to be in the same timezone.
|
|
17
|
+
*
|
|
18
|
+
* @param date Date
|
|
19
|
+
*/
|
|
20
|
+
export declare const utcDateToSameDateInLocale: (date: Date) => Date;
|
|
21
|
+
/**
|
|
22
|
+
* To make sure selected/input date is correct and in the current time-zone.
|
|
23
|
+
|
|
24
|
+
*
|
|
25
|
+
* '2022-06-14' is considered to be '2022-06-13 00:00:00.
|
|
26
|
+
* And when date object is created it uses the current timezone.
|
|
27
|
+
*
|
|
28
|
+
* '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
|
|
29
|
+
*
|
|
30
|
+
* @param stringDate date string
|
|
31
|
+
*/
|
|
32
|
+
export declare const parseFilterInputDate: (stringDate: string) => Date;
|
|
33
|
+
/**
|
|
34
|
+
* Used to parse the date from rowDate inside date predicates.
|
|
35
|
+
* The date is parsed in moved to local timezone.
|
|
36
|
+
*/
|
|
37
|
+
export declare const parseFilterValueDate: (value: any) => Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
|
|
3
|
+
exports.parseFilterValueDate = exports.parseFilterInputDate = exports.utcDateToSameDateInLocale = exports.parseDateValue = exports.parseToISO = exports.dateToISO = exports.isValueValidDate = exports.isValidDate = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const parseISO_1 = tslib_1.__importDefault(require("date-fns/parseISO"));
|
|
6
6
|
const parse_1 = tslib_1.__importDefault(require("date-fns/parse"));
|
|
@@ -63,3 +63,35 @@ const parseDateValue = (dateValue, dateFormat) => {
|
|
|
63
63
|
return dateInstance;
|
|
64
64
|
};
|
|
65
65
|
exports.parseDateValue = parseDateValue;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a date with the same day/month/year/hour with the current timezone.
|
|
68
|
+
* '2022-06-01T17:00:00.000Z' => '2022-06-01T17:00:00.000+03:00' // RO time
|
|
69
|
+
*
|
|
70
|
+
* new Date() always creates the date using the current timezone.
|
|
71
|
+
* To compare two dates, they need to be in the same timezone.
|
|
72
|
+
*
|
|
73
|
+
* @param date Date
|
|
74
|
+
*/
|
|
75
|
+
const utcDateToSameDateInLocale = (date) => {
|
|
76
|
+
return new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
|
|
77
|
+
};
|
|
78
|
+
exports.utcDateToSameDateInLocale = utcDateToSameDateInLocale;
|
|
79
|
+
/**
|
|
80
|
+
* To make sure selected/input date is correct and in the current time-zone.
|
|
81
|
+
|
|
82
|
+
*
|
|
83
|
+
* '2022-06-14' is considered to be '2022-06-13 00:00:00.
|
|
84
|
+
* And when date object is created it uses the current timezone.
|
|
85
|
+
*
|
|
86
|
+
* '2022-06-14' => Mon Jun 13 2022 20:00:00 GMT-0400 (Eastern Daylight Time)
|
|
87
|
+
*
|
|
88
|
+
* @param stringDate date string
|
|
89
|
+
*/
|
|
90
|
+
const parseFilterInputDate = (stringDate) => exports.utcDateToSameDateInLocale(new Date(stringDate));
|
|
91
|
+
exports.parseFilterInputDate = parseFilterInputDate;
|
|
92
|
+
/**
|
|
93
|
+
* Used to parse the date from rowDate inside date predicates.
|
|
94
|
+
* The date is parsed in moved to local timezone.
|
|
95
|
+
*/
|
|
96
|
+
const parseFilterValueDate = (value) => exports.utcDateToSameDateInLocale(exports.parseDateValue(value));
|
|
97
|
+
exports.parseFilterValueDate = parseFilterValueDate;
|
|
@@ -5,7 +5,13 @@ export declare class MetamodelService implements IMetamodelService {
|
|
|
5
5
|
private gridInfoOptions;
|
|
6
6
|
constructor(adaptableApi: AdaptableApi);
|
|
7
7
|
getGridInfoOptions(): GridInfoOptions;
|
|
8
|
+
validateAdaptableOptionsValues(): void;
|
|
9
|
+
private validateOptionsObject;
|
|
10
|
+
private getExpectedOptionsValueType;
|
|
8
11
|
private buildGridInfoOptions;
|
|
9
12
|
private mapGridInfoContainerItems;
|
|
10
|
-
|
|
13
|
+
private getAdaptableOptionsDefaultValues;
|
|
14
|
+
private getAdaptableMetamodel;
|
|
15
|
+
private getAdaptableOptionsMetamodel;
|
|
16
|
+
private getAdaptableOptions;
|
|
11
17
|
}
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MetamodelService = void 0;
|
|
4
4
|
const adaptable_metamodel_1 = require("../../metamodel/adaptable.metamodel");
|
|
5
5
|
const DefaultAdaptableOptions_1 = require("../Defaults/DefaultAdaptableOptions");
|
|
6
|
+
const LoggingHelper_1 = require("../Helpers/LoggingHelper");
|
|
7
|
+
const DocumentationLinkConstants_1 = require("../Constants/DocumentationLinkConstants");
|
|
8
|
+
const supportedMetamodelTypes = [
|
|
9
|
+
'string',
|
|
10
|
+
'number',
|
|
11
|
+
'boolean',
|
|
12
|
+
'array',
|
|
13
|
+
'function',
|
|
14
|
+
'REFERENCE',
|
|
15
|
+
];
|
|
6
16
|
class MetamodelService {
|
|
7
17
|
constructor(adaptableApi) {
|
|
8
18
|
this.adaptableApi = adaptableApi;
|
|
@@ -13,17 +23,72 @@ class MetamodelService {
|
|
|
13
23
|
getGridInfoOptions() {
|
|
14
24
|
return this.gridInfoOptions;
|
|
15
25
|
}
|
|
26
|
+
validateAdaptableOptionsValues() {
|
|
27
|
+
var _a;
|
|
28
|
+
LoggingHelper_1.LogAdaptableInfo('Validating Adaptable Options...');
|
|
29
|
+
const adaptableOptionsValues = this.getAdaptableOptions();
|
|
30
|
+
const adaptableOptionsMetamodel = this.getAdaptableOptionsMetamodel();
|
|
31
|
+
const adaptableOptionsDefaultValues = this.getAdaptableOptionsDefaultValues();
|
|
32
|
+
if ((_a = adaptableOptionsValues.adaptableId) === null || _a === void 0 ? void 0 : _a.includes('.')) {
|
|
33
|
+
LoggingHelper_1.ConsoleLogWarning("The 'AdaptableOptions.adaptableId' property should NOT include a '.' character. We strongly recommend to remove it to avoid unexpected AdapTable behavior.");
|
|
34
|
+
}
|
|
35
|
+
const validationErrors = [];
|
|
36
|
+
this.validateOptionsObject(validationErrors, 'AdaptableOptions', adaptableOptionsValues, adaptableOptionsMetamodel, adaptableOptionsDefaultValues);
|
|
37
|
+
if (validationErrors.length) {
|
|
38
|
+
LoggingHelper_1.LogAdaptableWarning([
|
|
39
|
+
'AdaptableOptions validation errors:',
|
|
40
|
+
'\n',
|
|
41
|
+
...validationErrors,
|
|
42
|
+
'\n',
|
|
43
|
+
`See AdaptableOptions documentation at ${DocumentationLinkConstants_1.AdaptableOptionsDocsLink} for details`,
|
|
44
|
+
].join('\n'));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
validateOptionsObject(validationErrors, optionsObjectName, optionsObject, optionsObjectMetamodel, optionsObjectDefaultValues) {
|
|
48
|
+
Object.entries(optionsObject).forEach(([optionKey, optionValue]) => {
|
|
49
|
+
const optionMetamodel = optionsObjectMetamodel.properties.find((metamodelProperty) => metamodelProperty.name === optionKey);
|
|
50
|
+
if (!optionMetamodel) {
|
|
51
|
+
validationErrors.push(`${optionsObjectName}.${optionKey} (value=${optionValue}) :: unknown/unsupported property, will be ignored`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// let's try to validate the type of the provided value
|
|
55
|
+
const expectedOptionsValueType = this.getExpectedOptionsValueType(optionMetamodel);
|
|
56
|
+
const providedOptionsValueType = Array.isArray(optionValue) ? 'array' : typeof optionValue;
|
|
57
|
+
if (!expectedOptionsValueType) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// if it's a REFERENCE, we try to go (recursively) deeper
|
|
61
|
+
if (expectedOptionsValueType === 'REFERENCE') {
|
|
62
|
+
const referenceObjectName = optionMetamodel.reference;
|
|
63
|
+
const referenceObject = optionsObject[optionKey];
|
|
64
|
+
const referenceObjectMetamodel = this.getAdaptableMetamodel()[referenceObjectName];
|
|
65
|
+
if (referenceObject && (referenceObjectMetamodel === null || referenceObjectMetamodel === void 0 ? void 0 : referenceObjectMetamodel.kind) === 'Interface') {
|
|
66
|
+
this.validateOptionsObject(validationErrors, referenceObjectName, referenceObject, referenceObjectMetamodel, optionsObjectDefaultValues === null || optionsObjectDefaultValues === void 0 ? void 0 : optionsObjectDefaultValues[optionKey]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (supportedMetamodelTypes.includes(providedOptionsValueType) &&
|
|
70
|
+
providedOptionsValueType !== expectedOptionsValueType) {
|
|
71
|
+
validationErrors.push(`${optionsObjectName}.${optionKey} (value=${optionValue}) :: wrong type (${providedOptionsValueType}), expected ${expectedOptionsValueType}`);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getExpectedOptionsValueType(metamodelProperty) {
|
|
76
|
+
const metamodelPropertyKind = metamodelProperty.kind;
|
|
77
|
+
if (supportedMetamodelTypes.includes(metamodelPropertyKind)) {
|
|
78
|
+
return metamodelPropertyKind;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
16
81
|
buildGridInfoOptions() {
|
|
17
82
|
const gridInfoOptions = new Map();
|
|
18
|
-
const adaptableMetamodel =
|
|
19
|
-
const adaptableOptionsMetamodel =
|
|
20
|
-
const adaptableOptionsValues = this.
|
|
21
|
-
const adaptableOptionsDefaultValues =
|
|
83
|
+
const adaptableMetamodel = this.getAdaptableMetamodel();
|
|
84
|
+
const adaptableOptionsMetamodel = this.getAdaptableOptionsMetamodel();
|
|
85
|
+
const adaptableOptionsValues = this.getAdaptableOptions();
|
|
86
|
+
const adaptableOptionsDefaultValues = this.getAdaptableOptionsDefaultValues();
|
|
22
87
|
if (!adaptableOptionsMetamodel) {
|
|
23
88
|
// should never happen
|
|
24
89
|
return gridInfoOptions;
|
|
25
90
|
}
|
|
26
|
-
// root-level properties are grouped in a
|
|
91
|
+
// root-level properties are grouped in a synthetic 'Base Options' container
|
|
27
92
|
const baseOptionsItems = this.mapGridInfoContainerItems(adaptableOptionsMetamodel, adaptableOptionsValues, adaptableOptionsDefaultValues);
|
|
28
93
|
gridInfoOptions.set('baseOptions', {
|
|
29
94
|
containerLabel: 'Base Options',
|
|
@@ -65,6 +130,17 @@ class MetamodelService {
|
|
|
65
130
|
};
|
|
66
131
|
});
|
|
67
132
|
}
|
|
68
|
-
|
|
133
|
+
getAdaptableOptionsDefaultValues() {
|
|
134
|
+
return DefaultAdaptableOptions_1.DefaultAdaptableOptions;
|
|
135
|
+
}
|
|
136
|
+
getAdaptableMetamodel() {
|
|
137
|
+
return adaptable_metamodel_1.ADAPTABLE_METAMODEL;
|
|
138
|
+
}
|
|
139
|
+
getAdaptableOptionsMetamodel() {
|
|
140
|
+
return this.getAdaptableMetamodel()['AdaptableOptions'];
|
|
141
|
+
}
|
|
142
|
+
getAdaptableOptions() {
|
|
143
|
+
return this.adaptableApi.internalApi.getAdaptableOptions();
|
|
144
|
+
}
|
|
69
145
|
}
|
|
70
146
|
exports.MetamodelService = MetamodelService;
|
|
@@ -21,14 +21,16 @@ const ConfigurationWizard = (props) => {
|
|
|
21
21
|
const handleFinish = () => {
|
|
22
22
|
const newAdaptableOptions = Object.assign({}, adaptableOptions);
|
|
23
23
|
newAdaptableOptions.gridOptions = Object.assign({}, adaptableOptions.gridOptions);
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (columnsHandle.current) {
|
|
25
|
+
newAdaptableOptions.gridOptions.columnDefs = columnsHandle
|
|
26
|
+
.current.getColumns()
|
|
27
|
+
.map((column) => {
|
|
28
|
+
const newColumn = Object.assign(Object.assign({}, column), { headerName: column.caption || StringExtensions_1.default.Humanize(column.field) });
|
|
29
|
+
delete newColumn.caption;
|
|
30
|
+
return newColumn;
|
|
31
|
+
});
|
|
32
|
+
newAdaptableOptions.primaryKey = columnsHandle.current.getPrimaryKey();
|
|
33
|
+
}
|
|
32
34
|
setAdaptableOptions(newAdaptableOptions);
|
|
33
35
|
props.onFinish(newAdaptableOptions);
|
|
34
36
|
};
|
|
@@ -21,7 +21,7 @@ const AdaptableDateInput = React.forwardRef((props, ref) => {
|
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
const dateValue =
|
|
24
|
+
const dateValue = DateHelper_1.parseFilterInputDate(value);
|
|
25
25
|
const datepickerProps = Object.assign({
|
|
26
26
|
// this is OK as long as we do not support range datepicker
|
|
27
27
|
value: dateValue, onChange: (dateValue) => { var _a;
|