@adaptabletools/adaptable-cjs 18.0.17 → 18.1.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agGrid.d.ts +4 -3
- package/agGrid.js +6 -1
- package/base.css +7 -2
- package/base.css.map +1 -1
- package/index.css +11 -2
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -4
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +52 -11
- package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
- package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
- package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
- package/src/Api/ExpressionApi.d.ts +2 -2
- package/src/Api/Fdc3Api.d.ts +14 -19
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +3 -0
- package/src/Api/Implementation/ConfigApiImpl.js +3 -0
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
- package/src/Api/Implementation/Fdc3ApiImpl.js +35 -11
- package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
- package/src/Api/Internal/AlertInternalApi.js +196 -25
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
- package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
- package/src/Api/Internal/ExportInternalApi.js +31 -17
- package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
- package/src/Api/Internal/ExpressionInternalApi.js +80 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +5 -9
- package/src/Api/Internal/GridInternalApi.d.ts +29 -13
- package/src/Api/Internal/GridInternalApi.js +129 -39
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +2 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +22 -1
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
- package/src/PredefinedConfig/Common/Fdc3Context.js +44 -32
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
- package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
- package/src/Strategy/AdaptableModuleBase.js +1 -3
- package/src/Strategy/AlertModule.d.ts +1 -1
- package/src/Strategy/AlertModule.js +8 -8
- package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +14 -13
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
- package/src/Utilities/Services/QueryLanguageService.js +105 -6
- package/src/Utilities/Services/ReportService.js +8 -5
- package/src/Utilities/Services/RowSummaryService.js +3 -1
- package/src/Utilities/divideBy100.d.ts +1 -0
- package/src/Utilities/divideBy100.js +34 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +27 -0
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
- package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
- package/src/View/Components/EntityRulesEditor/index.js +11 -7
- package/src/View/Components/ExpressionWizard.js +1 -1
- package/src/View/Components/FilterForm/FilterForm.js +2 -2
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
- package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
- package/src/View/Components/FilterForm/QuickFilterValues.js +5 -5
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
- package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
- package/src/View/Components/Selectors/FieldSelector.js +26 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.js +9 -5
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
- package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
- package/src/agGrid/AdaptableAgGrid.d.ts +4 -6
- package/src/agGrid/AdaptableAgGrid.js +66 -47
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +24 -1
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/FilterWrapper.js +12 -7
- package/src/agGrid/defaultAdaptableOptions.js +2 -2
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
- package/src/agGrid/editors/AdaptableDateEditor/index.js +6 -19
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +6 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -0
- package/src/components/Accordion.js +1 -1
- package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
- package/src/components/Datepicker/index.js +3 -4
- package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
- package/src/components/ExpressionEditor/DataTableEditor.js +68 -0
- package/src/components/ExpressionEditor/EditorInput.js +21 -8
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +72 -14
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +68 -95
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +6 -5
- package/src/components/OverlayTrigger/index.js +10 -6
- package/src/components/icons/column-outline.d.ts +3 -0
- package/src/components/icons/column-outline.js +7 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +7 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +121 -200
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +14 -3
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
- package/src/parser/src/types.d.ts +101 -1
- package/src/types.d.ts +8 -6
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -92,7 +92,7 @@ const GridFilterExpressionEditor = (props) => {
|
|
|
92
92
|
},
|
|
93
93
|
} },
|
|
94
94
|
React.createElement(rebass_1.Flex, { height: "100%", flexDirection: "column" },
|
|
95
|
-
React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: ModuleConstants_1.GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
95
|
+
React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { type: 'boolean', module: ModuleConstants_1.GridFilterModuleId, value: expression, onChange: (expression) => setExpression(expression), initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })),
|
|
96
96
|
React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 1, alignItems: "center" },
|
|
97
97
|
props.onDismiss && (React.createElement(SimpleButton_1.default, { margin: 1, variant: "text", "data-name": "action-close", onClick: () => {
|
|
98
98
|
props.onDismiss();
|
|
@@ -12,6 +12,7 @@ const ExpressionEditor_1 = require("../../../../components/ExpressionEditor");
|
|
|
12
12
|
const ModuleConstants_1 = require("../../../../Utilities/Constants/ModuleConstants");
|
|
13
13
|
const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
|
|
14
14
|
const useGridFilterOptionsForExpressionEditor_1 = require("../../../GridFilter/useGridFilterOptionsForExpressionEditor");
|
|
15
|
+
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
|
|
15
16
|
const isGridFiltersValid = (layout, api) => {
|
|
16
17
|
var _a;
|
|
17
18
|
const expression = (_a = layout === null || layout === void 0 ? void 0 : layout.GridFilter) === null || _a === void 0 ? void 0 : _a.Expression;
|
|
@@ -36,9 +37,10 @@ const GridFilterSection = (props) => {
|
|
|
36
37
|
const expressionEditorProps = (0, useGridFilterOptionsForExpressionEditor_1.useGridFilterOptionsForExpressionEditorProps)();
|
|
37
38
|
const expressionEditorContent = (React.createElement(ExpressionEditor_1.ExpressionEditor, Object.assign({}, expressionEditorProps, { allowSaveNamedQuery: false, type: 'boolean', module: ModuleConstants_1.GridFilterModuleId, value: (_b = (_a = layout === null || layout === void 0 ? void 0 : layout.GridFilter) === null || _a === void 0 ? void 0 : _a.Expression) !== null && _b !== void 0 ? _b : '', onChange: (expression) => {
|
|
38
39
|
props.onChange(Object.assign(Object.assign({}, layout), { GridFilter: Object.assign(Object.assign({}, layout.GridFilter), { Expression: expression }) }));
|
|
39
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
40
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api })));
|
|
40
41
|
return (React.createElement(Tabs_1.Tabs, { style: { height: '100%' } },
|
|
41
42
|
React.createElement(Tabs_1.Tabs.Tab, null, "Grid Filters"),
|
|
42
|
-
React.createElement(Tabs_1.Tabs.Content, null,
|
|
43
|
+
React.createElement(Tabs_1.Tabs.Content, null,
|
|
44
|
+
React.createElement(Panel_1.default, null, expressionEditorContent))));
|
|
43
45
|
};
|
|
44
46
|
exports.GridFilterSection = GridFilterSection;
|
|
@@ -18,6 +18,7 @@ const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
|
18
18
|
const ValueSelector_1 = require("../../../Components/ValueSelector");
|
|
19
19
|
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
|
|
20
20
|
const Utilities_1 = require("./Utilities");
|
|
21
|
+
const SuspendToggleButton_1 = require("../../../Components/Buttons/SuspendToggleButton");
|
|
21
22
|
const areSummaryRowsValid = (layout) => {
|
|
22
23
|
var _a;
|
|
23
24
|
if (!layout.RowSummaries)
|
|
@@ -37,7 +38,6 @@ const areSummaryRowsValid = (layout) => {
|
|
|
37
38
|
exports.areSummaryRowsValid = areSummaryRowsValid;
|
|
38
39
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
39
40
|
const inputType = (0, adaptableQlUtils_1.mapColumnDataTypeToExpressionFunctionType)(columnType);
|
|
40
|
-
// Object.entries(availableScalarExpressions ?? {})
|
|
41
41
|
return RowSummary_1.summarySupportedExpressions
|
|
42
42
|
.filter((expression) => availableScalarExpressions[expression])
|
|
43
43
|
.map((expression) => {
|
|
@@ -86,6 +86,12 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
86
86
|
}, [rowSummary.ColumnsMap]);
|
|
87
87
|
return (React.createElement(Panel_1.default, { header: React.createElement(rebass_1.Flex, { style: { width: '100%' } },
|
|
88
88
|
React.createElement(rebass_1.Flex, { flex: 1, alignItems: "center" }, "Row Summary"),
|
|
89
|
+
React.createElement(rebass_1.Box, { mr: 2 },
|
|
90
|
+
React.createElement(SuspendToggleButton_1.SuspendToggleButton, { onSuspend: () => {
|
|
91
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: true }));
|
|
92
|
+
}, onUnSuspend: () => {
|
|
93
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: false }));
|
|
94
|
+
}, suspendableObject: rowSummary })),
|
|
89
95
|
React.createElement(SimpleButton_1.default, { icon: "delete", onClick: () => {
|
|
90
96
|
onDelete();
|
|
91
97
|
} })), p: 2 },
|
|
@@ -32,6 +32,6 @@ const NamedQueryExpressionWizardSection = (props) => {
|
|
|
32
32
|
const initialData = (0, react_1.useMemo)(() => api.internalApi.getQueryPreviewData(), []);
|
|
33
33
|
return (React.createElement(ExpressionEditor_1.ExpressionEditor, { allowSaveNamedQuery: false, showQueryBuilder: true, type: 'boolean', module: moduleInfo.ModuleName, value: data.BooleanExpression, onChange: (BooleanExpression) => {
|
|
34
34
|
props.onChange(Object.assign(Object.assign({}, data), { BooleanExpression }));
|
|
35
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
35
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
36
36
|
};
|
|
37
37
|
exports.NamedQueryExpressionWizardSection = NamedQueryExpressionWizardSection;
|
|
@@ -75,7 +75,8 @@ const OnePageAdaptableWizard = (props) => {
|
|
|
75
75
|
};
|
|
76
76
|
exports.OnePageAdaptableWizard = OnePageAdaptableWizard;
|
|
77
77
|
const OnePageWizardSummary = () => {
|
|
78
|
-
const {
|
|
78
|
+
const { sections, data, api } = useOnePageAdaptableWizardContext();
|
|
79
|
+
const { setCurrentSection } = (0, OnePageWizards_1.useOnePageWizardContext)();
|
|
79
80
|
const renderEdit = (index) => (React.createElement(SimpleButton_1.default, { px: 1, variant: "text", style: {
|
|
80
81
|
textDecoration: 'underline',
|
|
81
82
|
display: 'inline-block',
|
|
@@ -96,7 +97,7 @@ const OnePageWizardSummary = () => {
|
|
|
96
97
|
section.title,
|
|
97
98
|
" ",
|
|
98
99
|
renderEdit(index)),
|
|
99
|
-
React.createElement(Tabs_1.Tabs.Content, null, section.renderSummary(data))));
|
|
100
|
+
React.createElement(Tabs_1.Tabs.Content, null, section.renderSummary(data, api))));
|
|
100
101
|
})
|
|
101
102
|
.filter(Boolean)));
|
|
102
103
|
};
|
|
@@ -2,7 +2,7 @@ import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
|
|
|
2
2
|
import { ChartRef, Column, GridApi, GridOptions, IRowNode, Module, RowModelType } from '@ag-grid-community/core';
|
|
3
3
|
import { AdaptableLogger } from './AdaptableLogger';
|
|
4
4
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
5
|
-
import {
|
|
5
|
+
import { DistinctColumnValuesParams, IAdaptable } from '../AdaptableInterfaces/IAdaptable';
|
|
6
6
|
import { EmitterCallback } from '../Utilities/Emitter';
|
|
7
7
|
import { AdaptablePlugin } from '../AdaptableOptions/AdaptablePlugin';
|
|
8
8
|
import { AgGridAdapter } from './AgGridAdapter';
|
|
@@ -25,9 +25,8 @@ import { AgGridMenuAdapter } from './AgGridMenuAdapter';
|
|
|
25
25
|
import { AdaptableColumn, AdaptableTheme, ChartDefinition, ColumnSort, DataUpdateConfig, GridCell, Layout, ReportData, SelectedCellInfo, SelectedRowInfo } from '../types';
|
|
26
26
|
import { RenderReactRootFn } from '../renderReactRoot';
|
|
27
27
|
import { AgGridOptionsService } from './AgGridOptionsService';
|
|
28
|
-
import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
28
|
+
import { AdaptableVariant, AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
29
29
|
import { RowEditService } from '../Utilities/Services/RowEditService';
|
|
30
|
-
export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
|
|
31
30
|
export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'available' | 'ready' | 'preDestroyed';
|
|
32
31
|
type RenderAgGridFrameworkComponentResult = false | GridApi;
|
|
33
32
|
interface AdaptableInitInternalConfig<TData = any> {
|
|
@@ -239,13 +238,12 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
239
238
|
autoSizeAllColumns(): void;
|
|
240
239
|
setColumnOrder(VisibleColumnList: string[]): void;
|
|
241
240
|
private getSortedColumnStateForVisibleColumns;
|
|
242
|
-
getDistinctValuesForColumn(column: AdaptableColumn, distinctValuesParams:
|
|
241
|
+
getDistinctValuesForColumn(column: AdaptableColumn, distinctValuesParams: DistinctColumnValuesParams): GridCell[];
|
|
243
242
|
private getGridCellsForPermittedValues;
|
|
244
243
|
private getDistinctGridCellsForColumn;
|
|
245
|
-
addBlankValueToGridCell(gridCell: GridCell): void;
|
|
246
244
|
private addDistinctColumnValue;
|
|
247
245
|
private getUniqueGridCells;
|
|
248
|
-
getGridCellsForColumn(columnId: string, includeBlanks?: boolean): GridCell[] | undefined;
|
|
246
|
+
getGridCellsForColumn(columnId: string, includeBlanks?: boolean, onlyVisibleRows?: boolean): GridCell[] | undefined;
|
|
249
247
|
getRowNodesForPrimaryKeys(primaryKeyValues: any[]): any[];
|
|
250
248
|
getRowNodeByIndex(index: number): IRowNode;
|
|
251
249
|
getAgGridStatusPanels(): import("@ag-grid-community/core").StatusPanelDef[];
|
|
@@ -69,8 +69,6 @@ const Fdc3Module_1 = require("../Strategy/Fdc3Module");
|
|
|
69
69
|
const GridFilterModule_1 = require("../Strategy/GridFilterModule");
|
|
70
70
|
const NamedQueryModule_1 = require("../Strategy/NamedQueryModule");
|
|
71
71
|
const CommentModule_1 = require("../Strategy/CommentModule");
|
|
72
|
-
const AdaptableNumberEditor_1 = require("./editors/AdaptableNumberEditor");
|
|
73
|
-
const AdaptableDateEditor_1 = require("./editors/AdaptableDateEditor");
|
|
74
72
|
const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
75
73
|
const uuid_1 = require("../components/utils/uuid");
|
|
76
74
|
const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
@@ -93,7 +91,7 @@ const RowEditService_1 = require("../Utilities/Services/RowEditService");
|
|
|
93
91
|
const weightedAverage_1 = require("./weightedAverage");
|
|
94
92
|
const sortWithOrder_1 = require("../Utilities/sortWithOrder");
|
|
95
93
|
const Enums_1 = require("../PredefinedConfig/Common/Enums");
|
|
96
|
-
const ObjectFactory_1 = tslib_1.
|
|
94
|
+
const ObjectFactory_1 = tslib_1.__importStar(require("../Utilities/ObjectFactory"));
|
|
97
95
|
const EnvVars_1 = require("../EnvVars");
|
|
98
96
|
const AdaptableUpgradeHelper_1 = require("../migration/AdaptableUpgradeHelper");
|
|
99
97
|
const Modal_1 = require("../components/Modal");
|
|
@@ -402,9 +400,16 @@ class AdaptableAgGrid {
|
|
|
402
400
|
}
|
|
403
401
|
this.lifecycleState = 'ready';
|
|
404
402
|
this.forPlugins((plugin) => plugin.onAdaptableReady(this, this.adaptableOptions));
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
setTimeout(() => {
|
|
404
|
+
// without the setTimeout, calling autoSizeAllColumns immediately in the onAdaptableReady
|
|
405
|
+
// does not work. (I prefer setTimeout to rAF, as raf is not running when you switch tabs)
|
|
406
|
+
//
|
|
407
|
+
// it also makes it possible to listen to CALCULATED_COLUMN_READY, DASHBOARD_READY, etc.
|
|
408
|
+
// in onAdaptableReady - without this those event listeners are not triggered
|
|
409
|
+
this.api.eventApi.emit('AdaptableReady', {
|
|
410
|
+
adaptableApi: this.api,
|
|
411
|
+
agGridApi: this.agGridAdapter.getAgGridApi(),
|
|
412
|
+
});
|
|
408
413
|
});
|
|
409
414
|
perfInitAdaptableAgGrid.end();
|
|
410
415
|
return Promise.resolve(this.api);
|
|
@@ -673,10 +678,15 @@ class AdaptableAgGrid {
|
|
|
673
678
|
const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
|
|
674
679
|
try {
|
|
675
680
|
if (columnFilters.length > 0) {
|
|
681
|
+
const isRowFiltrable = this.api.optionsApi.getColumnFilterOptions().isRowFilterable;
|
|
676
682
|
for (const columnFilter of columnFilters) {
|
|
677
683
|
const evaluateFilterOnClient = this.api.expressionApi.internalApi.evaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, [columnFilter.Predicate]);
|
|
678
684
|
if (evaluateFilterOnClient) {
|
|
679
685
|
// we then assess filters (if running locally)
|
|
686
|
+
if (typeof isRowFiltrable === 'function' &&
|
|
687
|
+
!isRowFiltrable(Object.assign(Object.assign({}, (0, ObjectFactory_1.createBaseContext)(this.api)), { rowNode: node, data: node.data }))) {
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
680
690
|
if (!this.api.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, node)) {
|
|
681
691
|
return false;
|
|
682
692
|
}
|
|
@@ -935,37 +945,46 @@ class AdaptableAgGrid {
|
|
|
935
945
|
*/
|
|
936
946
|
// this will have to go/be heavily extended with https://github.com/AdaptableTools/adaptable/issues/2230
|
|
937
947
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
|
|
938
|
-
var _a
|
|
948
|
+
var _a;
|
|
939
949
|
const providedColumnTypes = original_columnTypes || {};
|
|
940
950
|
const gridOptionsColumnTypes = gridOptions.columnTypes || {};
|
|
941
|
-
const patchedColumnTypes = Object.assign(providedColumnTypes, {
|
|
951
|
+
const patchedColumnTypes = Object.assign({}, providedColumnTypes, {
|
|
942
952
|
[GeneralConstants_1.AB_SPECIAL_COLUMN]: {},
|
|
943
953
|
[GeneralConstants_1.AB_FDC3_COLUMN]: {},
|
|
944
|
-
abColDefNumber: (
|
|
945
|
-
abColDefString: (
|
|
946
|
-
abColDefBoolean: (
|
|
947
|
-
abColDefDate: (
|
|
948
|
-
abColDefObject: (
|
|
949
|
-
abColDefCustom: (
|
|
950
|
-
abColDefStringArray: (
|
|
951
|
-
abColDefNumberArray: (
|
|
952
|
-
abColDefTupleNumberArray: (
|
|
953
|
-
abColDefObjectNumberArray: (
|
|
954
|
+
abColDefNumber: Object.assign({}, gridOptionsColumnTypes.abColDefNumber),
|
|
955
|
+
abColDefString: Object.assign({}, gridOptionsColumnTypes.abColDefString),
|
|
956
|
+
abColDefBoolean: Object.assign({}, gridOptionsColumnTypes.abColDefBoolean),
|
|
957
|
+
abColDefDate: Object.assign({}, gridOptionsColumnTypes.abColDefDate),
|
|
958
|
+
abColDefObject: Object.assign({}, gridOptionsColumnTypes.abColDefObject),
|
|
959
|
+
abColDefCustom: Object.assign({}, gridOptionsColumnTypes.abColDefCustom),
|
|
960
|
+
abColDefStringArray: Object.assign({}, gridOptionsColumnTypes.abColDefStringArray),
|
|
961
|
+
abColDefNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefNumberArray),
|
|
962
|
+
abColDefTupleNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefTupleNumberArray),
|
|
963
|
+
abColDefObjectNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefObjectNumberArray),
|
|
954
964
|
});
|
|
955
|
-
const customColumnTypes = (
|
|
965
|
+
const customColumnTypes = (_a = this.api.columnApi.getColumnTypes()) !== null && _a !== void 0 ? _a : [];
|
|
956
966
|
for (const customColumnType of customColumnTypes) {
|
|
957
967
|
if (!patchedColumnTypes[customColumnType]) {
|
|
958
968
|
patchedColumnTypes[customColumnType] = {};
|
|
959
969
|
}
|
|
960
970
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
971
|
+
const colTypesToEditors = (0, AgGridColumnAdapter_1.getEditorsForColumnTypes)(this.variant);
|
|
972
|
+
// we used to patch here the column types
|
|
973
|
+
// and have the editors for abColDefNumber and abColDefDate set here
|
|
974
|
+
// but AG Grid seems to have a bug where if we have a custom editor
|
|
975
|
+
// for a specific number column, it's applied to all abColDefNumber columns, because they
|
|
976
|
+
// share the same column type
|
|
977
|
+
// so we're now doing this logic in AgGridColumnAdaptapter.setupColumnCellEditor
|
|
978
|
+
// and instead, here we're just assigning the editor to null
|
|
979
|
+
// because if we don't assign to null, the default that AG Grid provides
|
|
980
|
+
// will be used instead, and we don't want that for those column types
|
|
981
|
+
Object.keys(colTypesToEditors).forEach((colType) => {
|
|
982
|
+
if (patchedColumnTypes[colType].cellEditor == undefined) {
|
|
983
|
+
patchedColumnTypes[colType].cellEditor = null; // colTypesToEditors[colType];
|
|
984
|
+
// if you dont believe me, just put colTypesToEditors[colType] in the line above instead of the null value
|
|
985
|
+
// and see the editing/percentage-editor.spec.ts test fail as it wont be using the correct editor
|
|
986
|
+
}
|
|
987
|
+
});
|
|
969
988
|
return patchedColumnTypes;
|
|
970
989
|
});
|
|
971
990
|
/**
|
|
@@ -2294,13 +2313,10 @@ class AdaptableAgGrid {
|
|
|
2294
2313
|
}
|
|
2295
2314
|
getDistinctGridCellsForColumn(column, distinctValuesParams) {
|
|
2296
2315
|
let gridCells = [];
|
|
2297
|
-
if (distinctValuesParams.visibleRowsOnly) {
|
|
2316
|
+
if (distinctValuesParams.visibleRowsOnly === true) {
|
|
2298
2317
|
this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter((rowNode) => {
|
|
2299
2318
|
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
|
|
2300
2319
|
if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
|
|
2301
|
-
if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
|
|
2302
|
-
this.addBlankValueToGridCell(gridCell);
|
|
2303
|
-
}
|
|
2304
2320
|
gridCells.push(gridCell);
|
|
2305
2321
|
}
|
|
2306
2322
|
});
|
|
@@ -2309,20 +2325,12 @@ class AdaptableAgGrid {
|
|
|
2309
2325
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
|
|
2310
2326
|
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
|
|
2311
2327
|
if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
|
|
2312
|
-
if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
|
|
2313
|
-
this.addBlankValueToGridCell(gridCell);
|
|
2314
|
-
}
|
|
2315
2328
|
gridCells.push(gridCell);
|
|
2316
2329
|
}
|
|
2317
2330
|
});
|
|
2318
2331
|
}
|
|
2319
2332
|
return gridCells;
|
|
2320
2333
|
}
|
|
2321
|
-
addBlankValueToGridCell(gridCell) {
|
|
2322
|
-
gridCell.rawValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
|
|
2323
|
-
gridCell.displayValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
|
|
2324
|
-
gridCell.normalisedValue = GeneralConstants_1.BLANK_DISTINCT_COLUMN_VALUE;
|
|
2325
|
-
}
|
|
2326
2334
|
addDistinctColumnValue(rowNode, columnId) {
|
|
2327
2335
|
// we do not return the values of the aggregates when in grouping mode
|
|
2328
2336
|
// otherwise they would appear in the filter dropdown etc....
|
|
@@ -2349,9 +2357,9 @@ class AdaptableAgGrid {
|
|
|
2349
2357
|
}
|
|
2350
2358
|
return uniqueVals.slice(0, this.api.columnFilterApi.internalApi.getFilterValuesMaxNumberOfItems(column));
|
|
2351
2359
|
}
|
|
2352
|
-
getGridCellsForColumn(columnId, includeBlanks = false) {
|
|
2360
|
+
getGridCellsForColumn(columnId, includeBlanks = false, onlyVisibleRows = false) {
|
|
2353
2361
|
let returnValues = [];
|
|
2354
|
-
|
|
2362
|
+
const handler = (rowNode) => {
|
|
2355
2363
|
const gridCell = this.getGridCellFromRowNode(rowNode, columnId);
|
|
2356
2364
|
if (gridCell) {
|
|
2357
2365
|
if (gridCell.rawValue == undefined || gridCell.rawValue == null) {
|
|
@@ -2363,7 +2371,13 @@ class AdaptableAgGrid {
|
|
|
2363
2371
|
returnValues.push(gridCell);
|
|
2364
2372
|
}
|
|
2365
2373
|
}
|
|
2366
|
-
}
|
|
2374
|
+
};
|
|
2375
|
+
if (onlyVisibleRows) {
|
|
2376
|
+
this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter(handler);
|
|
2377
|
+
}
|
|
2378
|
+
else {
|
|
2379
|
+
this.agGridAdapter.getAgGridApi().forEachNode(handler);
|
|
2380
|
+
}
|
|
2367
2381
|
return returnValues;
|
|
2368
2382
|
}
|
|
2369
2383
|
getRowNodesForPrimaryKeys(primaryKeyValues) {
|
|
@@ -2694,6 +2708,16 @@ class AdaptableAgGrid {
|
|
|
2694
2708
|
return 'ag-theme-balham';
|
|
2695
2709
|
}
|
|
2696
2710
|
applyAdaptableTheme(theme) {
|
|
2711
|
+
const container = this.getAgGridContainerElement();
|
|
2712
|
+
if (container != null) {
|
|
2713
|
+
container.classList.add('ab-Grid');
|
|
2714
|
+
if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
|
|
2715
|
+
container.classList.add('ab-Grid--indicate-filtered-columns');
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
if (this._isDetailGrid) {
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2697
2721
|
theme = this.ThemeService.mapOsTheme(theme);
|
|
2698
2722
|
const themeName = typeof theme === 'string' ? theme : theme.Name;
|
|
2699
2723
|
const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
|
|
@@ -2748,7 +2772,6 @@ class AdaptableAgGrid {
|
|
|
2748
2772
|
el.classList.add(`infinite-${variantTheme}`);
|
|
2749
2773
|
}
|
|
2750
2774
|
// AG THEME CLASS NAME
|
|
2751
|
-
const container = this.getAgGridContainerElement();
|
|
2752
2775
|
const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
|
|
2753
2776
|
const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
|
|
2754
2777
|
if (newTheme && (isSystemTheme || variantTheme)) {
|
|
@@ -2782,10 +2805,6 @@ class AdaptableAgGrid {
|
|
|
2782
2805
|
if (newTheme && newTheme.AgGridClassName) {
|
|
2783
2806
|
container.classList.add(newTheme.AgGridClassName);
|
|
2784
2807
|
}
|
|
2785
|
-
container.classList.add('ab-Grid');
|
|
2786
|
-
if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
|
|
2787
|
-
container.classList.add('ab-Grid--indicate-filtered-columns');
|
|
2788
|
-
}
|
|
2789
2808
|
}
|
|
2790
2809
|
// MAC LIKE SCROLLBARS
|
|
2791
2810
|
if (this.adaptableOptions.userInterfaceOptions &&
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AdaptableAgGrid } from './AdaptableAgGrid';
|
|
2
2
|
import { ColumnSetupInfo } from './ColumnSetupInfo';
|
|
3
3
|
import { ColDef, Column } from '@ag-grid-community/core';
|
|
4
|
+
export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
|
|
5
|
+
export declare function getEditorsForColumnTypes(variant: AdaptableVariant): Record<string, ColDef['cellEditor']>;
|
|
4
6
|
export declare class AgGridColumnAdapter {
|
|
5
7
|
private adaptableInstance;
|
|
6
8
|
private colDefPropertyCache;
|
|
7
9
|
constructor(adaptableInstance: AdaptableAgGrid);
|
|
10
|
+
private getVariant;
|
|
8
11
|
destroy(): void;
|
|
9
12
|
private get adaptableApi();
|
|
10
13
|
private get adaptableOptions();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgGridColumnAdapter = void 0;
|
|
3
|
+
exports.AgGridColumnAdapter = exports.getEditorsForColumnTypes = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("ag-grid-community");
|
|
6
6
|
const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
|
|
@@ -14,11 +14,23 @@ const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
|
14
14
|
const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
15
15
|
const BadgeRenderer_1 = require("./BadgeRenderer");
|
|
16
16
|
const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
|
|
17
|
+
const AdaptableNumberEditor_1 = require("./editors/AdaptableNumberEditor");
|
|
18
|
+
const AdaptableDateEditor_1 = require("./editors/AdaptableDateEditor");
|
|
19
|
+
function getEditorsForColumnTypes(variant) {
|
|
20
|
+
return {
|
|
21
|
+
abColDefNumber: variant === 'react' ? AdaptableNumberEditor_1.AdaptableReactNumberEditor : AdaptableNumberEditor_1.AdaptableNumberEditor,
|
|
22
|
+
abColDefDate: variant === 'react' ? AdaptableDateEditor_1.AdaptableReactDateEditor : AdaptableDateEditor_1.AdaptableDateEditor,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.getEditorsForColumnTypes = getEditorsForColumnTypes;
|
|
17
26
|
class AgGridColumnAdapter {
|
|
18
27
|
constructor(adaptableInstance) {
|
|
19
28
|
this.adaptableInstance = adaptableInstance;
|
|
20
29
|
this.colDefPropertyCache = new Map();
|
|
21
30
|
}
|
|
31
|
+
getVariant() {
|
|
32
|
+
return this.adaptableInstance.variant;
|
|
33
|
+
}
|
|
22
34
|
destroy() {
|
|
23
35
|
this.adaptableInstance = null;
|
|
24
36
|
this.colDefPropertyCache.clear();
|
|
@@ -183,6 +195,17 @@ class AgGridColumnAdapter {
|
|
|
183
195
|
if (editLookUpItem) {
|
|
184
196
|
return hasRichSelectCellEditor ? 'agRichSelectCellEditor' : 'agSelectCellEditor';
|
|
185
197
|
}
|
|
198
|
+
else {
|
|
199
|
+
const colDef = col.getColDef();
|
|
200
|
+
if (colDef.cellEditor) {
|
|
201
|
+
return colDef.cellEditor;
|
|
202
|
+
}
|
|
203
|
+
const columnTypeToCellEditor = getEditorsForColumnTypes(this.getVariant());
|
|
204
|
+
return (adaptableColumn.columnTypes || []).reduce((cellEditor, colType) => {
|
|
205
|
+
var _a;
|
|
206
|
+
return (_a = columnTypeToCellEditor[colType]) !== null && _a !== void 0 ? _a : cellEditor;
|
|
207
|
+
}, undefined);
|
|
208
|
+
}
|
|
186
209
|
});
|
|
187
210
|
this.setColDefProperty(col, 'cellEditorPopup', () => {
|
|
188
211
|
// as specified in https://www.ag-grid.com/react-data-grid/provided-cell-editors/#rich-select-cell-editor
|
|
@@ -31,16 +31,21 @@ const FilterWrapperFactory = (adaptable) => {
|
|
|
31
31
|
const [filterProps, setFilterProps] = (0, react_1.useState)(null);
|
|
32
32
|
const colId = props.column.getId();
|
|
33
33
|
const column = adaptable.api.columnApi.getColumnWithColumnId(colId);
|
|
34
|
+
const afterGuidAttached = React.useCallback((params) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
|
|
37
|
+
const filterProps = getFilterProps(colId, !!hidePopup);
|
|
38
|
+
adaptable.hideFilterFormPopup = hidePopup;
|
|
39
|
+
setFilterProps(filterProps);
|
|
40
|
+
}, [colId]);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
afterGuidAttached();
|
|
43
|
+
}, []);
|
|
34
44
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
35
45
|
return {
|
|
36
46
|
isFilterActive: () => isFilterActive(colId),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
|
|
40
|
-
const filterProps = getFilterProps(colId, !!hidePopup);
|
|
41
|
-
adaptable.hideFilterFormPopup = hidePopup;
|
|
42
|
-
setFilterProps(filterProps);
|
|
43
|
-
},
|
|
47
|
+
// left here for backward compatibility
|
|
48
|
+
afterGuidAttached,
|
|
44
49
|
getModel: () => { },
|
|
45
50
|
setModel: () => { },
|
|
46
51
|
//we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
|
|
@@ -193,10 +193,10 @@ const DefaultAdaptableOptions = {
|
|
|
193
193
|
valuesFilterTrigger: 'mouseenter',
|
|
194
194
|
sortValuesFilter: false,
|
|
195
195
|
filterValuesUsingTime: false,
|
|
196
|
-
|
|
196
|
+
showCurrentlyFilteredValuesOnly: false,
|
|
197
197
|
maxFilterValuesToDisplay: undefined,
|
|
198
|
-
includeBlankFilterValues: false,
|
|
199
198
|
showValuesCount: undefined,
|
|
199
|
+
valuesFilterPredicateOptions: undefined,
|
|
200
200
|
},
|
|
201
201
|
indicateFilteredColumns: true,
|
|
202
202
|
useAdaptableColumnFiltering: true,
|
|
@@ -8,6 +8,5 @@ export type InternalAdaptableDateEditorProps = {
|
|
|
8
8
|
dateFormat: string;
|
|
9
9
|
onValueChange?: (value: Date | null) => void;
|
|
10
10
|
onStopEdit?: (keyboardEventKey?: string) => void;
|
|
11
|
-
showClearButton?: boolean;
|
|
12
11
|
};
|
|
13
12
|
export declare const InternalAdaptableDateEditor: React.ForwardRefExoticComponent<InternalAdaptableDateEditorProps & React.RefAttributes<InternalAdaptableDateEditorApi>>;
|
|
@@ -26,7 +26,6 @@ const inputStyle = {
|
|
|
26
26
|
border: 'none',
|
|
27
27
|
};
|
|
28
28
|
exports.InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
|
|
29
|
-
var _a;
|
|
30
29
|
const inputRef = React.useRef(null);
|
|
31
30
|
const focus = () => {
|
|
32
31
|
var _a;
|
|
@@ -60,7 +59,6 @@ exports.InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
|
|
|
60
59
|
(_a = props.onStopEdit) === null || _a === void 0 ? void 0 : _a.call(props, keyboardEventKey);
|
|
61
60
|
},
|
|
62
61
|
onShow: () => { },
|
|
63
|
-
showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true,
|
|
64
62
|
} },
|
|
65
63
|
React.createElement(AdaptableInput_1.default, { type: 'date', value: stringValue, onChange: onChange, style: inputStyle, ref: inputRef }))));
|
|
66
64
|
});
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core';
|
|
3
3
|
import { IAdaptable } from '../../../AdaptableInterfaces/IAdaptable';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
export interface AdaptableDateEditorParams extends ICellEditorParams {
|
|
5
|
+
onValueChange?: (value: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const AdaptableReactDateEditor: React.ForwardRefExoticComponent<AdaptableDateEditorParams & React.RefAttributes<unknown>>;
|
|
7
8
|
/**
|
|
8
9
|
* Used by default for all `abColDefDate` columns.
|
|
9
10
|
*
|
|
10
|
-
* You can configure it by specifying `cellEditorParams` in the colDef:
|
|
11
|
-
*
|
|
12
|
-
* colDef {
|
|
13
|
-
* field: 'tradeDate',
|
|
14
|
-
* type: 'abColDefDate',
|
|
15
|
-
* cellEditorParams: {
|
|
16
|
-
* showClearButton: true
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* For now, there is just 1 editor param you can configure:
|
|
21
|
-
*
|
|
22
|
-
* cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button.
|
|
23
11
|
*
|
|
24
12
|
* When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
|
|
25
13
|
* This is useful because dates can be stored as strings, numbers or Date instances - the value parser will be called with a `Date` instance,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableDateEditor = exports.
|
|
3
|
+
exports.AdaptableDateEditor = exports.AdaptableReactDateEditor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
|
|
@@ -27,8 +27,7 @@ const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
|
|
|
27
27
|
}
|
|
28
28
|
return newValue;
|
|
29
29
|
};
|
|
30
|
-
exports.
|
|
31
|
-
var _a;
|
|
30
|
+
exports.AdaptableReactDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
32
31
|
const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
|
|
33
32
|
const valueRef = (0, react_1.useRef)(initialValue);
|
|
34
33
|
const colValueParser = props.column.getColDef().valueParser;
|
|
@@ -48,6 +47,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
|
48
47
|
};
|
|
49
48
|
});
|
|
50
49
|
const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
50
|
+
var _a;
|
|
51
51
|
const invalid = isNaN(+value);
|
|
52
52
|
if (valueParser) {
|
|
53
53
|
const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
|
|
@@ -62,6 +62,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
|
62
62
|
} });
|
|
63
63
|
// @ts-ignore it will be fixed with https://github.com/AdaptableTools/adaptable/issues/2230
|
|
64
64
|
valueRef.current = valueParser(params);
|
|
65
|
+
(_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, valueRef.current);
|
|
65
66
|
}
|
|
66
67
|
else {
|
|
67
68
|
valueRef.current = invalid ? null : value;
|
|
@@ -71,7 +72,7 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
|
71
72
|
props.stopEditing();
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
|
-
},
|
|
75
|
+
}, onStopEdit: (keyboardEventKey) => {
|
|
75
76
|
if (keyboardEventKey === 'Escape') {
|
|
76
77
|
props.api.stopEditing(true);
|
|
77
78
|
}
|
|
@@ -87,19 +88,6 @@ exports.ReactAdaptableDateEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
|
87
88
|
/**
|
|
88
89
|
* Used by default for all `abColDefDate` columns.
|
|
89
90
|
*
|
|
90
|
-
* You can configure it by specifying `cellEditorParams` in the colDef:
|
|
91
|
-
*
|
|
92
|
-
* colDef {
|
|
93
|
-
* field: 'tradeDate',
|
|
94
|
-
* type: 'abColDefDate',
|
|
95
|
-
* cellEditorParams: {
|
|
96
|
-
* showClearButton: true
|
|
97
|
-
* }
|
|
98
|
-
* }
|
|
99
|
-
*
|
|
100
|
-
* For now, there is just 1 editor param you can configure:
|
|
101
|
-
*
|
|
102
|
-
* cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button.
|
|
103
91
|
*
|
|
104
92
|
* When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
|
|
105
93
|
* This is useful because dates can be stored as strings, numbers or Date instances - the value parser will be called with a `Date` instance,
|
|
@@ -144,7 +132,6 @@ class AdaptableDateEditor {
|
|
|
144
132
|
}
|
|
145
133
|
// after this component has been created and inserted into the grid
|
|
146
134
|
afterGuiAttached() {
|
|
147
|
-
var _a;
|
|
148
135
|
const adaptable = this.getAdaptableInstance(this.params);
|
|
149
136
|
const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
|
|
150
137
|
const editorElement = (React.createElement(InternalAdaptableDateEditor_1.InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
@@ -171,7 +158,7 @@ class AdaptableDateEditor {
|
|
|
171
158
|
this.params.stopEditing();
|
|
172
159
|
});
|
|
173
160
|
}
|
|
174
|
-
},
|
|
161
|
+
}, onStopEdit: (keyboardEventKey) => {
|
|
175
162
|
if (keyboardEventKey === 'Escape') {
|
|
176
163
|
this.params.api.stopEditing(true);
|
|
177
164
|
}
|
|
@@ -38,6 +38,11 @@ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdapta
|
|
|
38
38
|
(_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
// When the editor is opened by typing, the value is not set, even if the user
|
|
43
|
+
// dismisses the editing by pressing enter or clicking outside, this forces the value to be set.
|
|
44
|
+
setValue(props.defaultValue);
|
|
45
|
+
}, []);
|
|
41
46
|
React.useImperativeHandle(ref, () => {
|
|
42
47
|
return {
|
|
43
48
|
focus,
|
|
@@ -50,7 +55,7 @@ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdapta
|
|
|
50
55
|
e.stopPropagation();
|
|
51
56
|
}
|
|
52
57
|
} },
|
|
53
|
-
React.createElement("input", { type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
|
|
58
|
+
React.createElement("input", { "data-name": "AdaptableNumberEditorInput", type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
|
|
54
59
|
setValue(event.target.value);
|
|
55
60
|
}, []), style: inputStyle, ref: inputRef }),
|
|
56
61
|
showClear ? (React.createElement("div", { style: {
|