@adaptabletools/adaptable-cjs 21.0.11 → 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.
Files changed (63) hide show
  1. package/base.css +1811 -2336
  2. package/base.css.map +1 -1
  3. package/index.css +1768 -1413
  4. package/index.css.map +1 -1
  5. package/package.json +3 -3
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  7. package/src/AdaptableOptions/FilterOptions.d.ts +7 -0
  8. package/src/AdaptableOptions/PredicateOptions.d.ts +4 -3
  9. package/src/AdaptableState/Common/AdaptableColumn.d.ts +1 -1
  10. package/src/AdaptableState/Common/AdaptablePredicate.d.ts +12 -0
  11. package/src/AdaptableState/Common/AdaptablePredicate.js +132 -18
  12. package/src/AdaptableState/Selection/GridCell.d.ts +10 -0
  13. package/src/Api/Implementation/ExportApiImpl.js +1 -7
  14. package/src/Api/Implementation/PredicateApiImpl.d.ts +3 -1
  15. package/src/Api/Implementation/PredicateApiImpl.js +27 -3
  16. package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -1
  17. package/src/Api/Internal/AdaptableInternalApi.js +6 -0
  18. package/src/Api/Internal/PredicateInternalApi.d.ts +3 -1
  19. package/src/Api/Internal/PredicateInternalApi.js +14 -0
  20. package/src/Api/PredicateApi.d.ts +1 -1
  21. package/src/Redux/Store/AdaptableStore.js +111 -3
  22. package/src/Utilities/Helpers/Helper.js +26 -2
  23. package/src/Utilities/Hooks/index.d.ts +4 -0
  24. package/src/Utilities/Hooks/index.js +9 -0
  25. package/src/Utilities/Hooks/useAdaptableColumn.d.ts +2 -0
  26. package/src/Utilities/Hooks/useAdaptableColumn.js +10 -0
  27. package/src/Utilities/Hooks/useAdaptableOptions.d.ts +2 -0
  28. package/src/Utilities/Hooks/useAdaptableOptions.js +9 -0
  29. package/src/Utilities/Hooks/useAdaptableState.d.ts +3 -0
  30. package/src/Utilities/Hooks/useAdaptableState.js +43 -0
  31. package/src/Utilities/adaptableQlUtils.js +3 -0
  32. package/src/View/AdaptableComputedCSSVarsContext.d.ts +12 -0
  33. package/src/View/AdaptableComputedCSSVarsContext.js +32 -0
  34. package/src/View/Components/AdaptableInput/AdaptableDateInlineInput.d.ts +1 -1
  35. package/src/View/Components/ColumnFilter/FloatingFilter.js +5 -1
  36. package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +1 -1
  37. package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +34 -9
  38. package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +1 -0
  39. package/src/View/Components/FilterForm/ListBoxFilterForm.js +93 -16
  40. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  41. package/src/View/renderWithAdaptableContext.js +3 -1
  42. package/src/agGrid/AdaptableAgGrid.d.ts +3 -1
  43. package/src/agGrid/AdaptableAgGrid.js +360 -23
  44. package/src/agGrid/AdaptableFilterHandler.d.ts +3 -1
  45. package/src/agGrid/AdaptableFilterHandler.js +16 -12
  46. package/src/agGrid/AgGridAdapter.js +12 -6
  47. package/src/agGrid/AgGridColumnAdapter.js +19 -13
  48. package/src/components/OverlayTrigger/index.js +1 -1
  49. package/src/components/Select/Select.js +21 -21
  50. package/src/components/Tree/TreeDropdown/index.d.ts +27 -0
  51. package/src/components/Tree/TreeDropdown/index.js +256 -0
  52. package/src/components/Tree/TreeList/index.d.ts +25 -0
  53. package/src/components/Tree/TreeList/index.js +40 -0
  54. package/src/devTools/DevToolsTracks.d.ts +31 -0
  55. package/src/devTools/DevToolsTracks.js +34 -0
  56. package/src/devTools/PerfMarker.d.ts +12 -0
  57. package/src/devTools/PerfMarker.js +2 -0
  58. package/src/devTools/index.d.ts +102 -0
  59. package/src/devTools/index.js +165 -0
  60. package/src/env.js +2 -2
  61. package/src/layout-manager/src/index.d.ts +2 -0
  62. package/src/layout-manager/src/index.js +24 -0
  63. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -18,6 +18,26 @@ const date_fns_13 = require("date-fns");
18
18
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
19
19
  const DateHelper_1 = require("../../Utilities/Helpers/DateHelper");
20
20
  const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
