@adaptabletools/adaptable 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 +4 -3
- 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 +36 -12
- 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 +79 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +6 -10
- 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 +1 -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 +43 -31
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
- 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 +1 -1
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/Fdc3Service.js +2 -2
- 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 +30 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +23 -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 +21 -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 +68 -49
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +22 -0
- 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 +5 -18
- 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 +5 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -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 +63 -0
- package/src/components/ExpressionEditor/EditorInput.js +22 -9
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -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 +71 -13
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +67 -94
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +7 -4
- 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 +4 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +4 -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 +12 -2
- 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.esm.tsbuildinfo +1 -1
|
@@ -14,6 +14,7 @@ import { useAdaptable } from '../../../AdaptableContext';
|
|
|
14
14
|
import { ValueSelector } from '../../../Components/ValueSelector';
|
|
15
15
|
import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
|
|
16
16
|
import { columnFilter } from './Utilities';
|
|
17
|
+
import { SuspendToggleButton } from '../../../Components/Buttons/SuspendToggleButton';
|
|
17
18
|
export const areSummaryRowsValid = (layout) => {
|
|
18
19
|
var _a;
|
|
19
20
|
if (!layout.RowSummaries)
|
|
@@ -32,7 +33,6 @@ export const areSummaryRowsValid = (layout) => {
|
|
|
32
33
|
};
|
|
33
34
|
const getAvailableExpressionsForColumnType = (columnType, availableScalarExpressions) => {
|
|
34
35
|
const inputType = mapColumnDataTypeToExpressionFunctionType(columnType);
|
|
35
|
-
// Object.entries(availableScalarExpressions ?? {})
|
|
36
36
|
return summarySupportedExpressions
|
|
37
37
|
.filter((expression) => availableScalarExpressions[expression])
|
|
38
38
|
.map((expression) => {
|
|
@@ -80,6 +80,12 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
|
|
|
80
80
|
}, [rowSummary.ColumnsMap]);
|
|
81
81
|
return (React.createElement(Panel, { header: React.createElement(Flex, { style: { width: '100%' } },
|
|
82
82
|
React.createElement(Flex, { flex: 1, alignItems: "center" }, "Row Summary"),
|
|
83
|
+
React.createElement(Box, { mr: 2 },
|
|
84
|
+
React.createElement(SuspendToggleButton, { onSuspend: () => {
|
|
85
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: true }));
|
|
86
|
+
}, onUnSuspend: () => {
|
|
87
|
+
onChange(Object.assign(Object.assign({}, rowSummary), { IsSuspended: false }));
|
|
88
|
+
}, suspendableObject: rowSummary })),
|
|
83
89
|
React.createElement(SimpleButton, { icon: "delete", onClick: () => {
|
|
84
90
|
onDelete();
|
|
85
91
|
} })), p: 2 },
|
|
@@ -26,5 +26,5 @@ export const NamedQueryExpressionWizardSection = (props) => {
|
|
|
26
26
|
const initialData = useMemo(() => api.internalApi.getQueryPreviewData(), []);
|
|
27
27
|
return (React.createElement(ExpressionEditor, { allowSaveNamedQuery: false, showQueryBuilder: true, type: 'boolean', module: moduleInfo.ModuleName, value: data.BooleanExpression, onChange: (BooleanExpression) => {
|
|
28
28
|
props.onChange(Object.assign(Object.assign({}, data), { BooleanExpression }));
|
|
29
|
-
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
29
|
+
}, initialData: initialData, columns: api.columnApi.getQueryableColumns(), fields: api.expressionApi.internalApi.getAvailableFields(), namedQueries: api.namedQueryApi.getNamedQueries(), api: api }));
|
|
30
30
|
};
|
|
@@ -66,7 +66,8 @@ export const OnePageAdaptableWizard = (props) => {
|
|
|
66
66
|
React.createElement(OnePageWizard, Object.assign({}, props, { name: name, sections: sections, onFinish: handleClickFinish })))));
|
|
67
67
|
};
|
|
68
68
|
export const OnePageWizardSummary = () => {
|
|
69
|
-
const {
|
|
69
|
+
const { sections, data, api } = useOnePageAdaptableWizardContext();
|
|
70
|
+
const { setCurrentSection } = useOnePageWizardContext();
|
|
70
71
|
const renderEdit = (index) => (React.createElement(SimpleButton, { px: 1, variant: "text", style: {
|
|
71
72
|
textDecoration: 'underline',
|
|
72
73
|
display: 'inline-block',
|
|
@@ -87,7 +88,7 @@ export const OnePageWizardSummary = () => {
|
|
|
87
88
|
section.title,
|
|
88
89
|
" ",
|
|
89
90
|
renderEdit(index)),
|
|
90
|
-
React.createElement(Tabs.Content, null, section.renderSummary(data))));
|
|
91
|
+
React.createElement(Tabs.Content, null, section.renderSummary(data, api))));
|
|
91
92
|
})
|
|
92
93
|
.filter(Boolean)));
|
|
93
94
|
};
|
|
@@ -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[];
|
|
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
|
|
|
8
8
|
import { applyDefaultAdaptableOptions } from './defaultAdaptableOptions';
|
|
9
9
|
import { AgGridAdapter } from './AgGridAdapter';
|
|
10
10
|
import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
|
|
11
|
-
import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, ADAPTABLE_ROW_ACTION_BUTTONS, AUTOGENERATED_PK_COLUMN,
|
|
11
|
+
import { AB_FDC3_COLUMN, AB_SPECIAL_COLUMN, ADAPTABLE_ROW_ACTION_BUTTONS, AUTOGENERATED_PK_COLUMN, DARK_THEME, DEFAULT_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, } from '../Utilities/Constants/GeneralConstants';
|
|
12
12
|
import { DataService } from '../Utilities/Services/DataService';
|
|
13
13
|
import { AdaptableStore } from '../Redux/Store/AdaptableStore';
|
|
14
14
|
import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
|
|
@@ -65,8 +65,6 @@ import { Fdc3Module } from '../Strategy/Fdc3Module';
|
|
|
65
65
|
import { GridFilterModule } from '../Strategy/GridFilterModule';
|
|
66
66
|
import { NamedQueryModule } from '../Strategy/NamedQueryModule';
|
|
67
67
|
import { CommentModule } from '../Strategy/CommentModule';
|
|
68
|
-
import { AdaptableNumberEditor, ReactAdaptableNumberEditor } from './editors/AdaptableNumberEditor';
|
|
69
|
-
import { AdaptableDateEditor, ReactAdaptableDateEditor } from './editors/AdaptableDateEditor';
|
|
70
68
|
import { Helper } from '../Utilities/Helpers/Helper';
|
|
71
69
|
import { createUuid } from '../components/utils/uuid';
|
|
72
70
|
import UIHelper from '../View/UIHelper';
|
|
@@ -80,7 +78,7 @@ import { AdaptableApp } from '../View/AdaptableView';
|
|
|
80
78
|
import { renderReactRoot as defaultRenderReactRoot } from '../renderReactRoot';
|
|
81
79
|
import { AgGridOptionsService } from './AgGridOptionsService';
|
|
82
80
|
import { parseDateValue } from '../Utilities/Helpers/DateHelper';
|
|
83
|
-
import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
81
|
+
import { AgGridColumnAdapter, getEditorsForColumnTypes, } from './AgGridColumnAdapter';
|
|
84
82
|
import uniqBy from 'lodash/uniqBy';
|
|
85
83
|
import getScrollbarSize from '../Utilities/getScrollbarSize';
|
|
86
84
|
import { isWeightedAverageAggregation, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../PredefinedConfig/Common/AggregationColumns';
|
|
@@ -89,7 +87,7 @@ import { RowEditService } from '../Utilities/Services/RowEditService';
|
|
|
89
87
|
import { weightedAverage } from './weightedAverage';
|
|
90
88
|
import { sortWithOrderArray } from '../Utilities/sortWithOrder';
|
|
91
89
|
import { FilterOnDataChangeOptions } from '../PredefinedConfig/Common/Enums';
|
|
92
|
-
import ObjectFactory from '../Utilities/ObjectFactory';
|
|
90
|
+
import ObjectFactory, { createBaseContext } from '../Utilities/ObjectFactory';
|
|
93
91
|
import { ADAPTABLE_PUBLISH_TIMESTAMP } from '../EnvVars';
|
|
94
92
|
import { AdaptableUpgradeHelper } from '../migration/AdaptableUpgradeHelper';
|
|
95
93
|
import { ensurePortalElement } from '../components/Modal';
|
|
@@ -398,9 +396,16 @@ export class AdaptableAgGrid {
|
|
|
398
396
|
}
|
|
399
397
|
this.lifecycleState = 'ready';
|
|
400
398
|
this.forPlugins((plugin) => plugin.onAdaptableReady(this, this.adaptableOptions));
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
// without the setTimeout, calling autoSizeAllColumns immediately in the onAdaptableReady
|
|
401
|
+
// does not work. (I prefer setTimeout to rAF, as raf is not running when you switch tabs)
|
|
402
|
+
//
|
|
403
|
+
// it also makes it possible to listen to CALCULATED_COLUMN_READY, DASHBOARD_READY, etc.
|
|
404
|
+
// in onAdaptableReady - without this those event listeners are not triggered
|
|
405
|
+
this.api.eventApi.emit('AdaptableReady', {
|
|
406
|
+
adaptableApi: this.api,
|
|
407
|
+
agGridApi: this.agGridAdapter.getAgGridApi(),
|
|
408
|
+
});
|
|
404
409
|
});
|
|
405
410
|
perfInitAdaptableAgGrid.end();
|
|
406
411
|
return Promise.resolve(this.api);
|
|
@@ -669,10 +674,15 @@ export class AdaptableAgGrid {
|
|
|
669
674
|
const columnFilters = this.api.columnFilterApi.getActiveColumnFilters();
|
|
670
675
|
try {
|
|
671
676
|
if (columnFilters.length > 0) {
|
|
677
|
+
const isRowFiltrable = this.api.optionsApi.getColumnFilterOptions().isRowFilterable;
|
|
672
678
|
for (const columnFilter of columnFilters) {
|
|
673
679
|
const evaluateFilterOnClient = this.api.expressionApi.internalApi.evaluatePredicatesInAdaptableQL('ColumnFilter', columnFilter, [columnFilter.Predicate]);
|
|
674
680
|
if (evaluateFilterOnClient) {
|
|
675
681
|
// we then assess filters (if running locally)
|
|
682
|
+
if (typeof isRowFiltrable === 'function' &&
|
|
683
|
+
!isRowFiltrable(Object.assign(Object.assign({}, createBaseContext(this.api)), { rowNode: node, data: node.data }))) {
|
|
684
|
+
return true;
|
|
685
|
+
}
|
|
676
686
|
if (!this.api.columnFilterApi.internalApi.evaluateColumnFilter(columnFilter, node)) {
|
|
677
687
|
return false;
|
|
678
688
|
}
|
|
@@ -931,37 +941,46 @@ export class AdaptableAgGrid {
|
|
|
931
941
|
*/
|
|
932
942
|
// this will have to go/be heavily extended with https://github.com/AdaptableTools/adaptable/issues/2230
|
|
933
943
|
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
|
|
934
|
-
var _a
|
|
944
|
+
var _a;
|
|
935
945
|
const providedColumnTypes = original_columnTypes || {};
|
|
936
946
|
const gridOptionsColumnTypes = gridOptions.columnTypes || {};
|
|
937
|
-
const patchedColumnTypes = Object.assign(providedColumnTypes, {
|
|
947
|
+
const patchedColumnTypes = Object.assign({}, providedColumnTypes, {
|
|
938
948
|
[AB_SPECIAL_COLUMN]: {},
|
|
939
949
|
[AB_FDC3_COLUMN]: {},
|
|
940
|
-
abColDefNumber: (
|
|
941
|
-
abColDefString: (
|
|
942
|
-
abColDefBoolean: (
|
|
943
|
-
abColDefDate: (
|
|
944
|
-
abColDefObject: (
|
|
945
|
-
abColDefCustom: (
|
|
946
|
-
abColDefStringArray: (
|
|
947
|
-
abColDefNumberArray: (
|
|
948
|
-
abColDefTupleNumberArray: (
|
|
949
|
-
abColDefObjectNumberArray: (
|
|
950
|
+
abColDefNumber: Object.assign({}, gridOptionsColumnTypes.abColDefNumber),
|
|
951
|
+
abColDefString: Object.assign({}, gridOptionsColumnTypes.abColDefString),
|
|
952
|
+
abColDefBoolean: Object.assign({}, gridOptionsColumnTypes.abColDefBoolean),
|
|
953
|
+
abColDefDate: Object.assign({}, gridOptionsColumnTypes.abColDefDate),
|
|
954
|
+
abColDefObject: Object.assign({}, gridOptionsColumnTypes.abColDefObject),
|
|
955
|
+
abColDefCustom: Object.assign({}, gridOptionsColumnTypes.abColDefCustom),
|
|
956
|
+
abColDefStringArray: Object.assign({}, gridOptionsColumnTypes.abColDefStringArray),
|
|
957
|
+
abColDefNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefNumberArray),
|
|
958
|
+
abColDefTupleNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefTupleNumberArray),
|
|
959
|
+
abColDefObjectNumberArray: Object.assign({}, gridOptionsColumnTypes.abColDefObjectNumberArray),
|
|
950
960
|
});
|
|
951
|
-
const customColumnTypes = (
|
|
961
|
+
const customColumnTypes = (_a = this.api.columnApi.getColumnTypes()) !== null && _a !== void 0 ? _a : [];
|
|
952
962
|
for (const customColumnType of customColumnTypes) {
|
|
953
963
|
if (!patchedColumnTypes[customColumnType]) {
|
|
954
964
|
patchedColumnTypes[customColumnType] = {};
|
|
955
965
|
}
|
|
956
966
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
967
|
+
const colTypesToEditors = getEditorsForColumnTypes(this.variant);
|
|
968
|
+
// we used to patch here the column types
|
|
969
|
+
// and have the editors for abColDefNumber and abColDefDate set here
|
|
970
|
+
// but AG Grid seems to have a bug where if we have a custom editor
|
|
971
|
+
// for a specific number column, it's applied to all abColDefNumber columns, because they
|
|
972
|
+
// share the same column type
|
|
973
|
+
// so we're now doing this logic in AgGridColumnAdaptapter.setupColumnCellEditor
|
|
974
|
+
// and instead, here we're just assigning the editor to null
|
|
975
|
+
// because if we don't assign to null, the default that AG Grid provides
|
|
976
|
+
// will be used instead, and we don't want that for those column types
|
|
977
|
+
Object.keys(colTypesToEditors).forEach((colType) => {
|
|
978
|
+
if (patchedColumnTypes[colType].cellEditor == undefined) {
|
|
979
|
+
patchedColumnTypes[colType].cellEditor = null; // colTypesToEditors[colType];
|
|
980
|
+
// if you dont believe me, just put colTypesToEditors[colType] in the line above instead of the null value
|
|
981
|
+
// and see the editing/percentage-editor.spec.ts test fail as it wont be using the correct editor
|
|
982
|
+
}
|
|
983
|
+
});
|
|
965
984
|
return patchedColumnTypes;
|
|
966
985
|
});
|
|
967
986
|
/**
|
|
@@ -2290,13 +2309,10 @@ export class AdaptableAgGrid {
|
|
|
2290
2309
|
}
|
|
2291
2310
|
getDistinctGridCellsForColumn(column, distinctValuesParams) {
|
|
2292
2311
|
let gridCells = [];
|
|
2293
|
-
if (distinctValuesParams.visibleRowsOnly) {
|
|
2312
|
+
if (distinctValuesParams.visibleRowsOnly === true) {
|
|
2294
2313
|
this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter((rowNode) => {
|
|
2295
2314
|
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
|
|
2296
2315
|
if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
|
|
2297
|
-
if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
|
|
2298
|
-
this.addBlankValueToGridCell(gridCell);
|
|
2299
|
-
}
|
|
2300
2316
|
gridCells.push(gridCell);
|
|
2301
2317
|
}
|
|
2302
2318
|
});
|
|
@@ -2305,20 +2321,12 @@ export class AdaptableAgGrid {
|
|
|
2305
2321
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode) => {
|
|
2306
2322
|
const gridCell = this.addDistinctColumnValue(rowNode, column.columnId);
|
|
2307
2323
|
if (gridCell && gridCell.rowNode !== distinctValuesParams.skipRowNode) {
|
|
2308
|
-
if (gridCell.rawValue == undefined && distinctValuesParams.addBlankValue) {
|
|
2309
|
-
this.addBlankValueToGridCell(gridCell);
|
|
2310
|
-
}
|
|
2311
2324
|
gridCells.push(gridCell);
|
|
2312
2325
|
}
|
|
2313
2326
|
});
|
|
2314
2327
|
}
|
|
2315
2328
|
return gridCells;
|
|
2316
2329
|
}
|
|
2317
|
-
addBlankValueToGridCell(gridCell) {
|
|
2318
|
-
gridCell.rawValue = BLANK_DISTINCT_COLUMN_VALUE;
|
|
2319
|
-
gridCell.displayValue = BLANK_DISTINCT_COLUMN_VALUE;
|
|
2320
|
-
gridCell.normalisedValue = BLANK_DISTINCT_COLUMN_VALUE;
|
|
2321
|
-
}
|
|
2322
2330
|
addDistinctColumnValue(rowNode, columnId) {
|
|
2323
2331
|
// we do not return the values of the aggregates when in grouping mode
|
|
2324
2332
|
// otherwise they would appear in the filter dropdown etc....
|
|
@@ -2345,9 +2353,9 @@ export class AdaptableAgGrid {
|
|
|
2345
2353
|
}
|
|
2346
2354
|
return uniqueVals.slice(0, this.api.columnFilterApi.internalApi.getFilterValuesMaxNumberOfItems(column));
|
|
2347
2355
|
}
|
|
2348
|
-
getGridCellsForColumn(columnId, includeBlanks = false) {
|
|
2356
|
+
getGridCellsForColumn(columnId, includeBlanks = false, onlyVisibleRows = false) {
|
|
2349
2357
|
let returnValues = [];
|
|
2350
|
-
|
|
2358
|
+
const handler = (rowNode) => {
|
|
2351
2359
|
const gridCell = this.getGridCellFromRowNode(rowNode, columnId);
|
|
2352
2360
|
if (gridCell) {
|
|
2353
2361
|
if (gridCell.rawValue == undefined || gridCell.rawValue == null) {
|
|
@@ -2359,7 +2367,13 @@ export class AdaptableAgGrid {
|
|
|
2359
2367
|
returnValues.push(gridCell);
|
|
2360
2368
|
}
|
|
2361
2369
|
}
|
|
2362
|
-
}
|
|
2370
|
+
};
|
|
2371
|
+
if (onlyVisibleRows) {
|
|
2372
|
+
this.agGridAdapter.getAgGridApi().forEachNodeAfterFilter(handler);
|
|
2373
|
+
}
|
|
2374
|
+
else {
|
|
2375
|
+
this.agGridAdapter.getAgGridApi().forEachNode(handler);
|
|
2376
|
+
}
|
|
2363
2377
|
return returnValues;
|
|
2364
2378
|
}
|
|
2365
2379
|
getRowNodesForPrimaryKeys(primaryKeyValues) {
|
|
@@ -2690,6 +2704,16 @@ export class AdaptableAgGrid {
|
|
|
2690
2704
|
return 'ag-theme-balham';
|
|
2691
2705
|
}
|
|
2692
2706
|
applyAdaptableTheme(theme) {
|
|
2707
|
+
const container = this.getAgGridContainerElement();
|
|
2708
|
+
if (container != null) {
|
|
2709
|
+
container.classList.add('ab-Grid');
|
|
2710
|
+
if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
|
|
2711
|
+
container.classList.add('ab-Grid--indicate-filtered-columns');
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
if (this._isDetailGrid) {
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2693
2717
|
theme = this.ThemeService.mapOsTheme(theme);
|
|
2694
2718
|
const themeName = typeof theme === 'string' ? theme : theme.Name;
|
|
2695
2719
|
const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
|
|
@@ -2744,7 +2768,6 @@ export class AdaptableAgGrid {
|
|
|
2744
2768
|
el.classList.add(`infinite-${variantTheme}`);
|
|
2745
2769
|
}
|
|
2746
2770
|
// AG THEME CLASS NAME
|
|
2747
|
-
const container = this.getAgGridContainerElement();
|
|
2748
2771
|
const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
|
|
2749
2772
|
const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
|
|
2750
2773
|
if (newTheme && (isSystemTheme || variantTheme)) {
|
|
@@ -2778,10 +2801,6 @@ export class AdaptableAgGrid {
|
|
|
2778
2801
|
if (newTheme && newTheme.AgGridClassName) {
|
|
2779
2802
|
container.classList.add(newTheme.AgGridClassName);
|
|
2780
2803
|
}
|
|
2781
|
-
container.classList.add('ab-Grid');
|
|
2782
|
-
if (this.adaptableOptions.columnFilterOptions.indicateFilteredColumns) {
|
|
2783
|
-
container.classList.add('ab-Grid--indicate-filtered-columns');
|
|
2784
|
-
}
|
|
2785
2804
|
}
|
|
2786
2805
|
// MAC LIKE SCROLLBARS
|
|
2787
2806
|
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();
|
|
@@ -10,11 +10,22 @@ import UIHelper from '../View/UIHelper';
|
|
|
10
10
|
import { getPercentBarRendererForColumn } from './PercentBarRenderer';
|
|
11
11
|
import { getBadgeRendererForColumn } from './BadgeRenderer';
|
|
12
12
|
import Helper from '../Utilities/Helpers/Helper';
|
|
13
|
+
import { AdaptableReactNumberEditor, AdaptableNumberEditor } from './editors/AdaptableNumberEditor';
|
|
14
|
+
import { AdaptableDateEditor, AdaptableReactDateEditor } from './editors/AdaptableDateEditor';
|
|
15
|
+
export function getEditorsForColumnTypes(variant) {
|
|
16
|
+
return {
|
|
17
|
+
abColDefNumber: variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor,
|
|
18
|
+
abColDefDate: variant === 'react' ? AdaptableReactDateEditor : AdaptableDateEditor,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
13
21
|
export class AgGridColumnAdapter {
|
|
14
22
|
constructor(adaptableInstance) {
|
|
15
23
|
this.adaptableInstance = adaptableInstance;
|
|
16
24
|
this.colDefPropertyCache = new Map();
|
|
17
25
|
}
|
|
26
|
+
getVariant() {
|
|
27
|
+
return this.adaptableInstance.variant;
|
|
28
|
+
}
|
|
18
29
|
destroy() {
|
|
19
30
|
this.adaptableInstance = null;
|
|
20
31
|
this.colDefPropertyCache.clear();
|
|
@@ -179,6 +190,17 @@ export class AgGridColumnAdapter {
|
|
|
179
190
|
if (editLookUpItem) {
|
|
180
191
|
return hasRichSelectCellEditor ? 'agRichSelectCellEditor' : 'agSelectCellEditor';
|
|
181
192
|
}
|
|
193
|
+
else {
|
|
194
|
+
const colDef = col.getColDef();
|
|
195
|
+
if (colDef.cellEditor) {
|
|
196
|
+
return colDef.cellEditor;
|
|
197
|
+
}
|
|
198
|
+
const columnTypeToCellEditor = getEditorsForColumnTypes(this.getVariant());
|
|
199
|
+
return (adaptableColumn.columnTypes || []).reduce((cellEditor, colType) => {
|
|
200
|
+
var _a;
|
|
201
|
+
return (_a = columnTypeToCellEditor[colType]) !== null && _a !== void 0 ? _a : cellEditor;
|
|
202
|
+
}, undefined);
|
|
203
|
+
}
|
|
182
204
|
});
|
|
183
205
|
this.setColDefProperty(col, 'cellEditorPopup', () => {
|
|
184
206
|
// as specified in https://www.ag-grid.com/react-data-grid/provided-cell-editors/#rich-select-cell-editor
|
|
@@ -27,16 +27,21 @@ export const FilterWrapperFactory = (adaptable) => {
|
|
|
27
27
|
const [filterProps, setFilterProps] = useState(null);
|
|
28
28
|
const colId = props.column.getId();
|
|
29
29
|
const column = adaptable.api.columnApi.getColumnWithColumnId(colId);
|
|
30
|
+
const afterGuidAttached = React.useCallback((params) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
|
|
33
|
+
const filterProps = getFilterProps(colId, !!hidePopup);
|
|
34
|
+
adaptable.hideFilterFormPopup = hidePopup;
|
|
35
|
+
setFilterProps(filterProps);
|
|
36
|
+
}, [colId]);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
afterGuidAttached();
|
|
39
|
+
}, []);
|
|
30
40
|
useImperativeHandle(ref, () => {
|
|
31
41
|
return {
|
|
32
42
|
isFilterActive: () => isFilterActive(colId),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const hidePopup = (_a = params === null || params === void 0 ? void 0 : params.hidePopup) !== null && _a !== void 0 ? _a : null;
|
|
36
|
-
const filterProps = getFilterProps(colId, !!hidePopup);
|
|
37
|
-
adaptable.hideFilterFormPopup = hidePopup;
|
|
38
|
-
setFilterProps(filterProps);
|
|
39
|
-
},
|
|
43
|
+
// left here for backward compatibility
|
|
44
|
+
afterGuidAttached,
|
|
40
45
|
getModel: () => { },
|
|
41
46
|
setModel: () => { },
|
|
42
47
|
//we do not filter here.... we filter using the doesExternalFilterPass. Not sure there is a difference....
|
|
@@ -189,10 +189,10 @@ const DefaultAdaptableOptions = {
|
|
|
189
189
|
valuesFilterTrigger: 'mouseenter',
|
|
190
190
|
sortValuesFilter: false,
|
|
191
191
|
filterValuesUsingTime: false,
|
|
192
|
-
|
|
192
|
+
showCurrentlyFilteredValuesOnly: false,
|
|
193
193
|
maxFilterValuesToDisplay: undefined,
|
|
194
|
-
includeBlankFilterValues: false,
|
|
195
194
|
showValuesCount: undefined,
|
|
195
|
+
valuesFilterPredicateOptions: undefined,
|
|
196
196
|
},
|
|
197
197
|
indicateFilteredColumns: true,
|
|
198
198
|
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>>;
|
|
@@ -22,7 +22,6 @@ const inputStyle = {
|
|
|
22
22
|
border: 'none',
|
|
23
23
|
};
|
|
24
24
|
export const InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
|
|
25
|
-
var _a;
|
|
26
25
|
const inputRef = React.useRef(null);
|
|
27
26
|
const focus = () => {
|
|
28
27
|
var _a;
|
|
@@ -56,7 +55,6 @@ export const InternalAdaptableDateEditor = React.forwardRef((props, ref) => {
|
|
|
56
55
|
(_a = props.onStopEdit) === null || _a === void 0 ? void 0 : _a.call(props, keyboardEventKey);
|
|
57
56
|
},
|
|
58
57
|
onShow: () => { },
|
|
59
|
-
showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true,
|
|
60
58
|
} },
|
|
61
59
|
React.createElement(AdaptableInput, { type: 'date', value: stringValue, onChange: onChange, style: inputStyle, ref: inputRef }))));
|
|
62
60
|
});
|
|
@@ -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,
|
|
@@ -23,8 +23,7 @@ const defaultDateValueParser = ({ newValue, oldValue, defaultParser }) => {
|
|
|
23
23
|
}
|
|
24
24
|
return newValue;
|
|
25
25
|
};
|
|
26
|
-
export const
|
|
27
|
-
var _a;
|
|
26
|
+
export const AdaptableReactDateEditor = forwardRef((props, ref) => {
|
|
28
27
|
const [initialValue] = useState(() => getStartValue(props));
|
|
29
28
|
const valueRef = useRef(initialValue);
|
|
30
29
|
const colValueParser = props.column.getColDef().valueParser;
|
|
@@ -44,6 +43,7 @@ export const ReactAdaptableDateEditor = forwardRef((props, ref) => {
|
|
|
44
43
|
};
|
|
45
44
|
});
|
|
46
45
|
const editorElement = (React.createElement(InternalAdaptableDateEditor, { defaultValue: initialValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
46
|
+
var _a;
|
|
47
47
|
const invalid = isNaN(+value);
|
|
48
48
|
if (valueParser) {
|
|
49
49
|
const params = Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value, defaultParser: (value) => {
|
|
@@ -58,6 +58,7 @@ export const ReactAdaptableDateEditor = forwardRef((props, ref) => {
|
|
|
58
58
|
} });
|
|
59
59
|
// @ts-ignore it will be fixed with https://github.com/AdaptableTools/adaptable/issues/2230
|
|
60
60
|
valueRef.current = valueParser(params);
|
|
61
|
+
(_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, valueRef.current);
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
64
|
valueRef.current = invalid ? null : value;
|
|
@@ -67,7 +68,7 @@ export const ReactAdaptableDateEditor = forwardRef((props, ref) => {
|
|
|
67
68
|
props.stopEditing();
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
},
|
|
71
|
+
}, onStopEdit: (keyboardEventKey) => {
|
|
71
72
|
if (keyboardEventKey === 'Escape') {
|
|
72
73
|
props.api.stopEditing(true);
|
|
73
74
|
}
|
|
@@ -83,19 +84,6 @@ export const ReactAdaptableDateEditor = forwardRef((props, ref) => {
|
|
|
83
84
|
/**
|
|
84
85
|
* Used by default for all `abColDefDate` columns.
|
|
85
86
|
*
|
|
86
|
-
* You can configure it by specifying `cellEditorParams` in the colDef:
|
|
87
|
-
*
|
|
88
|
-
* colDef {
|
|
89
|
-
* field: 'tradeDate',
|
|
90
|
-
* type: 'abColDefDate',
|
|
91
|
-
* cellEditorParams: {
|
|
92
|
-
* showClearButton: true
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
*
|
|
96
|
-
* For now, there is just 1 editor param you can configure:
|
|
97
|
-
*
|
|
98
|
-
* cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button.
|
|
99
87
|
*
|
|
100
88
|
* When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
|
|
101
89
|
* This is useful because dates can be stored as strings, numbers or Date instances - the value parser will be called with a `Date` instance,
|
|
@@ -140,7 +128,6 @@ export class AdaptableDateEditor {
|
|
|
140
128
|
}
|
|
141
129
|
// after this component has been created and inserted into the grid
|
|
142
130
|
afterGuiAttached() {
|
|
143
|
-
var _a;
|
|
144
131
|
const adaptable = this.getAdaptableInstance(this.params);
|
|
145
132
|
const defaultValue = shouldClearExistingValue(this.params) ? '' : this.params.value;
|
|
146
133
|
const editorElement = (React.createElement(InternalAdaptableDateEditor, { defaultValue: defaultValue, dateFormat: adaptable.adaptableOptions.userInterfaceOptions.dateInputOptions.dateFormat, onValueChange: (value) => {
|
|
@@ -167,7 +154,7 @@ export class AdaptableDateEditor {
|
|
|
167
154
|
this.params.stopEditing();
|
|
168
155
|
});
|
|
169
156
|
}
|
|
170
|
-
},
|
|
157
|
+
}, onStopEdit: (keyboardEventKey) => {
|
|
171
158
|
if (keyboardEventKey === 'Escape') {
|
|
172
159
|
this.params.api.stopEditing(true);
|
|
173
160
|
}
|
|
@@ -34,6 +34,11 @@ export const InternalAdaptableNumberEditor = React.forwardRef(function InternalA
|
|
|
34
34
|
(_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
// When the editor is opened by typing, the value is not set, even if the user
|
|
39
|
+
// dismisses the editing by pressing enter or clicking outside, this forces the value to be set.
|
|
40
|
+
setValue(props.defaultValue);
|
|
41
|
+
}, []);
|
|
37
42
|
React.useImperativeHandle(ref, () => {
|
|
38
43
|
return {
|
|
39
44
|
focus,
|
|
@@ -46,7 +51,7 @@ export const InternalAdaptableNumberEditor = React.forwardRef(function InternalA
|
|
|
46
51
|
e.stopPropagation();
|
|
47
52
|
}
|
|
48
53
|
} },
|
|
49
|
-
React.createElement("input", { type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
|
|
54
|
+
React.createElement("input", { "data-name": "AdaptableNumberEditorInput", type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', value: value, onChange: React.useCallback((event) => {
|
|
50
55
|
setValue(event.target.value);
|
|
51
56
|
}, []), style: inputStyle, ref: inputRef }),
|
|
52
57
|
showClear ? (React.createElement("div", { style: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ICellEditorComp, ICellEditorParams } from '@ag-grid-community/core';
|
|
3
|
+
export declare function getStartValue(params: ICellEditorParams): any;
|
|
3
4
|
/**
|
|
4
5
|
* Adaptable number editor parameters extending the AG Grid {@link ICellEditorParams}.
|
|
5
6
|
*/
|
|
6
|
-
interface AdaptableNumberCellEditorParams extends ICellEditorParams {
|
|
7
|
+
export interface AdaptableNumberCellEditorParams extends ICellEditorParams {
|
|
7
8
|
/**
|
|
8
9
|
* Whether to show the clear button. If `true`, it works together with `cellEditorParams.emptyValue`
|
|
9
10
|
* @defaultValue true
|
|
@@ -14,8 +15,9 @@ interface AdaptableNumberCellEditorParams extends ICellEditorParams {
|
|
|
14
15
|
* @defaultValue '' (empty string)
|
|
15
16
|
*/
|
|
16
17
|
emptyValue: string;
|
|
18
|
+
onValueChange: (value: any) => void;
|
|
17
19
|
}
|
|
18
|
-
export declare const
|
|
20
|
+
export declare const AdaptableReactNumberEditor: React.ForwardRefExoticComponent<AdaptableNumberCellEditorParams & React.RefAttributes<unknown>>;
|
|
19
21
|
/**
|
|
20
22
|
* Used by default for all `abColDefNumber` columns.
|
|
21
23
|
*
|
|
@@ -54,4 +56,3 @@ export declare class AdaptableNumberEditor implements ICellEditorComp {
|
|
|
54
56
|
destroy(): void;
|
|
55
57
|
private onValueChange;
|
|
56
58
|
}
|
|
57
|
-
export {};
|