@adaptabletools/adaptable 15.2.0 → 15.2.2-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "15.2.0",
3
+ "version": "15.2.2-canary.0",
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",
@@ -1,2 +1,2 @@
1
- declare const _default: 1681725929316;
1
+ declare const _default: 1682420831244;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1681725929316;
3
+ exports.default = 1682420831244;
@@ -60,28 +60,25 @@ export interface ExportOptions {
60
60
  */
61
61
  isColumnExportable?: (exportableColumnContext: ExportableColumnContext) => boolean;
62
62
  /**
63
- * Function invoked when a Report is run, enabling you to preload the data before it is exported.
64
- * If the function returns a `ReportData` object, that will be used as the data for the Report;
65
- * if it returns `TRUE`, the Report will be run as normal, using the data from the grid;
66
- * if it returns `FALSE`, the Report will be cancelled.
63
+ * Function invoked when a Report is run, enabling users to preload the data before it is exported
67
64
  */
68
65
  preProcessExport?: (context: PreProcessExportContext) => boolean | Promise<ReportData | boolean>;
69
66
  }
70
67
  /**
71
- * Context provided to `ExportOptions.processExport()` callback
68
+ * Context provided to `ExportOptions.processExport()` callback used when pre-processing Export
72
69
  */
73
70
  export interface PreProcessExportContext extends BaseContext {
74
71
  /**
75
- * The report to be exported
72
+ * Report being exported
76
73
  */
77
74
  report: Report;
78
75
  /**
79
- * Returns the columns which would be included in the report based on the `Report.ReportColumnScope`
76
+ * Returns Columns to export based on Report's `ReportColumnScope`
80
77
  * @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
81
78
  */
82
79
  getReportColumns: (includePrimaryKey?: boolean) => AdaptableReportColumn[];
83
80
  /**
84
- * Returns the row data which would be included in the report based on the `Report.ReportRowScope`
81
+ * Returns row data which would typically be exported based on the Report's `ReportRowScope`
85
82
  * @param reportColumns - the columns to include in the report
86
83
  * @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
87
84
  */
@@ -182,8 +182,9 @@ export interface FilterOptions<TData = any> {
182
182
  */
183
183
  quickFilterWildcards?: Partial<Record<SystemAlertPredicateId, string[]>>;
184
184
  /**
185
- * Time to wait before applying the Filter after entering a value
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
  /**
@@ -194,9 +195,7 @@ export interface FilterOptions<TData = any> {
194
195
  */
195
196
  showValuesCount?: (column: AdaptableColumn<TData>) => boolean;
196
197
  /**
197
- * Quick filter width can be set in pixels or made to have the same size as the column.
198
- * - 'auto' will use the column width
199
- * - number will use the number of pixels
198
+ * Width of Values popup in Filter Bar - can be set width or same size as Column
200
199
  * @defaultValue '180'
201
200
  */
202
201
  quickFilterValuesWidth?: 'auto' | number;
@@ -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 that includes Adaptable Api object
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
  }
@@ -32,7 +32,7 @@ export interface SearchOptions<TData = any> {
32
32
  */
33
33
  filterResultsAfterQuickSearch?: boolean;
34
34
  /**
35
- * Include Row Groups when Quick Searching (highlight only)
35
+ * Include Aggregrated Columns in Grouped Rows when Quick Searching (highlight only)
36
36
  *
37
37
  * @defaultValue false
38
38
  * @gridInfoItem
@@ -8,6 +8,7 @@ const isArray_1 = tslib_1.__importDefault(require("lodash/isArray"));
8
8
  const extend_1 = tslib_1.__importDefault(require("lodash/extend"));
9
9
  const isObject_1 = tslib_1.__importDefault(require("lodash/isObject"));
10
10
  const isAdaptableObject_1 = require("../../Utilities/isAdaptableObject");
11
+ const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
11
12
  function customizer(objValue, srcValue) {
12
13
  if ((0, isArray_1.default)(objValue)) {
13
14
  if (!Array.isArray(srcValue)) {
@@ -86,7 +87,7 @@ function MergeStateFunction(oldState, newState) {
86
87
  let state = newState;
87
88
  if (!state || typeof state !== 'object') {
88
89
  // in case loadState returns something different than an empty object
89
- this.adaptable.logger.warn('State is something different that expected, expected object, received: ', state);
90
+ AdaptableLogger_1.AdaptableLogger.consoleWarnBase('State is something different that expected, expected object, received: ', state);
90
91
  state = {};
91
92
  }
92
93
  // any Module in config that doesn't exist in state will be added
@@ -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), (_a = this.props.api.optionsApi.getFilterOptions()) === null || _a === void 0 ? void 0 : _a.quickFilterDebounce);
28
- this.debouncedEditFilter = (0, debounce_1.default)((filter) => this.props.onEditColumnFilter(filter), (_b = this.props.api.optionsApi.getFilterOptions()) === null || _b === void 0 ? void 0 : _b.quickFilterDebounce);
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
- const { columnFilter } = this.props;
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(columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.Predicate.PredicateId);
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
- (columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.Predicate.PredicateId) && (React.createElement(SimpleButton_1.default, { p: 2, variant: "text", onClick: () => this.clearFilter() },
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": columnFilter.Predicate.PredicateId, disabled: this.isFilterDisabled(), key: p.id, p: 2, variant: "text", tone: (columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.Predicate.PredicateId) === p.id ? 'info' : 'none', onClick: () => this.selectColumnPredicate(p.id) },
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": columnFilter.Predicate.PredicateId, style: {
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(columnFilter, activePredicateDef),
74
- showQuickFilterInput && this.renderPredicateInput(activePredicateDef, columnFilter)));
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
- (_a = valuesDropdownRef.current) === null || _a === void 0 ? void 0 : _a.show();
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)',