21
+ const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
22
+ function getGroupValuesForNode(config) {
23
+ const { node, value } = config;
24
+ const groupValues = node.group
25
+ ? []
26
+ : /*for the leaf node, also use its value*/ value != null
27
+ ? [value]
28
+ : [];
29
+ let currentNode = node.group ? node : node.parent;
30
+ while (currentNode && currentNode.groupData) {
31
+ if (currentNode.treeParent && !currentNode.data) {
32
+ // skip filler groups in tree mode
33
+ }
34
+ else {
35
+ groupValues.unshift(currentNode.groupData[GeneralConstants_1.AG_GRID_GROUPED_COLUMN]);
36
+ }
37
+ currentNode = currentNode.parent;
38
+ }
39
+ return groupValues;
40
+ }
21
41
  /**
22
42
  * Array of Predicate Defs which are shipped by AdapTable
23
43
  */
@@ -26,7 +46,10 @@ exports.SystemPredicateDefs = [
26
46
  id: 'In',
27
47
  label: 'In',
28
48
  icon: { text: 'IN' },
29
- columnScope: { DataTypes: ['text', 'number', 'date', 'textArray', 'numberArray'] },
49
+ columnScope: {
50
+ DataTypes: ['text', 'number', 'date', 'textArray', 'numberArray'],
51
+ ColumnIds: [GeneralConstants_1.AG_GRID_GROUPED_COLUMN],
52
+ },
30
53
  moduleScope: ['columnFilter', 'flashingcell', 'formatColumn', 'alert', 'badgeStyle'],
31
54
  handler: (context) => {
32
55
  const { inputs = [], column, value, adaptableApi } = context;
@@ -63,9 +86,26 @@ exports.SystemPredicateDefs = [
63
86
  if (inputs.length === 0) {
64
87
  return true;
65
88
  }
89
+ if (column.columnId === GeneralConstants_1.AG_GRID_GROUPED_COLUMN) {
90
+ const { node, treeSelectionState } = context;
91
+ const groupValues = getGroupValuesForNode({ node, value });
92
+ if (!treeSelectionState) {
93
+ // in case we don't have treeSelectionState
94
+ // this is another possible implementation
95
+ // though it won't be as performant as using the treeSelectionState
96
+ const currentValues = (groupValues ?? []).join('#');
97
+ return inputs.some((values) => {
98
+ const valuesString = values.join('#');
99
+ return currentValues.startsWith(valuesString);
100
+ });
101
+ }
102
+ const result = groupValues ? treeSelectionState.isNodeSelected(groupValues) : false;
103
+ // console.log('filter', groupValues, 'pass', result, treeSelectionState.getState());
104
+ return result;
105
+ }
66
106
  if (column.dataType === 'date') {
67
107
  return inputs.some((input) => {
68
- if (adaptableApi.optionsApi.getPredicateOptions().evaluateInPredicateUsingTime) {
108
+ if (adaptableApi.predicateApi.internalApi.shouldEvaluateInPredicateUsingTime(column.columnId)) {
69
109
  return (0, date_fns_3.isEqual)(input, value);
70
110
  }
71
111
  else {
@@ -82,7 +122,7 @@ exports.SystemPredicateDefs = [
82
122
  return arrayValue.includes(input);
83
123
  });
84
124
  }
85
- const useCaseSensitivity = adaptableApi.predicateApi.useCaseSensitivity();
125
+ const useCaseSensitivity = adaptableApi.predicateApi.useCaseSensitivity(column.columnId);
86
126
  if (column.dataType === 'text') {
87
127
  return useCaseSensitivity
88
128
  ? inputs
@@ -105,6 +145,80 @@ exports.SystemPredicateDefs = [
105
145
  toString: ({ inputs }) => `IN (${inputs.join(', ')})`,
106
146
  shortcuts: ['#', '['],
107
147
  },
148
+ // {
149
+ // id: 'Tree',
150
+ // label: 'Tree',
151
+ // icon: { text: 'Tree' },
152
+ // columnScope: { DataTypes: ['date'] },
153
+ // moduleScope: ['columnFilter', 'flashingcell', 'formatColumn', 'alert'],
154
+ // handler: (context) => {
155
+ // const { inputs = [], column, value, adaptableApi } = context;
156
+ // const predicateInputs = (context.inputs || []).reduce<AdaptablePredicateDef[]>(
157
+ // (acc, input) => {
158
+ // const predicate = adaptableApi.predicateApi.getPredicateDefById(input);
159
+ // if (predicate) {
160
+ // acc.push(predicate);
161
+ // }
162
+ // return acc;
163
+ // },
164
+ // []
165
+ // );
166
+ // if (predicateInputs.length) {
167
+ // const nestedContext = { ...context };
168
+ // delete nestedContext.inputs;
169
+ // const predicateResult = predicateInputs.some((predicate) => {
170
+ // return adaptableApi.predicateApi.handlePredicate(
171
+ // {
172
+ // PredicateId: predicate.id,
173
+ // },
174
+ // nestedContext,
175
+ // false
176
+ // );
177
+ // });
178
+ // if (predicateResult) {
179
+ // // We want to use the only true values, to allow for multiple predicates to be used
180
+ // return predicateResult;
181
+ // }
182
+ // }
183
+ // if (inputs.length === 0) {
184
+ // return true;
185
+ // }
186
+ // if (column.dataType === 'date') {
187
+ // const treeSelectionState = new TreeSelectionState(
188
+ // {
189
+ // defaultSelection: false,
190
+ // // make sure something like
191
+ // // Predicates: [{ PredicateId: 'Tree', Inputs: [['2021', '2'], ['2022']] }],
192
+ // // is always converted to numbers
193
+ // selectedPaths: inputs
194
+ // .map((array) => {
195
+ // if (!Array.isArray(array)) {
196
+ // return null;
197
+ // }
198
+ // return array.map(Number);
199
+ // })
200
+ // .filter(Boolean),
201
+ // },
202
+ // () => {
203
+ // return {
204
+ // treeDeepMap: new DeepMap<string, any>(),
205
+ // treePaths: new DeepMap<string, any>(),
206
+ // };
207
+ // }
208
+ // );
209
+ // const currrentDate = parseDateValue(value);
210
+ // const currentYear = currrentDate.getFullYear();
211
+ // const currentMonth = currrentDate.getMonth() + 1;
212
+ // const currentDay = currrentDate.getDate();
213
+ // const result = treeSelectionState.isNodeSelected([currentYear, currentMonth, currentDay]);
214
+ // // console.log({ currentYear, currentMonth, currentDay, result, inputs: inputs.join('-') });
215
+ // return result;
216
+ // }
217
+ // return true;
218
+ // },
219
+ // toString: ({ inputs }) => `IN Tree (${inputs.join(', ')})`,
220
+ // shortcuts: ['#', '['],
221
+ // },
108
222
  {
109
223
  id: 'NotIn',
110
224
  label: 'Not In',
@@ -149,7 +263,7 @@ exports.SystemPredicateDefs = [
149
263
  return true;
150
264
  }
151
265
  if (column.dataType === 'date') {
152
- if (adaptableApi.optionsApi.getPredicateOptions().evaluateInPredicateUsingTime) {
266
+ if (adaptableApi.predicateApi.useCaseSensitivity(column.columnId)) {
153
267
  return inputs.every((input) => {
154
268
  return !(0, date_fns_3.isEqual)(input, value);
155
269
  });
@@ -170,7 +284,7 @@ exports.SystemPredicateDefs = [
170
284
  });
171
285
  }
172
286
  if (column.dataType === 'text') {
173
- return adaptableApi.predicateApi.useCaseSensitivity()
287
+ return adaptableApi.predicateApi.useCaseSensitivity(column.columnId)
174
288
  ? !inputs
175
289
  .map((i) => {
176
290
  return i?.toLocaleLowerCase();
@@ -181,7 +295,7 @@ exports.SystemPredicateDefs = [
181
295
  if (column.dataType === 'textArray') {
182
296
  const arrayValue = Array.isArray(value) ? value : [value];
183
297
  return inputs.every((input) => {
184
- return adaptableApi.predicateApi.useCaseSensitivity()
298
+ return adaptableApi.predicateApi.useCaseSensitivity(column.columnId)
185
299
  ? !arrayValue.map((v) => v?.toLocaleLowerCase()).includes(input?.toLocaleLowerCase())
186
300
  : !arrayValue.includes(input);
187
301
  });
@@ -337,11 +451,11 @@ exports.SystemPredicateDefs = [
337
451
  columnScope: { DataTypes: ['text'] },
338
452
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
339
453
  inputs: [{ type: 'text' }],
340
- handler: ({ value, inputs, adaptableApi }) => {
454
+ handler: ({ value, inputs, adaptableApi, column }) => {
341
455
  if (!value) {
342
456
  return false;
343
457
  }
344
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
458
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
345
459
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
346
460
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
347
461
  return v == i;
@@ -356,11 +470,11 @@ exports.SystemPredicateDefs = [
356
470
  columnScope: { DataTypes: ['text'] },
357
471
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
358
472
  inputs: [{ type: 'text' }],
359
- handler: ({ value, inputs, adaptableApi }) => {
473
+ handler: ({ value, inputs, adaptableApi, column }) => {
360
474
  if (!value) {
361
475
  return true;
362
476
  }
363
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
477
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
364
478
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
365
479
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
366
480
  return v != i;
@@ -375,11 +489,11 @@ exports.SystemPredicateDefs = [
375
489
  columnScope: { DataTypes: ['text'] },
376
490
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
377
491
  inputs: [{ type: 'text' }],
378
- handler: ({ value, inputs, adaptableApi }) => {
492
+ handler: ({ value, inputs, adaptableApi, column }) => {
379
493
  if (!value) {
380
494
  return false;
381
495
  }
382
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
496
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
383
497
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
384
498
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
385
499
  return v.indexOf(i) !== -1;
@@ -393,11 +507,11 @@ exports.SystemPredicateDefs = [
393
507
  columnScope: { DataTypes: ['text'] },
394
508
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
395
509
  inputs: [{ type: 'text' }],
396
- handler: ({ value, inputs, adaptableApi }) => {
510
+ handler: ({ value, inputs, adaptableApi, column }) => {
397
511
  if (!value) {
398
512
  return true;
399
513
  }
400
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
514
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
401
515
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
402
516
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
403
517
  return v.indexOf(i) === -1;
@@ -411,11 +525,11 @@ exports.SystemPredicateDefs = [
411
525
  columnScope: { DataTypes: ['text'] },
412
526
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
413
527
  inputs: [{ type: 'text' }],
414
- handler: ({ value, inputs, adaptableApi }) => {
528
+ handler: ({ value, inputs, adaptableApi, column }) => {
415
529
  if (!value) {
416
530
  return false;
417
531
  }
418
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
532
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
419
533
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
420
534
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
421
535
  return v.startsWith(i);
@@ -429,11 +543,11 @@ exports.SystemPredicateDefs = [
429
543
  columnScope: { DataTypes: ['text'] },
430
544
  moduleScope: ['columnFilter', 'alert', 'flashingcell', 'formatColumn', 'badgeStyle'],
431
545
  inputs: [{ type: 'text' }],
432
- handler: ({ value, inputs, adaptableApi }) => {
546
+ handler: ({ value, inputs, adaptableApi, column }) => {
433
547
  if (!value) {
434
548
  return false;
435
549
  }
436
- const ignoreCase = !adaptableApi.predicateApi.useCaseSensitivity();
550
+ const ignoreCase = !adaptableApi.predicateApi.internalApi.shouldUseCaseSensitivePredicates(column);
437
551
  const v = ignoreCase ? String(value).toLocaleLowerCase() : String(value);
438
552
  const i = ignoreCase ? String(inputs[0]).toLocaleLowerCase() : String(inputs[0]);
439
553
  return v.endsWith(i);
@@ -64,6 +64,16 @@ export interface GridCellWithCount extends GridCell {
64
64
  */
65
65
  visibleCount?: number;
66
66
  }
67
+ export interface GridCellWithChildren extends GridCell {
68
+ /**
69
+ * Children of Cell
70
+ */
71
+ children?: GridCellWithChildren[];
72
+ /**
73
+ * For the grouping scenario, how many leafs are there under this item
74
+ */
75
+ leafChildrenCount?: number;
76
+ }
67
77
  export interface UniqueGridCell<TData = any> {
68
78
  /**
69
79
  * Raw value of Cell
@@ -89,13 +89,7 @@ class ExportApiImpl extends ApiBase_1.ApiBase {
89
89
  currentReportFormat: this.getExportApi().getCurrentReportFormat(),
90
90
  })
91
91
  : systemExportDestinationsOption;
92
- return systemExportDestinations.filter((destination) => {
93
- // VisualExcel format can't be exported to custom destinations
94
- if (this.getExportApi().getCurrentReportFormat() === GeneralConstants_1.VISUAL_EXCEL_FORMAT_REPORT) {
95
- return false;
96
- }
97
- return true;
98
- });
92
+ return systemExportDestinations;
99
93
  }
100
94
  getAvailableCustomDestinations() {
101
95
  const customDestinationsOption = this.getExportOptions().customDestinations;
@@ -3,6 +3,8 @@ import { PredicateApi } from '../PredicateApi';
3
3
  import { AdaptableColumnPredicate, AdaptablePredicate, AdaptablePredicateDef, PredicateDefHandlerContext, PredicateModuleScope } from '../../types';
4
4
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
5
5
  import { PredicateInternalApi } from '../Internal/PredicateInternalApi';
6
+ import { TreeSelectionState } from '@infinite-table/infinite-react';
7
+ export declare const getTreeSelectionStateForPredicateInputs: (inputs: any[], cache?: WeakMap<any[], TreeSelectionState>) => TreeSelectionState<any>;
6
8
  export declare class PredicateApiImpl extends ApiBase implements PredicateApi {
7
9
  internalApi: PredicateInternalApi;
8
10
  constructor(_adaptable: IAdaptable);
@@ -22,5 +24,5 @@ export declare class PredicateApiImpl extends ApiBase implements PredicateApi {
22
24
  handleColumnPredicates(predicates: AdaptableColumnPredicate[], context: Omit<PredicateDefHandlerContext, 'adaptableApi' | 'inputs'>, defaultReturn: boolean): boolean;
23
25
  handlePredicate(predicate: AdaptablePredicate | undefined, context: Omit<PredicateDefHandlerContext, 'adaptableApi' | 'inputs'>, defaultReturn: boolean): boolean;
24
26
  handlePredicates(predicates: AdaptablePredicate[], params: Omit<PredicateDefHandlerContext, 'adaptableApi' | 'inputs'>, defaultReturn: boolean): boolean;
25
- useCaseSensitivity(): boolean;
27
+ useCaseSensitivity(columnId: string): boolean;
26
28
  }
@@ -1,12 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PredicateApiImpl = void 0;
3
+ exports.PredicateApiImpl = exports.getTreeSelectionStateForPredicateInputs = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
7
7
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
8
8
  const PredicateInternalApi_1 = require("../Internal/PredicateInternalApi");
9
9
  const AdaptablePredicate_1 = require("../../AdaptableState/Common/AdaptablePredicate");
10
+ const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
11
+ const infinite_react_1 = require("@infinite-table/infinite-react");
12
+ const treeSelectionStatesForPredicates = new WeakMap();
13
+ const getTreeSelectionStateForPredicateInputs = (inputs, cache = treeSelectionStatesForPredicates) => {
14
+ const treeSelectionState = cache.get(inputs);
15
+ if (treeSelectionState) {
16
+ return treeSelectionState;
17
+ }
18
+ const newTreeSelectionState = new infinite_react_1.TreeSelectionState({
19
+ defaultSelection: false,
20
+ selectedPaths: inputs,
21
+ }, {
22
+ treePaths: inputs,
23
+ strictCheckPaths: false,
24
+ });
25
+ cache.set(inputs, newTreeSelectionState);
26
+ return newTreeSelectionState;
27
+ };
28
+ exports.getTreeSelectionStateForPredicateInputs = getTreeSelectionStateForPredicateInputs;
10
29
  class PredicateApiImpl extends ApiBase_1.ApiBase {
11
30
  constructor(_adaptable) {
12
31
  super(_adaptable);
@@ -129,10 +148,15 @@ class PredicateApiImpl extends ApiBase_1.ApiBase {
129
148
  if (predicateDef.inputs?.some((_, i) => predicate.Inputs?.[i] === undefined || predicate.Inputs?.[i] === '')) {
130
149
  return defaultReturn;
131
150
  }
151
+ let treeSelectionState;
152
+ if (context.column.columnId === GeneralConstants_1.AG_GRID_GROUPED_COLUMN && predicate.PredicateId === 'In') {
153
+ treeSelectionState = (0, exports.getTreeSelectionStateForPredicateInputs)(predicate.Inputs);
154
+ }
132
155
  try {
133
156
  return predicateDef.handler({
134
157
  adaptableApi: this.getAdaptableApi(),
135
158
  inputs: predicate.Inputs,
159
+ treeSelectionState,
136
160
  ...context,
137
161
  });
138
162
  }
@@ -150,8 +174,8 @@ class PredicateApiImpl extends ApiBase_1.ApiBase {
150
174
  }
151
175
  return predicates?.every((p) => this.handlePredicate(p, params, defaultReturn));
152
176
  }
153
- useCaseSensitivity() {
154
- return this.getPredicateOptions().caseSensitivePredicates;
177
+ useCaseSensitivity(columnId) {
178
+ return this.internalApi.shouldUseCaseSensitivePredicates(columnId);
155
179
  }
156
180
  }
157
181
  exports.PredicateApiImpl = PredicateApiImpl;
@@ -23,7 +23,7 @@ import { AdaptableFrameworkComponent } from '../../agGrid/AdaptableFrameworkComp
23
23
  import { IMetamodelService } from '../../Utilities/Services/Interface/IMetamodelService';
24
24
  import { IModuleCollection } from '../../Strategy/Interface/IModule';
25
25
  import { AdaptableObjectTag, AdaptableObjectWithScope } from '../../AdaptableState/Common/AdaptableObject';
26
- import { AdaptableForm, CellSummmaryInfo, FormContext, RowDataChangeTrigger, RowDataChangedInfo } from '../../../types';
26
+ import { AdaptableForm, CellSummmaryInfo, FormContext, RowDataChangeTrigger, RowDataChangedInfo, AdaptableColumn, AdaptableColumnContext } from '../../../types';
27
27
  import { Fdc3Service } from '../../Utilities/Services/Fdc3Service';
28
28
  import { AnnotationsService } from '../../Utilities/Services/AnnotationsService';
29
29
  import { RowFormService } from '../../Utilities/Services/RowFormService';
@@ -122,6 +122,7 @@ export declare class AdaptableInternalApi extends ApiBase {
122
122
  setValueUsingField(rowData: Record<string, any>, fieldName: string, newValue: any): Record<string, any>;
123
123
  findAdaptableObjectsByLookupCriteria<T extends AdaptableObjectWithScope>({ scope, tag, ids }: AdaptableObjectLookupCriteria, specificAdaptableObjects: T[]): T[];
124
124
  buildBaseContext(): BaseContext;
125
+ buildAdaptableColumnContext(column: AdaptableColumn<any> | string): AdaptableColumnContext;
125
126
  setCellSummaryInfo(cellSummaryInfo: CellSummmaryInfo): void;
126
127
  parseDateValue(dateValue: string | Date | number): Date | undefined;
127
128
  }
@@ -441,6 +441,12 @@ class AdaptableInternalApi extends ApiBase_1.ApiBase {
441
441
  clientTimestamp: new Date(),
442
442
  };
443
443
  }
444
+ buildAdaptableColumnContext(column) {
445
+ return {
446
+ ...this.buildBaseContext(),
447
+ column: typeof column === 'string' ? this.getColumnApi().getColumnWithColumnId(column) : column,
448
+ };
449
+ }
444
450
  setCellSummaryInfo(cellSummaryInfo) {
445
451
  this.dispatchAction(InternalRedux.SetCellSummaryInfo(cellSummaryInfo));
446
452
  }
@@ -1,7 +1,7 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { AdaptablePredicate, AdaptablePredicateDef } from '../../AdaptableState/Common/AdaptablePredicate';
3
3
  import { SystemFilterPredicateId } from '../../AdaptableState/Common/ColumnFilter';
4
- import { AdaptableColumnDataType } from '../../AdaptableState/Common/AdaptableColumn';
4
+ import { AdaptableColumn, AdaptableColumnDataType } from '../../AdaptableState/Common/AdaptableColumn';
5
5
  import { ColumnScope } from '../../types';
6
6
  export declare class PredicateInternalApi extends ApiBase {
7
7
  IsInOrNotInPredicate(predicate: AdaptablePredicate): boolean;
@@ -10,6 +10,8 @@ export declare class PredicateInternalApi extends ApiBase {
10
10
  * Get all Filter Predicate Definitions - System and Custom
11
11
  */
12
12
  getFilterPredicateDefs(scope: ColumnScope): AdaptablePredicateDef[];
13
+ shouldUseCaseSensitivePredicates(column: string | AdaptableColumn): boolean;
14
+ shouldEvaluateInPredicateUsingTime(column: string | AdaptableColumn): boolean;
13
15
  private getSystemFilterPredicateIds;
14
16
  /**
15
17
  * Get all Alert Predicate Definitions - System and Custom
@@ -15,6 +15,20 @@ class PredicateInternalApi extends ApiBase_1.ApiBase {
15
15
  getFilterPredicateDefs(scope) {
16
16
  return this.mergeSystemAndCustomPredicates(this.getSystemFilterPredicateIds(scope)?.map((predicateId) => this.getPredicateApi().getPredicateDefById(predicateId)), this.getPredicateApi().getCustomPredicateDefs()).filter((predicateDef) => predicateDef.moduleScope.includes('columnFilter'));
17
17
  }
18
+ shouldUseCaseSensitivePredicates(column) {
19
+ const caseSensitivePredicates = this.getPredicateOptions().caseSensitivePredicates;
20
+ if (typeof caseSensitivePredicates === 'function') {
21
+ return caseSensitivePredicates(this.getAdaptableInternalApi().buildAdaptableColumnContext(column));
22
+ }
23
+ return caseSensitivePredicates;
24
+ }
25
+ shouldEvaluateInPredicateUsingTime(column) {
26
+ const evaluateInPredicateUsingTime = this.getPredicateOptions().evaluateInPredicateUsingTime;
27
+ if (typeof evaluateInPredicateUsingTime === 'function') {
28
+ return evaluateInPredicateUsingTime(this.getAdaptableInternalApi().buildAdaptableColumnContext(column));
29
+ }
30
+ return evaluateInPredicateUsingTime;
31
+ }
18
32
  getSystemFilterPredicateIds(scope) {
19
33
  const systemFilterPredicates = this.getPredicateOptions().systemFilterPredicates;
20
34
  if (typeof systemFilterPredicates === 'function') {
@@ -95,5 +95,5 @@ export interface PredicateApi {
95
95
  /**
96
96
  * Whether Predicates are evaluated using Case Sensitivity
97
97
  */
98
- useCaseSensitivity(): boolean;
98
+ useCaseSensitivity(columnId: string): boolean;
99
99
  }
@@ -42,6 +42,7 @@ const InternalRedux = tslib_1.__importStar(require("../ActionsReducers/InternalR
42
42
  const TeamSharingRedux = tslib_1.__importStar(require("../ActionsReducers/TeamSharingRedux"));
43
43
  const ThemeRedux = tslib_1.__importStar(require("../ActionsReducers/ThemeRedux"));
44
44
  const ToolPanelRedux = tslib_1.__importStar(require("../ActionsReducers/ToolPanelRedux"));
45
+ const devTools_1 = require("../../devTools");
45
46
  const TeamSharingState_1 = require("../../AdaptableState/TeamSharingState");
46
47
  const buildAdaptableStateFunctionConfig_1 = require("./buildAdaptableStateFunctionConfig");
47
48
  const INIT_STATE = 'INIT_STATE';
@@ -233,17 +234,21 @@ class AdaptableStore {
233
234
  }
234
235
  return finalState;
235
236
  };
237
+ const devToolsActionMarkerMiddleware = createDevToolsActionMarkerMiddleware(adaptable);
236
238
  const pluginsMiddleware = [];
237
239
  adaptable.forPlugins((plugin) => {
238
240
  if (plugin.reduxMiddleware) {
239
241
  pluginsMiddleware.push(plugin.reduxMiddleware(adaptable));
240
242
  }
241
243
  });
244
+ const middlewares = [
245
+ devToolsActionMarkerMiddleware,
246
+ adaptableMiddleware(adaptable), // the main middleware that actually does stuff,
247
+ ...pluginsMiddleware, // the plugins middleware
248
+ ].filter(Boolean);
242
249
  //TODO: need to check if we want the storage to be done before or after
243
250
  //we enrich the state with the AB middleware
244
- this.TheStore = Redux.createStore(persistedReducer, composeEnhancers(Redux.applyMiddleware(adaptableMiddleware(adaptable), // the main middleware that actually does stuff,
245
- ...pluginsMiddleware // the plugins middleware
246
- )));
251
+ this.TheStore = Redux.createStore(persistedReducer, composeEnhancers(Redux.applyMiddleware(...middlewares)));
247
252
  this.storageEngine = storageEngine;
248
253
  }
249
254
  destroy() {
@@ -265,6 +270,109 @@ class AdaptableStore {
265
270
  }
266
271
  }
267
272
  exports.AdaptableStore = AdaptableStore;
273
+ function createDevToolsActionMarkerMiddleware(adaptable) {
274
+ const adaptableId = adaptable?.adaptableOptions?.adaptableId;
275
+ if (!adaptableId) {
276
+ return null;
277
+ }
278
+ if (!(0, devTools_1.areAdaptableProfileTracksEnabled)(adaptableId)) {
279
+ return null;
280
+ }
281
+ return (middlewareAPI) => (next) => (action) => {
282
+ if (!isTrackableReduxAction(action)) {
283
+ return next(action);
284
+ }
285
+ const previousState = middlewareAPI.getState();
286
+ const marker = (0, devTools_1.getMarker)(adaptableId).track.Redux.label.Action.start();
287
+ try {
288
+ return next(action);
289
+ }
290
+ finally {
291
+ const nextState = middlewareAPI.getState();
292
+ const changedKeys = detectChangedAdaptableStateKeys(previousState, nextState);
293
+ const details = buildDevToolsActionDetails(action, changedKeys);
294
+ marker.end({
295
+ label: action.type,
296
+ tooltip: changedKeys?.length ? `State changes: ${changedKeys.join(', ')}` : undefined,
297
+ details: details.length ? details : undefined,
298
+ });
299
+ }
300
+ };
301
+ }
302
+ const MAX_MARKER_DETAILS = 6;
303
+ function buildDevToolsActionDetails(action, changedKeys) {
304
+ const details = [];
305
+ if (changedKeys && changedKeys.length > 0) {
306
+ const truncatedKeys = changedKeys.slice(0, MAX_MARKER_DETAILS);
307
+ const suffix = changedKeys.length > truncatedKeys.length
308
+ ? ` +${changedKeys.length - truncatedKeys.length} more`
309
+ : '';
310
+ details.push({
311
+ name: 'State changes',
312
+ value: `${truncatedKeys.join(', ')}${suffix}`,
313
+ });
314
+ }
315
+ if (isActionWithPayload(action)) {
316
+ const entries = Object.entries(action).filter(([key]) => key !== 'type');
317
+ for (const [key, value] of entries) {
318
+ if (details.length >= MAX_MARKER_DETAILS) {
319
+ break;
320
+ }
321
+ details.push({
322
+ name: `action.${key}`,
323
+ value: coerceMarkerDetailValue(value),
324
+ });
325
+ }
326
+ }
327
+ return details;
328
+ }
329
+ function detectChangedAdaptableStateKeys(previousState, nextState) {
330
+ if (!previousState || !nextState || previousState === nextState) {
331
+ return undefined;
332
+ }
333
+ const previous = previousState;
334
+ const next = nextState;
335
+ const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);
336
+ const changed = [];
337
+ keys.forEach((key) => {
338
+ if (previous[key] !== next[key]) {
339
+ changed.push(key);
340
+ }
341
+ });
342
+ return changed.length > 0 ? changed : undefined;
343
+ }
344
+ function isTrackableReduxAction(action) {
345
+ return !!action && typeof action.type === 'string';
346
+ }
347
+ function isActionWithPayload(action) {
348
+ return !!action && typeof action === 'object';
349
+ }
350
+ function coerceMarkerDetailValue(value) {
351
+ if (value === null) {
352
+ return 'null';
353
+ }
354
+ if (value === undefined) {
355
+ return 'undefined';
356
+ }
357
+ const valueType = typeof value;
358
+ if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') {
359
+ return value;
360
+ }
361
+ if (valueType === 'function') {
362
+ return '[function]';
363
+ }
364
+ try {
365
+ const json = JSON.stringify(value);
366
+ if (!json) {
367
+ return '[empty]';
368
+ }
369
+ const MAX_LENGTH = 200;
370
+ return json.length > MAX_LENGTH ? `${json.slice(0, MAX_LENGTH - 3)}...` : json;
371
+ }
372
+ catch (err) {
373
+ return '[unserializable]';
374
+ }
375
+ }
268
376
  // this is the main function for dealing with Redux Actions which require additional functionality to be triggered.
269
377
  // Please document each use case where we have to use the Store rather than a module or a popup screen
270
378
  // This should ideally be the ONLY place where we LISTEN to store changes
@@ -99,11 +99,35 @@ async function copyToClipboard(text) {
99
99
  return true;
100
100
  }
101
101
  catch (ex) {
102
- AdaptableLogger_1.AdaptableLogger.consoleErrorBase('Copy to clipboard failed.', ex);
103
- return false;
102
+ return copyToClipboardForOldBrowsers(text);
104
103
  }
105
104
  }
106
105
  exports.copyToClipboard = copyToClipboard;
106
+ function copyToClipboardForOldBrowsers(text) {
107
+ if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
108
+ let textarea = document.createElement('textarea');
109
+ textarea.textContent = text;
110
+ textarea.style.width = '1px';
111
+ textarea.style.height = '1px';
112
+ textarea.style.top = '0px';
113
+ textarea.style.left = '0px';
114
+ textarea.style.position = 'absolute';
115
+ textarea.style.opacity = '0.0';
116
+ document.body.appendChild(textarea);
117
+ textarea.select();
118
+ textarea.focus();
119
+ try {
120
+ return document.execCommand('copy'); // Security exception may be thrown by some browsers.
121
+ }
122
+ catch (ex) {
123
+ AdaptableLogger_1.AdaptableLogger.consoleErrorBase('Copy to clipboard failed.', ex);
124
+ return false;
125
+ }
126
+ finally {
127
+ document.body.removeChild(textarea);
128
+ }
129
+ }
130
+ }
107
131
  function returnItemCount(items, itemName) {
108
132
  if (items.length == 0) {
109
133
  return `No ${itemName}s`;
@@ -0,0 +1,4 @@
1
+ import { useAdaptableColumn } from './useAdaptableColumn';
2
+ import { useAdaptableOptions } from './useAdaptableOptions';
3
+ import { useAdaptableState } from './useAdaptableState';
4
+ export { useAdaptableColumn, useAdaptableOptions, useAdaptableState };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAdaptableState = exports.useAdaptableOptions = exports.useAdaptableColumn = void 0;
4
+ const useAdaptableColumn_1 = require("./useAdaptableColumn");
5
+ Object.defineProperty(exports, "useAdaptableColumn", { enumerable: true, get: function () { return useAdaptableColumn_1.useAdaptableColumn; } });
6
+ const useAdaptableOptions_1 = require("./useAdaptableOptions");
7
+ Object.defineProperty(exports, "useAdaptableOptions", { enumerable: true, get: function () { return useAdaptableOptions_1.useAdaptableOptions; } });
8
+ const useAdaptableState_1 = require("./useAdaptableState");
9
+ Object.defineProperty(exports, "useAdaptableState", { enumerable: true, get: function () { return useAdaptableState_1.useAdaptableState; } });
@@ -0,0 +1,2 @@
1
+ import { AdaptableColumn } from '../../types';
2
+ export declare function useAdaptableColumn(columnId: string): AdaptableColumn | undefined;