@adaptabletools/adaptable 15.2.1 → 15.2.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/bundle.cjs.js +106 -106
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +2 -1
- package/src/AdaptableOptions/MasterDetailPluginOptions.d.ts +2 -2
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -1
- package/src/View/Components/FilterForm/QuickFilterForm.d.ts +2 -0
- package/src/View/Components/FilterForm/QuickFilterForm.js +22 -12
- package/src/View/Components/FilterForm/QuickFilterValues.js +7 -3
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.2",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1682423805441;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -182,8 +182,9 @@ export interface FilterOptions<TData = any> {
|
|
|
182
182
|
*/
|
|
183
183
|
quickFilterWildcards?: Partial<Record<SystemAlertPredicateId, string[]>>;
|
|
184
184
|
/**
|
|
185
|
-
* Time to wait
|
|
185
|
+
* Time to wait (in ms) before Filter Bar reacts to new value
|
|
186
186
|
* @defaultValue 250
|
|
187
|
+
* @gridInfoItem
|
|
187
188
|
*/
|
|
188
189
|
quickFilterDebounce?: number;
|
|
189
190
|
/**
|
|
@@ -8,12 +8,12 @@ export interface MasterDetailPluginOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
detailAdaptableOptions: AdaptableOptions;
|
|
10
10
|
/**
|
|
11
|
-
* Function called when Detail Grid is initialised receives context
|
|
11
|
+
* Function called when a Detail Grid is initialised, receives context including Adaptable Api
|
|
12
12
|
*/
|
|
13
13
|
onDetailInit?: (context: DetailInitContext) => void;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Context passed to Detail Grids when using Master Detail
|
|
16
|
+
* Context passed to Detail Grids when using Master Detail Plugin
|
|
17
17
|
*/
|
|
18
18
|
export interface DetailInitContext extends BaseContext {
|
|
19
19
|
}
|
|
@@ -191,6 +191,7 @@ exports.DefaultAdaptableOptions = {
|
|
|
191
191
|
clearFiltersOnStartUp: false,
|
|
192
192
|
quickFilterTrigger: 'mouseenter',
|
|
193
193
|
quickFilterValuesTrigger: 'mouseenter',
|
|
194
|
+
quickFilterDebounce: 250,
|
|
194
195
|
quickFilterHeight: null,
|
|
195
196
|
filterActionOnUserDataChange: {
|
|
196
197
|
applyFilter: GeneralConstants.FILTER_ALWAYS,
|
|
@@ -213,7 +214,6 @@ exports.DefaultAdaptableOptions = {
|
|
|
213
214
|
showClearFilterButton: false,
|
|
214
215
|
showSuspendFilterButton: false,
|
|
215
216
|
quickFilterWildcards: {},
|
|
216
|
-
quickFilterDebounce: 250,
|
|
217
217
|
showValuesCount: undefined,
|
|
218
218
|
quickFilterValuesWidth: 180,
|
|
219
219
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColumnFilterContext } from '../../../Utilities/Interface/ColumnFilterContext';
|
|
3
|
+
import { ColumnFilter } from '../../../types';
|
|
3
4
|
export interface QuickFilterFormState {
|
|
5
|
+
transientColumnFilter: ColumnFilter;
|
|
4
6
|
}
|
|
5
7
|
export declare const QuickFilterFormReact: (FilterContext: ColumnFilterContext) => JSX.Element;
|
|
@@ -20,13 +20,18 @@ const AdaptableIconComponent_1 = require("../../../components/AdaptableIconCompo
|
|
|
20
20
|
const QuickFilterValues_1 = require("./QuickFilterValues");
|
|
21
21
|
class QuickFilterFormComponent extends React.Component {
|
|
22
22
|
constructor(props) {
|
|
23
|
-
var _a, _b;
|
|
24
23
|
super(props);
|
|
25
24
|
this.shouldOpenValuesDropdown = false;
|
|
26
25
|
this._isMounted = false;
|
|
27
|
-
this.debouncedAddFilter = (0, debounce_1.default)((filter) => this.props.onAddColumnFilter(filter),
|
|
28
|
-
this.debouncedEditFilter = (0, debounce_1.default)((filter) => this.props.onEditColumnFilter(filter),
|
|
26
|
+
this.debouncedAddFilter = (0, debounce_1.default)((filter) => this.props.onAddColumnFilter(filter), this.props.quickFilterDebounce);
|
|
27
|
+
this.debouncedEditFilter = (0, debounce_1.default)((filter) => this.props.onEditColumnFilter(filter), this.props.quickFilterDebounce);
|
|
29
28
|
this._isMounted = true;
|
|
29
|
+
this.state = {
|
|
30
|
+
transientColumnFilter: props.columnFilter,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static getDerivedStateFromProps(props, state) {
|
|
34
|
+
return Object.assign(Object.assign({}, state), { transientColumnFilter: props.columnFilter });
|
|
30
35
|
}
|
|
31
36
|
componentWillUnmount() {
|
|
32
37
|
this._isMounted = false;
|
|
@@ -35,9 +40,12 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
35
40
|
return Boolean(this.props.columnFilter.IsSuspended);
|
|
36
41
|
}
|
|
37
42
|
render() {
|
|
38
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Transient column filter needs to be used for it to work with the debounced update.
|
|
45
|
+
*/
|
|
46
|
+
const { transientColumnFilter } = this.state;
|
|
39
47
|
const predicateDefs = this.props.api.filterApi.getFilterPredicateDefsForColumn(this.props.currentColumn);
|
|
40
|
-
const activePredicateDef = this.props.api.predicateApi.getPredicateDefById(
|
|
48
|
+
const activePredicateDef = this.props.api.predicateApi.getPredicateDefById(transientColumnFilter === null || transientColumnFilter === void 0 ? void 0 : transientColumnFilter.Predicate.PredicateId);
|
|
41
49
|
if (!this.props.currentColumn || !this.props.currentColumn.filterable) {
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
@@ -59,19 +67,20 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
59
67
|
}
|
|
60
68
|
return (React.createElement(React.Fragment, null,
|
|
61
69
|
showQuickFilterDropdown && (React.createElement(OverlayTrigger_1.default, { className: "ab-QuickFilter", showEvent: showEvent, hideEvent: hideEvent, preventPortalEventPropagation: showEvent === 'click', targetOffset: 10, hideDelay: 300, "data-name": "quick-filter-overlay", render: () => (React.createElement(rebass_1.Flex, { className: "ab-QuickFilter__dropdown", flexDirection: "column", "data-name": "quick-filter", fontSize: 2 },
|
|
62
|
-
(
|
|
70
|
+
(transientColumnFilter === null || transientColumnFilter === void 0 ? void 0 : transientColumnFilter.Predicate.PredicateId) && (React.createElement(SimpleButton_1.default, { p: 2, variant: "text", onClick: () => this.clearFilter() },
|
|
63
71
|
React.createElement("span", { style: { width: 20, marginRight: 10 } },
|
|
64
72
|
React.createElement(icons_1.Icon, { name: "delete" })),
|
|
65
73
|
"Clear")),
|
|
66
|
-
predicateDefs.map((p) => (React.createElement(SimpleButton_1.default, { "data-name":
|
|
74
|
+
predicateDefs.map((p) => (React.createElement(SimpleButton_1.default, { "data-name": transientColumnFilter.Predicate.PredicateId, disabled: this.isFilterDisabled(), key: p.id, p: 2, variant: "text", tone: (transientColumnFilter === null || transientColumnFilter === void 0 ? void 0 : transientColumnFilter.Predicate.PredicateId) === p.id ? 'info' : 'none', onClick: () => this.selectColumnPredicate(p.id) },
|
|
67
75
|
React.createElement("span", { style: { width: 20, marginRight: 10 } }, this.renderPredicateIcon(p)),
|
|
68
76
|
p.label))))) },
|
|
69
|
-
React.createElement(SimpleButton_1.default, { "data-name":
|
|
77
|
+
React.createElement(SimpleButton_1.default, { "data-name": transientColumnFilter.Predicate.PredicateId, style: {
|
|
70
78
|
borderRadius: 0,
|
|
71
79
|
borderColor: 'var(--ab-color-primarydark)',
|
|
72
80
|
} }, this.renderPredicateIcon(activePredicateDef)))),
|
|
73
|
-
showQuickFilterInput && this.renderLabel(
|
|
74
|
-
showQuickFilterInput &&
|
|
81
|
+
showQuickFilterInput && this.renderLabel(transientColumnFilter, activePredicateDef),
|
|
82
|
+
showQuickFilterInput &&
|
|
83
|
+
this.renderPredicateInput(activePredicateDef, transientColumnFilter)));
|
|
75
84
|
}
|
|
76
85
|
renderLabel(filter, activePredicateDef) {
|
|
77
86
|
if (this.hasValuesPredicate(filter === null || filter === void 0 ? void 0 : filter.Predicate)) {
|
|
@@ -163,6 +172,7 @@ class QuickFilterFormComponent extends React.Component {
|
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
updateFilter(filter) {
|
|
175
|
+
this.setState({ transientColumnFilter: filter });
|
|
166
176
|
if (filter.Uuid) {
|
|
167
177
|
this.debouncedEditFilter(filter);
|
|
168
178
|
}
|
|
@@ -228,7 +238,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
228
238
|
}
|
|
229
239
|
const QuickFilterForm = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(QuickFilterFormComponent);
|
|
230
240
|
const QuickFilterFormReact = (FilterContext) => {
|
|
231
|
-
var _a, _b;
|
|
232
|
-
return (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(QuickFilterForm, { api: FilterContext.Adaptable.api, quickFilterTrigger: (_a = FilterContext.Adaptable.adaptableOptions.filterOptions) === null || _a === void 0 ? void 0 : _a.quickFilterTrigger, quickFilterValuesTrigger: (_b = FilterContext.Adaptable.adaptableOptions.filterOptions) === null || _b === void 0 ? void 0 : _b.quickFilterValuesTrigger, currentColumn: FilterContext.Column, teamSharingActivated: false, embedColumnMenu: FilterContext.Adaptable.embedColumnMenu }), FilterContext.Adaptable);
|
|
241
|
+
var _a, _b, _c;
|
|
242
|
+
return (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(React.createElement(QuickFilterForm, { api: FilterContext.Adaptable.api, quickFilterTrigger: (_a = FilterContext.Adaptable.adaptableOptions.filterOptions) === null || _a === void 0 ? void 0 : _a.quickFilterTrigger, quickFilterValuesTrigger: (_b = FilterContext.Adaptable.adaptableOptions.filterOptions) === null || _b === void 0 ? void 0 : _b.quickFilterValuesTrigger, quickFilterDebounce: (_c = FilterContext.Adaptable.adaptableOptions.filterOptions) === null || _c === void 0 ? void 0 : _c.quickFilterDebounce, currentColumn: FilterContext.Column, teamSharingActivated: false, embedColumnMenu: FilterContext.Adaptable.embedColumnMenu }), FilterContext.Adaptable);
|
|
233
243
|
};
|
|
234
244
|
exports.QuickFilterFormReact = QuickFilterFormReact;
|
|
@@ -12,6 +12,7 @@ const rebass_1 = require("rebass");
|
|
|
12
12
|
const ListBoxFilterForm_1 = require("./ListBoxFilterForm");
|
|
13
13
|
const QuickFilterValues = (props) => {
|
|
14
14
|
const { api } = props;
|
|
15
|
+
const currentOverlayVisible = (0, react_1.useRef)(false);
|
|
15
16
|
const valuesDropdownRef = React.useRef(null);
|
|
16
17
|
const [quickFilterValues, setQuickFilterValues] = React.useState({ values: [], suppressClientSideFilter: false, dataLoadIsComplete: false });
|
|
17
18
|
const [isDistinctColumnValuesLoading, setIsDistinctColumnValuesLoading] = React.useState(false);
|
|
@@ -117,7 +118,6 @@ const QuickFilterValues = (props) => {
|
|
|
117
118
|
}
|
|
118
119
|
return null;
|
|
119
120
|
};
|
|
120
|
-
const currentOverlayVisible = (0, react_1.useRef)(false);
|
|
121
121
|
return (React.createElement(OverlayTrigger_1.default, { showEvent: showEvent,
|
|
122
122
|
// cannot hide on blur, because the form input receives the input when this is opened
|
|
123
123
|
hideEvent: "mouseleave", hideDelay: 300, ref: (api) => {
|
|
@@ -132,12 +132,16 @@ const QuickFilterValues = (props) => {
|
|
|
132
132
|
}, render: ({ targetWidth }) => {
|
|
133
133
|
var _a;
|
|
134
134
|
return (React.createElement(rebass_1.Flex, { onMouseEnter: () => {
|
|
135
|
-
var _a;
|
|
136
135
|
if (showEvent === 'click') {
|
|
137
136
|
// For showEvent=mousenter this is not needed.
|
|
138
137
|
// When mouseenter is triggered on the overlay, onShowFn is called, the overlay is no longer hidden.
|
|
139
138
|
// But in this case because the trigger is click, another show is not triggered.
|
|
140
|
-
|
|
139
|
+
// The hide event is added direcly on the element so it does not use the React event system.
|
|
140
|
+
// But this event does, maybe beause it uses event delegation it is triggered to soon.
|
|
141
|
+
requestAnimationFrame(() => {
|
|
142
|
+
var _a;
|
|
143
|
+
(_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
|
|
144
|
+
});
|
|
141
145
|
}
|
|
142
146
|
}, "data-name": "quick-filter-form", flexDirection: "column", style: {
|
|
143
147
|
fontSize: 'var(--ab-font-size-2)',
|