@adaptabletools/adaptable 23.0.21 → 23.0.22
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/AdaptableOptions/FilterOptions.d.ts +18 -0
- package/src/Api/GridApi.d.ts +5 -1
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +22 -1
- package/src/Utilities/Helpers/DisplayFormatHelper.js +16 -4
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +9 -0
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +12 -1
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
- package/src/View/Components/PredicateEditor/PredicateEditor.js +7 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +6 -2
- package/src/components/Combobox/index.d.ts +11 -0
- package/src/components/Combobox/index.js +5 -3
- package/src/components/Tree/TreeDropdown/index.d.ts +11 -0
- package/src/components/Tree/TreeDropdown/index.js +6 -3
- package/src/env.js +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -206,6 +206,24 @@ export interface InFilterValueResult {
|
|
|
206
206
|
* Search changes reset the list and set `offset` back to 0.
|
|
207
207
|
*/
|
|
208
208
|
hasMore?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Custom text for the collapsed IN Filter input.
|
|
211
|
+
*
|
|
212
|
+
* Receives the currently selected items (and their count) and must return a
|
|
213
|
+
* string.
|
|
214
|
+
*
|
|
215
|
+
* When omitted, the input shows the selected count (e.g. `(3)`) followed by the
|
|
216
|
+
* selected labels joined with a comma. When provided, it fully replaces that
|
|
217
|
+
* text (including the count - render one yourself if you want it).
|
|
218
|
+
*
|
|
219
|
+
* For tree-shaped filters (group columns and date columns), each selected leaf
|
|
220
|
+
* is one entry in `selectedValues`: its `value` is the full leaf path and its
|
|
221
|
+
* `label` the joined path label. `selectedCount` is the number of selected leaves.
|
|
222
|
+
*/
|
|
223
|
+
renderInputValues?: (params: {
|
|
224
|
+
selectedValues: InFilterValue[];
|
|
225
|
+
selectedCount: number;
|
|
226
|
+
}) => string;
|
|
209
227
|
}
|
|
210
228
|
/**
|
|
211
229
|
* Information about items in the IN Column Filter
|
package/src/Api/GridApi.d.ts
CHANGED
|
@@ -35,9 +35,13 @@ export interface GridApi {
|
|
|
35
35
|
*/
|
|
36
36
|
getFilteredData(): any[];
|
|
37
37
|
/**
|
|
38
|
-
* Retrieves visible data from the grid (filtered and sorted)
|
|
38
|
+
* Retrieves visible data from the grid (filtered and sorted from visible columns only)
|
|
39
39
|
*/
|
|
40
40
|
getVisibleData(): any[];
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the displayed (formatted but not styled) data from the grid (filtered and sorted and visible columns only)
|
|
43
|
+
*/
|
|
44
|
+
getDisplayedData(): any[];
|
|
41
45
|
/**
|
|
42
46
|
* Retrieves all the values for a single Column.
|
|
43
47
|
*
|
|
@@ -27,6 +27,7 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
|
|
|
27
27
|
getGridData(): any[];
|
|
28
28
|
getFilteredData(): any[];
|
|
29
29
|
getVisibleData(): any[];
|
|
30
|
+
getDisplayedData(): any[];
|
|
30
31
|
getColumnData(columnId: string): any[];
|
|
31
32
|
getFilteredColumnData(columnId: string): any[];
|
|
32
33
|
getVisibleColumnData(columnId: string): any[];
|
|
@@ -36,9 +36,30 @@ export class GridApiImpl extends ApiBase {
|
|
|
36
36
|
}
|
|
37
37
|
getVisibleData() {
|
|
38
38
|
const data = [];
|
|
39
|
+
const visibleColumns = this.getColumnApi().getVisibleColumns();
|
|
39
40
|
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
40
41
|
if (!this.isGroupRowNode(rowNode)) {
|
|
41
|
-
|
|
42
|
+
const visibleRow = {};
|
|
43
|
+
visibleColumns.forEach((column) => {
|
|
44
|
+
const key = column.field ?? column.columnId;
|
|
45
|
+
visibleRow[key] = this.getRawValueFromRowNode(rowNode, column.columnId);
|
|
46
|
+
});
|
|
47
|
+
data.push(visibleRow);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
getDisplayedData() {
|
|
53
|
+
const data = [];
|
|
54
|
+
const visibleColumns = this.getColumnApi().getVisibleColumns();
|
|
55
|
+
this.getAdaptableInternalApi().forAllVisibleRowNodesDo((rowNode) => {
|
|
56
|
+
if (!this.isGroupRowNode(rowNode)) {
|
|
57
|
+
const displayedRow = {};
|
|
58
|
+
visibleColumns.forEach((column) => {
|
|
59
|
+
const key = column.field ?? column.columnId;
|
|
60
|
+
displayedRow[key] = this.getDisplayValueFromRowNode(rowNode, column.columnId);
|
|
61
|
+
});
|
|
62
|
+
data.push(displayedRow);
|
|
42
63
|
}
|
|
43
64
|
});
|
|
44
65
|
return data;
|
|
@@ -14,9 +14,21 @@ const getFractionDigitsAfterMultiplier = (input, multiplier, explicitFractionDig
|
|
|
14
14
|
if (multiplier === 1) {
|
|
15
15
|
return getInputFractionDigitCount(input);
|
|
16
16
|
}
|
|
17
|
+
if (!Number.isFinite(multiplier) || multiplier === 0) {
|
|
18
|
+
return getInputFractionDigitCount(input);
|
|
19
|
+
}
|
|
17
20
|
const multiplierPower = Math.round(Math.log10(Math.abs(multiplier)));
|
|
21
|
+
if (!Number.isFinite(multiplierPower)) {
|
|
22
|
+
return getInputFractionDigitCount(input);
|
|
23
|
+
}
|
|
18
24
|
return Math.max(0, getInputFractionDigitCount(input) - multiplierPower);
|
|
19
25
|
};
|
|
26
|
+
const normalizeMultiplier = (multiplier) => {
|
|
27
|
+
if (multiplier == null || !Number.isFinite(multiplier) || multiplier === 0) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return multiplier;
|
|
31
|
+
};
|
|
20
32
|
export function NumberFormatter(input, options = {}, rowNode, column, api) {
|
|
21
33
|
let preparedInput;
|
|
22
34
|
if (options.Content) {
|
|
@@ -41,11 +53,11 @@ export function NumberFormatter(input, options = {}, rowNode, column, api) {
|
|
|
41
53
|
if (isNaN(n)) {
|
|
42
54
|
return preparedInput.toString();
|
|
43
55
|
}
|
|
44
|
-
|
|
56
|
+
const effectiveMultiplier = normalizeMultiplier(options.Multiplier);
|
|
45
57
|
let multiplierFractionDigits;
|
|
46
|
-
if (
|
|
47
|
-
n *=
|
|
48
|
-
multiplierFractionDigits = getFractionDigitsAfterMultiplier(preparedInput,
|
|
58
|
+
if (effectiveMultiplier !== undefined) {
|
|
59
|
+
n *= effectiveMultiplier;
|
|
60
|
+
multiplierFractionDigits = getFractionDigitsAfterMultiplier(preparedInput, effectiveMultiplier, options.FractionDigits);
|
|
49
61
|
n = parseFloat(n.toFixed(multiplierFractionDigits));
|
|
50
62
|
}
|
|
51
63
|
if (options.IntegerDigits > 20) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ColumnValuesSelectProps } from '../../FilterForm/ListBoxFilterForm';
|
|
3
|
+
import { InFilterValue } from '../../../../types';
|
|
3
4
|
/** Suggested page size passed to `customInFilterValues` as `context.limit`. */
|
|
4
5
|
export declare const IN_FILTER_VALUES_PAGE_SIZE = 1000;
|
|
5
6
|
export interface FloatingFilterValuesProps {
|
|
@@ -31,6 +32,10 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
31
32
|
skipDefaultSearch: boolean;
|
|
32
33
|
searchValueUsedInFilterValue: boolean;
|
|
33
34
|
hasMore: boolean;
|
|
35
|
+
renderInputValues?: (params: {
|
|
36
|
+
selectedValues: InFilterValue[];
|
|
37
|
+
selectedCount: number;
|
|
38
|
+
}) => string;
|
|
34
39
|
};
|
|
35
40
|
setQuickFilterValues: React.Dispatch<React.SetStateAction<{
|
|
36
41
|
values: {
|
|
@@ -41,6 +46,10 @@ export declare function useDistinctFilterColumnValues(options: {
|
|
|
41
46
|
skipDefaultSearch: boolean;
|
|
42
47
|
searchValueUsedInFilterValue: boolean;
|
|
43
48
|
hasMore: boolean;
|
|
49
|
+
renderInputValues?: (params: {
|
|
50
|
+
selectedValues: InFilterValue[];
|
|
51
|
+
selectedCount: number;
|
|
52
|
+
}) => string;
|
|
44
53
|
}>>;
|
|
45
54
|
triggerValuesLoad: (options?: {
|
|
46
55
|
usePrevious: boolean;
|
|
@@ -118,6 +118,7 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
118
118
|
skipDefaultSearch: !!result.skipDefaultSearch,
|
|
119
119
|
searchValueUsedInFilterValue: prev.searchValueUsedInFilterValue || searchValueUsedInFilterValue,
|
|
120
120
|
hasMore: !!result.hasMore,
|
|
121
|
+
renderInputValues: result.renderInputValues,
|
|
121
122
|
dataLoadIsComplete: true,
|
|
122
123
|
}));
|
|
123
124
|
})
|
|
@@ -171,6 +172,7 @@ export function useDistinctFilterColumnValues(options) {
|
|
|
171
172
|
skipDefaultSearch: !!distinctFilterDisplayValues.skipDefaultSearch,
|
|
172
173
|
searchValueUsedInFilterValue,
|
|
173
174
|
hasMore: !!distinctFilterDisplayValues.hasMore,
|
|
175
|
+
renderInputValues: distinctFilterDisplayValues.renderInputValues,
|
|
174
176
|
});
|
|
175
177
|
lastRequestedOffsetRef.current = 0;
|
|
176
178
|
setIsDistinctColumnValuesLoading(false);
|
|
@@ -335,7 +337,10 @@ export const FloatingFilterValues = (props) => {
|
|
|
335
337
|
triggerValuesLoad();
|
|
336
338
|
}
|
|
337
339
|
}, []);
|
|
338
|
-
const { skipDefaultSearch } = quickFilterValues;
|
|
340
|
+
const { skipDefaultSearch, renderInputValues } = quickFilterValues;
|
|
341
|
+
const renderComboboxInputValues = React.useMemo(() => renderInputValues
|
|
342
|
+
? (items) => renderInputValues({ selectedValues: items, selectedCount: items.length })
|
|
343
|
+
: undefined, [renderInputValues]);
|
|
339
344
|
if (props.columnId === AG_GRID_GROUPED_COLUMN) {
|
|
340
345
|
if (Array.isArray(props.value) && !props.value.every((value) => Array.isArray(value))) {
|
|
341
346
|
logOnce(`All the inputs for the IN predicate for the column "${props.columnId}" need to be arrays. Example:
|
|
@@ -358,11 +363,17 @@ export const FloatingFilterValues = (props) => {
|
|
|
358
363
|
...props.selectProps,
|
|
359
364
|
'data-name': 'Select Values',
|
|
360
365
|
showSelectedCount: true,
|
|
366
|
+
...(renderComboboxInputValues
|
|
367
|
+
? { renderInputValues: renderComboboxInputValues }
|
|
368
|
+
: {}),
|
|
361
369
|
filter: skipDefaultSearch ? null : undefined,
|
|
362
370
|
onInputValueChange: onInputChange,
|
|
363
371
|
}
|
|
364
372
|
: {
|
|
365
373
|
...props.selectProps,
|
|
374
|
+
...(renderComboboxInputValues
|
|
375
|
+
? { renderInputValues: renderComboboxInputValues }
|
|
376
|
+
: {}),
|
|
366
377
|
filter: skipDefaultSearch ? null : undefined,
|
|
367
378
|
onInputValueChange: onInputChange,
|
|
368
379
|
}, disabled: props.disabled, onMenuOpen: onMenuOpen, isLoading: isDistinctColumnValuesLoading, column: currentColumn, dataType: currentColumn.dataType, options: quickFilterValues.values, value: props.value, onChange: props.onChange }));
|
|
@@ -117,7 +117,7 @@ export const ColumnValuesSelect = (props) => {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
: undefined;
|
|
120
|
-
const component = column.dataType === 'date' || column.columnId === AG_GRID_GROUPED_COLUMN ? (_jsx(GridFilterTreeDropdown, { toDisplayValue: treeDropdownToDisplayValue, resizable: true, onValueChange: column.dataType === 'date'
|
|
120
|
+
const component = column.dataType === 'date' || column.columnId === AG_GRID_GROUPED_COLUMN ? (_jsx(GridFilterTreeDropdown, { toDisplayValue: treeDropdownToDisplayValue, renderInputValues: selectProps.renderInputValues, resizable: true, onValueChange: column.dataType === 'date'
|
|
121
121
|
? (value) => props.onChange(dateOnChangeParser(value))
|
|
122
122
|
: props.onChange, items: options, value: selectedColumnValues, "data-name": "Select Values", primaryKey: 'value', isLoading: props.isLoading, onOpenChange: onOpenChange, showClear: isEmbeddedColumnFilterLocation(location) })) : (_jsx(GridFilterCombobox, { disabled: props.disabled, ...selectProps, onOpenChange: onOpenChange, items: options, value: value, lookupItems: lookupItems, isLoading: props.isLoading, onValueChange: props.onChange, showClear: isEmbeddedColumnFilterLocation(location) }, "select"));
|
|
123
123
|
return (_jsx("div", { className: join(baseClassName, 'twa:relative', props.isLoading && `${baseClassName}--loading`, !value.length && `${baseClassName}--empty`), onKeyDownCapture: (e) => {
|
|
@@ -64,7 +64,10 @@ export const PredicateEditor = (props) => {
|
|
|
64
64
|
triggerValuesLoad();
|
|
65
65
|
}
|
|
66
66
|
}, []);
|
|
67
|
-
const { skipDefaultSearch } = quickFilterValues;
|
|
67
|
+
const { skipDefaultSearch, renderInputValues } = quickFilterValues;
|
|
68
|
+
const renderComboboxInputValues = React.useMemo(() => renderInputValues
|
|
69
|
+
? (items) => renderInputValues({ selectedValues: items, selectedCount: items.length })
|
|
70
|
+
: undefined, [renderInputValues]);
|
|
68
71
|
return (_jsxs(Box, { className: baseClassName, children: [_jsxs(Flex, { alignItems: "center", className: "twa:justify-stretch", children: [icon && _jsx(Tag, { className: "twa:mr-2", children: icon }), _jsx(SingleSelect, { items: predicateDefsOptions, "data-name": "select-predicate", placeholder: "Select Rule", value: props.predicate?.PredicateId ?? null, onValueChange: (value) => {
|
|
69
72
|
const option = predicateDefsOptions.find((x) => x.value === value);
|
|
70
73
|
props.onChange({
|
|
@@ -75,5 +78,8 @@ export const PredicateEditor = (props) => {
|
|
|
75
78
|
} })] }), _jsx(Flex, { children: currentPredicateDef?.inputs?.map((predicateDefInput, index) => (_jsxs(_Fragment, { children: [index > 0 && _jsx(HelpBlock, { className: "twa:m-2", children: "AND" }), _jsx(Flex, { className: "twa:flex-1", flexDirection: "column", children: _jsx(AdaptableInput, { "data-name": `predicate-input-${index}`, className: "twa:mt-2", type: predicateDefInput.type, autoFocus: index === 0, value: props.predicate.Inputs?.[index] ?? '', onChange: (e) => handlePredicateInputChange(e, index) }) }, index)] }))) }), adaptable.api.predicateApi.internalApi.IsInOrNotInPredicateDef(currentPredicateDef) && (_jsx(Box, { className: "twa:mt-2", children: _jsx(ColumnValuesSelect, { isLoading: isDistinctColumnValuesLoading, column: column, options: quickFilterValues.values, onMenuOpen: onMenuOpen, selectProps: {
|
|
76
79
|
onInputValueChange: onInputChange,
|
|
77
80
|
filter: skipDefaultSearch ? null : undefined,
|
|
81
|
+
...(renderComboboxInputValues
|
|
82
|
+
? { renderInputValues: renderComboboxInputValues }
|
|
83
|
+
: {}),
|
|
78
84
|
}, dataType: column.dataType, value: props.predicate.Inputs, onChange: handlePredicateValuesChange }) }))] }));
|
|
79
85
|
};
|
|
@@ -71,7 +71,7 @@ const appendNumberFormatOptions = (items, options) => {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
appendDisplayFormatItem(items, 'Content', options.Content);
|
|
74
|
-
if (options.Multiplier != null && options.Multiplier !== 1) {
|
|
74
|
+
if (options.Multiplier != null && options.Multiplier !== 0 && options.Multiplier !== 1) {
|
|
75
75
|
items.push({ label: 'Multiplier', value: String(options.Multiplier) });
|
|
76
76
|
}
|
|
77
77
|
appendDisplayFormatItem(items, 'Parentheses', options.Parentheses);
|
|
@@ -342,7 +342,11 @@ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatt
|
|
|
342
342
|
? clamp(Number(e.currentTarget.value), 0, 20)
|
|
343
343
|
: undefined) }) }), _jsx(FormRow, { label: "Integer Digits", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "integer-digits", type: "number", min: "0", value: resolved.Options.IntegerDigits, onChange: (e) => setFormatOption('IntegerDigits', StringExtensions.IsNumeric(e.currentTarget.value)
|
|
344
344
|
? clamp(Number(e.currentTarget.value), 0, 20)
|
|
345
|
-
: undefined) }) }), _jsx(FormRow, { label: "Fraction Separator", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "fraction-separator", value: resolved.Options.FractionSeparator ?? '', onChange: (e) => setFormatOption('FractionSeparator', e.currentTarget.value) }) }), _jsx(FormRow, { label: "Integer Separator", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "integer-separator", value: resolved.Options.IntegerSeparator ?? '', onChange: (e) => setFormatOption('IntegerSeparator', e.currentTarget.value) }) })] }), _jsxs(FormLayout, { sizes: NUMBER_FORMAT_VALUE_FORM_SIZES, columns: [NUMBER_FORMAT_LABEL_COLUMN, NUMBER_FORMAT_VALUE_CHILDREN_COLUMN], className: "twa:mr-5 twa:shrink-0", children: [_jsx(FormRow, { label: "Multiplier", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "multiplier", type: "number", value: resolved.Options.Multiplier
|
|
345
|
+
: undefined) }) }), _jsx(FormRow, { label: "Fraction Separator", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "fraction-separator", value: resolved.Options.FractionSeparator ?? '', onChange: (e) => setFormatOption('FractionSeparator', e.currentTarget.value) }) }), _jsx(FormRow, { label: "Integer Separator", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "integer-separator", value: resolved.Options.IntegerSeparator ?? '', onChange: (e) => setFormatOption('IntegerSeparator', e.currentTarget.value) }) })] }), _jsxs(FormLayout, { sizes: NUMBER_FORMAT_VALUE_FORM_SIZES, columns: [NUMBER_FORMAT_LABEL_COLUMN, NUMBER_FORMAT_VALUE_CHILDREN_COLUMN], className: "twa:mr-5 twa:shrink-0", children: [_jsx(FormRow, { label: "Multiplier", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "multiplier", type: "number", value: typeof resolved.Options.Multiplier === 'number'
|
|
346
|
+
? resolved.Options.Multiplier
|
|
347
|
+
: '', onChange: (e) => setFormatOption('Multiplier', StringExtensions.IsNumeric(e.currentTarget.value)
|
|
348
|
+
? Number(e.currentTarget.value)
|
|
349
|
+
: undefined) }) }), _jsx(FormRow, { label: "Prefix", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "prefix", value: resolved.Options.Prefix ?? '', onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) }) }), _jsx(FormRow, { label: "Suffix", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "suffix", value: resolved.Options.Suffix ?? '', onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) }) }), _jsx(FormRow, { label: "Zero Display", children: _jsx(Input, { className: NUMBER_FORMAT_INPUT_CLASS, "data-name": "zero-display", value: resolved.Options.ZeroDisplay === undefined ||
|
|
346
350
|
resolved.Options.ZeroDisplay === '0'
|
|
347
351
|
? '0'
|
|
348
352
|
: resolved.Options.ZeroDisplay, onChange: (e) => {
|
|
@@ -33,7 +33,18 @@ export type MultiComboboxProps<T extends ComboboxItemType> = Omit<AdaptableCombo
|
|
|
33
33
|
} & ComboboxDataProps<T>;
|
|
34
34
|
export declare const MultiCombobox: <T extends ComboboxItemType>(props: MultiComboboxProps<T>) => React.JSX.Element;
|
|
35
35
|
export type GridFilterComboboxProps<T extends ComboboxItemType> = Omit<MultiComboboxProps<T>, 'showSelectAllCheckbox' | 'searchable' | 'renderInput' | 'renderInputValues'> & {
|
|
36
|
+
/**
|
|
37
|
+
* When true, prefix the selected values in the collapsed input with the
|
|
38
|
+
* selected count (e.g. `(3)`). Ignored when `renderInputValues` is provided.
|
|
39
|
+
*/
|
|
36
40
|
showSelectedCount?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Custom content for the selected values in the collapsed input (rendered inside the
|
|
43
|
+
* standard wrapper). When provided, the built-in selected count is not rendered -
|
|
44
|
+
* include one in the returned content if needed.
|
|
45
|
+
* When omitted, selected labels are joined with a comma.
|
|
46
|
+
*/
|
|
47
|
+
renderInputValues?: (items: T[]) => React.ReactNode;
|
|
37
48
|
};
|
|
38
49
|
export declare const GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME: string;
|
|
39
50
|
export declare const GridFilterCombobox: <T extends ComboboxItemType>(props: GridFilterComboboxProps<T>) => React.JSX.Element;
|
|
@@ -567,7 +567,7 @@ export const MultiCombobox = (props) => {
|
|
|
567
567
|
};
|
|
568
568
|
export const GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME = cn('twa:[.ab-FloatingFilter_&]:border-none twa:[.ab-FloatingFilter_&]:inset-y-0.5 twa:[.ab-FloatingFilter_&]:inset-x-0 twa:[.ab-FloatingFilter_&]:absolute twa:[.ab-FloatingFilter_&]:shadow-none twa:[.ab-FloatingFilter_&]:min-h-auto!', 'twa:[.ab-FloatingFilter_&]:[line-height:1]', 'twa:[.ab-FloatingFilter_[data-slot=combobox-trigger]]:py-0', 'twa:[.ab-FloatingFilter_&]:[container-type:size]');
|
|
569
569
|
export const GridFilterCombobox = (props) => {
|
|
570
|
-
const { showSelectedCount = false, placeholder = 'Select...', ...comboboxProps } = props;
|
|
570
|
+
const { showSelectedCount = false, placeholder = 'Select...', renderInputValues: renderInputValuesProp, ...comboboxProps } = props;
|
|
571
571
|
const sharedProps = {
|
|
572
572
|
placeholder,
|
|
573
573
|
showSelectAllCheckbox: true,
|
|
@@ -579,11 +579,13 @@ export const GridFilterCombobox = (props) => {
|
|
|
579
579
|
showClear: false,
|
|
580
580
|
showTrigger: false,
|
|
581
581
|
renderInputValues: (items) => {
|
|
582
|
-
let children =
|
|
582
|
+
let children = renderInputValuesProp
|
|
583
|
+
? renderInputValuesProp(items)
|
|
584
|
+
: items.map((item) => getItemTextLabel(item)).join(', ');
|
|
583
585
|
if (items.length === 0) {
|
|
584
586
|
children = (_jsx("span", { "data-name": "placeholder", className: "twa:text-muted-foreground", children: placeholder }));
|
|
585
587
|
}
|
|
586
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: "twa:text-ellipsis twa:overflow-hidden twa:whitespace-nowrap twa:flex-1000", "data-slot": "combobox-selected-values", children: [showSelectedCount && items.length > 0 && (_jsxs("span", { "data-name": "multiple-values-count",
|
|
588
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "twa:text-ellipsis twa:overflow-hidden twa:whitespace-nowrap twa:flex-1000", "data-slot": "combobox-selected-values", children: [showSelectedCount && !renderInputValuesProp && items.length > 0 && (_jsxs(_Fragment, { children: [_jsxs("span", { "data-name": "multiple-values-count", children: ["(", items.length, ")"] }), ' '] })), children] }) }));
|
|
587
589
|
},
|
|
588
590
|
};
|
|
589
591
|
const className = cn(GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME, comboboxProps.className);
|
|
@@ -48,7 +48,18 @@ export type GridFilterTreeDropdownProps<T extends TreeListItem<any>> = Omit<NewT
|
|
|
48
48
|
/**
|
|
49
49
|
* When true, prefix the selected-values summary with `(N)` where N is the
|
|
50
50
|
* number of selected leaves. Mirrors `GridFilterCombobox.showSelectedCount`.
|
|
51
|
+
* Ignored when `renderInputValues` is provided.
|
|
51
52
|
*/
|
|
52
53
|
showSelectedCount?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Custom content for the selected values in the collapsed input (rendered inside the
|
|
56
|
+
* standard wrapper). Mirrors `GridFilterCombobox.renderInputValues`: called with one
|
|
57
|
+
* item per selected leaf (`value` is the full leaf path, `label` its display label).
|
|
58
|
+
* When provided, the built-in selected count is not rendered.
|
|
59
|
+
*/
|
|
60
|
+
renderInputValues?: (items: {
|
|
61
|
+
value: any;
|
|
62
|
+
label: string;
|
|
63
|
+
}[]) => React.ReactNode;
|
|
53
64
|
};
|
|
54
65
|
export declare function GridFilterTreeDropdown<T extends TreeListItem<any>>(props: GridFilterTreeDropdownProps<T>): React.JSX.Element;
|
|
@@ -399,17 +399,20 @@ export function TreeDropdown(props) {
|
|
|
399
399
|
return (_jsx(MultiCombobox, { ...comboboxProps }));
|
|
400
400
|
}
|
|
401
401
|
export function GridFilterTreeDropdown(props) {
|
|
402
|
-
const { showSelectedCount = false, placeholder = 'Select...', className, ...rest } = props;
|
|
402
|
+
const { showSelectedCount = false, placeholder = 'Select...', renderInputValues: renderInputValuesProp, className, ...rest } = props;
|
|
403
403
|
const renderSelectedValues = useCallback(({ selectedLeafPaths, getLabelForPath }) => {
|
|
404
404
|
let children;
|
|
405
405
|
if (selectedLeafPaths.length === 0) {
|
|
406
406
|
children = (_jsx("span", { "data-name": "placeholder", className: "twa:text-muted-foreground", children: placeholder }));
|
|
407
407
|
}
|
|
408
|
+
else if (renderInputValuesProp) {
|
|
409
|
+
children = renderInputValuesProp(selectedLeafPaths.map((path) => ({ value: path, label: getLabelForPath(path) })));
|
|
410
|
+
}
|
|
408
411
|
else {
|
|
409
412
|
children = selectedLeafPaths.map((path) => getLabelForPath(path)).join(', ');
|
|
410
413
|
}
|
|
411
|
-
return (_jsxs("div", { className: "twa:text-ellipsis twa:overflow-hidden twa:whitespace-nowrap twa:flex-1000", "data-slot": "combobox-selected-values", children: [showSelectedCount && selectedLeafPaths.length > 0 && (_jsxs("span", { "data-name": "multiple-values-count", className: "twa:mr-0.5", children: ["(", selectedLeafPaths.length, ")"] })), children] }));
|
|
412
|
-
}, [placeholder, showSelectedCount]);
|
|
414
|
+
return (_jsxs("div", { className: "twa:text-ellipsis twa:overflow-hidden twa:whitespace-nowrap twa:flex-1000", "data-slot": "combobox-selected-values", children: [showSelectedCount && !renderInputValuesProp && selectedLeafPaths.length > 0 && (_jsxs("span", { "data-name": "multiple-values-count", className: "twa:mr-0.5", children: ["(", selectedLeafPaths.length, ")"] })), children] }));
|
|
415
|
+
}, [placeholder, showSelectedCount, renderInputValuesProp]);
|
|
413
416
|
const mergedClassName = cn(GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME, className);
|
|
414
417
|
return (_jsx(TreeDropdown, { ...rest, placeholder: placeholder, className: mergedClassName, showClear: rest.showClear ?? false, resizable: rest.resizable ?? true, renderSelectedValues: renderSelectedValues }));
|
|
415
418
|
}
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "23.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1789246590646 || Date.now(),
|
|
4
|
+
VERSION: "23.0.22" || '--current-version--',
|
|
5
5
|
};
|