@adaptabletools/adaptable-cjs 21.0.0-canary.0 → 21.0.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -2
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +0 -1
- package/src/AdaptableOptions/EditOptions.d.ts +6 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +20 -8
- package/src/AdaptableOptions/LayoutOptions.d.ts +35 -1
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +2 -2
- package/src/Api/ColumnFilterApi.d.ts +5 -5
- package/src/Api/Implementation/ColumnApiImpl.js +1 -1
- package/src/Api/Implementation/ColumnFilterApiImpl.d.ts +3 -3
- package/src/Api/Implementation/ColumnFilterApiImpl.js +6 -6
- package/src/Api/Implementation/LayoutApiImpl.js +6 -6
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -3
- package/src/Api/Internal/ColumnFilterInternalApi.js +17 -25
- package/src/Api/Internal/ColumnInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.d.ts +3 -2
- package/src/Api/Internal/GridInternalApi.js +3 -2
- package/src/Api/Internal/LayoutInternalApi.d.ts +5 -0
- package/src/Api/Internal/LayoutInternalApi.js +43 -0
- package/src/Api/Internal/PredicateInternalApi.js +0 -1
- package/src/Redux/Store/AdaptableStore.js +0 -2
- package/src/Strategy/ColumnFilterModule.js +8 -1
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +1 -0
- package/src/Utilities/Helpers/AdaptableHelper.js +1 -0
- package/src/Utilities/ObjectFactory.d.ts +7 -3
- package/src/Utilities/ObjectFactory.js +27 -18
- package/src/Utilities/adaptableQlUtils.js +1 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +2 -0
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +20 -5
- package/src/View/Components/ColumnFilter/utils.js +0 -1
- package/src/View/Components/PredicateEditor/PredicateEditor.js +14 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.d.ts +2 -4
- package/src/View/Components/Selectors/PermittedValuesSelector.js +6 -5
- package/src/View/Layout/Wizard/LayoutWizard.js +5 -7
- package/src/agGrid/AdaptableAgGrid.d.ts +3 -2
- package/src/agGrid/AdaptableAgGrid.js +20 -10
- package/src/agGrid/AdaptableFilterHandler.d.ts +9 -4
- package/src/agGrid/AdaptableFilterHandler.js +28 -11
- package/src/agGrid/AgGridColumnAdapter.js +5 -2
- package/src/agGrid/AgGridExportAdapter.js +2 -4
- package/src/agGrid/AgGridModulesAdapter.js +5 -1
- package/src/agGrid/agGridDataTypeDefinitions.js +1 -8
- package/src/components/Select/Select.d.ts +1 -0
- package/src/components/Select/Select.js +5 -4
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +49 -22
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade20.js +1 -2
- package/src/types.d.ts +3 -3
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectFactory = exports.CreateToastOptions = exports.CreateEmptyCommentThread = exports.CreateEmptyTheme = exports.CreateCustomDisplayFormatterContext = exports.CreateEmptyChartDefinition = exports.CreateDefaultStyledColumnBadge = exports.CreateEmptyStyledColumn = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyPivotLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateAdaptableComment = exports.CreateEmptyCustomSort = void 0;
|
|
3
|
+
exports.ObjectFactory = exports.CreateToastOptions = exports.CreateEmptyCommentThread = exports.CreateEmptyTheme = exports.CreateCustomDisplayFormatterContext = exports.CreateEmptyChartDefinition = exports.CreateDefaultStyledColumnBadge = exports.CreateEmptyStyledColumn = exports.CreateColumnFilter = exports.CreateEmptyCellSummmary = exports.CreateSystemStatusMessageInfo = exports.CreateEmptyStyle = exports.CreateEmptyLayout = exports.CreateEmptyTableLayout = exports.CreateEmptyPivotLayout = exports.CreateEmptyFreeTextColumn = exports.CreateEmptyFormatColumn = exports.CreateEmptyShortcut = exports.CreateEmptySchedule = exports.CreateReportSchedule = exports.CreateIPushPullSchedule = exports.CreateEmptyOpenFinSchedule = exports.CreateEmptyIPushPullSchedule = exports.CreateEmptyOpenFinReport = exports.CreateEmptyIPushPullReport = exports.CreateEmptyReportSchedule = exports.CreateEmptyReminderSchedule = exports.CreateEmptyBaseSchedule = exports.CreateEmptyReport = exports.CreateInternalAlertDefinitionForMessages = exports.CreateEmptyFlashingCellDefinition = exports.CreateEmptyAlertDefinition = exports.CreateRowChangedAlert = exports.CreateCellChangedAlert = exports.CreateGenericAlert = exports.CreateEmptyPlusMinusNudge = exports.CreateEmptyNamedQuery = exports.CreateEmptyCalculatedColumn = exports.CreateAdaptableComment = exports.CreateEmptyCustomSort = void 0;
|
|
4
4
|
const Enums_1 = require("../AdaptableState/Common/Enums");
|
|
5
5
|
const Uuid_1 = require("../AdaptableState/Uuid");
|
|
6
6
|
const GeneralConstants_1 = require("./Constants/GeneralConstants");
|
|
@@ -274,37 +274,45 @@ function CreateEmptyFreeTextColumn(defaultSpecialColumnSettings) {
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
exports.CreateEmptyFreeTextColumn = CreateEmptyFreeTextColumn;
|
|
277
|
-
function CreateEmptyPivotLayout(
|
|
277
|
+
function CreateEmptyPivotLayout(pivotLayout) {
|
|
278
278
|
const result = {
|
|
279
|
-
|
|
280
|
-
ColumnSorts: layout.ColumnSorts || [],
|
|
281
|
-
ColumnFilters: layout.ColumnFilters || [],
|
|
279
|
+
...pivotLayout,
|
|
282
280
|
Uuid: (0, Uuid_1.createUuid)(),
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
ColumnSizing: pivotLayout.ColumnSizing || {},
|
|
282
|
+
ColumnHeaders: pivotLayout.ColumnHeaders || {},
|
|
283
|
+
ColumnPinning: pivotLayout.ColumnPinning || {},
|
|
284
|
+
ColumnSorts: pivotLayout.ColumnSorts || [],
|
|
285
|
+
ColumnFilters: pivotLayout.ColumnFilters || [],
|
|
286
|
+
PivotColumns: pivotLayout.PivotColumns || [],
|
|
287
|
+
PivotAggregationColumns: pivotLayout.PivotAggregationColumns || [],
|
|
288
|
+
PivotGroupedColumns: pivotLayout.PivotGroupedColumns || [],
|
|
287
289
|
};
|
|
288
290
|
return result;
|
|
289
291
|
}
|
|
290
292
|
exports.CreateEmptyPivotLayout = CreateEmptyPivotLayout;
|
|
291
|
-
function
|
|
292
|
-
if ((0, LayoutHelpers_1.isPivotLayout)(layout)) {
|
|
293
|
-
return CreateEmptyPivotLayout(layout);
|
|
294
|
-
}
|
|
295
|
-
const tableLayout = layout;
|
|
293
|
+
function CreateEmptyTableLayout(tableLayout) {
|
|
296
294
|
const result = {
|
|
297
295
|
...tableLayout,
|
|
298
296
|
Uuid: (0, Uuid_1.createUuid)(),
|
|
299
|
-
|
|
297
|
+
ColumnSizing: tableLayout.ColumnSizing || {},
|
|
298
|
+
ColumnHeaders: tableLayout.ColumnHeaders || {},
|
|
299
|
+
ColumnPinning: tableLayout.ColumnPinning || {},
|
|
300
300
|
ColumnSorts: tableLayout.ColumnSorts || [],
|
|
301
301
|
ColumnFilters: tableLayout.ColumnFilters || [],
|
|
302
|
-
|
|
303
|
-
RowGroupedColumns: tableLayout.RowGroupedColumns ||
|
|
304
|
-
(adaptableColumns ? adaptableColumns.filter((c) => c.isGrouped).map((c) => c.columnId) : []),
|
|
302
|
+
TableColumns: tableLayout.TableColumns || [],
|
|
303
|
+
RowGroupedColumns: tableLayout.RowGroupedColumns || [],
|
|
305
304
|
};
|
|
306
305
|
return result;
|
|
307
306
|
}
|
|
307
|
+
exports.CreateEmptyTableLayout = CreateEmptyTableLayout;
|
|
308
|
+
function CreateEmptyLayout(layout) {
|
|
309
|
+
if ((0, LayoutHelpers_1.isPivotLayout)(layout)) {
|
|
310
|
+
return CreateEmptyPivotLayout(layout);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
return CreateEmptyTableLayout(layout);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
308
316
|
exports.CreateEmptyLayout = CreateEmptyLayout;
|
|
309
317
|
function CreateEmptyStyle() {
|
|
310
318
|
return {
|
|
@@ -485,6 +493,7 @@ exports.ObjectFactory = {
|
|
|
485
493
|
CreateEmptyFreeTextColumn,
|
|
486
494
|
CreateEmptyLayout,
|
|
487
495
|
CreateEmptyPivotLayout,
|
|
496
|
+
CreateEmptyTableLayout,
|
|
488
497
|
CreateColumnFilter,
|
|
489
498
|
CreateEmptyStyle,
|
|
490
499
|
CreateEmptyCellSummmary,
|
|
@@ -11,7 +11,7 @@ const mapColumnDataTypeToExpressionFunctionType = (dataType) => {
|
|
|
11
11
|
if (dataType === 'text') {
|
|
12
12
|
return 'text';
|
|
13
13
|
}
|
|
14
|
-
if (dataType === 'date'
|
|
14
|
+
if (dataType === 'date') {
|
|
15
15
|
return 'date';
|
|
16
16
|
}
|
|
17
17
|
if (dataType === 'numberArray') {
|
|
@@ -25,6 +25,7 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
25
25
|
label: string;
|
|
26
26
|
}[];
|
|
27
27
|
dataLoadIsComplete: boolean;
|
|
28
|
+
skipDefaultSearch: boolean;
|
|
28
29
|
searchValueUsedInFilterValue: boolean;
|
|
29
30
|
};
|
|
30
31
|
setQuickFilterValues: React.Dispatch<React.SetStateAction<{
|
|
@@ -33,6 +34,7 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
33
34
|
label: string;
|
|
34
35
|
}[];
|
|
35
36
|
dataLoadIsComplete: boolean;
|
|
37
|
+
skipDefaultSearch: boolean;
|
|
36
38
|
searchValueUsedInFilterValue: boolean;
|
|
37
39
|
}>>;
|
|
38
40
|
triggerValuesLoad: () => void;
|
|
@@ -27,7 +27,12 @@ function useDistinctFilterColumnValues(options) {
|
|
|
27
27
|
const triggerValuesLoad = React.useCallback(() => {
|
|
28
28
|
setValuesLoadTrigger((prev) => prev + 1);
|
|
29
29
|
}, []);
|
|
30
|
-
const [quickFilterValues, setQuickFilterValues] = React.useState({
|
|
30
|
+
const [quickFilterValues, setQuickFilterValues] = React.useState({
|
|
31
|
+
values: [],
|
|
32
|
+
dataLoadIsComplete: false,
|
|
33
|
+
skipDefaultSearch: false,
|
|
34
|
+
searchValueUsedInFilterValue: false,
|
|
35
|
+
});
|
|
31
36
|
const [isDistinctColumnValuesLoading, setIsDistinctColumnValuesLoading] = React.useState(false);
|
|
32
37
|
(0, react_1.useEffect)(() => {
|
|
33
38
|
if (valuesLoadTrigger === 0) {
|
|
@@ -49,9 +54,11 @@ function useDistinctFilterColumnValues(options) {
|
|
|
49
54
|
if (ignore) {
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
57
|
+
const values = distinctFilterDisplayValues.values;
|
|
52
58
|
setQuickFilterValues({
|
|
53
|
-
values
|
|
59
|
+
values,
|
|
54
60
|
dataLoadIsComplete: true,
|
|
61
|
+
skipDefaultSearch: !!distinctFilterDisplayValues.skipDefaultSearch,
|
|
55
62
|
searchValueUsedInFilterValue,
|
|
56
63
|
});
|
|
57
64
|
setIsDistinctColumnValuesLoading(false);
|
|
@@ -121,16 +128,19 @@ const FloatingFilterValues = (props) => {
|
|
|
121
128
|
const onMenuOpen = triggerValuesLoad;
|
|
122
129
|
const onInputChange = React.useCallback((value) => {
|
|
123
130
|
searchValueRef.current = value;
|
|
124
|
-
|
|
131
|
+
const quickFilterValues = quickFilterValuesRef.current;
|
|
132
|
+
if (quickFilterValues.searchValueUsedInFilterValue || quickFilterValues.skipDefaultSearch) {
|
|
125
133
|
triggerValuesLoad();
|
|
126
134
|
}
|
|
127
|
-
}, [
|
|
135
|
+
}, []);
|
|
136
|
+
const { skipDefaultSearch } = quickFilterValues;
|
|
128
137
|
return (React.createElement(ListBoxFilterForm_1.ColumnValuesSelect, { selectProps: props.inline
|
|
129
138
|
? {
|
|
130
139
|
...props.selectProps,
|
|
131
140
|
'data-name': 'Select Values',
|
|
132
141
|
renderMultipleValues,
|
|
133
142
|
isClearable: false,
|
|
143
|
+
skipDefaultFiltering: skipDefaultSearch,
|
|
134
144
|
styles: {
|
|
135
145
|
dropdownIndicator: {
|
|
136
146
|
display: 'none',
|
|
@@ -159,6 +169,11 @@ const FloatingFilterValues = (props) => {
|
|
|
159
169
|
onMenuOpen,
|
|
160
170
|
onInputChange,
|
|
161
171
|
}
|
|
162
|
-
: {
|
|
172
|
+
: {
|
|
173
|
+
...props.selectProps,
|
|
174
|
+
skipDefaultFiltering: skipDefaultSearch,
|
|
175
|
+
onMenuOpen,
|
|
176
|
+
onInputChange,
|
|
177
|
+
}, disabled: props.disabled, isLoading: isDistinctColumnValuesLoading, column: currentColumn, dataType: currentColumn.dataType, options: quickFilterValues.values, value: props.value, onChange: props.onChange }));
|
|
163
178
|
};
|
|
164
179
|
exports.FloatingFilterValues = FloatingFilterValues;
|
|
@@ -142,7 +142,6 @@ const mapColumnFilterToQlPredicate = (columnFilter, abColumn, qlPredicateDefs, c
|
|
|
142
142
|
: { operator: 'Contains', args: [] };
|
|
143
143
|
break;
|
|
144
144
|
case 'date':
|
|
145
|
-
case 'dateString':
|
|
146
145
|
let defaultQlDatePredicate;
|
|
147
146
|
const defaultDateColumnFilter = columnFilterOptions.defaultDateColumnFilter;
|
|
148
147
|
if (defaultDateColumnFilter) {
|
|
@@ -49,13 +49,25 @@ const PredicateEditor = (props) => {
|
|
|
49
49
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
50
50
|
const columnId = props.columnId;
|
|
51
51
|
const column = adaptable.api.columnApi.getColumnWithColumnId(columnId);
|
|
52
|
+
const searchValueRef = React.useRef('');
|
|
52
53
|
const { quickFilterValues, isDistinctColumnValuesLoading, triggerValuesLoad } = (0, FloatingFilterValues_1.useDistinctFilterColumnValues)({
|
|
53
54
|
columnId,
|
|
55
|
+
searchValueRef,
|
|
54
56
|
});
|
|
57
|
+
const quickFilterValuesRef = React.useRef(quickFilterValues);
|
|
58
|
+
quickFilterValuesRef.current = quickFilterValues;
|
|
55
59
|
(0, react_1.useEffect)(triggerValuesLoad, []);
|
|
56
60
|
const onMenuOpen = () => {
|
|
57
61
|
triggerValuesLoad();
|
|
58
62
|
};
|
|
63
|
+
const onInputChange = React.useCallback((value) => {
|
|
64
|
+
searchValueRef.current = value;
|
|
65
|
+
const quickFilterValues = quickFilterValuesRef.current;
|
|
66
|
+
if (quickFilterValues.searchValueUsedInFilterValue || quickFilterValues.skipDefaultSearch) {
|
|
67
|
+
triggerValuesLoad();
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
const { skipDefaultSearch } = quickFilterValues;
|
|
59
71
|
return (React.createElement(rebass_1.Box, { className: baseClassName },
|
|
60
72
|
React.createElement(rebass_1.Flex, { justifyContent: "stretch", alignItems: "center" },
|
|
61
73
|
icon && React.createElement(Tag_1.Tag, { mr: 2 }, icon),
|
|
@@ -74,6 +86,8 @@ const PredicateEditor = (props) => {
|
|
|
74
86
|
adaptable.api.predicateApi.internalApi.IsInorNotInPredicateDef(currentPredicateDef) && (React.createElement(rebass_1.Box, { mt: 2 },
|
|
75
87
|
React.createElement(ListBoxFilterForm_1.ColumnValuesSelect, { isLoading: isDistinctColumnValuesLoading, column: column, options: quickFilterValues.values, selectProps: {
|
|
76
88
|
onMenuOpen,
|
|
89
|
+
onInputChange,
|
|
90
|
+
skipDefaultFiltering: skipDefaultSearch,
|
|
77
91
|
}, dataType: column.dataType, value: props.predicate.Inputs, onChange: handlePredicateValuesChange })))));
|
|
78
92
|
};
|
|
79
93
|
exports.PredicateEditor = PredicateEditor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SelectProps } from '../../../components/Select';
|
|
3
|
+
import { InFilterValue } from '../../../AdaptableOptions/FilterOptions';
|
|
3
4
|
export type ValueType = number | string | Date;
|
|
4
5
|
interface PermittedValuesSelectorProps<Value extends ValueType, IsMulti extends boolean> {
|
|
5
6
|
searchable?: false | 'inline' | 'menulist';
|
|
@@ -17,10 +18,7 @@ interface PermittedValuesSelectorProps<Value extends ValueType, IsMulti extends
|
|
|
17
18
|
menuPortalTarget?: HTMLElement;
|
|
18
19
|
loadValues?: (options: {
|
|
19
20
|
currentSearchValue: string;
|
|
20
|
-
}) => Promise<
|
|
21
|
-
value: any;
|
|
22
|
-
label: string;
|
|
23
|
-
}[]>;
|
|
21
|
+
}) => Promise<InFilterValue[]>;
|
|
24
22
|
}
|
|
25
23
|
export declare const PermittedValuesSelector: <Value extends ValueType, IsMulti extends boolean = false>(props: PermittedValuesSelectorProps<Value, IsMulti>) => React.JSX.Element;
|
|
26
24
|
export {};
|
|
@@ -26,9 +26,7 @@ const PermittedValuesSelector = function (props) {
|
|
|
26
26
|
(async () => {
|
|
27
27
|
let searchValueUsedInFilterValue = false;
|
|
28
28
|
const currentSearchValue = searchFilterRef.current;
|
|
29
|
-
const
|
|
30
|
-
// we are here ALWAYS getting Filter values but sometimes we want to get other things!!!
|
|
31
|
-
props.loadValues
|
|
29
|
+
const p = props.loadValues
|
|
32
30
|
? props.loadValues({
|
|
33
31
|
get currentSearchValue() {
|
|
34
32
|
searchValueUsedInFilterValue = true;
|
|
@@ -41,12 +39,15 @@ const PermittedValuesSelector = function (props) {
|
|
|
41
39
|
searchValueUsedInFilterValue = true;
|
|
42
40
|
return currentSearchValue;
|
|
43
41
|
},
|
|
44
|
-
})
|
|
42
|
+
});
|
|
43
|
+
const distinctColumnValues = await (0, runIfNotResolvedIn_1.runIfNotResolvedIn)(
|
|
44
|
+
// we are here ALWAYS getting Filter values but sometimes we want to get other things!!!
|
|
45
|
+
p, () => {
|
|
45
46
|
setIsLoading(true);
|
|
46
47
|
});
|
|
47
48
|
setSearchValueWasUsedWhenFiltering(searchValueUsedInFilterValue);
|
|
48
49
|
setIsLoading(false);
|
|
49
|
-
setOptions(distinctColumnValues);
|
|
50
|
+
setOptions(Array.isArray(distinctColumnValues) ? distinctColumnValues : distinctColumnValues.values);
|
|
50
51
|
})();
|
|
51
52
|
}, [props.columnId, props.loadValues, refetchKey]);
|
|
52
53
|
const isCreatable = (props.allowNewValues && !dataType) || ['text', 'number'].includes(dataType);
|
|
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const LayoutRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/LayoutRedux"));
|
|
7
7
|
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
|
|
8
|
-
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
|
|
9
8
|
const Helper_1 = require("../../../Utilities/Helpers/Helper");
|
|
10
9
|
const SettingsSection_1 = require("./sections/SettingsSection");
|
|
11
10
|
const rebass_1 = require("rebass");
|
|
@@ -33,17 +32,17 @@ const LayoutWizard = (props) => {
|
|
|
33
32
|
if (initialLayout) {
|
|
34
33
|
preparedLayout = (0, Helper_1.cloneObject)(initialLayout);
|
|
35
34
|
if (props?.popupParams?.action === 'Clone') {
|
|
36
|
-
preparedLayout
|
|
37
|
-
|
|
35
|
+
preparedLayout = {
|
|
36
|
+
...adaptable.api.layoutApi.internalApi.cloneLayout(preparedLayout),
|
|
37
|
+
Name: '',
|
|
38
|
+
};
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
42
|
const shouldCreatePivot = props.popupParams?.config?.layoutType === 'pivot' ||
|
|
42
43
|
props.abObjectType?.name?.toLowerCase().includes('pivot') ||
|
|
43
44
|
false;
|
|
44
|
-
preparedLayout = shouldCreatePivot
|
|
45
|
-
? ObjectFactory_1.default.CreateEmptyPivotLayout({ Name: '' })
|
|
46
|
-
: ObjectFactory_1.default.CreateEmptyLayout({ Name: '' });
|
|
45
|
+
preparedLayout = adaptable.api.layoutApi.internalApi.buildInitialLayout({ Name: '' }, shouldCreatePivot ? 'pivot' : 'table');
|
|
47
46
|
}
|
|
48
47
|
if (preparedLayout.SuppressAggFuncInHeader === undefined) {
|
|
49
48
|
preparedLayout.SuppressAggFuncInHeader =
|
|
@@ -66,7 +65,6 @@ const LayoutWizard = (props) => {
|
|
|
66
65
|
break;
|
|
67
66
|
case 'Clone':
|
|
68
67
|
const clonedLayout = { ...layout };
|
|
69
|
-
delete clonedLayout.Uuid;
|
|
70
68
|
dispatch(LayoutRedux.LayoutAdd(clonedLayout));
|
|
71
69
|
dispatch(LayoutRedux.LayoutSelect(clonedLayout.Name));
|
|
72
70
|
break;
|
|
@@ -21,7 +21,7 @@ import { Fdc3Service } from '../Utilities/Services/Fdc3Service';
|
|
|
21
21
|
import { AnnotationsService } from '../Utilities/Services/AnnotationsService';
|
|
22
22
|
import { IModuleCollection } from '../Strategy/Interface/IModule';
|
|
23
23
|
import { AgGridMenuAdapter } from './AgGridMenuAdapter';
|
|
24
|
-
import { AdaptableColumn, AdaptableTheme, ChartDefinition, ColumnSort, DataUpdateConfig, GridCell,
|
|
24
|
+
import { AdaptableColumn, AdaptableTheme, ChartDefinition, ColumnSort, InFilterValueResult, DataUpdateConfig, GridCell, Layout, SelectedCellInfo, SelectedRowInfo } from '../types';
|
|
25
25
|
import { RenderReactRootFn } from '../renderReactRoot';
|
|
26
26
|
import { AgGridOptionsService } from './AgGridOptionsService';
|
|
27
27
|
import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
@@ -257,7 +257,8 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
257
257
|
getDistinctFilterValuesForColumn(options: {
|
|
258
258
|
column: AdaptableColumn;
|
|
259
259
|
currentSearchValue: string;
|
|
260
|
-
|
|
260
|
+
previousResult: InFilterValueResult | undefined;
|
|
261
|
+
}): Promise<InFilterValueResult>;
|
|
261
262
|
getDistinctEditValuesForColumn(options: {
|
|
262
263
|
column: AdaptableColumn;
|
|
263
264
|
currentSearchValue: string;
|
|
@@ -432,7 +432,6 @@ class AdaptableAgGrid {
|
|
|
432
432
|
this.lifecycleState = 'available';
|
|
433
433
|
this.api.themeApi.applyCurrentTheme();
|
|
434
434
|
this.validatePrimaryKey();
|
|
435
|
-
// TODO AFL MIG: we could just patch the defautl Layout on init? instead
|
|
436
435
|
this.checkShouldClearExistingFiltersOrSearches();
|
|
437
436
|
// FIXME AFL FILTER: talk with Radu: should ColumnFilters still be ignored?!
|
|
438
437
|
// see layoutModel.Ignore_ColumnFilters
|
|
@@ -1857,7 +1856,7 @@ You need to define at least one Layout!`);
|
|
|
1857
1856
|
if (dataType === 'boolean') {
|
|
1858
1857
|
return typeof rawValue !== 'boolean' ? Boolean(rawValue) : rawValue;
|
|
1859
1858
|
}
|
|
1860
|
-
if (dataType === 'date'
|
|
1859
|
+
if (dataType === 'date') {
|
|
1861
1860
|
return rawValue instanceof Date ? rawValue : (0, DateHelper_1.parseDateValue)(rawValue);
|
|
1862
1861
|
}
|
|
1863
1862
|
return rawValue;
|
|
@@ -2258,10 +2257,19 @@ You need to define at least one Layout!`);
|
|
|
2258
2257
|
return this.getDistinctGridCellsForColumn(column);
|
|
2259
2258
|
}
|
|
2260
2259
|
async getDistinctFilterValuesForColumn(options) {
|
|
2261
|
-
const { column } = options;
|
|
2260
|
+
const { column, previousResult } = options;
|
|
2262
2261
|
const self = this;
|
|
2263
2262
|
// First get the Grid Cells in the Column
|
|
2264
|
-
|
|
2263
|
+
let currentGridCells;
|
|
2264
|
+
const getCurrentGridCells = () => {
|
|
2265
|
+
// we do this in a function so it's lazy
|
|
2266
|
+
// but we also store in the outside closure, so we can reuse the value if
|
|
2267
|
+
// already called
|
|
2268
|
+
if (currentGridCells) {
|
|
2269
|
+
return currentGridCells;
|
|
2270
|
+
}
|
|
2271
|
+
return (currentGridCells = this.getDistinctGridCellsForColumn(column));
|
|
2272
|
+
};
|
|
2265
2273
|
// If there are custom distinct value, return them; otherwise return the Grids Cells just retrieved
|
|
2266
2274
|
const customInFilterValues = this.adaptableOptions.filterOptions.customInFilterValues;
|
|
2267
2275
|
if (customInFilterValues) {
|
|
@@ -2269,12 +2277,13 @@ You need to define at least one Layout!`);
|
|
|
2269
2277
|
const customInFilterValuesContext = {
|
|
2270
2278
|
...this.api.internalApi.buildBaseContext(),
|
|
2271
2279
|
column,
|
|
2280
|
+
previousFilterResult: previousResult,
|
|
2272
2281
|
get currentSearchValue() {
|
|
2273
2282
|
return options.currentSearchValue;
|
|
2274
2283
|
},
|
|
2275
2284
|
get sortedValues() {
|
|
2276
2285
|
const result = gridApiInternal
|
|
2277
|
-
.sortDistinctValues(
|
|
2286
|
+
.sortDistinctValues(getCurrentGridCells(), column)
|
|
2278
2287
|
.map((gridCell) => {
|
|
2279
2288
|
return {
|
|
2280
2289
|
label: gridCell.displayValue,
|
|
@@ -2293,7 +2302,7 @@ You need to define at least one Layout!`);
|
|
|
2293
2302
|
return result;
|
|
2294
2303
|
},
|
|
2295
2304
|
get defaultValues() {
|
|
2296
|
-
const result =
|
|
2305
|
+
const result = getCurrentGridCells().map((gridCell) => {
|
|
2297
2306
|
return {
|
|
2298
2307
|
label: gridCell.displayValue,
|
|
2299
2308
|
value: gridCell.rawValue,
|
|
@@ -2331,23 +2340,24 @@ You need to define at least one Layout!`);
|
|
|
2331
2340
|
return result;
|
|
2332
2341
|
},
|
|
2333
2342
|
};
|
|
2334
|
-
let
|
|
2343
|
+
let customInFilterValuesResult;
|
|
2335
2344
|
try {
|
|
2336
|
-
|
|
2345
|
+
customInFilterValuesResult = await customInFilterValues(customInFilterValuesContext);
|
|
2337
2346
|
}
|
|
2338
2347
|
catch (error) {
|
|
2339
2348
|
this.logger.consoleError(`Failed to fetch custom filter values`, column, error);
|
|
2340
2349
|
}
|
|
2341
|
-
return
|
|
2350
|
+
return customInFilterValuesResult;
|
|
2342
2351
|
}
|
|
2343
2352
|
// No distinct values so lets return unique grid cells
|
|
2344
|
-
|
|
2353
|
+
const values = getCurrentGridCells().map((gridCell) => {
|
|
2345
2354
|
const inFilterValue = {
|
|
2346
2355
|
value: gridCell.rawValue,
|
|
2347
2356
|
label: gridCell.displayValue,
|
|
2348
2357
|
};
|
|
2349
2358
|
return inFilterValue;
|
|
2350
2359
|
});
|
|
2360
|
+
return { values };
|
|
2351
2361
|
}
|
|
2352
2362
|
async getDistinctEditValuesForColumn(options) {
|
|
2353
2363
|
const { column, gridCell } = options;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { DoesFilterPassParams, FilterHandler, FilterHandlerParams } from 'ag-grid-enterprise';
|
|
2
2
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
3
|
import { ColumnSetupInfo } from '../AdaptableState/Common/ColumnSetupInfo';
|
|
4
|
-
import {
|
|
4
|
+
import { InFilterValueResult } from '../AdaptableOptions/FilterOptions';
|
|
5
5
|
export declare class AdaptableFilterHandler implements FilterHandler {
|
|
6
6
|
private adaptableApi;
|
|
7
7
|
readonly colId: string;
|
|
8
|
-
private
|
|
8
|
+
private filterDisplayValuesResult;
|
|
9
9
|
constructor(adaptableApi: AdaptableApi, columnSetup: ColumnSetupInfo);
|
|
10
10
|
doesFilterPass(params: DoesFilterPassParams): boolean;
|
|
11
|
-
|
|
11
|
+
getFilterDisplayValuesFromCache(options: {
|
|
12
|
+
currentSearchValue: string;
|
|
13
|
+
}): Promise<InFilterValueResult>;
|
|
14
|
+
fetchFilterDisplayValues(options: {
|
|
15
|
+
currentSearchValue: string;
|
|
16
|
+
}): Promise<InFilterValueResult>;
|
|
12
17
|
onNewRowsLoaded(): void;
|
|
13
18
|
onAnyFilterChanged(): void;
|
|
14
19
|
resetFilterDisplayValues(): void;
|
|
15
|
-
refreshFilterDisplayValues(): Promise<
|
|
20
|
+
refreshFilterDisplayValues(): Promise<InFilterValueResult>;
|
|
16
21
|
refresh(params: FilterHandlerParams<any, any, any, any>): void;
|
|
17
22
|
destroy(): void;
|
|
18
23
|
}
|
|
@@ -30,36 +30,53 @@ class AdaptableFilterHandler {
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
this.
|
|
36
|
-
this.adaptableApi.gridApi.internalApi.getDistinctFilterDisplayValuesForColumn({
|
|
37
|
-
columnId: this.colId,
|
|
38
|
-
currentSearchValue,
|
|
39
|
-
});
|
|
33
|
+
getFilterDisplayValuesFromCache(options) {
|
|
34
|
+
if (this.filterDisplayValuesResult) {
|
|
35
|
+
return Promise.resolve(this.filterDisplayValuesResult);
|
|
40
36
|
}
|
|
41
|
-
return this.
|
|
37
|
+
return this.fetchFilterDisplayValues(options);
|
|
38
|
+
}
|
|
39
|
+
fetchFilterDisplayValues(options) {
|
|
40
|
+
return this.adaptableApi.gridApi.internalApi
|
|
41
|
+
.getDistinctFilterDisplayValuesForColumn({
|
|
42
|
+
columnId: this.colId,
|
|
43
|
+
get currentSearchValue() {
|
|
44
|
+
return options.currentSearchValue;
|
|
45
|
+
},
|
|
46
|
+
previousResult: this.filterDisplayValuesResult,
|
|
47
|
+
})
|
|
48
|
+
.then((result) => {
|
|
49
|
+
this.filterDisplayValuesResult = result;
|
|
50
|
+
return result;
|
|
51
|
+
});
|
|
42
52
|
}
|
|
43
53
|
onNewRowsLoaded() {
|
|
44
54
|
this.resetFilterDisplayValues();
|
|
45
55
|
}
|
|
46
56
|
onAnyFilterChanged() {
|
|
57
|
+
const filterOptions = this.adaptableApi.optionsApi.getFilterOptions();
|
|
58
|
+
if (!filterOptions.customInFilterValues) {
|
|
59
|
+
// no-one is using value.count or value.visible
|
|
60
|
+
// or context.sortedValues
|
|
61
|
+
// so no need to reset the filter display values
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
47
64
|
this.resetFilterDisplayValues();
|
|
48
65
|
}
|
|
49
66
|
resetFilterDisplayValues() {
|
|
50
67
|
// Reset the filter display values manually
|
|
51
|
-
this.
|
|
68
|
+
this.filterDisplayValuesResult = undefined;
|
|
52
69
|
}
|
|
53
70
|
async refreshFilterDisplayValues() {
|
|
54
71
|
this.resetFilterDisplayValues();
|
|
55
|
-
return this.
|
|
72
|
+
return this.getFilterDisplayValuesFromCache({ currentSearchValue: '' });
|
|
56
73
|
}
|
|
57
74
|
refresh(params) {
|
|
58
75
|
// No specific refresh logic needed for this handler
|
|
59
76
|
// The filter display values will be reset on new rows loaded or any filter changed
|
|
60
77
|
}
|
|
61
78
|
destroy() {
|
|
62
|
-
this.
|
|
79
|
+
this.filterDisplayValuesResult = undefined;
|
|
63
80
|
}
|
|
64
81
|
}
|
|
65
82
|
exports.AdaptableFilterHandler = AdaptableFilterHandler;
|
|
@@ -24,7 +24,7 @@ function getEditorForColumnDataType(columnDataType, variant) {
|
|
|
24
24
|
if (columnDataType === 'number') {
|
|
25
25
|
return variant === 'react' ? AdaptableNumberEditor_1.AdaptableReactNumberEditor : AdaptableNumberEditor_1.AdaptableNumberEditor;
|
|
26
26
|
}
|
|
27
|
-
if (columnDataType === 'date'
|
|
27
|
+
if (columnDataType === 'date') {
|
|
28
28
|
return variant === 'react' ? AdaptableDateEditor_1.AdaptableReactDateEditor : AdaptableDateEditor_1.AdaptableDateEditor;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -511,7 +511,10 @@ class AgGridColumnAdapter {
|
|
|
511
511
|
: Array.isArray(original_columnType)
|
|
512
512
|
? original_columnType
|
|
513
513
|
: [original_columnType];
|
|
514
|
-
|
|
514
|
+
// Adaptable uses type 'date' for all date columns, while AG Grid uses 'date' and 'dateString'
|
|
515
|
+
// #data_type_dateString
|
|
516
|
+
let normalisedTypes = originalTypes.map((t) => (t === 'dateString' ? 'date' : t));
|
|
517
|
+
const columnTypes = new Set(normalisedTypes);
|
|
515
518
|
if (this.adaptableApi.columnApi.isCalculatedColumn(colId)) {
|
|
516
519
|
columnTypes.add(AdaptableColumn_1.CALCULATED_COLUMN_TYPE);
|
|
517
520
|
}
|
|
@@ -435,7 +435,7 @@ class AgGridExportAdapter {
|
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
437
|
const columnDataType = this.adaptableApi.columnApi.getColumnDataTypeForColumnId(columnId);
|
|
438
|
-
if (
|
|
438
|
+
if (columnDataType === 'date' &&
|
|
439
439
|
typeof rawValue === 'string' &&
|
|
440
440
|
// rawValue is composed only of digits
|
|
441
441
|
/^\d+$/.test(rawValue)) {
|
|
@@ -693,7 +693,6 @@ class AgGridExportAdapter {
|
|
|
693
693
|
case 'boolean':
|
|
694
694
|
return 'Boolean';
|
|
695
695
|
case 'date':
|
|
696
|
-
case 'dateString':
|
|
697
696
|
return 'DateTime';
|
|
698
697
|
case 'text':
|
|
699
698
|
default:
|
|
@@ -823,7 +822,7 @@ class AgGridExportAdapter {
|
|
|
823
822
|
if (exportContext.isVisualExcelReport) {
|
|
824
823
|
return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, 'formattedValue');
|
|
825
824
|
}
|
|
826
|
-
const isDateColumn = columnDataType === 'date'
|
|
825
|
+
const isDateColumn = columnDataType === 'date';
|
|
827
826
|
// 2. if this is a date column and there is a custom export date format provided, that will next take precedence
|
|
828
827
|
if (isDateColumn) {
|
|
829
828
|
const customExportDateFormat = this.getCustomExportDateFormat(column, exportContext);
|
|
@@ -881,7 +880,6 @@ class AgGridExportAdapter {
|
|
|
881
880
|
case 'number':
|
|
882
881
|
return dataFormatDataType.number;
|
|
883
882
|
case 'date':
|
|
884
|
-
case 'dateString':
|
|
885
883
|
return dataFormatDataType.date;
|
|
886
884
|
default:
|
|
887
885
|
// default to rawValue for all other column types
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgGridModulesAdapter = exports.AG_GRID_VERSION = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
4
5
|
const ag_grid_enterprise_1 = require("ag-grid-enterprise");
|
|
5
6
|
exports.AG_GRID_VERSION = ag_grid_enterprise_1.AllEnterpriseModule.version;
|
|
6
7
|
class AgGridModulesAdapter {
|
|
@@ -45,7 +46,10 @@ class AgGridModulesAdapter {
|
|
|
45
46
|
mandatoryModules.push('ServerSideRowModelApiModule');
|
|
46
47
|
break;
|
|
47
48
|
case 'infinite':
|
|
48
|
-
|
|
49
|
+
_1.AdaptableLogger.consoleErrorBase("AdapTable does not support AG Grid's Infinite Row Model");
|
|
50
|
+
break;
|
|
51
|
+
case 'viewport':
|
|
52
|
+
mandatoryModules.push('ViewportRowModelModule');
|
|
49
53
|
break;
|
|
50
54
|
default:
|
|
51
55
|
mandatoryModules.push('ClientSideRowModelModule');
|
|
@@ -10,7 +10,6 @@ exports.ALL_ADAPTABLE_DATA_TYPES = [
|
|
|
10
10
|
'number',
|
|
11
11
|
'boolean',
|
|
12
12
|
'date',
|
|
13
|
-
'dateString',
|
|
14
13
|
'object',
|
|
15
14
|
exports.TEXT_ARRAY_DATA_TYPE,
|
|
16
15
|
exports.NUMBER_ARRAY_DATA_TYPE,
|
|
@@ -34,13 +33,7 @@ exports.agGridDataTypeDefinitions = {
|
|
|
34
33
|
valueFormatter: null,
|
|
35
34
|
suppressDefaultProperties: true,
|
|
36
35
|
},
|
|
37
|
-
dateString
|
|
38
|
-
baseDataType: 'dateString',
|
|
39
|
-
extendsDataType: 'dateString',
|
|
40
|
-
valueParser: null,
|
|
41
|
-
valueFormatter: null,
|
|
42
|
-
suppressDefaultProperties: true,
|
|
43
|
-
},
|
|
36
|
+
// dateString is force-cast to date in AdapTable, see #data_type_dateString
|
|
44
37
|
// text: is kept as is
|
|
45
38
|
// boolean: is kept as is
|
|
46
39
|
// object: is kept as is
|
|
@@ -16,6 +16,7 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
|
|
|
16
16
|
searchable?: false | 'inline' | 'menulist';
|
|
17
17
|
resizable?: boolean;
|
|
18
18
|
isClearable?: boolean;
|
|
19
|
+
skipDefaultFiltering?: boolean;
|
|
19
20
|
closeMenuOnSelect?: boolean;
|
|
20
21
|
hideSelectedOptions?: boolean;
|
|
21
22
|
showHeaderSelectionCheckbox?: boolean;
|