@adaptabletools/adaptable 21.0.12 → 21.1.0-canary.0
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/base.css +1811 -2336
- package/base.css.map +1 -1
- package/index.css +1768 -1413
- package/index.css.map +1 -1
- package/package.json +3 -3
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +7 -0
- package/src/AdaptableOptions/PredicateOptions.d.ts +4 -3
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +1 -1
- package/src/AdaptableState/Common/AdaptablePredicate.d.ts +12 -0
- package/src/AdaptableState/Common/AdaptablePredicate.js +132 -18
- package/src/AdaptableState/Selection/GridCell.d.ts +10 -0
- package/src/Api/Implementation/ExportApiImpl.js +2 -8
- package/src/Api/Implementation/PredicateApiImpl.d.ts +3 -1
- package/src/Api/Implementation/PredicateApiImpl.js +25 -2
- package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -1
- package/src/Api/Internal/AdaptableInternalApi.js +6 -0
- package/src/Api/Internal/PredicateInternalApi.d.ts +3 -1
- package/src/Api/Internal/PredicateInternalApi.js +14 -0
- package/src/Api/PredicateApi.d.ts +1 -1
- package/src/Redux/Store/AdaptableStore.js +111 -3
- package/src/Utilities/Helpers/Helper.js +26 -2
- package/src/Utilities/Hooks/index.d.ts +4 -0
- package/src/Utilities/Hooks/index.js +4 -0
- package/src/Utilities/Hooks/useAdaptableColumn.d.ts +2 -0
- package/src/Utilities/Hooks/useAdaptableColumn.js +6 -0
- package/src/Utilities/Hooks/useAdaptableOptions.d.ts +2 -0
- package/src/Utilities/Hooks/useAdaptableOptions.js +5 -0
- package/src/Utilities/Hooks/useAdaptableState.d.ts +3 -0
- package/src/Utilities/Hooks/useAdaptableState.js +39 -0
- package/src/Utilities/adaptableQlUtils.js +3 -0
- package/src/View/AdaptableComputedCSSVarsContext.d.ts +12 -0
- package/src/View/AdaptableComputedCSSVarsContext.js +25 -0
- package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.d.ts +1 -1
- package/src/View/Components/ColumnFilter/FloatingFilter.js +5 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +1 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +34 -9
- package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +1 -0
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +93 -16
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/renderWithAdaptableContext.js +3 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +3 -1
- package/src/agGrid/AdaptableAgGrid.js +361 -24
- package/src/agGrid/AdaptableFilterHandler.d.ts +3 -1
- package/src/agGrid/AdaptableFilterHandler.js +16 -12
- package/src/agGrid/AgGridAdapter.js +9 -5
- package/src/agGrid/AgGridColumnAdapter.js +14 -12
- package/src/components/OverlayTrigger/index.js +1 -1
- package/src/components/Select/Select.js +22 -22
- package/src/components/Tree/TreeDropdown/index.d.ts +27 -0
- package/src/components/Tree/TreeDropdown/index.js +250 -0
- package/src/components/Tree/TreeList/index.d.ts +25 -0
- package/src/components/Tree/TreeList/index.js +35 -0
- package/src/devTools/DevToolsTracks.d.ts +31 -0
- package/src/devTools/DevToolsTracks.js +31 -0
- package/src/devTools/PerfMarker.d.ts +12 -0
- package/src/devTools/PerfMarker.js +1 -0
- package/src/devTools/index.d.ts +102 -0
- package/src/devTools/index.js +159 -0
- package/src/env.js +2 -2
- package/src/layout-manager/src/index.d.ts +2 -0
- package/src/layout-manager/src/index.js +24 -0
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import { useAdaptable } from '../../View/AdaptableContext';
|
|
3
|
+
export function useAdaptableState(selector) {
|
|
4
|
+
const adaptable = useAdaptable();
|
|
5
|
+
const store = adaptable.adaptableStore;
|
|
6
|
+
const [_refreshKey, setRefreshKey] = useState(0);
|
|
7
|
+
const resultRef = useRef(null);
|
|
8
|
+
const getResult = () => {
|
|
9
|
+
if (!store) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const state = store.getCurrentStorageState();
|
|
13
|
+
if (!state) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return selector ? selector(state) : state;
|
|
17
|
+
};
|
|
18
|
+
// don't refresh when the state changes
|
|
19
|
+
// as we're under the adaptable context
|
|
20
|
+
// and this means it will be refreshed automatically
|
|
21
|
+
// useEffect(() => {
|
|
22
|
+
// if (!store) {
|
|
23
|
+
// return;
|
|
24
|
+
// }
|
|
25
|
+
// return store.onAny(() => {
|
|
26
|
+
// const newResult = getResult();
|
|
27
|
+
// if (newResult !== resultRef.current) {
|
|
28
|
+
// //only refresh when the result has changed
|
|
29
|
+
// setRefreshKey((prev) => prev + 1);
|
|
30
|
+
// }
|
|
31
|
+
// });
|
|
32
|
+
// }, [store]);
|
|
33
|
+
if (!adaptable || !adaptable.isReady) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const res = getResult();
|
|
37
|
+
resultRef.current = res;
|
|
38
|
+
return res;
|
|
39
|
+
}
|
|
@@ -17,6 +17,9 @@ export const mapColumnDataTypeToExpressionFunctionType = (dataType) => {
|
|
|
17
17
|
if (dataType === 'textArray') {
|
|
18
18
|
return 'text[]';
|
|
19
19
|
}
|
|
20
|
+
if (dataType === 'groupColumn') {
|
|
21
|
+
return 'text';
|
|
22
|
+
}
|
|
20
23
|
};
|
|
21
24
|
export const mapExpressionFunctionTypeToColumnDataType = (type) => {
|
|
22
25
|
if (type === 'number') {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const computedCSSVarNames: readonly ["--ab-cmp-select-menu__max-width", "--ab-cmp-select-menu__min-width", "--ab-cmp-select-menu__max-height"];
|
|
3
|
+
type AdaptableComputedCSSVars = {
|
|
4
|
+
[key in (typeof computedCSSVarNames)[number]]: string | number;
|
|
5
|
+
};
|
|
6
|
+
export declare const AdaptableComputedCSSVarsContext: React.Context<AdaptableComputedCSSVars>;
|
|
7
|
+
export declare const WithAdaptableComputedCSSVars: ({ children }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}) => React.JSX.Element;
|
|
10
|
+
export declare const useAdaptableComputedCSSVars: () => AdaptableComputedCSSVars;
|
|
11
|
+
export declare const useAdaptableComputedCSSVar: (varName: (typeof computedCSSVarNames)[number]) => string | number;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CSSNumericVariableWatch } from '../components/Select/CSSNumericVariableWatch';
|
|
3
|
+
const computedCSSVarNames = [
|
|
4
|
+
'--ab-cmp-select-menu__max-width',
|
|
5
|
+
'--ab-cmp-select-menu__min-width',
|
|
6
|
+
'--ab-cmp-select-menu__max-height',
|
|
7
|
+
];
|
|
8
|
+
const defaultValues = Object.fromEntries(computedCSSVarNames.map((varName) => [varName, 0]));
|
|
9
|
+
export const AdaptableComputedCSSVarsContext = React.createContext(defaultValues);
|
|
10
|
+
export const WithAdaptableComputedCSSVars = ({ children }) => {
|
|
11
|
+
const [computedCSSVars, setComputedCSSVars] = React.useState(defaultValues);
|
|
12
|
+
return (React.createElement(AdaptableComputedCSSVarsContext.Provider, { value: computedCSSVars },
|
|
13
|
+
children,
|
|
14
|
+
computedCSSVarNames.map((varName) => (React.createElement(CSSNumericVariableWatch, { key: varName, varName: varName, onChange: (value) => {
|
|
15
|
+
setComputedCSSVars((prev) => ({ ...prev, [varName]: value }));
|
|
16
|
+
} })))));
|
|
17
|
+
};
|
|
18
|
+
export const useAdaptableComputedCSSVars = () => {
|
|
19
|
+
const context = React.useContext(AdaptableComputedCSSVarsContext);
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
export const useAdaptableComputedCSSVar = (varName) => {
|
|
23
|
+
const context = React.useContext(AdaptableComputedCSSVarsContext);
|
|
24
|
+
return context?.[varName];
|
|
25
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AdaptableInputProps } from '.';
|
|
3
|
-
export declare const AdaptableDateInlineInput: React.ForwardRefExoticComponent<Omit<Omit<AdaptableInputProps, "
|
|
3
|
+
export declare const AdaptableDateInlineInput: React.ForwardRefExoticComponent<Omit<Omit<AdaptableInputProps, "value" | "onChange"> & {
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
5
|
value: string;
|
|
6
6
|
}, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -7,6 +7,7 @@ import { AdaptableIconComponent } from '../AdaptableIconComponent';
|
|
|
7
7
|
import { ColumnFilterMenu } from './components/ColumnFilterMenu';
|
|
8
8
|
import { FloatingFilterInputList } from './components/FloatingFilterInputList';
|
|
9
9
|
import { isPredicateEmpty, qlPredicateToString } from './utils';
|
|
10
|
+
import { AG_GRID_GROUPED_COLUMN } from '../../../Utilities/Constants/GeneralConstants';
|
|
10
11
|
export const FloatingFilter = (props) => {
|
|
11
12
|
const adaptable = useAdaptable();
|
|
12
13
|
/**
|
|
@@ -22,7 +23,10 @@ export const FloatingFilter = (props) => {
|
|
|
22
23
|
singleFilterPredicateDef = props.predicateDefs.find((predicateDef) => predicateDef.operator === props.predicate.args[0].operator);
|
|
23
24
|
}
|
|
24
25
|
const noInputs = !singleFilterPredicateDef?.inputs || singleFilterPredicateDef.inputs.length === 0;
|
|
25
|
-
|
|
26
|
+
let showLabel = isMultiple || noInputs || isManualApply;
|
|
27
|
+
if (props.columnId === AG_GRID_GROUPED_COLUMN) {
|
|
28
|
+
showLabel = false;
|
|
29
|
+
}
|
|
26
30
|
let label = qlPredicateToString(props.predicate, props.predicateDefs);
|
|
27
31
|
if (isManualApply &&
|
|
28
32
|
singleFilterPredicateDef &&
|
|
@@ -33,7 +33,7 @@ export const FloatingFilterInputList = (props) => {
|
|
|
33
33
|
});
|
|
34
34
|
}, value: props.predicate.args,
|
|
35
35
|
// are not known ql operators for now
|
|
36
|
-
// should change when porting, it has
|
|
36
|
+
// should change when porting, it has knowledge about predicates
|
|
37
37
|
type: props.predicate.operator === 'In' ? 'In' : 'NotIn' }));
|
|
38
38
|
}
|
|
39
39
|
return (React.createElement(React.Fragment, null, (matchingInputs ?? []).map((input, index) => {
|
|
@@ -2,6 +2,15 @@ import * as React from 'react';
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useAdaptable } from '../../../AdaptableContext';
|
|
4
4
|
import { ColumnValuesSelect } from '../../FilterForm/ListBoxFilterForm';
|
|
5
|
+
import { AG_GRID_GROUPED_COLUMN } from '../../../../Utilities/Constants/GeneralConstants';
|
|
6
|
+
const onceFlags = {};
|
|
7
|
+
const logOnce = (message, loggingFn) => {
|
|
8
|
+
if (onceFlags[message]) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
loggingFn(message);
|
|
12
|
+
onceFlags[message] = true;
|
|
13
|
+
};
|
|
5
14
|
const renderSingleValue = (option) => {
|
|
6
15
|
return option.label;
|
|
7
16
|
};
|
|
@@ -41,10 +50,10 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
41
50
|
let ignore = false;
|
|
42
51
|
setIsDistinctColumnValuesLoading(true);
|
|
43
52
|
let searchValueUsedInFilterValue = false;
|
|
44
|
-
const
|
|
53
|
+
const columnFilterInternalApi = api.filterApi.columnFilterApi.internalApi;
|
|
45
54
|
let promise = undefined;
|
|
46
55
|
if (usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current) {
|
|
47
|
-
const previousResult =
|
|
56
|
+
const previousResult = columnFilterInternalApi
|
|
48
57
|
.getAdaptableFilterHandler(columnId)
|
|
49
58
|
?.getLastCachedFilterDisplayValues();
|
|
50
59
|
if (previousResult) {
|
|
@@ -53,7 +62,7 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
53
62
|
}
|
|
54
63
|
usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef.current = false;
|
|
55
64
|
if (!promise) {
|
|
56
|
-
promise =
|
|
65
|
+
promise = columnFilterInternalApi.getColumnFilterValues({
|
|
57
66
|
columnId,
|
|
58
67
|
get currentSearchValue() {
|
|
59
68
|
searchValueUsedInFilterValue = true;
|
|
@@ -91,6 +100,9 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
91
100
|
*/
|
|
92
101
|
export const FloatingFilterValues = (props) => {
|
|
93
102
|
const { api } = useAdaptable();
|
|
103
|
+
// const evaluateInPredicateUsingTime = useAdaptableOptions(
|
|
104
|
+
// (options) => options.predicateOptions.evaluateInPredicateUsingTime
|
|
105
|
+
// );
|
|
94
106
|
const currentColumn = api.columnApi.getColumnWithColumnId(props.columnId);
|
|
95
107
|
const searchValueRef = React.useRef('');
|
|
96
108
|
const { isDistinctColumnValuesLoading, quickFilterValues, triggerValuesLoad } = useDistinctFilterColumnValues({
|
|
@@ -107,9 +119,10 @@ export const FloatingFilterValues = (props) => {
|
|
|
107
119
|
return;
|
|
108
120
|
}
|
|
109
121
|
// see 😅 usePreviousValuesProbablyBecauseOfAGGridUnnecessaryFilterRemountRef 😅
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
const filterHandler = api.filterApi.columnFilterApi.internalApi.getAdaptableFilterHandler(props.columnId);
|
|
123
|
+
const usePrevious = filterHandler && typeof filterHandler.getLastCachedFilterDisplayValues === 'function'
|
|
124
|
+
? !!filterHandler.getLastCachedFilterDisplayValues()
|
|
125
|
+
: false;
|
|
113
126
|
// however, if the `value` prop is a non-empty array, we need to load the values
|
|
114
127
|
// so we know which labels to show
|
|
115
128
|
triggerValuesLoad({
|
|
@@ -150,6 +163,20 @@ export const FloatingFilterValues = (props) => {
|
|
|
150
163
|
}
|
|
151
164
|
}, []);
|
|
152
165
|
const { skipDefaultSearch } = quickFilterValues;
|
|
166
|
+
if (props.columnId === AG_GRID_GROUPED_COLUMN) {
|
|
167
|
+
if (Array.isArray(props.value) && !props.value.every((value) => Array.isArray(value))) {
|
|
168
|
+
logOnce(`All the inputs for the IN predicate for the column "${props.columnId}" need to be arrays. Example:
|
|
169
|
+
{
|
|
170
|
+
PredicateId: 'In',
|
|
171
|
+
Inputs: [
|
|
172
|
+
['United States'],
|
|
173
|
+
['Canada'],
|
|
174
|
+
['United Kingdom', 'England'],
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
`, (msg) => console.warn(msg));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
153
180
|
return (React.createElement(ColumnValuesSelect, { selectProps: props.inline
|
|
154
181
|
? {
|
|
155
182
|
...props.selectProps,
|
|
@@ -182,13 +209,11 @@ export const FloatingFilterValues = (props) => {
|
|
|
182
209
|
}
|
|
183
210
|
: {}),
|
|
184
211
|
},
|
|
185
|
-
onMenuOpen,
|
|
186
212
|
onInputChange,
|
|
187
213
|
}
|
|
188
214
|
: {
|
|
189
215
|
...props.selectProps,
|
|
190
216
|
skipDefaultFiltering: skipDefaultSearch,
|
|
191
|
-
onMenuOpen,
|
|
192
217
|
onInputChange,
|
|
193
|
-
}, disabled: props.disabled, isLoading: isDistinctColumnValuesLoading, column: currentColumn, dataType: currentColumn.dataType, options: quickFilterValues.values, value: props.value, onChange: props.onChange }));
|
|
218
|
+
}, disabled: props.disabled, onMenuOpen: onMenuOpen, isLoading: isDistinctColumnValuesLoading, column: currentColumn, dataType: currentColumn.dataType, options: quickFilterValues.values, value: props.value, onChange: props.onChange }));
|
|
194
219
|
};
|
|
@@ -12,5 +12,6 @@ export interface ColumnValuesSelectProps {
|
|
|
12
12
|
dataType: AdaptableColumnDataType;
|
|
13
13
|
isLoading?: boolean;
|
|
14
14
|
selectProps?: Partial<SelectProps<any, false>>;
|
|
15
|
+
onMenuOpen?: () => void;
|
|
15
16
|
}
|
|
16
17
|
export declare const ColumnValuesSelect: (props: ColumnValuesSelectProps) => React.JSX.Element;
|
|
@@ -4,31 +4,108 @@ import { isEqual } from 'date-fns';
|
|
|
4
4
|
import { parseDateValue } from '../../../Utilities/Helpers/DateHelper';
|
|
5
5
|
import join from '../../../components/utils/join';
|
|
6
6
|
import { Select } from '../../../components/Select';
|
|
7
|
+
import { toDisplayValueDefault, TreeDropdown } from '../../../components/Tree/TreeDropdown';
|
|
8
|
+
import { AG_GRID_GROUPED_COLUMN } from '../../../Utilities/Constants/GeneralConstants';
|
|
9
|
+
import { useAdaptable } from '../../AdaptableContext';
|
|
10
|
+
import { useMemo } from 'react';
|
|
7
11
|
const baseClassName = 'ab-ListBoxFilterForm';
|
|
12
|
+
// used for displaying the date values in the input
|
|
13
|
+
function toDateDisplayValue(values) {
|
|
14
|
+
values = values.map((v) => {
|
|
15
|
+
if (!Array.isArray(v)) {
|
|
16
|
+
return v;
|
|
17
|
+
}
|
|
18
|
+
return v[v.length - 1];
|
|
19
|
+
});
|
|
20
|
+
return toDisplayValueDefault(values);
|
|
21
|
+
}
|
|
22
|
+
const dateOnChangeParser = (value) => {
|
|
23
|
+
/**
|
|
24
|
+
* the value looks like this:
|
|
25
|
+
* [
|
|
26
|
+
* ["2021","2021-01","2021-01-01"],
|
|
27
|
+
* ["2024","2024-02","2024-02-15T12:34:00"],
|
|
28
|
+
* ]
|
|
29
|
+
*/
|
|
30
|
+
// so first need to transfor the above to this:
|
|
31
|
+
/**
|
|
32
|
+
* [
|
|
33
|
+
* [2023, 12, 1, 1640668800000],
|
|
34
|
+
* [2023, 12, 3, 1738377600000]
|
|
35
|
+
* ]
|
|
36
|
+
*/
|
|
37
|
+
return value.map((v) => {
|
|
38
|
+
return v[v.length - 1];
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const EMPTY_ARRAY = [];
|
|
8
42
|
export const ColumnValuesSelect = (props) => {
|
|
9
43
|
const column = props.column;
|
|
10
|
-
const
|
|
44
|
+
const { api } = useAdaptable();
|
|
45
|
+
let selectedColumnValues = props.value || EMPTY_ARRAY;
|
|
46
|
+
const optionsFromProps = Array.isArray(props.options) ? props.options : EMPTY_ARRAY;
|
|
11
47
|
const value = [];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
if (column.dataType === 'date') {
|
|
49
|
+
// we might have a use-case where users might want to get rid of a tree level
|
|
50
|
+
// because it may contain only one child. currently,
|
|
51
|
+
// the value is an array of strings that have this form (ISOish)
|
|
52
|
+
// ["2021-01-01", "2021-10-02", "2021-01-03T12:00:00"]
|
|
53
|
+
// but we want the full path to each value
|
|
54
|
+
// but we can't compute that by simply splitting the strings by '-' or 'T',
|
|
55
|
+
// as if we do that, then we won't support removing a tree level
|
|
56
|
+
// so we have to compute the paths based on the options
|
|
57
|
+
const valueToPath = useMemo(() => {
|
|
58
|
+
const valueToPath = new Map();
|
|
59
|
+
const withOption = (option, parentPath = []) => {
|
|
60
|
+
const optionPath = [...parentPath, option.value];
|
|
61
|
+
valueToPath.set(option.value, optionPath);
|
|
62
|
+
if (Array.isArray(option.children)) {
|
|
63
|
+
option.children.forEach((child) => withOption(child, optionPath));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
optionsFromProps.forEach((option) => withOption(option, []));
|
|
67
|
+
return valueToPath;
|
|
68
|
+
}, [optionsFromProps]);
|
|
69
|
+
selectedColumnValues = selectedColumnValues
|
|
70
|
+
.map((v) => {
|
|
71
|
+
return valueToPath.get(v);
|
|
72
|
+
})
|
|
73
|
+
.filter(Boolean);
|
|
74
|
+
}
|
|
75
|
+
const options = column.dataType === 'date' || column.columnId === AG_GRID_GROUPED_COLUMN
|
|
76
|
+
? optionsFromProps
|
|
77
|
+
: optionsFromProps.filter((distinctValue) => {
|
|
78
|
+
let isActive = selectedColumnValues.indexOf(distinctValue.value) >= 0;
|
|
79
|
+
// special case for date objects, need to check against string values
|
|
80
|
+
if (!isActive && distinctValue.value && distinctValue.value instanceof Date) {
|
|
81
|
+
isActive = selectedColumnValues.some((dateStr) => isEqual(parseDateValue(dateStr), parseDateValue(distinctValue.value)));
|
|
82
|
+
}
|
|
83
|
+
if (StringExtensions.IsNullOrEmpty(distinctValue.value)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (isActive) {
|
|
87
|
+
value.push(distinctValue.value);
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
});
|
|
26
91
|
const menuStyle = React.useMemo(() => {
|
|
27
92
|
return {
|
|
28
93
|
minWidth: `var(--ab-cmp-select-column-menu-${column.columnId}__min-width, var(--ab-cmp-select-column-menu__min-width, 160px))`,
|
|
29
94
|
};
|
|
30
95
|
}, [column.columnId]);
|
|
31
|
-
const component =
|
|
96
|
+
const component = column.dataType === 'date' || column.columnId === AG_GRID_GROUPED_COLUMN ? (React.createElement(TreeDropdown, { style: {
|
|
97
|
+
width: '100%',
|
|
98
|
+
height: '100%',
|
|
99
|
+
...props.selectProps?.styles?.container,
|
|
100
|
+
}, toDisplayValue: column.dataType === 'date' ? toDateDisplayValue : undefined, fieldStyle: {
|
|
101
|
+
boxShadow: 'none',
|
|
102
|
+
...props.selectProps?.styles?.control,
|
|
103
|
+
}, resizable: true, onChange: column.dataType === 'date'
|
|
104
|
+
? (value) => props.onChange(dateOnChangeParser(value))
|
|
105
|
+
: props.onChange, options: options,
|
|
106
|
+
// for dates, the treeDateOptions have ids that are numbers
|
|
107
|
+
// so we have to add the `toDateValue` function to convert the values to the correct format
|
|
108
|
+
value: selectedColumnValues, primaryKey: 'value', onMenuOpen: props.onMenuOpen, onMouseDown: (e) => e.stopPropagation() })) : (React.createElement(Select, { key: "select", isMulti: true, resizable: true, showHeaderSelectionCheckbox: true, searchable: 'menulist', closeMenuOnSelect: false, menuStyle: menuStyle, ...props.selectProps, onMenuOpen: props.onMenuOpen, options: options, value: value, isLoading: props.isLoading, onChange: props.onChange }));
|
|
32
109
|
return (React.createElement("div", { className: join(baseClassName, props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
|
|
33
110
|
const event = e.nativeEvent || e;
|
|
34
111
|
event.stopPropagation = () => {
|
|
@@ -250,7 +250,7 @@ export const ColumnsSection = (props) => {
|
|
|
250
250
|
// however, changes in RowGroupedColumns done in the previous step
|
|
251
251
|
// are reflected into the layout, so we use the latest layout.RowGroupedColumns
|
|
252
252
|
// to create new columns
|
|
253
|
-
if (layout.RowGroupedColumns) {
|
|
253
|
+
if (layout.RowGroupedColumns && layout.RowGroupedColumns.length > 0) {
|
|
254
254
|
if (layout.RowGroupDisplayType === 'single') {
|
|
255
255
|
allColumns.unshift(generateAutoRowGroupSingleColumn());
|
|
256
256
|
}
|
|
@@ -3,8 +3,10 @@ import { Provider } from 'react-redux';
|
|
|
3
3
|
import { ThemeProvider } from 'styled-components';
|
|
4
4
|
import theme from '../theme';
|
|
5
5
|
import AdaptableContext from './AdaptableContext';
|
|
6
|
+
import { WithAdaptableComputedCSSVars } from './AdaptableComputedCSSVarsContext';
|
|
6
7
|
export const renderWithAdaptableContext = (children, adaptable) => {
|
|
7
8
|
return (React.createElement(Provider, { store: adaptable.adaptableStore.TheStore },
|
|
8
9
|
React.createElement(ThemeProvider, { theme: theme },
|
|
9
|
-
React.createElement(
|
|
10
|
+
React.createElement(WithAdaptableComputedCSSVars, null,
|
|
11
|
+
React.createElement(AdaptableContext.Provider, { value: adaptable }, children)))));
|
|
10
12
|
};
|
|
@@ -26,7 +26,7 @@ import { RenderReactRootFn } from '../renderReactRoot';
|
|
|
26
26
|
import { AgGridOptionsService } from './AgGridOptionsService';
|
|
27
27
|
import { AgGridColumnAdapter } from './AgGridColumnAdapter';
|
|
28
28
|
import { RowFormService } from '../Utilities/Services/RowFormService';
|
|
29
|
-
import { GridCellWithCount } from '../AdaptableState/Selection/GridCell';
|
|
29
|
+
import { GridCellWithCount, GridCellWithChildren } from '../AdaptableState/Selection/GridCell';
|
|
30
30
|
import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
|
|
31
31
|
import { AgGridExportAdapter } from './AgGridExportAdapter';
|
|
32
32
|
import { PivotLayoutModel, TableLayoutModel } from '../layout-manager/src/LayoutManagerModel';
|
|
@@ -266,6 +266,8 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
266
266
|
currentSearchValue: string;
|
|
267
267
|
gridCell?: GridCell;
|
|
268
268
|
}): Promise<EditColumnValueInfo[]>;
|
|
269
|
+
getDistinctGridCellsForGroupedColumn(rowNodes?: IRowNode[]): GridCellWithChildren[];
|
|
270
|
+
getDistinctGridCellsForDateColumn(column: AdaptableColumn, rowNodes?: IRowNode[]): GridCellWithChildren[];
|
|
269
271
|
getDistinctGridCellsForColumn(column: AdaptableColumn, rowNodes?: IRowNode[]): GridCellWithCount[];
|
|
270
272
|
private addDistinctColumnValue;
|
|
271
273
|
private getUniqueGridCells;
|